create-express-kickstart 1.2.2 → 1.2.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/README.md +4 -2
- package/bin/cli.js +21 -24
- package/package.json +1 -1
- package/test-app/.env.example +0 -10
- package/test-app/package-lock.json +0 -5787
- package/test-app/package.json +0 -33
- package/test-app/src/app.js +0 -28
- package/test-app/src/controllers/auth.controller.js +0 -5
- package/test-app/src/controllers/healthcheck.controller.js +0 -17
- package/test-app/src/middlewares/auth.middleware.js +0 -5
- package/test-app/src/middlewares/errorHandler.middleware.js +0 -37
- package/test-app/src/models/example-model.js +0 -18
- package/test-app/src/routes/auth.routes.js +0 -11
- package/test-app/src/routes/healthcheck.routes.js +0 -9
- package/test-app/src/server.js +0 -20
- package/test-app/src/utils/ApiError.js +0 -23
- package/test-app/src/utils/ApiResponse.js +0 -10
- package/test-app/src/utils/asyncHandler.js +0 -7
- package/test-app/src/utils/constants.js +0 -1
- package/test-app/tests/healthcheck.test.js +0 -12
- package/test-runner.js +0 -39
package/README.md
CHANGED
|
@@ -14,14 +14,16 @@ You do not need to clone this repository, install dependencies manually, or writ
|
|
|
14
14
|
|
|
15
15
|
### 1. Initialize a New Project
|
|
16
16
|
|
|
17
|
+
We highly recommend using the `@latest` tag to ensure you are always downloading the most recent version of our CLI tool dynamically, bypassing any local caching issues!
|
|
18
|
+
|
|
17
19
|
Run the following command anywhere in your terminal:
|
|
18
20
|
```bash
|
|
19
|
-
npx create-express-kickstart <your-project-name>
|
|
21
|
+
npx create-express-kickstart@latest <your-project-name>
|
|
20
22
|
```
|
|
21
23
|
|
|
22
24
|
**Example:**
|
|
23
25
|
```bash
|
|
24
|
-
npx create-express-kickstart my-awesome-api
|
|
26
|
+
npx create-express-kickstart@latest my-awesome-api
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
### 2. What happens under the hood?
|
package/bin/cli.js
CHANGED
|
@@ -266,7 +266,6 @@ async function init() {
|
|
|
266
266
|
if (initAuth) {
|
|
267
267
|
dependenciesToInstall.push('jsonwebtoken', 'bcryptjs'); // Add bcryptjs too since it's standard with JWT
|
|
268
268
|
}
|
|
269
|
-
const depString = dependenciesToInstall.join(' ');
|
|
270
269
|
|
|
271
270
|
const devDependenciesToInstall = ['nodemon'];
|
|
272
271
|
if (deps.prettier) devDependenciesToInstall.push('prettier');
|
|
@@ -274,32 +273,30 @@ async function init() {
|
|
|
274
273
|
if (initTests) {
|
|
275
274
|
devDependenciesToInstall.push('jest', 'supertest');
|
|
276
275
|
}
|
|
277
|
-
const devDepString = devDependenciesToInstall.join(' ');
|
|
278
276
|
|
|
279
|
-
console.log(`\n⏳ Installing selected core dependencies (${dependenciesToInstall.join(', ')}). This might take a minute...`);
|
|
280
277
|
try {
|
|
281
|
-
|
|
282
|
-
: packageManager === 'pnpm' ? 'pnpm add'
|
|
283
|
-
: packageManager === 'bun' ? 'bun add'
|
|
284
|
-
: 'npm install';
|
|
285
|
-
|
|
286
|
-
let installDevCmd = packageManager === 'yarn' ? 'yarn add -D'
|
|
287
|
-
: packageManager === 'pnpm' ? 'pnpm add -D'
|
|
288
|
-
: packageManager === 'bun' ? 'bun add -d'
|
|
289
|
-
: 'npm install --save-dev';
|
|
290
|
-
|
|
291
|
-
if (depString) {
|
|
292
|
-
execSync(`${installCmd} ${depString}`, {
|
|
293
|
-
cwd: projectPath,
|
|
294
|
-
stdio: 'inherit'
|
|
295
|
-
});
|
|
296
|
-
}
|
|
278
|
+
const execConfig = { cwd: projectPath, stdio: 'inherit' };
|
|
297
279
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
280
|
+
// Inject dependencies directly into package.json instead of doing them via raw arguments.
|
|
281
|
+
// This perfectly bypasses PNPM / YARN / BUN specific registry caching bugs when downloading deeply nested trees.
|
|
282
|
+
console.log(`\n⏳ Configuring ${packageManager} and resolving dependency trees...`);
|
|
283
|
+
const finalPackageJsonPath = path.join(projectPath, 'package.json');
|
|
284
|
+
const finalPackageJsonCode = JSON.parse(fs.readFileSync(finalPackageJsonPath, 'utf8'));
|
|
285
|
+
|
|
286
|
+
// We add them dynamically so package managers can evaluate them holistically at once
|
|
287
|
+
const latestDeps = {};
|
|
288
|
+
dependenciesToInstall.forEach(d => latestDeps[d] = 'latest');
|
|
289
|
+
finalPackageJsonCode.dependencies = latestDeps;
|
|
290
|
+
|
|
291
|
+
const latestDevDeps = {};
|
|
292
|
+
devDependenciesToInstall.forEach(d => latestDevDeps[d] = 'latest');
|
|
293
|
+
finalPackageJsonCode.devDependencies = latestDevDeps;
|
|
294
|
+
|
|
295
|
+
fs.writeFileSync(finalPackageJsonPath, JSON.stringify(finalPackageJsonCode, null, 2));
|
|
296
|
+
|
|
297
|
+
console.log(`\n⏳ Running final installation via ${packageManager} (This might take a minute)...`);
|
|
298
|
+
const installTriggerCmd = packageManager === 'npm' ? 'npm install' : `${packageManager} install`;
|
|
299
|
+
execSync(installTriggerCmd, execConfig);
|
|
303
300
|
|
|
304
301
|
if (initGit) {
|
|
305
302
|
console.log(`\n🌱 Initializing Git repository...`);
|
package/package.json
CHANGED
package/test-app/.env.example
DELETED