create-express-kickstart 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +7 -7
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -56,7 +56,7 @@ async function init() {
|
|
|
56
56
|
'cookie-parser': (await question('Include cookie-parser? [Y/n] ')).toLowerCase() !== 'n',
|
|
57
57
|
'pino-http': (await question('Include Pino (HTTP Logger)? [Y/n] ')).toLowerCase() !== 'n',
|
|
58
58
|
'express-rate-limit': (await question('Include Rate Limiting? [Y/n] ')).toLowerCase() !== 'n',
|
|
59
|
-
dotenv: (await question('Include
|
|
59
|
+
dotenv: (await question('Include dotenvx (Environment variables)? [Y/n] ')).toLowerCase() !== 'n',
|
|
60
60
|
prettier: (await question('Include Prettier (Code formatter)? [Y/n] ')).toLowerCase() !== 'n'
|
|
61
61
|
};
|
|
62
62
|
|
|
@@ -111,7 +111,7 @@ async function init() {
|
|
|
111
111
|
const envExamplePath = path.join(__dirname, '..', '.env.example');
|
|
112
112
|
if (fs.existsSync(envExamplePath)) {
|
|
113
113
|
fs.copyFileSync(envExamplePath, path.join(projectPath, '.env.example'));
|
|
114
|
-
fs.copyFileSync(envExamplePath, path.join(projectPath, '.env'));
|
|
114
|
+
fs.copyFileSync(envExamplePath, path.join(projectPath, '.env.local'));
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
if (initDocker) {
|
|
@@ -157,7 +157,7 @@ JWT_SECRET=supersecretjwtkey123
|
|
|
157
157
|
JWT_EXPIRES_IN=1d
|
|
158
158
|
`;
|
|
159
159
|
fs.appendFileSync(path.join(projectPath, '.env.example'), authEnvConfig);
|
|
160
|
-
fs.appendFileSync(path.join(projectPath, '.env'), authEnvConfig);
|
|
160
|
+
fs.appendFileSync(path.join(projectPath, '.env.local'), authEnvConfig);
|
|
161
161
|
|
|
162
162
|
const utilsPath = path.join(projectPath, 'src', 'utils');
|
|
163
163
|
if (!fs.existsSync(utilsPath)) {
|
|
@@ -270,8 +270,8 @@ export const verifyToken = (token) => {
|
|
|
270
270
|
main: "src/server.js",
|
|
271
271
|
type: "module",
|
|
272
272
|
scripts: {
|
|
273
|
-
"start": "node src/server.js",
|
|
274
|
-
"dev": deps.dotenv ? "
|
|
273
|
+
"start": deps.dotenv ? "dotenvx run -f .env.local -- node src/server.js" : "node src/server.js",
|
|
274
|
+
"dev": deps.dotenv ? "dotenvx run -f .env.local -- nodemon src/server.js" : "nodemon src/server.js"
|
|
275
275
|
},
|
|
276
276
|
imports: {
|
|
277
277
|
"#*": "./src/*"
|
|
@@ -305,8 +305,8 @@ export const verifyToken = (token) => {
|
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
const devDependenciesToInstall = ['nodemon'];
|
|
308
|
+
if (deps.dotenv) devDependenciesToInstall.push('@dotenvx/dotenvx');
|
|
308
309
|
if (deps.prettier) devDependenciesToInstall.push('prettier');
|
|
309
|
-
if (deps.dotenv) devDependenciesToInstall.push('dotenv');
|
|
310
310
|
if (installPinoPretty) devDependenciesToInstall.push('pino-pretty');
|
|
311
311
|
if (initTests) {
|
|
312
312
|
devDependenciesToInstall.push('jest', 'supertest');
|
|
@@ -367,7 +367,7 @@ export const verifyToken = (token) => {
|
|
|
367
367
|
console.log(`\n Initializing Git repository...`);
|
|
368
368
|
execSync('git init', { cwd: projectPath, stdio: 'inherit' });
|
|
369
369
|
// Create .gitignore
|
|
370
|
-
const gitignoreContent = "node_modules\n.env\ndist\nbuild\ncoverage\n";
|
|
370
|
+
const gitignoreContent = "node_modules\n.env\n.env.keys\n.env.local\ndist\nbuild\ncoverage\n";
|
|
371
371
|
fs.writeFileSync(path.join(projectPath, '.gitignore'), gitignoreContent);
|
|
372
372
|
execSync('git add .', { cwd: projectPath, stdio: 'inherit' });
|
|
373
373
|
execSync('git commit -m "initial commit"', { cwd: projectPath, stdio: 'inherit' });
|