@nextsparkjs/core 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/components/dashboard/navigation/DynamicNavigation.d.ts.map +1 -1
- package/dist/components/dashboard/navigation/DynamicNavigation.js +1 -7
- package/dist/styles/classes.json +1 -1
- package/package.json +1 -1
- package/scripts/build/registry/config.mjs +7 -4
- package/scripts/build/registry.mjs +8 -1
- package/scripts/registry-build.js +0 -81
- package/scripts/registry-watch.js +0 -157
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/navigation/DynamicNavigation.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAA;AA0BnF,UAAU,sBAAsB;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;IACxB,QAAQ,EAAE,wBAAwB,EAAE,CAAA;CACrC;
|
|
1
|
+
{"version":3,"file":"DynamicNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/navigation/DynamicNavigation.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAA;AA0BnF,UAAU,sBAAsB;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;IACxB,QAAQ,EAAE,wBAAwB,EAAE,CAAA;CACrC;AAyGD,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,QAAgB,EAChB,WAAW,EACX,QAAQ,EACT,EAAE,sBAAsB,2CAqFxB;AAgDD,eAAe,iBAAiB,CAAA"}
|
|
@@ -7,7 +7,7 @@ import { useMemo } from "react";
|
|
|
7
7
|
import { cn } from "../../../lib/utils";
|
|
8
8
|
import { useTranslations } from "next-intl";
|
|
9
9
|
import { createCyId } from "../../../lib/test";
|
|
10
|
-
import { Home
|
|
10
|
+
import { Home } from "lucide-react";
|
|
11
11
|
import * as Icons from "lucide-react";
|
|
12
12
|
import { THEME_REGISTRY } from "@nextsparkjs/registries/theme-registry";
|
|
13
13
|
import { usePermission } from "../../../lib/permissions/hooks";
|
|
@@ -20,12 +20,6 @@ const coreItems = [
|
|
|
20
20
|
href: "/dashboard",
|
|
21
21
|
icon: Home,
|
|
22
22
|
descriptionKey: "dashboard"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: "pages",
|
|
26
|
-
href: "/dashboard/pages",
|
|
27
|
-
icon: FileText,
|
|
28
|
-
descriptionKey: "pages"
|
|
29
23
|
}
|
|
30
24
|
];
|
|
31
25
|
const labelMappings = {
|
package/dist/styles/classes.json
CHANGED
package/package.json
CHANGED
|
@@ -18,10 +18,13 @@ import { existsSync } from 'fs'
|
|
|
18
18
|
import dotenv from 'dotenv'
|
|
19
19
|
import { loadNextSparkConfigSync } from '../config-loader.mjs'
|
|
20
20
|
|
|
21
|
-
// Load .env
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
|
|
21
|
+
// Load .env from the correct project root
|
|
22
|
+
// Priority: NEXTSPARK_PROJECT_ROOT env var > cwd
|
|
23
|
+
// This is critical for npm mode where cwd might be node_modules/@nextsparkjs/core
|
|
24
|
+
const envPath = process.env.NEXTSPARK_PROJECT_ROOT
|
|
25
|
+
? join(process.env.NEXTSPARK_PROJECT_ROOT, '.env')
|
|
26
|
+
: undefined
|
|
27
|
+
dotenv.config({ path: envPath, override: true })
|
|
25
28
|
|
|
26
29
|
const __filename = fileURLToPath(import.meta.url)
|
|
27
30
|
const __dirname = dirname(__filename)
|
|
@@ -20,7 +20,14 @@ import { join, dirname, resolve } from 'path'
|
|
|
20
20
|
import { fileURLToPath } from 'url'
|
|
21
21
|
import { existsSync } from 'fs'
|
|
22
22
|
import dotenv from 'dotenv'
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
// Load .env from the correct project root
|
|
25
|
+
// Priority: NEXTSPARK_PROJECT_ROOT env var > cwd
|
|
26
|
+
// This is critical for npm mode where cwd might be node_modules/@nextsparkjs/core
|
|
27
|
+
const envPath = process.env.NEXTSPARK_PROJECT_ROOT
|
|
28
|
+
? join(process.env.NEXTSPARK_PROJECT_ROOT, '.env')
|
|
29
|
+
: undefined
|
|
30
|
+
dotenv.config({ path: envPath, override: true })
|
|
24
31
|
|
|
25
32
|
const __filename = fileURLToPath(import.meta.url)
|
|
26
33
|
const __dirname = dirname(__filename)
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Registry Build Script
|
|
5
|
-
*
|
|
6
|
-
* Orchestrates the generation of all auto-generated registries.
|
|
7
|
-
* Currently generates:
|
|
8
|
-
* - docs-registry.ts (documentation index)
|
|
9
|
-
*
|
|
10
|
-
* Future: Will integrate other registry generators (theme, plugin, entity, etc.)
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { spawn } from 'child_process';
|
|
14
|
-
import { fileURLToPath } from 'url';
|
|
15
|
-
import { dirname, join } from 'path';
|
|
16
|
-
|
|
17
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
18
|
-
const __dirname = dirname(__filename);
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Run a script and wait for completion
|
|
22
|
-
*/
|
|
23
|
-
function runScript(scriptPath, description) {
|
|
24
|
-
return new Promise((resolve, reject) => {
|
|
25
|
-
console.log(`\n▶️ ${description}...`);
|
|
26
|
-
|
|
27
|
-
const child = spawn('node', [scriptPath], {
|
|
28
|
-
stdio: 'inherit',
|
|
29
|
-
env: {
|
|
30
|
-
...process.env,
|
|
31
|
-
NEXTSPARK_PROJECT_ROOT: process.env.NEXTSPARK_PROJECT_ROOT || process.cwd()
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
child.on('error', (error) => {
|
|
36
|
-
console.error(`❌ Failed to run ${description}: ${error.message}`);
|
|
37
|
-
reject(error);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
child.on('close', (code) => {
|
|
41
|
-
if (code === 0) {
|
|
42
|
-
resolve();
|
|
43
|
-
} else {
|
|
44
|
-
reject(new Error(`${description} exited with code ${code}`));
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Main build function
|
|
52
|
-
*/
|
|
53
|
-
async function buildAllRegistries() {
|
|
54
|
-
const startTime = Date.now();
|
|
55
|
-
|
|
56
|
-
console.log('🏗️ Building NextSpark Registries');
|
|
57
|
-
console.log('================================\n');
|
|
58
|
-
|
|
59
|
-
try {
|
|
60
|
-
// Build docs registry
|
|
61
|
-
await runScript(
|
|
62
|
-
join(__dirname, 'build/docs-registry.mjs'),
|
|
63
|
-
'Building Documentation Registry'
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
// Future: Add other registry generators here
|
|
67
|
-
// await runScript(join(__dirname, 'build/theme-registry.mjs'), 'Building Theme Registry');
|
|
68
|
-
// await runScript(join(__dirname, 'build/plugin-registry.mjs'), 'Building Plugin Registry');
|
|
69
|
-
// await runScript(join(__dirname, 'build/entity-registry.mjs'), 'Building Entity Registry');
|
|
70
|
-
|
|
71
|
-
const duration = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
72
|
-
console.log(`\n✅ All registries built successfully in ${duration}s`);
|
|
73
|
-
process.exit(0);
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.error('\n❌ Registry build failed:', error.message);
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Run the build
|
|
81
|
-
buildAllRegistries();
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Registry Watch Script
|
|
5
|
-
*
|
|
6
|
-
* Watches for changes in documentation directories and rebuilds registries automatically.
|
|
7
|
-
* Useful during development.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { watch } from 'fs';
|
|
11
|
-
import { spawn } from 'child_process';
|
|
12
|
-
import { fileURLToPath } from 'url';
|
|
13
|
-
import { dirname, join } from 'path';
|
|
14
|
-
import { existsSync } from 'fs';
|
|
15
|
-
|
|
16
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
-
const __dirname = dirname(__filename);
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Detect project root
|
|
21
|
-
*/
|
|
22
|
-
function detectProjectRoot() {
|
|
23
|
-
let dir = process.cwd();
|
|
24
|
-
const maxDepth = 10;
|
|
25
|
-
let depth = 0;
|
|
26
|
-
|
|
27
|
-
while (dir !== '/' && depth < maxDepth) {
|
|
28
|
-
const pkgPath = join(dir, 'package.json');
|
|
29
|
-
if (existsSync(pkgPath)) {
|
|
30
|
-
try {
|
|
31
|
-
const pkg = JSON.parse(require('fs').readFileSync(pkgPath, 'utf8'));
|
|
32
|
-
if (pkg.workspaces || existsSync(join(dir, 'pnpm-workspace.yaml'))) {
|
|
33
|
-
return dir;
|
|
34
|
-
}
|
|
35
|
-
} catch (error) {
|
|
36
|
-
// Continue searching
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
dir = dirname(dir);
|
|
40
|
-
depth++;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Fallback
|
|
44
|
-
return join(__dirname, '../../..');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const PROJECT_ROOT = process.env.NEXTSPARK_PROJECT_ROOT || detectProjectRoot();
|
|
48
|
-
const ACTIVE_THEME = process.env.NEXT_PUBLIC_ACTIVE_THEME || 'default';
|
|
49
|
-
|
|
50
|
-
// Paths to watch
|
|
51
|
-
const CORE_DOCS = join(PROJECT_ROOT, 'packages/core/docs');
|
|
52
|
-
const THEME_DOCS = join(PROJECT_ROOT, 'contents/themes', ACTIVE_THEME, 'docs');
|
|
53
|
-
const CONTENTS_DIR = join(PROJECT_ROOT, 'contents');
|
|
54
|
-
|
|
55
|
-
let buildTimeout = null;
|
|
56
|
-
let isBuilding = false;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Run the build script
|
|
60
|
-
*/
|
|
61
|
-
function rebuild() {
|
|
62
|
-
if (isBuilding) {
|
|
63
|
-
console.log('⏳ Build already in progress, skipping...');
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
isBuilding = true;
|
|
68
|
-
console.log('\n🔄 Change detected, rebuilding registries...');
|
|
69
|
-
|
|
70
|
-
const child = spawn('node', [join(__dirname, 'registry-build.js')], {
|
|
71
|
-
stdio: 'inherit',
|
|
72
|
-
env: {
|
|
73
|
-
...process.env,
|
|
74
|
-
NEXTSPARK_PROJECT_ROOT: PROJECT_ROOT
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
child.on('close', (code) => {
|
|
79
|
-
isBuilding = false;
|
|
80
|
-
if (code === 0) {
|
|
81
|
-
console.log('👀 Watching for changes... (Press Ctrl+C to stop)');
|
|
82
|
-
} else {
|
|
83
|
-
console.error('❌ Build failed');
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Debounced rebuild
|
|
90
|
-
*/
|
|
91
|
-
function scheduleRebuild() {
|
|
92
|
-
if (buildTimeout) {
|
|
93
|
-
clearTimeout(buildTimeout);
|
|
94
|
-
}
|
|
95
|
-
buildTimeout = setTimeout(rebuild, 500);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Start watching
|
|
100
|
-
*/
|
|
101
|
-
function startWatcher() {
|
|
102
|
-
console.log('👀 NextSpark Registry Watcher');
|
|
103
|
-
console.log('============================\n');
|
|
104
|
-
console.log(`Project root: ${PROJECT_ROOT}`);
|
|
105
|
-
console.log(`Active theme: ${ACTIVE_THEME}\n`);
|
|
106
|
-
console.log('Watching:');
|
|
107
|
-
console.log(` - ${CORE_DOCS}`);
|
|
108
|
-
console.log(` - ${THEME_DOCS}`);
|
|
109
|
-
console.log(` - ${CONTENTS_DIR}/plugins/*/docs\n`);
|
|
110
|
-
|
|
111
|
-
// Initial build
|
|
112
|
-
rebuild();
|
|
113
|
-
|
|
114
|
-
// Watch core docs
|
|
115
|
-
if (existsSync(CORE_DOCS)) {
|
|
116
|
-
watch(CORE_DOCS, { recursive: true }, (eventType, filename) => {
|
|
117
|
-
if (filename && filename.endsWith('.md')) {
|
|
118
|
-
console.log(`📝 ${eventType}: ${filename}`);
|
|
119
|
-
scheduleRebuild();
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Watch theme docs
|
|
125
|
-
if (existsSync(THEME_DOCS)) {
|
|
126
|
-
watch(THEME_DOCS, { recursive: true }, (eventType, filename) => {
|
|
127
|
-
if (filename && filename.endsWith('.md')) {
|
|
128
|
-
console.log(`📝 ${eventType}: ${filename}`);
|
|
129
|
-
scheduleRebuild();
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Watch plugin docs
|
|
135
|
-
if (existsSync(CONTENTS_DIR)) {
|
|
136
|
-
watch(CONTENTS_DIR, { recursive: true }, (eventType, filename) => {
|
|
137
|
-
if (filename && filename.includes('/plugins/') && filename.includes('/docs/') && filename.endsWith('.md')) {
|
|
138
|
-
console.log(`📝 ${eventType}: ${filename}`);
|
|
139
|
-
scheduleRebuild();
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// Handle termination
|
|
146
|
-
process.on('SIGINT', () => {
|
|
147
|
-
console.log('\n\n👋 Stopping watcher...');
|
|
148
|
-
process.exit(0);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
process.on('SIGTERM', () => {
|
|
152
|
-
console.log('\n\n👋 Stopping watcher...');
|
|
153
|
-
process.exit(0);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// Start
|
|
157
|
-
startWatcher();
|