@nextsparkjs/cli 0.1.0-beta.5 → 0.1.0-beta.6
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 +100 -17
- package/package.json +8 -8
package/bin/nextspark.js
CHANGED
|
File without changes
|
package/dist/cli.js
CHANGED
|
@@ -1690,6 +1690,14 @@ async function updateReadme(config) {
|
|
|
1690
1690
|
);
|
|
1691
1691
|
await fs2.writeFile(readmePath, content, "utf-8");
|
|
1692
1692
|
}
|
|
1693
|
+
async function copyEnvExampleToEnv() {
|
|
1694
|
+
const projectRoot = process.cwd();
|
|
1695
|
+
const envExamplePath = path2.resolve(projectRoot, ".env.example");
|
|
1696
|
+
const envPath = path2.resolve(projectRoot, ".env");
|
|
1697
|
+
if (await fs2.pathExists(envExamplePath) && !await fs2.pathExists(envPath)) {
|
|
1698
|
+
await fs2.copy(envExamplePath, envPath);
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1693
1701
|
|
|
1694
1702
|
// src/wizard/generators/messages-generator.ts
|
|
1695
1703
|
import fs3 from "fs-extra";
|
|
@@ -2197,6 +2205,65 @@ import fs6 from "fs-extra";
|
|
|
2197
2205
|
// src/wizard/generators/index.ts
|
|
2198
2206
|
var __filename4 = fileURLToPath4(import.meta.url);
|
|
2199
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
|
+
}
|
|
2200
2267
|
function getTemplatesDir3() {
|
|
2201
2268
|
try {
|
|
2202
2269
|
const corePkgPath = __require.resolve("@nextsparkjs/core/package.json");
|
|
@@ -2402,6 +2469,8 @@ async function generateProject(config) {
|
|
|
2402
2469
|
await updateGitignore(config);
|
|
2403
2470
|
await generateEnvExample(config);
|
|
2404
2471
|
await updateReadme(config);
|
|
2472
|
+
await copyEnvExampleToEnv();
|
|
2473
|
+
await generateInitialRegistries();
|
|
2405
2474
|
}
|
|
2406
2475
|
|
|
2407
2476
|
// src/wizard/presets.ts
|
|
@@ -2794,6 +2863,20 @@ async function runWizard(options = { mode: "interactive" }) {
|
|
|
2794
2863
|
if (selectedTheme || selectedPlugins.length > 0) {
|
|
2795
2864
|
await installThemeAndPlugins(selectedTheme, selectedPlugins);
|
|
2796
2865
|
}
|
|
2866
|
+
const installSpinner = ora7({
|
|
2867
|
+
text: "Installing dependencies...",
|
|
2868
|
+
prefixText: " "
|
|
2869
|
+
}).start();
|
|
2870
|
+
try {
|
|
2871
|
+
execSync("pnpm install", {
|
|
2872
|
+
cwd: process.cwd(),
|
|
2873
|
+
stdio: "pipe"
|
|
2874
|
+
});
|
|
2875
|
+
installSpinner.succeed("Dependencies installed!");
|
|
2876
|
+
} catch (error) {
|
|
2877
|
+
installSpinner.fail("Failed to install dependencies");
|
|
2878
|
+
console.log(chalk11.yellow(' Run "pnpm install" manually to install dependencies'));
|
|
2879
|
+
}
|
|
2797
2880
|
showNextSteps(config, selectedTheme);
|
|
2798
2881
|
} catch (error) {
|
|
2799
2882
|
if (error instanceof Error) {
|
|
@@ -2903,35 +2986,35 @@ function formatDevTool(tool) {
|
|
|
2903
2986
|
function showNextSteps(config, referenceTheme = null) {
|
|
2904
2987
|
console.log("");
|
|
2905
2988
|
console.log(chalk11.cyan(" " + "=".repeat(60)));
|
|
2906
|
-
console.log(chalk11.bold.green(" \u2728 NextSpark project
|
|
2989
|
+
console.log(chalk11.bold.green(" \u2728 NextSpark project ready!"));
|
|
2907
2990
|
console.log(chalk11.cyan(" " + "=".repeat(60)));
|
|
2908
2991
|
console.log("");
|
|
2909
2992
|
console.log(chalk11.bold.white(" Next steps:"));
|
|
2910
2993
|
console.log("");
|
|
2911
|
-
console.log(chalk11.white(" 1.
|
|
2912
|
-
console.log(chalk11.
|
|
2994
|
+
console.log(chalk11.white(" 1. Configure your .env file:"));
|
|
2995
|
+
console.log(chalk11.gray(" Edit these values in .env:"));
|
|
2913
2996
|
console.log("");
|
|
2914
|
-
console.log(chalk11.
|
|
2915
|
-
console.log(chalk11.gray("
|
|
2916
|
-
console.log(chalk11.
|
|
2917
|
-
console.log(chalk11.yellow(" - BETTER_AUTH_SECRET"));
|
|
2918
|
-
console.log(chalk11.yellow(` - NEXT_PUBLIC_ACTIVE_THEME=${config.projectSlug}`));
|
|
2997
|
+
console.log(chalk11.yellow(" DATABASE_URL"));
|
|
2998
|
+
console.log(chalk11.gray(" PostgreSQL connection string"));
|
|
2999
|
+
console.log(chalk11.dim(" Example: postgresql://user:pass@localhost:5432/mydb"));
|
|
2919
3000
|
console.log("");
|
|
2920
|
-
console.log(chalk11.
|
|
2921
|
-
console.log(chalk11.
|
|
3001
|
+
console.log(chalk11.yellow(" BETTER_AUTH_SECRET"));
|
|
3002
|
+
console.log(chalk11.gray(" Generate with:"));
|
|
3003
|
+
console.log(chalk11.cyan(" openssl rand -base64 32"));
|
|
2922
3004
|
console.log("");
|
|
2923
|
-
console.log(chalk11.white("
|
|
3005
|
+
console.log(chalk11.white(" 2. Run database migrations:"));
|
|
2924
3006
|
console.log(chalk11.cyan(" pnpm db:migrate"));
|
|
2925
3007
|
console.log("");
|
|
2926
|
-
console.log(chalk11.white("
|
|
3008
|
+
console.log(chalk11.white(" 3. Start the development server:"));
|
|
2927
3009
|
console.log(chalk11.cyan(" pnpm dev"));
|
|
2928
3010
|
console.log("");
|
|
2929
3011
|
console.log(chalk11.gray(" " + "-".repeat(60)));
|
|
2930
|
-
console.log(chalk11.gray(`
|
|
3012
|
+
console.log(chalk11.gray(` Theme: ${chalk11.white(`contents/themes/${config.projectSlug}/`)}`));
|
|
3013
|
+
console.log(chalk11.gray(` Active theme: ${chalk11.green(`NEXT_PUBLIC_ACTIVE_THEME=${config.projectSlug}`)}`));
|
|
2931
3014
|
if (referenceTheme) {
|
|
2932
|
-
console.log(chalk11.gray(` Reference
|
|
3015
|
+
console.log(chalk11.gray(` Reference: ${chalk11.white(`contents/themes/${referenceTheme}/`)}`));
|
|
2933
3016
|
}
|
|
2934
|
-
console.log(chalk11.gray("
|
|
3017
|
+
console.log(chalk11.gray(" Docs: https://nextspark.dev/docs"));
|
|
2935
3018
|
console.log("");
|
|
2936
3019
|
}
|
|
2937
3020
|
function findLocalCoreTarball() {
|
|
@@ -3019,7 +3102,7 @@ function hasExistingProject() {
|
|
|
3019
3102
|
const projectRoot = process.cwd();
|
|
3020
3103
|
return existsSync8(join7(projectRoot, "contents")) || existsSync8(join7(projectRoot, ".nextspark"));
|
|
3021
3104
|
}
|
|
3022
|
-
function
|
|
3105
|
+
function generateInitialRegistries2(registriesDir) {
|
|
3023
3106
|
writeFileSync2(join7(registriesDir, "block-registry.ts"), `// Auto-generated by nextspark init
|
|
3024
3107
|
import type { ComponentType } from 'react'
|
|
3025
3108
|
|
|
@@ -3084,7 +3167,7 @@ async function simpleInit(options) {
|
|
|
3084
3167
|
if (!existsSync8(registriesDir) || options.force) {
|
|
3085
3168
|
mkdirSync2(registriesDir, { recursive: true });
|
|
3086
3169
|
spinner.text = "Creating .nextspark/registries/";
|
|
3087
|
-
|
|
3170
|
+
generateInitialRegistries2(registriesDir);
|
|
3088
3171
|
spinner.text = "Generated initial registries";
|
|
3089
3172
|
}
|
|
3090
3173
|
const tsconfigPath = join7(projectRoot, "tsconfig.json");
|
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.6",
|
|
4
4
|
"description": "NextSpark CLI - Complete development toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -12,6 +12,10 @@
|
|
|
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
|
+
},
|
|
15
19
|
"dependencies": {
|
|
16
20
|
"@inquirer/prompts": "^7.2.0",
|
|
17
21
|
"@nextsparkjs/core": ">=0.1.0-beta.1",
|
|
@@ -22,12 +26,12 @@
|
|
|
22
26
|
"tar": "^7.0.0"
|
|
23
27
|
},
|
|
24
28
|
"devDependencies": {
|
|
29
|
+
"@nextsparkjs/core": "workspace:*",
|
|
25
30
|
"@types/fs-extra": "^11.0.4",
|
|
26
31
|
"@types/tar": "^6.1.0",
|
|
27
32
|
"tsup": "^8.0.0",
|
|
28
33
|
"typescript": "^5.0.0",
|
|
29
|
-
"@types/node": "^20.0.0"
|
|
30
|
-
"@nextsparkjs/core": "0.1.0-beta.3"
|
|
34
|
+
"@types/node": "^20.0.0"
|
|
31
35
|
},
|
|
32
36
|
"keywords": [
|
|
33
37
|
"nextspark",
|
|
@@ -44,9 +48,5 @@
|
|
|
44
48
|
},
|
|
45
49
|
"engines": {
|
|
46
50
|
"node": ">=18.0.0"
|
|
47
|
-
},
|
|
48
|
-
"scripts": {
|
|
49
|
-
"build": "tsup src/cli.ts --format esm --dts --outDir dist",
|
|
50
|
-
"dev": "tsup src/cli.ts --format esm --watch"
|
|
51
51
|
}
|
|
52
|
-
}
|
|
52
|
+
}
|