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 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)) fs.copyFileSync(dockerfilePath, path.join(projectPath, 'Dockerfile'));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-express-kickstart",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Production-ready CLI starter for Express APIs",
5
5
  "main": "bin/cli.js",
6
6
  "bin": {
@@ -15,4 +15,8 @@ const exampleSchema = new mongoose.Schema({
15
15
  required: [true, "Email is required"],
16
16
  unique: true,
17
17
  },
18
- });
18
+ });
19
+
20
+ const Example = mongoose.model("Example", exampleSchema);
21
+
22
+ export default Example;
@@ -8,7 +8,7 @@ services:
8
8
  environment:
9
9
  - NODE_ENV=development
10
10
  - PORT=3000
11
- - MONGO_URI=mongodb://mongo:27017/express-api
11
+ - MONGODB_URI=mongodb://mongo:27017/express-api
12
12
  volumes:
13
13
  - .:/usr/src/app
14
14
  - /usr/src/app/node_modules