@testspectra/cli 1.0.19 ā 1.0.20
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 +25 -31
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -418,25 +418,19 @@ pnpm type-check
|
|
|
418
418
|
\`\`\`
|
|
419
419
|
`;
|
|
420
420
|
fs.writeFileSync(path.join(cwd, "ARCHITECTURE.md"), archDocContent, "utf-8");
|
|
421
|
-
// 8.
|
|
421
|
+
// 8. Safely append to root README.md (do not overwrite existing content)
|
|
422
422
|
const rootReadmePath = path.join(cwd, "README.md");
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
- **Run all E2E tests**: \`pnpm nx run-many -t e2e\`
|
|
436
|
-
- **Run affected E2E tests**: \`pnpm nx affected -t e2e\`
|
|
437
|
-
- **Type-check all suites**: \`pnpm type-check\`
|
|
438
|
-
`;
|
|
439
|
-
fs.writeFileSync(rootReadmePath, readmeContent, "utf-8");
|
|
423
|
+
const archSection = `\n## E2E Testing Architecture (TestSpectra)\n\nThis workspace uses TestSpectra's **Centralized Configuration, Distributed Implementation** architecture.\nDetailed architecture, folder map, and zero-import mechanics are documented in: \nš **[ARCHITECTURE.md](./ARCHITECTURE.md)**\n\n- **Run all E2E tests**: \`pnpm nx run-many -t e2e\`\n- **Run affected E2E tests**: \`pnpm nx affected -t e2e\`\n- **Type-check E2E suites**: \`pnpm type-check\`\n`;
|
|
424
|
+
if (fs.existsSync(rootReadmePath)) {
|
|
425
|
+
const existing = fs.readFileSync(rootReadmePath, "utf-8");
|
|
426
|
+
if (!existing.includes("ARCHITECTURE.md")) {
|
|
427
|
+
fs.appendFileSync(rootReadmePath, archSection, "utf-8");
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
const readmeContent = `# ${projectName}\n\nAutomated cross-platform E2E testing powered by [TestSpectra](https://github.com/testspectra).\n${archSection}`;
|
|
432
|
+
fs.writeFileSync(rootReadmePath, readmeContent, "utf-8");
|
|
433
|
+
}
|
|
440
434
|
console.log(`\n\x1b[32m[TestSpectra]\x1b[0m Enterprise Nx Monorepo initialized successfully!`);
|
|
441
435
|
console.log(`\x1b[36m- Centralized Configuration:\x1b[0m ./spectra.config.ts`);
|
|
442
436
|
console.log(`\x1b[36m- Centralized App Data/Cache:\x1b[0m ./.testspectra/`);
|
|
@@ -484,19 +478,19 @@ pnpm type-check
|
|
|
484
478
|
\`\`\`
|
|
485
479
|
`;
|
|
486
480
|
fs.writeFileSync(path.join(cwd, "ARCHITECTURE.md"), standaloneArchDoc, "utf-8");
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
TestSpectra
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
481
|
+
// Safely update root README.md (do not overwrite existing content)
|
|
482
|
+
const standaloneReadmePath = path.join(cwd, "README.md");
|
|
483
|
+
const standaloneArchSection = `\n## E2E Testing Architecture (TestSpectra)\n\nDetailed test architecture and folder map are documented in: \nš **[ARCHITECTURE.md](./ARCHITECTURE.md)**\n\n- **Run tests**: \`pnpm test\`\n- **Type-check**: \`pnpm type-check\`\n`;
|
|
484
|
+
if (fs.existsSync(standaloneReadmePath)) {
|
|
485
|
+
const existing = fs.readFileSync(standaloneReadmePath, "utf-8");
|
|
486
|
+
if (!existing.includes("ARCHITECTURE.md")) {
|
|
487
|
+
fs.appendFileSync(standaloneReadmePath, standaloneArchSection, "utf-8");
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
const standaloneReadme = `# ${projectName}\n\nTestSpectra automated testing project.\n${standaloneArchSection}`;
|
|
492
|
+
fs.writeFileSync(standaloneReadmePath, standaloneReadme, "utf-8");
|
|
493
|
+
}
|
|
500
494
|
console.log(`\x1b[32m[TestSpectra]\x1b[0m Initialized project from template successfully!`);
|
|
501
495
|
console.log(`\x1b[32m[TestSpectra]\x1b[0m Generated documentation at ./ARCHITECTURE.md`);
|
|
502
496
|
console.log(`\x1b[32m[TestSpectra]\x1b[0m Generated ambient multi-platform types in .testspectra/types/`);
|