slicejs-cli 2.8.4 → 2.8.6
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/commands/init/init.js +9 -1
- package/package.json +1 -1
package/commands/init/init.js
CHANGED
|
@@ -18,9 +18,11 @@ export default async function initializeProject(projectType) {
|
|
|
18
18
|
const destinationSrc = getSrcPath(import.meta.url);
|
|
19
19
|
|
|
20
20
|
const fwSpinner = ora('Ensuring latest Slice framework...').start();
|
|
21
|
+
let latestVersion = null;
|
|
21
22
|
let sliceBaseDir;
|
|
22
23
|
try {
|
|
23
24
|
const latest = execSync('npm view slicejs-web-framework version', { cwd: projectRoot }).toString().trim();
|
|
25
|
+
latestVersion = latest;
|
|
24
26
|
const installedPkgPath = path.join(projectRoot, 'node_modules', 'slicejs-web-framework', 'package.json');
|
|
25
27
|
let installed = null;
|
|
26
28
|
if (await fs.pathExists(installedPkgPath)) {
|
|
@@ -179,6 +181,7 @@ export default async function initializeProject(projectType) {
|
|
|
179
181
|
}
|
|
180
182
|
|
|
181
183
|
pkg.scripts = pkg.scripts || {};
|
|
184
|
+
pkg.dependencies = pkg.dependencies || {};
|
|
182
185
|
|
|
183
186
|
// Comandos principales
|
|
184
187
|
pkg.scripts['dev'] = 'slice dev';
|
|
@@ -211,9 +214,14 @@ export default async function initializeProject(projectType) {
|
|
|
211
214
|
pkg.scripts['run'] = 'slice dev';
|
|
212
215
|
|
|
213
216
|
// Configuración de módulo
|
|
214
|
-
pkg.type =
|
|
217
|
+
pkg.type = 'module';
|
|
215
218
|
pkg.engines = pkg.engines || { node: '>=20.0.0' };
|
|
216
219
|
|
|
220
|
+
// Ensure framework dependency is present
|
|
221
|
+
if (!pkg.dependencies['slicejs-web-framework']) {
|
|
222
|
+
pkg.dependencies['slicejs-web-framework'] = latestVersion ? latestVersion : 'latest';
|
|
223
|
+
}
|
|
224
|
+
|
|
217
225
|
await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2), 'utf8');
|
|
218
226
|
pkgSpinner.succeed('npm scripts configured successfully');
|
|
219
227
|
|