Skip to content

Commit

Permalink
build: 🏗️ Add script package
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Feb 25, 2022
1 parent 27bff8c commit eb23ad6
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules
.next
.env
.env.local
.env.prod
workspace.code-workspace
.DS_Store
.turbo
Expand Down
1 change: 1 addition & 0 deletions packages/scripts/.env.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=postgresql://postgres:@localhost:5432/typebot
20 changes: 20 additions & 0 deletions packages/scripts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { PrismaClient } from 'db'
import { randomUUID } from 'crypto'
import path from 'path'

require('dotenv').config({
path: path.join(
__dirname,
process.env.NODE_ENV === 'production' ? '.env.prod' : '.env.local'
),
})

const prisma = new PrismaClient()
const main = async () => {
await prisma.user.updateMany({
where: { apiToken: null },
data: { apiToken: randomUUID() },
})
}

main().then()
15 changes: 15 additions & 0 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "scripts",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"scripts": {
"start:local": "ts-node index.ts",
"start:prod": "NODE_ENV=production ts-node index.ts"
},
"devDependencies": {
"db": "*",
"ts-node": "^10.5.0"
}
}
13 changes: 13 additions & 0 deletions packages/scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "es5",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"sourceMap": true,
"outDir": "dist",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true
}
}
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10563,9 +10563,9 @@ pend@~1.2.0:
resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50"
integrity sha1-elfrVQpng/kRUzH89GY9XI4AelA=

"php-parser@git+https://github.com/glayzzle/php-parser.git#27abcb2337ac6450c068ef064982dfabf77916a5":
"php-parser@https://github.com/glayzzle/php-parser#27abcb2337ac6450c068ef064982dfabf77916a5":
version "3.0.2"
resolved "git+https://github.com/glayzzle/php-parser.git#27abcb2337ac6450c068ef064982dfabf77916a5"
resolved "https://github.com/glayzzle/php-parser#27abcb2337ac6450c068ef064982dfabf77916a5"

picocolors@^1.0.0:
version "1.0.0"
Expand Down

0 comments on commit eb23ad6

Please sign in to comment.