Skip to content

Commit

Permalink
fix(docs): improve first install with scripting (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgriffing committed Apr 24, 2024
1 parent 945815e commit 6dc1fad
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
7 changes: 7 additions & 0 deletions apps/forms/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
APP_BASE_URL=http://localhost:5173
GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET=""
SMTP_SERVER=""
SMTP_SENDER=""
SMTP_PASSWORD=""
WEB_BASE_URL=""
3 changes: 2 additions & 1 deletion apps/forms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check .",
"format": "prettier --plugin-search-dir . --write .",
"prebuild": "geller scan -g ./src/**/*.ts"
"prebuild": "geller scan -g ./src/**/*.ts",
"postinstall": "node scripts/env.cjs"
},
"devDependencies": {
"@fontsource/fira-mono": "^4.5.10",
Expand Down
16 changes: 16 additions & 0 deletions apps/forms/scripts/env.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const fs = require('fs');
const path = require('path');

const formsDirPath = path.resolve(__dirname, '../');

const NODE_ENV = process.env.NODE_ENV;

if (NODE_ENV == 'development') {
const envFilePath = path.resolve(formsDirPath, '.env');
const envExamplePath = path.resolve(formsDirPath, '.env.example');
const envFileExists = fs.existsSync(path.resolve(formsDirPath, '.env'));

if (!envFileExists) {
fs.copyFileSync(envExamplePath, envFilePath);
}
}

0 comments on commit 6dc1fad

Please sign in to comment.