create-express-kickstart 1.3.2 → 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 +17 -1
- package/package.json +1 -1
- 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
|
}
|
package/package.json
CHANGED