create-express-kickstart 1.3.1 → 1.3.3
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 +18 -2
- package/package.json +2 -5
- package/src/models/example-model.js +5 -1
- package/templates/docker-compose.yml +1 -1
package/bin/cli.js
CHANGED
|
@@ -120,7 +120,23 @@ async function init() {
|
|
|
120
120
|
const dockerComposePath = path.join(__dirname, '..', 'templates', 'docker-compose.yml');
|
|
121
121
|
|
|
122
122
|
// Fallbacks if templates aren't bundled right
|
|
123
|
-
if (fs.existsSync(dockerfilePath))
|
|
123
|
+
if (fs.existsSync(dockerfilePath)) {
|
|
124
|
+
const destDockerfilePath = path.join(projectPath, 'Dockerfile');
|
|
125
|
+
fs.copyFileSync(dockerfilePath, destDockerfilePath);
|
|
126
|
+
// Rewrite install command and lockfile COPY based on chosen package manager
|
|
127
|
+
const lockfileMap = { npm: 'package-lock.json*', yarn: 'yarn.lock*', pnpm: 'pnpm-lock.yaml*', bun: 'bun.lockb*' };
|
|
128
|
+
const installCmdMap = { npm: 'npm install --production', yarn: 'yarn install --production', pnpm: 'pnpm install --production', bun: 'bun install --production' };
|
|
129
|
+
let dockerfileContent = fs.readFileSync(destDockerfilePath, 'utf8');
|
|
130
|
+
dockerfileContent = dockerfileContent.replace(
|
|
131
|
+
'COPY package.json ./',
|
|
132
|
+
`COPY package.json ${lockfileMap[packageManager]} ./`
|
|
133
|
+
);
|
|
134
|
+
dockerfileContent = dockerfileContent.replace(
|
|
135
|
+
'RUN npm install --production',
|
|
136
|
+
`RUN ${installCmdMap[packageManager]}`
|
|
137
|
+
);
|
|
138
|
+
fs.writeFileSync(destDockerfilePath, dockerfileContent);
|
|
139
|
+
}
|
|
124
140
|
if (fs.existsSync(dockerComposePath) && deps.mongoose) {
|
|
125
141
|
fs.copyFileSync(dockerComposePath, path.join(projectPath, 'docker-compose.yml'));
|
|
126
142
|
}
|
|
@@ -297,7 +313,6 @@ export const verifyToken = (token) => {
|
|
|
297
313
|
|
|
298
314
|
// Install Dependencies
|
|
299
315
|
const dependenciesToInstall = Object.keys(deps).filter(dep => deps[dep] && dep !== 'prettier' && dep !== 'dotenv');
|
|
300
|
-
if (deps.dotenv) dependenciesToInstall.push('@dotenvx/dotenvx');
|
|
301
316
|
if (deps['pino-http']) {
|
|
302
317
|
dependenciesToInstall.push('pino');
|
|
303
318
|
}
|
|
@@ -306,6 +321,7 @@ export const verifyToken = (token) => {
|
|
|
306
321
|
}
|
|
307
322
|
|
|
308
323
|
const devDependenciesToInstall = ['nodemon'];
|
|
324
|
+
if (deps.dotenv) devDependenciesToInstall.push('@dotenvx/dotenvx');
|
|
309
325
|
if (deps.prettier) devDependenciesToInstall.push('prettier');
|
|
310
326
|
if (installPinoPretty) devDependenciesToInstall.push('pino-pretty');
|
|
311
327
|
if (initTests) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-express-kickstart",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Production-ready CLI starter for Express APIs",
|
|
5
5
|
"main": "bin/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -28,8 +28,5 @@
|
|
|
28
28
|
"bugs": {
|
|
29
29
|
"url": "https://github.com/aasifashraf/create-express-kickstart/issues"
|
|
30
30
|
},
|
|
31
|
-
"homepage": "https://github.com/aasifashraf/create-express-kickstart#readme"
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"@dotenvx/dotenvx": "^1.52.0"
|
|
34
|
-
}
|
|
31
|
+
"homepage": "https://github.com/aasifashraf/create-express-kickstart#readme"
|
|
35
32
|
}
|