-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from simplyStyle/main
upgrade lucia and prisma
- Loading branch information
Showing
82 changed files
with
3,439 additions
and
554 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: CI-next-prisma | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- major | ||
- minor | ||
- dev | ||
# Only consider those paths to trigger the action | ||
paths: | ||
- 'packages/**' | ||
- 'package.json' | ||
- '*.lock' | ||
- '.yarnrc.yml' | ||
- 'tsconfig.base.json' | ||
- '.prettier*' | ||
- '.github/**' | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
- major | ||
- minor | ||
- dev | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
# Only consider those paths to trigger the action | ||
paths: | ||
- 'packages/**' | ||
- 'package.json' | ||
- '*.lock' | ||
- '.yarnrc.yml' | ||
- 'tsconfig.base.json' | ||
- '.prettier*' | ||
- '.github/**' | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: 📥 Monorepo install | ||
uses: ./.github/actions/yarn-nm-install | ||
|
||
- name: Typecheck | ||
working-directory: packages/next-prisma | ||
run: | | ||
yarn typecheck | ||
- name: Linter | ||
working-directory: packages/next-prisma | ||
run: | | ||
yarn lint | ||
- name: Unit tests | ||
working-directory: packages/next-prisma | ||
run: | | ||
yarn test-unit --passWithNoTests | ||
- name: Build next-prisma | ||
working-directory: packages/next-prisma | ||
run: | | ||
yarn build | ||
# commit: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# with: | ||
# ref: main | ||
# - uses: actions/setup-node@v3 | ||
# with: | ||
# node-version: 18 | ||
|
||
# - name: 📥 Monorepo install | ||
# uses: ./.github/actions/yarn-nm-install | ||
|
||
# - name: Unit test coverage | ||
# working-directory: packages/next-prisma | ||
# run: | | ||
# yarn test-coverage | ||
|
||
# - name: Publish github pages | ||
# run: | | ||
# git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | ||
# git config --global user.name 'hyperse-net' | ||
# git config --global user.email '[email protected]' | ||
# git fetch | ||
# git checkout gb_pages | ||
# mkdir -p ./gb_pages | ||
# cp -R ./packages/next-prisma/coverage/* ./gb_pages/coverage/next-prisma | ||
# git add gb_pages/* | ||
# git commit -m "Update page" | ||
# git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import { promisify } from 'util'; | ||
|
||
const readFile = promisify(fs.readFile); | ||
const writeFile = promisify(fs.writeFile); | ||
|
||
const prismaInputFile = path.join( | ||
process.cwd(), | ||
'/src/adapters/prisma/lucia.prisma' | ||
); | ||
|
||
const prismaOutputFile = path.join( | ||
process.cwd(), | ||
'/src/adapters/lucia-prisma.ts' | ||
); | ||
|
||
async function copyPrismaFile() { | ||
const prismaContent = await readFile(prismaInputFile); | ||
const prismaOutputContent = | ||
'/** auto generated code by "yarn generate" */\n' + | ||
'export const luciaPrismaContent = `' + | ||
prismaContent + | ||
'`;\n'; | ||
await writeFile(prismaOutputFile, prismaOutputContent); | ||
} | ||
|
||
copyPrismaFile() | ||
.then(() => { | ||
console.log('copy prisma content to luciaPrisma.js success!'); | ||
}) | ||
.catch((err) => { | ||
console.log('copy prisma content fail: ', err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './prisma-adapter.js'; | ||
export * from './lucia-prisma.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** auto generated code by "yarn generate" */ | ||
export const luciaPrismaContent = `datasource db { | ||
provider = "sqlite" | ||
url = "./prisma.db" | ||
} | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
model User { | ||
id String @id | ||
username String @unique | ||
email String? @unique | ||
authSession Session[] | ||
authorized Authorized[] | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
} | ||
model Authorized { | ||
id String @id | ||
userId String | ||
hashedPassword String? | ||
providerId String? | ||
providerMethod String | ||
user User @relation(references: [id], fields: [userId], onDelete: Cascade) | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
@@index([userId]) | ||
} | ||
model Session { | ||
id Int @id @default(autoincrement()) | ||
token String @unique | ||
userId String | ||
expiresAt DateTime @default(now()) | ||
user User @relation(references: [id], fields: [userId], onDelete: Cascade) | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
@@index([userId]) | ||
}`; |
Oops, something went wrong.