@testspectra/cli 1.0.64 → 1.0.66
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/add.js +24 -20
- package/dist/commands/init.js +44 -32
- package/package.json +2 -2
- package/templates/default/package.json +2 -2
- package/templates/nx/package.json +2 -2
package/dist/commands/add.js
CHANGED
|
@@ -136,27 +136,23 @@ export async function addCommand(moduleNameArg, options = {}) {
|
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
// 3. Resolve CLI dependency version
|
|
139
|
-
let cliVersion = "^1.0.
|
|
139
|
+
let cliVersion = "^1.0.65";
|
|
140
140
|
try {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
if (
|
|
145
|
-
|
|
141
|
+
let pDir = __dirname;
|
|
142
|
+
while (pDir !== path.dirname(pDir)) {
|
|
143
|
+
const cand = path.join(pDir, "package.json");
|
|
144
|
+
if (fs.existsSync(cand)) {
|
|
145
|
+
const cliPkg = JSON.parse(fs.readFileSync(cand, "utf-8"));
|
|
146
|
+
if (cliPkg.name === "@testspectra/cli" && cliPkg.version) {
|
|
147
|
+
cliVersion = `^${cliPkg.version}`;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
146
150
|
}
|
|
151
|
+
pDir = path.dirname(pDir);
|
|
147
152
|
}
|
|
148
153
|
}
|
|
149
154
|
catch { }
|
|
150
|
-
|
|
151
|
-
cur = rootDir;
|
|
152
|
-
while (cur !== path.dirname(cur)) {
|
|
153
|
-
if (fs.existsSync(path.join(cur, "pnpm-workspace.yaml"))) {
|
|
154
|
-
isInternalWorkspace = true;
|
|
155
|
-
break;
|
|
156
|
-
}
|
|
157
|
-
cur = path.dirname(cur);
|
|
158
|
-
}
|
|
159
|
-
const cliDepVersion = isInternalWorkspace ? "workspace:*" : (cliVersion.startsWith("^") ? cliVersion : `^${cliVersion}`);
|
|
155
|
+
const cliDepVersion = cliVersion.startsWith("^") ? cliVersion : `^${cliVersion}`;
|
|
160
156
|
function copyRecursive(src, dest, replacements = {}) {
|
|
161
157
|
const base = path.basename(src);
|
|
162
158
|
if (base === "node_modules" || base === "dist" || base === ".testspectra" || base === ".git") {
|
|
@@ -183,11 +179,19 @@ export async function addCommand(moduleNameArg, options = {}) {
|
|
|
183
179
|
if (dest.endsWith("package.json")) {
|
|
184
180
|
try {
|
|
185
181
|
const pkg = JSON.parse(content);
|
|
186
|
-
if (pkg.devDependencies
|
|
187
|
-
pkg.devDependencies
|
|
182
|
+
if (pkg.devDependencies) {
|
|
183
|
+
for (const key of Object.keys(pkg.devDependencies)) {
|
|
184
|
+
if (key.startsWith("@testspectra/") || pkg.devDependencies[key] === "workspace:*") {
|
|
185
|
+
pkg.devDependencies[key] = cliDepVersion;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
188
|
}
|
|
189
|
-
if (pkg.dependencies
|
|
190
|
-
pkg.dependencies
|
|
189
|
+
if (pkg.dependencies) {
|
|
190
|
+
for (const key of Object.keys(pkg.dependencies)) {
|
|
191
|
+
if (key.startsWith("@testspectra/") || pkg.dependencies[key] === "workspace:*") {
|
|
192
|
+
pkg.dependencies[key] = cliDepVersion;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
191
195
|
}
|
|
192
196
|
content = JSON.stringify(pkg, null, 2);
|
|
193
197
|
}
|
package/dist/commands/init.js
CHANGED
|
@@ -241,28 +241,24 @@ export async function initCommand(options = {}) {
|
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
243
|
// 2. Resolve CLI dependency version
|
|
244
|
-
let cliVersion = "^1.0.
|
|
244
|
+
let cliVersion = "^1.0.65";
|
|
245
245
|
try {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
|
|
246
|
+
let pDir = __dirname;
|
|
247
|
+
while (pDir !== path.dirname(pDir)) {
|
|
248
|
+
const cand = path.join(pDir, "package.json");
|
|
249
|
+
if (fs.existsSync(cand)) {
|
|
250
|
+
const cliPkg = JSON.parse(fs.readFileSync(cand, "utf-8"));
|
|
251
|
+
if (cliPkg.name === "@testspectra/cli" && cliPkg.version) {
|
|
252
|
+
cliVersion = `^${cliPkg.version}`;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
251
255
|
}
|
|
256
|
+
pDir = path.dirname(pDir);
|
|
252
257
|
}
|
|
253
258
|
}
|
|
254
259
|
catch { }
|
|
255
|
-
let isInternalWorkspace = false;
|
|
256
|
-
let cur = cwd;
|
|
257
|
-
while (cur !== path.dirname(cur)) {
|
|
258
|
-
if (fs.existsSync(path.join(cur, "pnpm-workspace.yaml"))) {
|
|
259
|
-
isInternalWorkspace = true;
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
cur = path.dirname(cur);
|
|
263
|
-
}
|
|
264
260
|
const projectName = path.basename(cwd);
|
|
265
|
-
const cliDepVersion =
|
|
261
|
+
const cliDepVersion = cliVersion.startsWith("^") ? cliVersion : `^${cliVersion}`;
|
|
266
262
|
// Helper: Copy directory contents recursively
|
|
267
263
|
function copyRecursive(src, dest, replacements = {}) {
|
|
268
264
|
const base = path.basename(src);
|
|
@@ -290,17 +286,22 @@ export async function initCommand(options = {}) {
|
|
|
290
286
|
if (dest.endsWith("package.json")) {
|
|
291
287
|
try {
|
|
292
288
|
const pkg = JSON.parse(content);
|
|
293
|
-
if (pkg.
|
|
294
|
-
pkg.
|
|
289
|
+
if (!pkg.name || pkg.name.startsWith("@testspectra/template-") || pkg.name === "spectra-monorepo") {
|
|
290
|
+
pkg.name = projectName;
|
|
295
291
|
}
|
|
296
|
-
if (pkg.
|
|
297
|
-
pkg.
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
292
|
+
if (pkg.devDependencies) {
|
|
293
|
+
for (const key of Object.keys(pkg.devDependencies)) {
|
|
294
|
+
if (key.startsWith("@testspectra/") || pkg.devDependencies[key] === "workspace:*") {
|
|
295
|
+
pkg.devDependencies[key] = cliDepVersion;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
301
298
|
}
|
|
302
|
-
if (pkg.dependencies
|
|
303
|
-
pkg.dependencies
|
|
299
|
+
if (pkg.dependencies) {
|
|
300
|
+
for (const key of Object.keys(pkg.dependencies)) {
|
|
301
|
+
if (key.startsWith("@testspectra/") || pkg.dependencies[key] === "workspace:*") {
|
|
302
|
+
pkg.dependencies[key] = cliDepVersion;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
304
305
|
}
|
|
305
306
|
content = JSON.stringify(pkg, null, 2);
|
|
306
307
|
}
|
|
@@ -412,11 +413,22 @@ export async function initCommand(options = {}) {
|
|
|
412
413
|
if (fs.existsSync(templatePkgSrc)) {
|
|
413
414
|
try {
|
|
414
415
|
const tPkg = JSON.parse(fs.readFileSync(templatePkgSrc, "utf-8"));
|
|
415
|
-
if (tPkg.
|
|
416
|
-
tPkg.
|
|
416
|
+
if (!tPkg.name || tPkg.name.startsWith("@testspectra/template-") || tPkg.name === "spectra-monorepo") {
|
|
417
|
+
tPkg.name = projectName;
|
|
418
|
+
}
|
|
419
|
+
if (tPkg.devDependencies) {
|
|
420
|
+
for (const key of Object.keys(tPkg.devDependencies)) {
|
|
421
|
+
if (key.startsWith("@testspectra/") || tPkg.devDependencies[key] === "workspace:*") {
|
|
422
|
+
tPkg.devDependencies[key] = cliDepVersion;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
417
425
|
}
|
|
418
|
-
if (tPkg.
|
|
419
|
-
tPkg.
|
|
426
|
+
if (tPkg.dependencies) {
|
|
427
|
+
for (const key of Object.keys(tPkg.dependencies)) {
|
|
428
|
+
if (key.startsWith("@testspectra/") || tPkg.dependencies[key] === "workspace:*") {
|
|
429
|
+
tPkg.dependencies[key] = cliDepVersion;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
420
432
|
}
|
|
421
433
|
fs.writeFileSync(rootPkgPath, JSON.stringify(tPkg, null, 2), "utf-8");
|
|
422
434
|
}
|
|
@@ -430,9 +442,9 @@ export async function initCommand(options = {}) {
|
|
|
430
442
|
const rootPkg = JSON.parse(fs.readFileSync(rootPkgPath, "utf-8"));
|
|
431
443
|
if (!rootPkg.devDependencies)
|
|
432
444
|
rootPkg.devDependencies = {};
|
|
433
|
-
if (!rootPkg.devDependencies["@testspectra/cli"])
|
|
445
|
+
if (!rootPkg.devDependencies["@testspectra/cli"] || rootPkg.devDependencies["@testspectra/cli"] === "workspace:*")
|
|
434
446
|
rootPkg.devDependencies["@testspectra/cli"] = cliDepVersion;
|
|
435
|
-
if (!rootPkg.devDependencies["@testspectra/matchers"])
|
|
447
|
+
if (!rootPkg.devDependencies["@testspectra/matchers"] || rootPkg.devDependencies["@testspectra/matchers"] === "workspace:*")
|
|
436
448
|
rootPkg.devDependencies["@testspectra/matchers"] = cliDepVersion;
|
|
437
449
|
if (!rootPkg.devDependencies["typescript"])
|
|
438
450
|
rootPkg.devDependencies["typescript"] = "^5.4.5";
|
|
@@ -443,7 +455,7 @@ export async function initCommand(options = {}) {
|
|
|
443
455
|
if (!rootPkg.devDependencies["@wdio/spec-reporter"])
|
|
444
456
|
rootPkg.devDependencies["@wdio/spec-reporter"] = "^9.2.8";
|
|
445
457
|
if (!rootPkg.devDependencies["@wdio/devtools-service"])
|
|
446
|
-
rootPkg.devDependencies["@wdio/devtools-service"] = "^
|
|
458
|
+
rootPkg.devDependencies["@wdio/devtools-service"] = "^8.46.0";
|
|
447
459
|
if (!rootPkg.devDependencies["@wdio/globals"])
|
|
448
460
|
rootPkg.devDependencies["@wdio/globals"] = "^9.2.8";
|
|
449
461
|
if (!rootPkg.devDependencies["@wdio/mocha-framework"])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testspectra/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.66",
|
|
4
4
|
"description": "TestSpectra Zero-Config Cross-Platform Test Runner CLI",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@clack/prompts": "^1.7.0",
|
|
33
|
-
"@testspectra/matchers": "^1.0.
|
|
33
|
+
"@testspectra/matchers": "^1.0.66",
|
|
34
34
|
"chalk": "^5.3.0",
|
|
35
35
|
"commander": "^12.1.0",
|
|
36
36
|
"dotenv": "^16.4.5",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"type-check": "tsc -b"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"@testspectra/cli": "
|
|
12
|
-
"@testspectra/matchers": "^1.0.
|
|
11
|
+
"@testspectra/cli": "^1.0.66",
|
|
12
|
+
"@testspectra/matchers": "^1.0.66",
|
|
13
13
|
"@types/node": "^20.14.0",
|
|
14
14
|
"@wdio/cli": "^9.2.8",
|
|
15
15
|
"@wdio/local-runner": "^9.2.8",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"build": "nx run-many -t build"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@testspectra/cli": "
|
|
14
|
-
"@testspectra/matchers": "^1.0.
|
|
13
|
+
"@testspectra/cli": "^1.0.66",
|
|
14
|
+
"@testspectra/matchers": "^1.0.66",
|
|
15
15
|
"@types/node": "^20.14.0",
|
|
16
16
|
"@wdio/cli": "^9.2.8",
|
|
17
17
|
"@wdio/local-runner": "^9.2.8",
|