Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neon #2

Merged
merged 11 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,33 @@ on:
types: [opened, synchronize]

jobs:
build:
name: CI
create-neon-branch:
name: 🚀 Create Neon Branch
runs-on: ubuntu-latest
outputs:
database_url: ${{ steps.create-branch.outputs.db_url }}
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7

- name: Create neon branch
uses: neondatabase/[email protected]
with:
project_id: ${{ secrets.NEON_PROJECT_ID }}
branch_name: ${{ steps.branch-name.outputs.current_branch }}
username: ${{ secrets.PG_USERNAME }}
api_key: ${{ secrets.NEON_API_KEY }}
id: create-branch

main:
name: 🧾 Main CI Checks
runs-on: ubuntu-latest
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
AUTH_GITHUB_CLIENT_ID: ${{ secrets.AUTH_GITHUB_CLIENT_ID }}
AUTH_GITHUB_CLIENT_SECRET: ${{ secrets.AUTH_GITHUB_CLIENT_SECRET }}

steps:
- name: Check out code
Expand Down Expand Up @@ -63,4 +83,6 @@ jobs:
run: pnpm turbo typecheck

- name: Build
env:
DATABASE_URL: ${{ needs.create-neon-branch.outputs.database_url }}
run: pnpm turbo build
1 change: 1 addition & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ignorePaths:
- dist
words:
- astro
- neonctl
- clsx
- commitlint
- esbenp
Expand Down
8 changes: 4 additions & 4 deletions packages/auth/src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ export const env = createEnv({
extends: [vercel],
server: {
NODE_ENV: z.enum(['development', 'test', 'production']).optional(),
GITHUB_CLIENT_ID: z.string(),
GITHUB_CLIENT_SECRET: z.string(),
AUTH_GITHUB_CLIENT_ID: z.string(),
AUTH_GITHUB_CLIENT_SECRET: z.string(),
},
runtimeEnv: {
NODE_ENV: process.env['NODE_ENV'],
GITHUB_CLIENT_ID: process.env['GITHUB_CLIENT_ID'],
GITHUB_CLIENT_SECRET: process.env['GITHUB_CLIENT_SECRET'],
AUTH_GITHUB_CLIENT_ID: process.env['GITHUB_CLIENT_ID'],
AUTH_GITHUB_CLIENT_SECRET: process.env['GITHUB_CLIENT_SECRET'],
},
emptyStringAsUndefined: true,
});
4 changes: 2 additions & 2 deletions packages/auth/src/providers/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { env } from '../env.js';
import { lucia } from '../lucia';

export const github = new GitHub(
env.GITHUB_CLIENT_ID,
env.GITHUB_CLIENT_SECRET,
env.AUTH_GITHUB_CLIENT_ID,
env.AUTH_GITHUB_CLIENT_SECRET,
);

export async function createGithubAuthorizationURL(): Promise<Response> {
Expand Down
1 change: 1 addition & 0 deletions packages/config/eslint/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const config = {
'plugin:@typescript-eslint/stylistic-type-checked',
],
rules: {
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/array-type': [
'error',
{
Expand Down
2 changes: 1 addition & 1 deletion packages/db/drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Config } from 'drizzle-kit';

import { env } from './src/env.mjs';
import { env } from './src/env.js';

export default {
schema: './src/schema/index.ts',
Expand Down
2 changes: 1 addition & 1 deletion packages/db/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { drizzle } from 'drizzle-orm/postgres-js';
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';

import { env } from './src/env.mjs';
import { env } from './src/env.js';

const sql = postgres(env.DATABASE_URL, { max: 1 });
const db = drizzle(sql);
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const entries = [
},
];

type PackageJson = {
interface PackageJson {
exports: Record<string, unknown>;
main: string;
module: string;
types: string;
};
}

export default defineConfig((opts) => ({
entry: entries.map((entry) => entry.source),
Expand Down
Loading