@nextsparkjs/cli 0.1.0-beta.10 → 0.1.0-beta.17
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/bin/nextspark.js +0 -0
- package/dist/cli.js +181 -168
- package/package.json +10 -9
package/bin/nextspark.js
CHANGED
|
File without changes
|
package/dist/cli.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-ALB2C27N.js";
|
|
11
11
|
|
|
12
12
|
// src/cli.ts
|
|
13
|
+
import { config } from "dotenv";
|
|
13
14
|
import { Command } from "commander";
|
|
14
15
|
import chalk15 from "chalk";
|
|
15
16
|
|
|
@@ -443,13 +444,24 @@ import { dirname as dirname2, join as join4 } from "path";
|
|
|
443
444
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
444
445
|
var __dirname2 = dirname2(__filename2);
|
|
445
446
|
function getCliVersion() {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
447
|
+
const possiblePaths = [
|
|
448
|
+
join4(__dirname2, "../package.json"),
|
|
449
|
+
// from dist/
|
|
450
|
+
join4(__dirname2, "../../package.json"),
|
|
451
|
+
// from dist/wizard/ or src/wizard/
|
|
452
|
+
join4(__dirname2, "../../../package.json")
|
|
453
|
+
// fallback
|
|
454
|
+
];
|
|
455
|
+
for (const packageJsonPath of possiblePaths) {
|
|
456
|
+
try {
|
|
457
|
+
const packageJson = JSON.parse(readFileSync4(packageJsonPath, "utf-8"));
|
|
458
|
+
if (packageJson.name === "@nextsparkjs/cli" && packageJson.version) {
|
|
459
|
+
return packageJson.version;
|
|
460
|
+
}
|
|
461
|
+
} catch {
|
|
462
|
+
}
|
|
452
463
|
}
|
|
464
|
+
return "unknown";
|
|
453
465
|
}
|
|
454
466
|
var BANNER = `
|
|
455
467
|
_ __ __ _____ __
|
|
@@ -1196,11 +1208,11 @@ function getTemplatesDir() {
|
|
|
1196
1208
|
function getTargetThemesDir() {
|
|
1197
1209
|
return path.resolve(process.cwd(), "contents", "themes");
|
|
1198
1210
|
}
|
|
1199
|
-
async function copyStarterTheme(
|
|
1211
|
+
async function copyStarterTheme(config2) {
|
|
1200
1212
|
const templatesDir = getTemplatesDir();
|
|
1201
1213
|
const starterThemePath = path.join(templatesDir, "contents", "themes", "starter");
|
|
1202
1214
|
const targetThemesDir = getTargetThemesDir();
|
|
1203
|
-
const newThemePath = path.join(targetThemesDir,
|
|
1215
|
+
const newThemePath = path.join(targetThemesDir, config2.projectSlug);
|
|
1204
1216
|
if (!await fs.pathExists(starterThemePath)) {
|
|
1205
1217
|
throw new Error(`Starter theme not found at: ${starterThemePath}`);
|
|
1206
1218
|
}
|
|
@@ -1210,97 +1222,97 @@ async function copyStarterTheme(config) {
|
|
|
1210
1222
|
await fs.ensureDir(targetThemesDir);
|
|
1211
1223
|
await fs.copy(starterThemePath, newThemePath);
|
|
1212
1224
|
}
|
|
1213
|
-
async function updateThemeConfig(
|
|
1214
|
-
const themeConfigPath = path.join(getTargetThemesDir(),
|
|
1225
|
+
async function updateThemeConfig(config2) {
|
|
1226
|
+
const themeConfigPath = path.join(getTargetThemesDir(), config2.projectSlug, "config", "theme.config.ts");
|
|
1215
1227
|
if (!await fs.pathExists(themeConfigPath)) {
|
|
1216
1228
|
throw new Error(`theme.config.ts not found at: ${themeConfigPath}`);
|
|
1217
1229
|
}
|
|
1218
1230
|
let content = await fs.readFile(themeConfigPath, "utf-8");
|
|
1219
1231
|
content = content.replace(
|
|
1220
1232
|
/name:\s*['"]starter['"]/g,
|
|
1221
|
-
`name: '${
|
|
1233
|
+
`name: '${config2.projectSlug}'`
|
|
1222
1234
|
);
|
|
1223
1235
|
content = content.replace(
|
|
1224
1236
|
/displayName:\s*['"]Starter['"]/g,
|
|
1225
|
-
`displayName: '${
|
|
1237
|
+
`displayName: '${config2.projectName}'`
|
|
1226
1238
|
);
|
|
1227
1239
|
content = content.replace(
|
|
1228
1240
|
/description:\s*['"]Minimal starter theme for NextSpark['"]/g,
|
|
1229
|
-
`description: '${
|
|
1241
|
+
`description: '${config2.projectDescription}'`
|
|
1230
1242
|
);
|
|
1231
1243
|
content = content.replace(
|
|
1232
1244
|
/export const starterThemeConfig/g,
|
|
1233
|
-
`export const ${toCamelCase(
|
|
1245
|
+
`export const ${toCamelCase(config2.projectSlug)}ThemeConfig`
|
|
1234
1246
|
);
|
|
1235
1247
|
content = content.replace(
|
|
1236
1248
|
/export default starterThemeConfig/g,
|
|
1237
|
-
`export default ${toCamelCase(
|
|
1249
|
+
`export default ${toCamelCase(config2.projectSlug)}ThemeConfig`
|
|
1238
1250
|
);
|
|
1239
1251
|
await fs.writeFile(themeConfigPath, content, "utf-8");
|
|
1240
1252
|
}
|
|
1241
|
-
async function updateDevConfig(
|
|
1242
|
-
const devConfigPath = path.join(getTargetThemesDir(),
|
|
1253
|
+
async function updateDevConfig(config2) {
|
|
1254
|
+
const devConfigPath = path.join(getTargetThemesDir(), config2.projectSlug, "config", "dev.config.ts");
|
|
1243
1255
|
if (!await fs.pathExists(devConfigPath)) {
|
|
1244
1256
|
return;
|
|
1245
1257
|
}
|
|
1246
1258
|
let content = await fs.readFile(devConfigPath, "utf-8");
|
|
1247
|
-
content = content.replace(/STARTER THEME/g, `${
|
|
1248
|
-
content = content.replace(/Starter Theme/g,
|
|
1259
|
+
content = content.replace(/STARTER THEME/g, `${config2.projectName.toUpperCase()}`);
|
|
1260
|
+
content = content.replace(/Starter Theme/g, config2.projectName);
|
|
1249
1261
|
await fs.writeFile(devConfigPath, content, "utf-8");
|
|
1250
1262
|
}
|
|
1251
|
-
async function updateAppConfig(
|
|
1252
|
-
const appConfigPath = path.join(getTargetThemesDir(),
|
|
1263
|
+
async function updateAppConfig(config2) {
|
|
1264
|
+
const appConfigPath = path.join(getTargetThemesDir(), config2.projectSlug, "config", "app.config.ts");
|
|
1253
1265
|
if (!await fs.pathExists(appConfigPath)) {
|
|
1254
1266
|
throw new Error(`app.config.ts not found at: ${appConfigPath}`);
|
|
1255
1267
|
}
|
|
1256
1268
|
let content = await fs.readFile(appConfigPath, "utf-8");
|
|
1257
1269
|
content = content.replace(
|
|
1258
1270
|
/name:\s*['"]Starter['"]/g,
|
|
1259
|
-
`name: '${
|
|
1271
|
+
`name: '${config2.projectName}'`
|
|
1260
1272
|
);
|
|
1261
1273
|
content = content.replace(
|
|
1262
1274
|
/mode:\s*['"]multi-tenant['"]\s*as\s*const/g,
|
|
1263
|
-
`mode: '${
|
|
1275
|
+
`mode: '${config2.teamMode}' as const`
|
|
1264
1276
|
);
|
|
1265
|
-
const localesArray =
|
|
1277
|
+
const localesArray = config2.supportedLocales.map((l) => `'${l}'`).join(", ");
|
|
1266
1278
|
content = content.replace(
|
|
1267
1279
|
/supportedLocales:\s*\[.*?\]/g,
|
|
1268
1280
|
`supportedLocales: [${localesArray}]`
|
|
1269
1281
|
);
|
|
1270
1282
|
content = content.replace(
|
|
1271
1283
|
/defaultLocale:\s*['"]en['"]\s*as\s*const/g,
|
|
1272
|
-
`defaultLocale: '${
|
|
1284
|
+
`defaultLocale: '${config2.defaultLocale}' as const`
|
|
1273
1285
|
);
|
|
1274
1286
|
content = content.replace(
|
|
1275
1287
|
/label:\s*['"]Starter['"]/g,
|
|
1276
|
-
`label: '${
|
|
1288
|
+
`label: '${config2.projectName}'`
|
|
1277
1289
|
);
|
|
1278
1290
|
await fs.writeFile(appConfigPath, content, "utf-8");
|
|
1279
1291
|
}
|
|
1280
|
-
async function updateRolesConfig(
|
|
1281
|
-
const appConfigPath = path.join(getTargetThemesDir(),
|
|
1292
|
+
async function updateRolesConfig(config2) {
|
|
1293
|
+
const appConfigPath = path.join(getTargetThemesDir(), config2.projectSlug, "config", "app.config.ts");
|
|
1282
1294
|
if (!await fs.pathExists(appConfigPath)) {
|
|
1283
1295
|
return;
|
|
1284
1296
|
}
|
|
1285
1297
|
let content = await fs.readFile(appConfigPath, "utf-8");
|
|
1286
|
-
const rolesArray =
|
|
1298
|
+
const rolesArray = config2.teamRoles.map((r) => `'${r}'`).join(", ");
|
|
1287
1299
|
content = content.replace(
|
|
1288
1300
|
/availableTeamRoles:\s*\[.*?\]/g,
|
|
1289
1301
|
`availableTeamRoles: [${rolesArray}]`
|
|
1290
1302
|
);
|
|
1291
1303
|
await fs.writeFile(appConfigPath, content, "utf-8");
|
|
1292
1304
|
}
|
|
1293
|
-
async function updateBillingConfig(
|
|
1294
|
-
const billingConfigPath = path.join(getTargetThemesDir(),
|
|
1305
|
+
async function updateBillingConfig(config2) {
|
|
1306
|
+
const billingConfigPath = path.join(getTargetThemesDir(), config2.projectSlug, "config", "billing.config.ts");
|
|
1295
1307
|
if (!await fs.pathExists(billingConfigPath)) {
|
|
1296
1308
|
return;
|
|
1297
1309
|
}
|
|
1298
1310
|
let content = await fs.readFile(billingConfigPath, "utf-8");
|
|
1299
1311
|
content = content.replace(
|
|
1300
1312
|
/currency:\s*['"]usd['"]/g,
|
|
1301
|
-
`currency: '${
|
|
1313
|
+
`currency: '${config2.currency}'`
|
|
1302
1314
|
);
|
|
1303
|
-
const plansContent = generateBillingPlans(
|
|
1315
|
+
const plansContent = generateBillingPlans(config2.billingModel, config2.currency);
|
|
1304
1316
|
content = content.replace(
|
|
1305
1317
|
/plans:\s*\[[\s\S]*?\],\s*\n\s*\/\/ ===+\s*\n\s*\/\/ ACTION MAPPINGS/,
|
|
1306
1318
|
`plans: ${plansContent},
|
|
@@ -1450,8 +1462,8 @@ function generateBillingPlans(billingModel, currency) {
|
|
|
1450
1462
|
},
|
|
1451
1463
|
]`;
|
|
1452
1464
|
}
|
|
1453
|
-
async function updateMigrations(
|
|
1454
|
-
const migrationsDir = path.join(getTargetThemesDir(),
|
|
1465
|
+
async function updateMigrations(config2) {
|
|
1466
|
+
const migrationsDir = path.join(getTargetThemesDir(), config2.projectSlug, "migrations");
|
|
1455
1467
|
if (!await fs.pathExists(migrationsDir)) {
|
|
1456
1468
|
return;
|
|
1457
1469
|
}
|
|
@@ -1460,9 +1472,9 @@ async function updateMigrations(config) {
|
|
|
1460
1472
|
for (const file of sqlFiles) {
|
|
1461
1473
|
const filePath = path.join(migrationsDir, file);
|
|
1462
1474
|
let content = await fs.readFile(filePath, "utf-8");
|
|
1463
|
-
content = content.replace(/@starter\.dev/g, `@${
|
|
1464
|
-
content = content.replace(/Starter Theme/g,
|
|
1465
|
-
content = content.replace(/starter theme/g,
|
|
1475
|
+
content = content.replace(/@starter\.dev/g, `@${config2.projectSlug}.dev`);
|
|
1476
|
+
content = content.replace(/Starter Theme/g, config2.projectName);
|
|
1477
|
+
content = content.replace(/starter theme/g, config2.projectSlug);
|
|
1466
1478
|
await fs.writeFile(filePath, content, "utf-8");
|
|
1467
1479
|
}
|
|
1468
1480
|
}
|
|
@@ -1481,10 +1493,10 @@ import path2 from "path";
|
|
|
1481
1493
|
function getTargetThemesDir2() {
|
|
1482
1494
|
return path2.resolve(process.cwd(), "contents", "themes");
|
|
1483
1495
|
}
|
|
1484
|
-
async function updateAuthConfig(
|
|
1496
|
+
async function updateAuthConfig(config2) {
|
|
1485
1497
|
const authConfigPath = path2.join(
|
|
1486
1498
|
getTargetThemesDir2(),
|
|
1487
|
-
|
|
1499
|
+
config2.projectSlug,
|
|
1488
1500
|
"config",
|
|
1489
1501
|
"auth.config.ts"
|
|
1490
1502
|
);
|
|
@@ -1494,22 +1506,22 @@ async function updateAuthConfig(config) {
|
|
|
1494
1506
|
let content = await fs2.readFile(authConfigPath, "utf-8");
|
|
1495
1507
|
content = content.replace(
|
|
1496
1508
|
/(emailPassword:\s*{[^}]*enabled:\s*)(?:true|false)/gs,
|
|
1497
|
-
`$1${
|
|
1509
|
+
`$1${config2.auth.emailPassword}`
|
|
1498
1510
|
);
|
|
1499
1511
|
content = content.replace(
|
|
1500
1512
|
/(google:\s*{[^}]*enabled:\s*)(?:true|false)/gs,
|
|
1501
|
-
`$1${
|
|
1513
|
+
`$1${config2.auth.googleOAuth}`
|
|
1502
1514
|
);
|
|
1503
1515
|
content = content.replace(
|
|
1504
1516
|
/(emailVerification:\s*)(?:true|false)/g,
|
|
1505
|
-
`$1${
|
|
1517
|
+
`$1${config2.auth.emailVerification}`
|
|
1506
1518
|
);
|
|
1507
1519
|
await fs2.writeFile(authConfigPath, content, "utf-8");
|
|
1508
1520
|
}
|
|
1509
|
-
async function updateDashboardUIConfig(
|
|
1521
|
+
async function updateDashboardUIConfig(config2) {
|
|
1510
1522
|
const dashboardConfigPath = path2.join(
|
|
1511
1523
|
getTargetThemesDir2(),
|
|
1512
|
-
|
|
1524
|
+
config2.projectSlug,
|
|
1513
1525
|
"config",
|
|
1514
1526
|
"dashboard.config.ts"
|
|
1515
1527
|
);
|
|
@@ -1519,42 +1531,42 @@ async function updateDashboardUIConfig(config) {
|
|
|
1519
1531
|
let content = await fs2.readFile(dashboardConfigPath, "utf-8");
|
|
1520
1532
|
content = content.replace(
|
|
1521
1533
|
/(search:\s*{[^}]*enabled:\s*)(?:true|false)/gs,
|
|
1522
|
-
`$1${
|
|
1534
|
+
`$1${config2.dashboard.search}`
|
|
1523
1535
|
);
|
|
1524
1536
|
content = content.replace(
|
|
1525
1537
|
/(notifications:\s*{[^}]*enabled:\s*)(?:true|false)/gs,
|
|
1526
|
-
`$1${
|
|
1538
|
+
`$1${config2.dashboard.notifications}`
|
|
1527
1539
|
);
|
|
1528
1540
|
content = content.replace(
|
|
1529
1541
|
/(themeToggle:\s*{[^}]*enabled:\s*)(?:true|false)/gs,
|
|
1530
|
-
`$1${
|
|
1542
|
+
`$1${config2.dashboard.themeToggle}`
|
|
1531
1543
|
);
|
|
1532
1544
|
content = content.replace(
|
|
1533
1545
|
/(support:\s*{[^}]*enabled:\s*)(?:true|false)/gs,
|
|
1534
|
-
`$1${
|
|
1546
|
+
`$1${config2.dashboard.support}`
|
|
1535
1547
|
);
|
|
1536
1548
|
content = content.replace(
|
|
1537
1549
|
/(quickCreate:\s*{[^}]*enabled:\s*)(?:true|false)/gs,
|
|
1538
|
-
`$1${
|
|
1550
|
+
`$1${config2.dashboard.quickCreate}`
|
|
1539
1551
|
);
|
|
1540
1552
|
content = content.replace(
|
|
1541
1553
|
/(adminAccess:\s*{[^}]*enabled:\s*)(?:true|false)/gs,
|
|
1542
|
-
`$1${
|
|
1554
|
+
`$1${config2.dashboard.superadminAccess}`
|
|
1543
1555
|
);
|
|
1544
1556
|
content = content.replace(
|
|
1545
1557
|
/(devtoolsAccess:\s*{[^}]*enabled:\s*)(?:true|false)/gs,
|
|
1546
|
-
`$1${
|
|
1558
|
+
`$1${config2.dashboard.devtoolsAccess}`
|
|
1547
1559
|
);
|
|
1548
1560
|
content = content.replace(
|
|
1549
1561
|
/(defaultCollapsed:\s*)(?:true|false)/g,
|
|
1550
|
-
`$1${
|
|
1562
|
+
`$1${config2.dashboard.sidebarCollapsed}`
|
|
1551
1563
|
);
|
|
1552
1564
|
await fs2.writeFile(dashboardConfigPath, content, "utf-8");
|
|
1553
1565
|
}
|
|
1554
|
-
async function updateDevToolsConfig(
|
|
1566
|
+
async function updateDevToolsConfig(config2) {
|
|
1555
1567
|
const devConfigPath = path2.join(
|
|
1556
1568
|
getTargetThemesDir2(),
|
|
1557
|
-
|
|
1569
|
+
config2.projectSlug,
|
|
1558
1570
|
"config",
|
|
1559
1571
|
"dev.config.ts"
|
|
1560
1572
|
);
|
|
@@ -1564,18 +1576,18 @@ async function updateDevToolsConfig(config) {
|
|
|
1564
1576
|
let content = await fs2.readFile(devConfigPath, "utf-8");
|
|
1565
1577
|
content = content.replace(
|
|
1566
1578
|
/(devKeyring:\s*{[^}]*enabled:\s*)(?:true|false)/gs,
|
|
1567
|
-
`$1${
|
|
1579
|
+
`$1${config2.dev.devKeyring}`
|
|
1568
1580
|
);
|
|
1569
1581
|
content = content.replace(
|
|
1570
1582
|
/(debugMode:\s*)(?:true|false)/g,
|
|
1571
|
-
`$1${
|
|
1583
|
+
`$1${config2.dev.debugMode}`
|
|
1572
1584
|
);
|
|
1573
1585
|
await fs2.writeFile(devConfigPath, content, "utf-8");
|
|
1574
1586
|
}
|
|
1575
|
-
async function updatePermissionsConfig(
|
|
1587
|
+
async function updatePermissionsConfig(config2) {
|
|
1576
1588
|
const permissionsConfigPath = path2.join(
|
|
1577
1589
|
getTargetThemesDir2(),
|
|
1578
|
-
|
|
1590
|
+
config2.projectSlug,
|
|
1579
1591
|
"config",
|
|
1580
1592
|
"permissions.config.ts"
|
|
1581
1593
|
);
|
|
@@ -1583,7 +1595,7 @@ async function updatePermissionsConfig(config) {
|
|
|
1583
1595
|
return;
|
|
1584
1596
|
}
|
|
1585
1597
|
let content = await fs2.readFile(permissionsConfigPath, "utf-8");
|
|
1586
|
-
const availableRoles =
|
|
1598
|
+
const availableRoles = config2.teamRoles;
|
|
1587
1599
|
const roleArrayPattern = /roles:\s*\[(.*?)\]/g;
|
|
1588
1600
|
content = content.replace(roleArrayPattern, (match, rolesStr) => {
|
|
1589
1601
|
const currentRoles = rolesStr.split(",").map((r) => r.trim().replace(/['"]/g, "")).filter((r) => r.length > 0);
|
|
@@ -1595,10 +1607,10 @@ async function updatePermissionsConfig(config) {
|
|
|
1595
1607
|
});
|
|
1596
1608
|
await fs2.writeFile(permissionsConfigPath, content, "utf-8");
|
|
1597
1609
|
}
|
|
1598
|
-
async function updateDashboardConfig(
|
|
1610
|
+
async function updateDashboardConfig(config2) {
|
|
1599
1611
|
const dashboardConfigPath = path2.join(
|
|
1600
1612
|
getTargetThemesDir2(),
|
|
1601
|
-
|
|
1613
|
+
config2.projectSlug,
|
|
1602
1614
|
"config",
|
|
1603
1615
|
"dashboard.config.ts"
|
|
1604
1616
|
);
|
|
@@ -1606,19 +1618,19 @@ async function updateDashboardConfig(config) {
|
|
|
1606
1618
|
return;
|
|
1607
1619
|
}
|
|
1608
1620
|
let content = await fs2.readFile(dashboardConfigPath, "utf-8");
|
|
1609
|
-
if (!
|
|
1621
|
+
if (!config2.features.analytics) {
|
|
1610
1622
|
content = content.replace(
|
|
1611
1623
|
/(id:\s*['"]analytics['"].*?enabled:\s*)true/gs,
|
|
1612
1624
|
"$1false"
|
|
1613
1625
|
);
|
|
1614
1626
|
}
|
|
1615
|
-
if (!
|
|
1627
|
+
if (!config2.features.billing) {
|
|
1616
1628
|
content = content.replace(
|
|
1617
1629
|
/(id:\s*['"]billing['"].*?enabled:\s*)true/gs,
|
|
1618
1630
|
"$1false"
|
|
1619
1631
|
);
|
|
1620
1632
|
}
|
|
1621
|
-
if (
|
|
1633
|
+
if (config2.teamMode === "single-user") {
|
|
1622
1634
|
content = content.replace(
|
|
1623
1635
|
/(id:\s*['"]team['"].*?enabled:\s*)true/gs,
|
|
1624
1636
|
"$1false"
|
|
@@ -1630,10 +1642,10 @@ async function updateDashboardConfig(config) {
|
|
|
1630
1642
|
}
|
|
1631
1643
|
await fs2.writeFile(dashboardConfigPath, content, "utf-8");
|
|
1632
1644
|
}
|
|
1633
|
-
async function generateEnvExample(
|
|
1645
|
+
async function generateEnvExample(config2) {
|
|
1634
1646
|
const envExamplePath = path2.resolve(process.cwd(), ".env.example");
|
|
1635
1647
|
let oauthSection = "";
|
|
1636
|
-
if (
|
|
1648
|
+
if (config2.auth.googleOAuth) {
|
|
1637
1649
|
oauthSection = `# =============================================================================
|
|
1638
1650
|
# OAUTH PROVIDERS
|
|
1639
1651
|
# =============================================================================
|
|
@@ -1649,7 +1661,7 @@ GOOGLE_CLIENT_SECRET="your-google-client-secret"
|
|
|
1649
1661
|
`;
|
|
1650
1662
|
}
|
|
1651
1663
|
const envContent = `# NextSpark Environment Configuration
|
|
1652
|
-
# Generated for: ${
|
|
1664
|
+
# Generated for: ${config2.projectName}
|
|
1653
1665
|
|
|
1654
1666
|
# =============================================================================
|
|
1655
1667
|
# DATABASE
|
|
@@ -1665,7 +1677,7 @@ BETTER_AUTH_SECRET="your-secret-key-here"
|
|
|
1665
1677
|
# =============================================================================
|
|
1666
1678
|
# THEME
|
|
1667
1679
|
# =============================================================================
|
|
1668
|
-
NEXT_PUBLIC_ACTIVE_THEME="${
|
|
1680
|
+
NEXT_PUBLIC_ACTIVE_THEME="${config2.projectSlug}"
|
|
1669
1681
|
|
|
1670
1682
|
# =============================================================================
|
|
1671
1683
|
# APPLICATION
|
|
@@ -1673,7 +1685,7 @@ NEXT_PUBLIC_ACTIVE_THEME="${config.projectSlug}"
|
|
|
1673
1685
|
NEXT_PUBLIC_APP_URL="http://localhost:3000"
|
|
1674
1686
|
NODE_ENV="development"
|
|
1675
1687
|
|
|
1676
|
-
${
|
|
1688
|
+
${config2.features.billing ? `# =============================================================================
|
|
1677
1689
|
# STRIPE (Billing)
|
|
1678
1690
|
# =============================================================================
|
|
1679
1691
|
STRIPE_SECRET_KEY="sk_test_..."
|
|
@@ -1691,16 +1703,16 @@ ${oauthSection}`;
|
|
|
1691
1703
|
await fs2.writeFile(envExamplePath, envContent, "utf-8");
|
|
1692
1704
|
}
|
|
1693
1705
|
}
|
|
1694
|
-
async function updateReadme(
|
|
1695
|
-
const readmePath = path2.join(getTargetThemesDir2(),
|
|
1706
|
+
async function updateReadme(config2) {
|
|
1707
|
+
const readmePath = path2.join(getTargetThemesDir2(), config2.projectSlug, "README.md");
|
|
1696
1708
|
if (!await fs2.pathExists(readmePath)) {
|
|
1697
1709
|
return;
|
|
1698
1710
|
}
|
|
1699
1711
|
let content = await fs2.readFile(readmePath, "utf-8");
|
|
1700
|
-
content = content.replace(/# Starter Theme/g, `# ${
|
|
1712
|
+
content = content.replace(/# Starter Theme/g, `# ${config2.projectName}`);
|
|
1701
1713
|
content = content.replace(
|
|
1702
1714
|
/Minimal starter theme for NextSpark/g,
|
|
1703
|
-
|
|
1715
|
+
config2.projectDescription
|
|
1704
1716
|
);
|
|
1705
1717
|
await fs2.writeFile(readmePath, content, "utf-8");
|
|
1706
1718
|
}
|
|
@@ -1719,8 +1731,8 @@ import path3 from "path";
|
|
|
1719
1731
|
function getTargetThemesDir3() {
|
|
1720
1732
|
return path3.resolve(process.cwd(), "contents", "themes");
|
|
1721
1733
|
}
|
|
1722
|
-
async function removeUnusedLanguages(
|
|
1723
|
-
const messagesDir = path3.join(getTargetThemesDir3(),
|
|
1734
|
+
async function removeUnusedLanguages(config2) {
|
|
1735
|
+
const messagesDir = path3.join(getTargetThemesDir3(), config2.projectSlug, "messages");
|
|
1724
1736
|
if (!await fs3.pathExists(messagesDir)) {
|
|
1725
1737
|
return;
|
|
1726
1738
|
}
|
|
@@ -1730,13 +1742,13 @@ async function removeUnusedLanguages(config) {
|
|
|
1730
1742
|
return fs3.statSync(folderPath).isDirectory() && Object.keys(AVAILABLE_LOCALES).includes(f);
|
|
1731
1743
|
});
|
|
1732
1744
|
for (const folder of languageFolders) {
|
|
1733
|
-
if (!
|
|
1745
|
+
if (!config2.supportedLocales.includes(folder)) {
|
|
1734
1746
|
await fs3.remove(path3.join(messagesDir, folder));
|
|
1735
1747
|
}
|
|
1736
1748
|
}
|
|
1737
1749
|
}
|
|
1738
|
-
async function removeUnusedEntityMessages(
|
|
1739
|
-
const entitiesDir = path3.join(getTargetThemesDir3(),
|
|
1750
|
+
async function removeUnusedEntityMessages(config2) {
|
|
1751
|
+
const entitiesDir = path3.join(getTargetThemesDir3(), config2.projectSlug, "entities");
|
|
1740
1752
|
if (!await fs3.pathExists(entitiesDir)) {
|
|
1741
1753
|
return;
|
|
1742
1754
|
}
|
|
@@ -1749,45 +1761,45 @@ async function removeUnusedEntityMessages(config) {
|
|
|
1749
1761
|
const files = await fs3.readdir(messagesDir);
|
|
1750
1762
|
for (const file of files) {
|
|
1751
1763
|
const locale = path3.basename(file, ".json");
|
|
1752
|
-
if (Object.keys(AVAILABLE_LOCALES).includes(locale) && !
|
|
1764
|
+
if (Object.keys(AVAILABLE_LOCALES).includes(locale) && !config2.supportedLocales.includes(locale)) {
|
|
1753
1765
|
await fs3.remove(path3.join(messagesDir, file));
|
|
1754
1766
|
}
|
|
1755
1767
|
}
|
|
1756
1768
|
}
|
|
1757
1769
|
}
|
|
1758
|
-
async function ensureLanguageFolders(
|
|
1759
|
-
const messagesDir = path3.join(getTargetThemesDir3(),
|
|
1770
|
+
async function ensureLanguageFolders(config2) {
|
|
1771
|
+
const messagesDir = path3.join(getTargetThemesDir3(), config2.projectSlug, "messages");
|
|
1760
1772
|
if (!await fs3.pathExists(messagesDir)) {
|
|
1761
1773
|
return;
|
|
1762
1774
|
}
|
|
1763
|
-
const defaultLocaleDir = path3.join(messagesDir,
|
|
1775
|
+
const defaultLocaleDir = path3.join(messagesDir, config2.defaultLocale);
|
|
1764
1776
|
if (!await fs3.pathExists(defaultLocaleDir)) {
|
|
1765
1777
|
const enDir = path3.join(messagesDir, "en");
|
|
1766
1778
|
if (await fs3.pathExists(enDir)) {
|
|
1767
1779
|
await fs3.copy(enDir, defaultLocaleDir);
|
|
1768
1780
|
}
|
|
1769
1781
|
}
|
|
1770
|
-
for (const locale of
|
|
1782
|
+
for (const locale of config2.supportedLocales) {
|
|
1771
1783
|
const localeDir = path3.join(messagesDir, locale);
|
|
1772
1784
|
if (!await fs3.pathExists(localeDir) && await fs3.pathExists(defaultLocaleDir)) {
|
|
1773
1785
|
await fs3.copy(defaultLocaleDir, localeDir);
|
|
1774
1786
|
}
|
|
1775
1787
|
}
|
|
1776
1788
|
}
|
|
1777
|
-
async function updateMessageFiles(
|
|
1778
|
-
const messagesDir = path3.join(getTargetThemesDir3(),
|
|
1789
|
+
async function updateMessageFiles(config2) {
|
|
1790
|
+
const messagesDir = path3.join(getTargetThemesDir3(), config2.projectSlug, "messages");
|
|
1779
1791
|
if (!await fs3.pathExists(messagesDir)) {
|
|
1780
1792
|
return;
|
|
1781
1793
|
}
|
|
1782
|
-
for (const locale of
|
|
1794
|
+
for (const locale of config2.supportedLocales) {
|
|
1783
1795
|
const commonPath = path3.join(messagesDir, locale, "common.json");
|
|
1784
1796
|
if (await fs3.pathExists(commonPath)) {
|
|
1785
1797
|
try {
|
|
1786
1798
|
const content = await fs3.readJson(commonPath);
|
|
1787
1799
|
if (content.app) {
|
|
1788
|
-
content.app.name =
|
|
1800
|
+
content.app.name = config2.projectName;
|
|
1789
1801
|
if (content.app.description) {
|
|
1790
|
-
content.app.description =
|
|
1802
|
+
content.app.description = config2.projectDescription;
|
|
1791
1803
|
}
|
|
1792
1804
|
}
|
|
1793
1805
|
await fs3.writeJson(commonPath, content, { spaces: 2 });
|
|
@@ -1796,11 +1808,11 @@ async function updateMessageFiles(config) {
|
|
|
1796
1808
|
}
|
|
1797
1809
|
}
|
|
1798
1810
|
}
|
|
1799
|
-
async function processI18n(
|
|
1800
|
-
await removeUnusedLanguages(
|
|
1801
|
-
await removeUnusedEntityMessages(
|
|
1802
|
-
await ensureLanguageFolders(
|
|
1803
|
-
await updateMessageFiles(
|
|
1811
|
+
async function processI18n(config2) {
|
|
1812
|
+
await removeUnusedLanguages(config2);
|
|
1813
|
+
await removeUnusedEntityMessages(config2);
|
|
1814
|
+
await ensureLanguageFolders(config2);
|
|
1815
|
+
await updateMessageFiles(config2);
|
|
1804
1816
|
}
|
|
1805
1817
|
|
|
1806
1818
|
// src/wizard/generators/content-features-generator.ts
|
|
@@ -1833,9 +1845,9 @@ function getFeaturesDir() {
|
|
|
1833
1845
|
function getTargetThemeDir(projectSlug) {
|
|
1834
1846
|
return path4.resolve(process.cwd(), "contents", "themes", projectSlug);
|
|
1835
1847
|
}
|
|
1836
|
-
async function copyPagesFeature(
|
|
1848
|
+
async function copyPagesFeature(config2) {
|
|
1837
1849
|
const featuresDir = getFeaturesDir();
|
|
1838
|
-
const targetThemeDir = getTargetThemeDir(
|
|
1850
|
+
const targetThemeDir = getTargetThemeDir(config2.projectSlug);
|
|
1839
1851
|
const sourcePagesEntity = path4.join(featuresDir, "pages", "entities", "pages");
|
|
1840
1852
|
const targetEntitiesDir = path4.join(targetThemeDir, "entities", "pages");
|
|
1841
1853
|
if (await fs4.pathExists(sourcePagesEntity)) {
|
|
@@ -1851,9 +1863,9 @@ async function copyPagesFeature(config) {
|
|
|
1851
1863
|
console.warn(`Warning: Hero block not found at: ${sourceHeroBlock}`);
|
|
1852
1864
|
}
|
|
1853
1865
|
}
|
|
1854
|
-
async function copyBlogFeature(
|
|
1866
|
+
async function copyBlogFeature(config2) {
|
|
1855
1867
|
const featuresDir = getFeaturesDir();
|
|
1856
|
-
const targetThemeDir = getTargetThemeDir(
|
|
1868
|
+
const targetThemeDir = getTargetThemeDir(config2.projectSlug);
|
|
1857
1869
|
const sourcePostsEntity = path4.join(featuresDir, "blog", "entities", "posts");
|
|
1858
1870
|
const targetPostsEntity = path4.join(targetThemeDir, "entities", "posts");
|
|
1859
1871
|
if (await fs4.pathExists(sourcePostsEntity)) {
|
|
@@ -1869,15 +1881,15 @@ async function copyBlogFeature(config) {
|
|
|
1869
1881
|
console.warn(`Warning: Post-content block not found at: ${sourcePostContentBlock}`);
|
|
1870
1882
|
}
|
|
1871
1883
|
}
|
|
1872
|
-
async function copyContentFeatures(
|
|
1873
|
-
if (!
|
|
1884
|
+
async function copyContentFeatures(config2) {
|
|
1885
|
+
if (!config2.contentFeatures.pages && !config2.contentFeatures.blog) {
|
|
1874
1886
|
return;
|
|
1875
1887
|
}
|
|
1876
|
-
if (
|
|
1877
|
-
await copyPagesFeature(
|
|
1888
|
+
if (config2.contentFeatures.pages) {
|
|
1889
|
+
await copyPagesFeature(config2);
|
|
1878
1890
|
}
|
|
1879
|
-
if (
|
|
1880
|
-
await copyBlogFeature(
|
|
1891
|
+
if (config2.contentFeatures.blog) {
|
|
1892
|
+
await copyBlogFeature(config2);
|
|
1881
1893
|
}
|
|
1882
1894
|
}
|
|
1883
1895
|
|
|
@@ -2269,12 +2281,12 @@ async function copyProjectFiles() {
|
|
|
2269
2281
|
}
|
|
2270
2282
|
}
|
|
2271
2283
|
}
|
|
2272
|
-
async function updatePackageJson(
|
|
2284
|
+
async function updatePackageJson(config2) {
|
|
2273
2285
|
const packageJsonPath = path5.resolve(process.cwd(), "package.json");
|
|
2274
2286
|
let packageJson;
|
|
2275
2287
|
if (!await fs7.pathExists(packageJsonPath)) {
|
|
2276
2288
|
packageJson = {
|
|
2277
|
-
name:
|
|
2289
|
+
name: config2.projectSlug,
|
|
2278
2290
|
version: "0.1.0",
|
|
2279
2291
|
private: true,
|
|
2280
2292
|
scripts: {},
|
|
@@ -2293,11 +2305,11 @@ async function updatePackageJson(config) {
|
|
|
2293
2305
|
"build:registries": "nextspark registry:build",
|
|
2294
2306
|
"db:migrate": "nextspark db:migrate",
|
|
2295
2307
|
"db:seed": "nextspark db:seed",
|
|
2296
|
-
"test:theme": `jest --config contents/themes/${
|
|
2297
|
-
"cy:open": `cypress open --config-file contents/themes/${
|
|
2298
|
-
"cy:run": `cypress run --config-file contents/themes/${
|
|
2299
|
-
"allure:generate": `allure generate contents/themes/${
|
|
2300
|
-
"allure:open": `allure open contents/themes/${
|
|
2308
|
+
"test:theme": `jest --config contents/themes/${config2.projectSlug}/tests/jest/jest.config.ts`,
|
|
2309
|
+
"cy:open": `cypress open --config-file contents/themes/${config2.projectSlug}/tests/cypress.config.ts`,
|
|
2310
|
+
"cy:run": `cypress run --config-file contents/themes/${config2.projectSlug}/tests/cypress.config.ts`,
|
|
2311
|
+
"allure:generate": `allure generate contents/themes/${config2.projectSlug}/tests/cypress/allure-results --clean -o contents/themes/${config2.projectSlug}/tests/cypress/allure-report`,
|
|
2312
|
+
"allure:open": `allure open contents/themes/${config2.projectSlug}/tests/cypress/allure-report`
|
|
2301
2313
|
};
|
|
2302
2314
|
for (const [name, command] of Object.entries(scriptsToAdd)) {
|
|
2303
2315
|
if (!packageJson.scripts[name]) {
|
|
@@ -2383,7 +2395,7 @@ async function updatePackageJson(config) {
|
|
|
2383
2395
|
}
|
|
2384
2396
|
await fs7.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
2385
2397
|
}
|
|
2386
|
-
async function updateGitignore(
|
|
2398
|
+
async function updateGitignore(config2) {
|
|
2387
2399
|
const gitignorePath = path5.resolve(process.cwd(), ".gitignore");
|
|
2388
2400
|
const entriesToAdd = `
|
|
2389
2401
|
# NextSpark
|
|
@@ -2411,26 +2423,26 @@ contents/themes/*/tests/jest/coverage
|
|
|
2411
2423
|
await fs7.writeFile(gitignorePath, entriesToAdd.trim());
|
|
2412
2424
|
}
|
|
2413
2425
|
}
|
|
2414
|
-
async function generateProject(
|
|
2426
|
+
async function generateProject(config2) {
|
|
2415
2427
|
await copyProjectFiles();
|
|
2416
|
-
await copyStarterTheme(
|
|
2417
|
-
await copyContentFeatures(
|
|
2418
|
-
await updateThemeConfig(
|
|
2419
|
-
await updateDevConfig(
|
|
2420
|
-
await updateAppConfig(
|
|
2421
|
-
await updateBillingConfig(
|
|
2422
|
-
await updateRolesConfig(
|
|
2423
|
-
await updateMigrations(
|
|
2424
|
-
await updatePermissionsConfig(
|
|
2425
|
-
await updateDashboardConfig(
|
|
2426
|
-
await updateAuthConfig(
|
|
2427
|
-
await updateDashboardUIConfig(
|
|
2428
|
-
await updateDevToolsConfig(
|
|
2429
|
-
await processI18n(
|
|
2430
|
-
await updatePackageJson(
|
|
2431
|
-
await updateGitignore(
|
|
2432
|
-
await generateEnvExample(
|
|
2433
|
-
await updateReadme(
|
|
2428
|
+
await copyStarterTheme(config2);
|
|
2429
|
+
await copyContentFeatures(config2);
|
|
2430
|
+
await updateThemeConfig(config2);
|
|
2431
|
+
await updateDevConfig(config2);
|
|
2432
|
+
await updateAppConfig(config2);
|
|
2433
|
+
await updateBillingConfig(config2);
|
|
2434
|
+
await updateRolesConfig(config2);
|
|
2435
|
+
await updateMigrations(config2);
|
|
2436
|
+
await updatePermissionsConfig(config2);
|
|
2437
|
+
await updateDashboardConfig(config2);
|
|
2438
|
+
await updateAuthConfig(config2);
|
|
2439
|
+
await updateDashboardUIConfig(config2);
|
|
2440
|
+
await updateDevToolsConfig(config2);
|
|
2441
|
+
await processI18n(config2);
|
|
2442
|
+
await updatePackageJson(config2);
|
|
2443
|
+
await updateGitignore(config2);
|
|
2444
|
+
await generateEnvExample(config2);
|
|
2445
|
+
await updateReadme(config2);
|
|
2434
2446
|
await copyEnvExampleToEnv();
|
|
2435
2447
|
}
|
|
2436
2448
|
|
|
@@ -2594,9 +2606,9 @@ var BOX = {
|
|
|
2594
2606
|
bottomRight: "\u2518"
|
|
2595
2607
|
// bottom-right corner
|
|
2596
2608
|
};
|
|
2597
|
-
function getFileTree(
|
|
2609
|
+
function getFileTree(config2) {
|
|
2598
2610
|
const files = [];
|
|
2599
|
-
const themeDir = `contents/themes/${
|
|
2611
|
+
const themeDir = `contents/themes/${config2.projectSlug}`;
|
|
2600
2612
|
files.push(`${themeDir}/config/app.config.ts`);
|
|
2601
2613
|
files.push(`${themeDir}/config/billing.config.ts`);
|
|
2602
2614
|
files.push(`${themeDir}/config/dashboard.config.ts`);
|
|
@@ -2612,7 +2624,7 @@ function getFileTree(config) {
|
|
|
2612
2624
|
files.push(`${themeDir}/blocks/hero/block.tsx`);
|
|
2613
2625
|
files.push(`${themeDir}/blocks/hero/schema.ts`);
|
|
2614
2626
|
files.push(`${themeDir}/blocks/hero/styles.ts`);
|
|
2615
|
-
for (const locale of
|
|
2627
|
+
for (const locale of config2.supportedLocales) {
|
|
2616
2628
|
files.push(`${themeDir}/messages/${locale}/common.json`);
|
|
2617
2629
|
files.push(`${themeDir}/messages/${locale}/auth.json`);
|
|
2618
2630
|
files.push(`${themeDir}/messages/${locale}/dashboard.json`);
|
|
@@ -2663,10 +2675,10 @@ function groupFilesByCategory(files) {
|
|
|
2663
2675
|
function formatFilePath(file, themeDir) {
|
|
2664
2676
|
return file.replace(`${themeDir}/`, "");
|
|
2665
2677
|
}
|
|
2666
|
-
function showConfigPreview(
|
|
2667
|
-
const files = getFileTree(
|
|
2678
|
+
function showConfigPreview(config2) {
|
|
2679
|
+
const files = getFileTree(config2);
|
|
2668
2680
|
const groups = groupFilesByCategory(files);
|
|
2669
|
-
const themeDir = `contents/themes/${
|
|
2681
|
+
const themeDir = `contents/themes/${config2.projectSlug}`;
|
|
2670
2682
|
console.log("");
|
|
2671
2683
|
console.log(chalk10.cyan.bold(" Theme Preview"));
|
|
2672
2684
|
console.log(chalk10.gray(" " + "=".repeat(50)));
|
|
@@ -2728,8 +2740,8 @@ function showConfigPreview(config) {
|
|
|
2728
2740
|
}
|
|
2729
2741
|
console.log("");
|
|
2730
2742
|
console.log(chalk10.gray(" Locales configured:"));
|
|
2731
|
-
for (const locale of
|
|
2732
|
-
const isDefault = locale ===
|
|
2743
|
+
for (const locale of config2.supportedLocales) {
|
|
2744
|
+
const isDefault = locale === config2.defaultLocale;
|
|
2733
2745
|
const suffix = isDefault ? chalk10.cyan(" (default)") : "";
|
|
2734
2746
|
console.log(chalk10.gray(` - `) + chalk10.white(locale) + suffix);
|
|
2735
2747
|
}
|
|
@@ -2771,25 +2783,25 @@ async function runWizard(options = { mode: "interactive" }) {
|
|
|
2771
2783
|
selectedPlugins = getRequiredPlugins(selectedTheme);
|
|
2772
2784
|
}
|
|
2773
2785
|
}
|
|
2774
|
-
let
|
|
2786
|
+
let config2;
|
|
2775
2787
|
if (options.preset) {
|
|
2776
|
-
|
|
2788
|
+
config2 = await runPresetMode(options.preset, options);
|
|
2777
2789
|
} else {
|
|
2778
2790
|
switch (options.mode) {
|
|
2779
2791
|
case "quick":
|
|
2780
|
-
|
|
2792
|
+
config2 = await runQuickPrompts();
|
|
2781
2793
|
break;
|
|
2782
2794
|
case "expert":
|
|
2783
|
-
|
|
2795
|
+
config2 = await runExpertPrompts();
|
|
2784
2796
|
break;
|
|
2785
2797
|
case "interactive":
|
|
2786
2798
|
default:
|
|
2787
|
-
|
|
2799
|
+
config2 = await runAllPrompts();
|
|
2788
2800
|
break;
|
|
2789
2801
|
}
|
|
2790
2802
|
}
|
|
2791
|
-
showConfigSummary(
|
|
2792
|
-
showConfigPreview(
|
|
2803
|
+
showConfigSummary(config2);
|
|
2804
|
+
showConfigPreview(config2);
|
|
2793
2805
|
if (!options.yes) {
|
|
2794
2806
|
console.log("");
|
|
2795
2807
|
const proceed = await confirm5({
|
|
@@ -2815,7 +2827,7 @@ async function runWizard(options = { mode: "interactive" }) {
|
|
|
2815
2827
|
prefixText: " "
|
|
2816
2828
|
}).start();
|
|
2817
2829
|
try {
|
|
2818
|
-
await generateProject(
|
|
2830
|
+
await generateProject(config2);
|
|
2819
2831
|
spinner.succeed("Project generated successfully!");
|
|
2820
2832
|
} catch (error) {
|
|
2821
2833
|
spinner.fail("Failed to generate project");
|
|
@@ -2858,7 +2870,7 @@ async function runWizard(options = { mode: "interactive" }) {
|
|
|
2858
2870
|
registrySpinner.fail("Failed to build registries");
|
|
2859
2871
|
console.log(chalk11.yellow(' Registries will be built automatically when you run "pnpm dev"'));
|
|
2860
2872
|
}
|
|
2861
|
-
showNextSteps(
|
|
2873
|
+
showNextSteps(config2, selectedTheme);
|
|
2862
2874
|
} catch (error) {
|
|
2863
2875
|
if (error instanceof Error) {
|
|
2864
2876
|
if (error.message.includes("User force closed")) {
|
|
@@ -2898,46 +2910,46 @@ async function runPresetMode(presetName, options) {
|
|
|
2898
2910
|
console.log("");
|
|
2899
2911
|
projectInfo = await promptProjectInfo();
|
|
2900
2912
|
}
|
|
2901
|
-
const
|
|
2902
|
-
return
|
|
2913
|
+
const config2 = applyPreset(projectInfo, presetName);
|
|
2914
|
+
return config2;
|
|
2903
2915
|
}
|
|
2904
|
-
function showConfigSummary(
|
|
2916
|
+
function showConfigSummary(config2) {
|
|
2905
2917
|
console.log("");
|
|
2906
2918
|
console.log(chalk11.cyan(" " + "=".repeat(60)));
|
|
2907
2919
|
console.log(chalk11.bold.white(" Configuration Summary"));
|
|
2908
2920
|
console.log(chalk11.cyan(" " + "=".repeat(60)));
|
|
2909
2921
|
console.log("");
|
|
2910
2922
|
console.log(chalk11.white(" Project:"));
|
|
2911
|
-
console.log(chalk11.gray(` Name: ${chalk11.white(
|
|
2912
|
-
console.log(chalk11.gray(` Slug: ${chalk11.white(
|
|
2913
|
-
console.log(chalk11.gray(` Description: ${chalk11.white(
|
|
2923
|
+
console.log(chalk11.gray(` Name: ${chalk11.white(config2.projectName)}`));
|
|
2924
|
+
console.log(chalk11.gray(` Slug: ${chalk11.white(config2.projectSlug)}`));
|
|
2925
|
+
console.log(chalk11.gray(` Description: ${chalk11.white(config2.projectDescription)}`));
|
|
2914
2926
|
console.log("");
|
|
2915
2927
|
console.log(chalk11.white(" Team Mode:"));
|
|
2916
|
-
console.log(chalk11.gray(` Mode: ${chalk11.white(
|
|
2917
|
-
console.log(chalk11.gray(` Roles: ${chalk11.white(
|
|
2928
|
+
console.log(chalk11.gray(` Mode: ${chalk11.white(config2.teamMode)}`));
|
|
2929
|
+
console.log(chalk11.gray(` Roles: ${chalk11.white(config2.teamRoles.join(", "))}`));
|
|
2918
2930
|
console.log("");
|
|
2919
2931
|
console.log(chalk11.white(" Internationalization:"));
|
|
2920
|
-
console.log(chalk11.gray(` Default: ${chalk11.white(
|
|
2921
|
-
console.log(chalk11.gray(` Languages: ${chalk11.white(
|
|
2932
|
+
console.log(chalk11.gray(` Default: ${chalk11.white(config2.defaultLocale)}`));
|
|
2933
|
+
console.log(chalk11.gray(` Languages: ${chalk11.white(config2.supportedLocales.join(", "))}`));
|
|
2922
2934
|
console.log("");
|
|
2923
2935
|
console.log(chalk11.white(" Billing:"));
|
|
2924
|
-
console.log(chalk11.gray(` Model: ${chalk11.white(
|
|
2925
|
-
console.log(chalk11.gray(` Currency: ${chalk11.white(
|
|
2936
|
+
console.log(chalk11.gray(` Model: ${chalk11.white(config2.billingModel)}`));
|
|
2937
|
+
console.log(chalk11.gray(` Currency: ${chalk11.white(config2.currency.toUpperCase())}`));
|
|
2926
2938
|
console.log("");
|
|
2927
2939
|
console.log(chalk11.white(" Features:"));
|
|
2928
|
-
const enabledFeatures = Object.entries(
|
|
2940
|
+
const enabledFeatures = Object.entries(config2.features).filter(([_, enabled]) => enabled).map(([feature]) => feature);
|
|
2929
2941
|
console.log(chalk11.gray(` Enabled: ${chalk11.white(enabledFeatures.join(", ") || "None")}`));
|
|
2930
2942
|
console.log("");
|
|
2931
2943
|
console.log(chalk11.white(" Authentication:"));
|
|
2932
|
-
const enabledAuth = Object.entries(
|
|
2944
|
+
const enabledAuth = Object.entries(config2.auth).filter(([_, enabled]) => enabled).map(([method]) => formatAuthMethod(method));
|
|
2933
2945
|
console.log(chalk11.gray(` Methods: ${chalk11.white(enabledAuth.join(", ") || "None")}`));
|
|
2934
2946
|
console.log("");
|
|
2935
2947
|
console.log(chalk11.white(" Dashboard:"));
|
|
2936
|
-
const enabledDashboard = Object.entries(
|
|
2948
|
+
const enabledDashboard = Object.entries(config2.dashboard).filter(([_, enabled]) => enabled).map(([feature]) => formatDashboardFeature(feature));
|
|
2937
2949
|
console.log(chalk11.gray(` Features: ${chalk11.white(enabledDashboard.join(", ") || "None")}`));
|
|
2938
2950
|
console.log("");
|
|
2939
2951
|
console.log(chalk11.white(" Dev Tools:"));
|
|
2940
|
-
const enabledDevTools = Object.entries(
|
|
2952
|
+
const enabledDevTools = Object.entries(config2.dev).filter(([_, enabled]) => enabled).map(([tool]) => formatDevTool(tool));
|
|
2941
2953
|
console.log(chalk11.gray(` Enabled: ${chalk11.white(enabledDevTools.join(", ") || "None")}`));
|
|
2942
2954
|
}
|
|
2943
2955
|
function formatAuthMethod(method) {
|
|
@@ -2964,7 +2976,7 @@ function formatDevTool(tool) {
|
|
|
2964
2976
|
};
|
|
2965
2977
|
return mapping[tool] || tool;
|
|
2966
2978
|
}
|
|
2967
|
-
function showNextSteps(
|
|
2979
|
+
function showNextSteps(config2, referenceTheme = null) {
|
|
2968
2980
|
console.log("");
|
|
2969
2981
|
console.log(chalk11.cyan(" " + "=".repeat(60)));
|
|
2970
2982
|
console.log(chalk11.bold.green(" \u2728 NextSpark project ready!"));
|
|
@@ -2990,8 +3002,8 @@ function showNextSteps(config, referenceTheme = null) {
|
|
|
2990
3002
|
console.log(chalk11.cyan(" pnpm dev"));
|
|
2991
3003
|
console.log("");
|
|
2992
3004
|
console.log(chalk11.gray(" " + "-".repeat(60)));
|
|
2993
|
-
console.log(chalk11.gray(` Theme: ${chalk11.white(`contents/themes/${
|
|
2994
|
-
console.log(chalk11.gray(` Active theme: ${chalk11.green(`NEXT_PUBLIC_ACTIVE_THEME=${
|
|
3005
|
+
console.log(chalk11.gray(` Theme: ${chalk11.white(`contents/themes/${config2.projectSlug}/`)}`));
|
|
3006
|
+
console.log(chalk11.gray(` Active theme: ${chalk11.green(`NEXT_PUBLIC_ACTIVE_THEME=${config2.projectSlug}`)}`));
|
|
2995
3007
|
if (referenceTheme) {
|
|
2996
3008
|
console.log(chalk11.gray(` Reference: ${chalk11.white(`contents/themes/${referenceTheme}/`)}`));
|
|
2997
3009
|
}
|
|
@@ -3673,9 +3685,10 @@ async function doctorCommand() {
|
|
|
3673
3685
|
}
|
|
3674
3686
|
|
|
3675
3687
|
// src/cli.ts
|
|
3688
|
+
config();
|
|
3676
3689
|
var program = new Command();
|
|
3677
3690
|
program.name("nextspark").description("NextSpark CLI - Professional SaaS Boilerplate").version("0.1.0-beta.4");
|
|
3678
|
-
program.command("dev").description("Start development server with registry watcher").option("-p, --port <port>", "Port to run the dev server on", "3000").option("--no-registry", "Disable registry watcher").action(devCommand);
|
|
3691
|
+
program.command("dev").description("Start development server with registry watcher").option("-p, --port <port>", "Port to run the dev server on", process.env.PORT || "3000").option("--no-registry", "Disable registry watcher").action(devCommand);
|
|
3679
3692
|
program.command("build").description("Build for production").option("--no-registry", "Skip registry generation before build").action(buildCommand);
|
|
3680
3693
|
program.command("generate").description("Generate all registries").option("-w, --watch", "Watch for changes").action(generateCommand);
|
|
3681
3694
|
var registry = program.command("registry").description("Registry management commands");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextsparkjs/cli",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.17",
|
|
4
4
|
"description": "NextSpark CLI - Complete development toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -12,26 +12,23 @@
|
|
|
12
12
|
"dist",
|
|
13
13
|
"bin"
|
|
14
14
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "tsup src/cli.ts --format esm --dts --outDir dist",
|
|
17
|
-
"dev": "tsup src/cli.ts --format esm --watch"
|
|
18
|
-
},
|
|
19
15
|
"dependencies": {
|
|
20
16
|
"@inquirer/prompts": "^7.2.0",
|
|
21
17
|
"@nextsparkjs/core": ">=0.1.0-beta.1",
|
|
22
|
-
"commander": "^12.0.0",
|
|
23
18
|
"chalk": "^5.3.0",
|
|
19
|
+
"commander": "^12.0.0",
|
|
20
|
+
"dotenv": "^17.2.2",
|
|
24
21
|
"fs-extra": "^11.2.0",
|
|
25
22
|
"ora": "^8.0.0",
|
|
26
23
|
"tar": "^7.0.0"
|
|
27
24
|
},
|
|
28
25
|
"devDependencies": {
|
|
29
|
-
"@nextsparkjs/core": "workspace:*",
|
|
30
26
|
"@types/fs-extra": "^11.0.4",
|
|
27
|
+
"@types/node": "^20.0.0",
|
|
31
28
|
"@types/tar": "^6.1.0",
|
|
32
29
|
"tsup": "^8.0.0",
|
|
33
30
|
"typescript": "^5.0.0",
|
|
34
|
-
"@
|
|
31
|
+
"@nextsparkjs/core": "0.1.0-beta.3"
|
|
35
32
|
},
|
|
36
33
|
"keywords": [
|
|
37
34
|
"nextspark",
|
|
@@ -48,5 +45,9 @@
|
|
|
48
45
|
},
|
|
49
46
|
"engines": {
|
|
50
47
|
"node": ">=18.0.0"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsup src/cli.ts --format esm --dts --outDir dist",
|
|
51
|
+
"dev": "tsup src/cli.ts --format esm --watch"
|
|
51
52
|
}
|
|
52
|
-
}
|
|
53
|
+
}
|