Skip to content

Commit

Permalink
added .env and generation script for env.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewlee348 committed Nov 18, 2024
1 parent 06b7950 commit 57e0b91
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DEVMODE=false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ dist/
.cache
package-lock.json
coverage

.env
packages/kit/src/env.ts
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"license": "Apache-2.0",
"sideEffects": false,
"scripts": {
"copy-env": "((cp -n .env.example .env) || echo already exists)",
"generate-env": "node scripts/generate-env.js",
"postinstall": "pnpm run copy-env && pnpm run generate-env",
"build": "turbo run build --filter={packages/*}",
"build:clean": "turbo run build:clean",
"dev": "turbo run dev --filter={packages/*}",
Expand Down
1 change: 0 additions & 1 deletion packages/kit/src/env.ts

This file was deleted.

13 changes: 13 additions & 0 deletions scripts/generate-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const fs = require('fs')
const path = require('path')
const dotenv = require('dotenv')

dotenv.config()

const envFilePath = path.resolve(__dirname, '../packages/kit/src/env.ts')

const envFileContent = `export const DEVMODE = ${process.env.DEVMODE}`

fs.writeFileSync(envFilePath, envFileContent.trim(), 'utf8')

console.log('env.ts file generated successfully')

0 comments on commit 57e0b91

Please sign in to comment.