create-express-kickstart 1.2.11 → 1.3.0
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 +27 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -336,6 +336,33 @@ export const verifyToken = (token) => {
|
|
|
336
336
|
const installTriggerCmd = packageManager === 'npm' ? 'npm install' : `${packageManager} install`;
|
|
337
337
|
execSync(installTriggerCmd, execConfig);
|
|
338
338
|
|
|
339
|
+
// Update package.json with the actual installed versions instead of "latest"
|
|
340
|
+
try {
|
|
341
|
+
const installedPackageJson = JSON.parse(fs.readFileSync(finalPackageJsonPath, 'utf8'));
|
|
342
|
+
|
|
343
|
+
const getInstalledVersion = (dep) => {
|
|
344
|
+
try {
|
|
345
|
+
const depPkgPath = path.join(projectPath, 'node_modules', dep, 'package.json');
|
|
346
|
+
const depPkgCode = JSON.parse(fs.readFileSync(depPkgPath, 'utf8'));
|
|
347
|
+
return `^${depPkgCode.version}`;
|
|
348
|
+
} catch (err) {
|
|
349
|
+
return 'latest';
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
dependenciesToInstall.forEach(d => {
|
|
354
|
+
installedPackageJson.dependencies[d] = getInstalledVersion(d);
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
devDependenciesToInstall.forEach(d => {
|
|
358
|
+
installedPackageJson.devDependencies[d] = getInstalledVersion(d);
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
fs.writeFileSync(finalPackageJsonPath, JSON.stringify(installedPackageJson, null, 2));
|
|
362
|
+
} catch (err) {
|
|
363
|
+
// Silently fall back to 'latest' if parsing fails
|
|
364
|
+
}
|
|
365
|
+
|
|
339
366
|
if (initGit) {
|
|
340
367
|
console.log(`\n Initializing Git repository...`);
|
|
341
368
|
execSync('git init', { cwd: projectPath, stdio: 'inherit' });
|