@nextsparkjs/cli 0.1.0-beta.25 → 0.1.0-beta.27

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.
Files changed (2) hide show
  1. package/dist/cli.js +30 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1478,6 +1478,33 @@ async function updateMigrations(config2) {
1478
1478
  await fs.writeFile(filePath, content, "utf-8");
1479
1479
  }
1480
1480
  }
1481
+ async function updateTestFiles(config2) {
1482
+ const testsDir = path.join(getTargetThemesDir(), config2.projectSlug, "tests");
1483
+ if (!await fs.pathExists(testsDir)) {
1484
+ return;
1485
+ }
1486
+ const processDir = async (dir) => {
1487
+ const items = await fs.readdir(dir);
1488
+ for (const item of items) {
1489
+ const itemPath = path.join(dir, item);
1490
+ const stat = await fs.stat(itemPath);
1491
+ if (stat.isDirectory()) {
1492
+ await processDir(itemPath);
1493
+ } else if (item.endsWith(".ts") || item.endsWith(".tsx")) {
1494
+ let content = await fs.readFile(itemPath, "utf-8");
1495
+ const hasChanges = content.includes("@/contents/themes/starter/");
1496
+ if (hasChanges) {
1497
+ content = content.replace(
1498
+ /@\/contents\/themes\/starter\//g,
1499
+ `@/contents/themes/${config2.projectSlug}/`
1500
+ );
1501
+ await fs.writeFile(itemPath, content, "utf-8");
1502
+ }
1503
+ }
1504
+ }
1505
+ };
1506
+ await processDir(testsDir);
1507
+ }
1481
1508
  function toCamelCase(str) {
1482
1509
  return str.split("-").map((word, index) => {
1483
1510
  if (index === 0) {
@@ -2305,7 +2332,7 @@ async function updatePackageJson(config2) {
2305
2332
  "build:registries": "nextspark registry:build",
2306
2333
  "db:migrate": "nextspark db:migrate",
2307
2334
  "db:seed": "nextspark db:seed",
2308
- "test:theme": `jest --config contents/themes/${config2.projectSlug}/tests/jest/jest.config.ts`,
2335
+ "test:theme": `jest --config contents/themes/${config2.projectSlug}/tests/jest/jest.config.cjs`,
2309
2336
  "cy:open": `cypress open --config-file contents/themes/${config2.projectSlug}/tests/cypress.config.ts`,
2310
2337
  "cy:run": `cypress run --config-file contents/themes/${config2.projectSlug}/tests/cypress.config.ts`,
2311
2338
  "allure:generate": `allure generate contents/themes/${config2.projectSlug}/tests/cypress/allure-results --clean -o contents/themes/${config2.projectSlug}/tests/cypress/allure-report`,
@@ -2433,6 +2460,7 @@ async function generateProject(config2) {
2433
2460
  await updateBillingConfig(config2);
2434
2461
  await updateRolesConfig(config2);
2435
2462
  await updateMigrations(config2);
2463
+ await updateTestFiles(config2);
2436
2464
  await updatePermissionsConfig(config2);
2437
2465
  await updateDashboardConfig(config2);
2438
2466
  await updateAuthConfig(config2);
@@ -2637,7 +2665,7 @@ function getFileTree(config2) {
2637
2665
  files.push(`${themeDir}/styles/theme.css`);
2638
2666
  files.push(`${themeDir}/styles/components.css`);
2639
2667
  files.push(`${themeDir}/tests/cypress.config.ts`);
2640
- files.push(`${themeDir}/tests/jest/jest.config.ts`);
2668
+ files.push(`${themeDir}/tests/jest/jest.config.cjs`);
2641
2669
  files.push(`${themeDir}/tests/cypress/e2e/auth.cy.ts`);
2642
2670
  files.push(`${themeDir}/tests/cypress/e2e/dashboard.cy.ts`);
2643
2671
  files.push(`${themeDir}/tests/jest/components/hero.test.tsx`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextsparkjs/cli",
3
- "version": "0.1.0-beta.25",
3
+ "version": "0.1.0-beta.27",
4
4
  "description": "NextSpark CLI - Complete development toolkit",
5
5
  "type": "module",
6
6
  "bin": {