@testspectra/cli 1.0.35 → 1.0.36
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/dist/commands/init.js +10 -1
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -363,7 +363,16 @@ export async function initCommand(options = {}) {
|
|
|
363
363
|
if (!fs.existsSync(rootPkgPath)) {
|
|
364
364
|
const templatePkgSrc = path.join(templateDir, "package.json");
|
|
365
365
|
if (fs.existsSync(templatePkgSrc)) {
|
|
366
|
-
|
|
366
|
+
try {
|
|
367
|
+
const tPkg = JSON.parse(fs.readFileSync(templatePkgSrc, "utf-8"));
|
|
368
|
+
if (tPkg.devDependencies && tPkg.devDependencies["@testspectra/cli"]) {
|
|
369
|
+
tPkg.devDependencies["@testspectra/cli"] = cliDepVersion;
|
|
370
|
+
}
|
|
371
|
+
fs.writeFileSync(rootPkgPath, JSON.stringify(tPkg, null, 2), "utf-8");
|
|
372
|
+
}
|
|
373
|
+
catch {
|
|
374
|
+
fs.copyFileSync(templatePkgSrc, rootPkgPath);
|
|
375
|
+
}
|
|
367
376
|
}
|
|
368
377
|
}
|
|
369
378
|
else {
|