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 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
  }
@@ -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.1",
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
  }
@@ -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