@nextsparkjs/cli 0.1.0-beta.6 → 0.1.0-beta.8
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/cli.js +25 -65
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -61,8 +61,8 @@ async function devCommand(options) {
|
|
|
61
61
|
spinner.succeed(`Core found at: ${coreDir} (${mode} mode)`);
|
|
62
62
|
const processes = [];
|
|
63
63
|
if (options.registry) {
|
|
64
|
-
console.log(chalk.blue("\n[Registry] Starting registry
|
|
65
|
-
const registryProcess = spawn("node", ["scripts/registry
|
|
64
|
+
console.log(chalk.blue("\n[Registry] Starting registry builder with watch mode..."));
|
|
65
|
+
const registryProcess = spawn("node", ["scripts/build/registry.mjs", "--watch"], {
|
|
66
66
|
cwd: coreDir,
|
|
67
67
|
stdio: "inherit",
|
|
68
68
|
env: {
|
|
@@ -2205,65 +2205,6 @@ import fs6 from "fs-extra";
|
|
|
2205
2205
|
// src/wizard/generators/index.ts
|
|
2206
2206
|
var __filename4 = fileURLToPath4(import.meta.url);
|
|
2207
2207
|
var __dirname4 = path5.dirname(__filename4);
|
|
2208
|
-
async function generateInitialRegistries() {
|
|
2209
|
-
const projectRoot = process.cwd();
|
|
2210
|
-
const registriesDir = path5.join(projectRoot, ".nextspark", "registries");
|
|
2211
|
-
await fs7.ensureDir(registriesDir);
|
|
2212
|
-
await fs7.writeFile(path5.join(registriesDir, "block-registry.ts"), `// Auto-generated by nextspark init
|
|
2213
|
-
import type { ComponentType } from 'react'
|
|
2214
|
-
|
|
2215
|
-
export const BLOCK_REGISTRY: Record<string, {
|
|
2216
|
-
name: string
|
|
2217
|
-
slug: string
|
|
2218
|
-
componentPath: string
|
|
2219
|
-
fields?: unknown[]
|
|
2220
|
-
examples?: unknown[]
|
|
2221
|
-
}> = {}
|
|
2222
|
-
|
|
2223
|
-
export const BLOCK_COMPONENTS: Record<string, React.LazyExoticComponent<ComponentType<any>>> = {}
|
|
2224
|
-
`);
|
|
2225
|
-
await fs7.writeFile(path5.join(registriesDir, "theme-registry.ts"), `// Auto-generated by nextspark init
|
|
2226
|
-
export const THEME_REGISTRY: Record<string, unknown> = {}
|
|
2227
|
-
`);
|
|
2228
|
-
await fs7.writeFile(path5.join(registriesDir, "entity-registry.ts"), `// Auto-generated by nextspark init
|
|
2229
|
-
export const ENTITY_REGISTRY: Record<string, unknown> = {}
|
|
2230
|
-
`);
|
|
2231
|
-
await fs7.writeFile(path5.join(registriesDir, "entity-registry.client.ts"), `// Auto-generated by nextspark init
|
|
2232
|
-
export const CLIENT_ENTITY_REGISTRY: Record<string, unknown> = {}
|
|
2233
|
-
export function parseChildEntity(path: string) { return null }
|
|
2234
|
-
export function getEntityApiPath(entity: string) { return \`/api/\${entity}\` }
|
|
2235
|
-
export function clientMetaSystemAdapter() { return {} }
|
|
2236
|
-
export type ClientEntityConfig = Record<string, unknown>
|
|
2237
|
-
`);
|
|
2238
|
-
await fs7.writeFile(path5.join(registriesDir, "billing-registry.ts"), `// Auto-generated by nextspark init
|
|
2239
|
-
export const BILLING_REGISTRY = { plans: [], features: [] }
|
|
2240
|
-
`);
|
|
2241
|
-
await fs7.writeFile(path5.join(registriesDir, "plugin-registry.ts"), `// Auto-generated by nextspark init
|
|
2242
|
-
export const PLUGIN_REGISTRY: Record<string, unknown> = {}
|
|
2243
|
-
`);
|
|
2244
|
-
await fs7.writeFile(path5.join(registriesDir, "testing-registry.ts"), `// Auto-generated by nextspark init
|
|
2245
|
-
export const FLOW_REGISTRY: Record<string, unknown> = {}
|
|
2246
|
-
export const FEATURE_REGISTRY: Record<string, unknown> = {}
|
|
2247
|
-
export const TAGS_REGISTRY: Record<string, unknown> = {}
|
|
2248
|
-
export const COVERAGE_SUMMARY = { total: 0, covered: 0 }
|
|
2249
|
-
export type FlowEntry = unknown
|
|
2250
|
-
export type FeatureEntry = unknown
|
|
2251
|
-
`);
|
|
2252
|
-
await fs7.writeFile(path5.join(registriesDir, "docs-registry.ts"), `// Auto-generated by nextspark init
|
|
2253
|
-
export const DOCS_REGISTRY = { sections: [], pages: [] }
|
|
2254
|
-
export type DocSectionMeta = { title: string; slug: string }
|
|
2255
|
-
`);
|
|
2256
|
-
await fs7.writeFile(path5.join(registriesDir, "index.ts"), `// Auto-generated by nextspark init
|
|
2257
|
-
export * from './block-registry'
|
|
2258
|
-
export * from './theme-registry'
|
|
2259
|
-
export * from './entity-registry'
|
|
2260
|
-
export * from './entity-registry.client'
|
|
2261
|
-
export * from './billing-registry'
|
|
2262
|
-
export * from './plugin-registry'
|
|
2263
|
-
export * from './testing-registry'
|
|
2264
|
-
export * from './docs-registry'
|
|
2265
|
-
`);
|
|
2266
|
-
}
|
|
2267
2208
|
function getTemplatesDir3() {
|
|
2268
2209
|
try {
|
|
2269
2210
|
const corePkgPath = __require.resolve("@nextsparkjs/core/package.json");
|
|
@@ -2470,7 +2411,6 @@ async function generateProject(config) {
|
|
|
2470
2411
|
await generateEnvExample(config);
|
|
2471
2412
|
await updateReadme(config);
|
|
2472
2413
|
await copyEnvExampleToEnv();
|
|
2473
|
-
await generateInitialRegistries();
|
|
2474
2414
|
}
|
|
2475
2415
|
|
|
2476
2416
|
// src/wizard/presets.ts
|
|
@@ -2868,7 +2808,7 @@ async function runWizard(options = { mode: "interactive" }) {
|
|
|
2868
2808
|
prefixText: " "
|
|
2869
2809
|
}).start();
|
|
2870
2810
|
try {
|
|
2871
|
-
execSync("pnpm install", {
|
|
2811
|
+
execSync("pnpm install --force", {
|
|
2872
2812
|
cwd: process.cwd(),
|
|
2873
2813
|
stdio: "pipe"
|
|
2874
2814
|
});
|
|
@@ -2877,6 +2817,26 @@ async function runWizard(options = { mode: "interactive" }) {
|
|
|
2877
2817
|
installSpinner.fail("Failed to install dependencies");
|
|
2878
2818
|
console.log(chalk11.yellow(' Run "pnpm install" manually to install dependencies'));
|
|
2879
2819
|
}
|
|
2820
|
+
const registrySpinner = ora7({
|
|
2821
|
+
text: "Building registries...",
|
|
2822
|
+
prefixText: " "
|
|
2823
|
+
}).start();
|
|
2824
|
+
try {
|
|
2825
|
+
const projectRoot = process.cwd();
|
|
2826
|
+
const registryScript = join6(projectRoot, "node_modules/@nextsparkjs/core/scripts/build/registry.mjs");
|
|
2827
|
+
execSync(`node "${registryScript}" --build`, {
|
|
2828
|
+
cwd: projectRoot,
|
|
2829
|
+
stdio: "pipe",
|
|
2830
|
+
env: {
|
|
2831
|
+
...process.env,
|
|
2832
|
+
NEXTSPARK_PROJECT_ROOT: projectRoot
|
|
2833
|
+
}
|
|
2834
|
+
});
|
|
2835
|
+
registrySpinner.succeed("Registries built!");
|
|
2836
|
+
} catch (error) {
|
|
2837
|
+
registrySpinner.fail("Failed to build registries");
|
|
2838
|
+
console.log(chalk11.yellow(' Registries will be built automatically when you run "pnpm dev"'));
|
|
2839
|
+
}
|
|
2880
2840
|
showNextSteps(config, selectedTheme);
|
|
2881
2841
|
} catch (error) {
|
|
2882
2842
|
if (error instanceof Error) {
|
|
@@ -3102,7 +3062,7 @@ function hasExistingProject() {
|
|
|
3102
3062
|
const projectRoot = process.cwd();
|
|
3103
3063
|
return existsSync8(join7(projectRoot, "contents")) || existsSync8(join7(projectRoot, ".nextspark"));
|
|
3104
3064
|
}
|
|
3105
|
-
function
|
|
3065
|
+
function generateInitialRegistries(registriesDir) {
|
|
3106
3066
|
writeFileSync2(join7(registriesDir, "block-registry.ts"), `// Auto-generated by nextspark init
|
|
3107
3067
|
import type { ComponentType } from 'react'
|
|
3108
3068
|
|
|
@@ -3167,7 +3127,7 @@ async function simpleInit(options) {
|
|
|
3167
3127
|
if (!existsSync8(registriesDir) || options.force) {
|
|
3168
3128
|
mkdirSync2(registriesDir, { recursive: true });
|
|
3169
3129
|
spinner.text = "Creating .nextspark/registries/";
|
|
3170
|
-
|
|
3130
|
+
generateInitialRegistries(registriesDir);
|
|
3171
3131
|
spinner.text = "Generated initial registries";
|
|
3172
3132
|
}
|
|
3173
3133
|
const tsconfigPath = join7(projectRoot, "tsconfig.json");
|