@olonjs/cli 3.0.91 → 3.0.93
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.
|
@@ -1645,7 +1645,7 @@ cat << 'END_OF_FILE_CONTENT' > "package.json"
|
|
|
1645
1645
|
"@tiptap/extension-link": "^2.11.5",
|
|
1646
1646
|
"@tiptap/react": "^2.11.5",
|
|
1647
1647
|
"@tiptap/starter-kit": "^2.11.5",
|
|
1648
|
-
"@olonjs/core": "^1.0.
|
|
1648
|
+
"@olonjs/core": "^1.0.81",
|
|
1649
1649
|
"class-variance-authority": "^0.7.1",
|
|
1650
1650
|
"clsx": "^2.1.1",
|
|
1651
1651
|
"lucide-react": "^0.474.0",
|
|
@@ -11195,9 +11195,9 @@ cat << 'END_OF_FILE_CONTENT' > "src/data/pages/platform/overview.json"
|
|
|
11195
11195
|
}
|
|
11196
11196
|
],
|
|
11197
11197
|
"badge": "",
|
|
11198
|
-
"title": "
|
|
11199
|
-
"titleItalic": "
|
|
11200
|
-
"description": "
|
|
11198
|
+
"title": "Platform",
|
|
11199
|
+
"titleItalic": "Overview",
|
|
11200
|
+
"description": "The platform overview page."
|
|
11201
11201
|
}
|
|
11202
11202
|
}
|
|
11203
11203
|
]
|
|
@@ -13308,7 +13308,7 @@ END_OF_FILE_CONTENT
|
|
|
13308
13308
|
echo "Creating vite.config.ts..."
|
|
13309
13309
|
cat << 'END_OF_FILE_CONTENT' > "vite.config.ts"
|
|
13310
13310
|
/**
|
|
13311
|
-
* Generated by @
|
|
13311
|
+
* Generated by @jsonpages/cli. Dev server API: /api/save-to-file, /api/upload-asset, /api/list-assets.
|
|
13312
13312
|
*/
|
|
13313
13313
|
import { defineConfig } from 'vite';
|
|
13314
13314
|
import react from '@vitejs/plugin-react';
|
|
@@ -13322,8 +13322,6 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
13322
13322
|
const ASSETS_IMAGES_DIR = path.resolve(__dirname, 'public', 'assets', 'images');
|
|
13323
13323
|
const DATA_CONFIG_DIR = path.resolve(__dirname, 'src', 'data', 'config');
|
|
13324
13324
|
const DATA_PAGES_DIR = path.resolve(__dirname, 'src', 'data', 'pages');
|
|
13325
|
-
const MONOREPO_ROOT_DIR = path.resolve(__dirname, '../..');
|
|
13326
|
-
const CORE_SRC_INDEX = path.resolve(__dirname, '../../packages/core/src/index.ts');
|
|
13327
13325
|
const IMAGE_EXT = new Set(['.jpg', '.jpeg', '.png', '.gif', '.webp', '.svg', '.avif']);
|
|
13328
13326
|
const IMAGE_MIMES = new Set([
|
|
13329
13327
|
'image/jpeg', 'image/png', 'image/webp', 'image/gif', 'image/svg+xml', 'image/avif',
|
|
@@ -13365,37 +13363,6 @@ function isTenantPageJsonRequest(req, pathname) {
|
|
|
13365
13363
|
const viteOrStaticPrefixes = ['/api/', '/assets/', '/src/', '/node_modules/', '/public/', '/@'];
|
|
13366
13364
|
return !viteOrStaticPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
13367
13365
|
}
|
|
13368
|
-
|
|
13369
|
-
function sanitizeNestedSlug(rawSlug) {
|
|
13370
|
-
const normalized = String(rawSlug || '')
|
|
13371
|
-
.replace(/\\/g, '/')
|
|
13372
|
-
.replace(/^\/+|\/+$/g, '');
|
|
13373
|
-
const segments = normalized
|
|
13374
|
-
.split('/')
|
|
13375
|
-
.map((segment) => segment.trim())
|
|
13376
|
-
.filter(Boolean)
|
|
13377
|
-
.map((segment) => segment.replace(/[^a-zA-Z0-9-_]/g, '_'))
|
|
13378
|
-
.filter((segment) => segment && segment !== '.' && segment !== '..');
|
|
13379
|
-
return segments.join('/');
|
|
13380
|
-
}
|
|
13381
|
-
|
|
13382
|
-
function writeJsonWithoutWatcher(server, targetPath, value) {
|
|
13383
|
-
const normalized = path.resolve(targetPath);
|
|
13384
|
-
try {
|
|
13385
|
-
server.watcher.unwatch(normalized);
|
|
13386
|
-
} catch {
|
|
13387
|
-
// best-effort
|
|
13388
|
-
}
|
|
13389
|
-
fs.mkdirSync(path.dirname(normalized), { recursive: true });
|
|
13390
|
-
fs.writeFileSync(normalized, JSON.stringify(value, null, 2), 'utf8');
|
|
13391
|
-
setTimeout(() => {
|
|
13392
|
-
try {
|
|
13393
|
-
server.watcher.add(normalized);
|
|
13394
|
-
} catch {
|
|
13395
|
-
// best-effort
|
|
13396
|
-
}
|
|
13397
|
-
}, 250);
|
|
13398
|
-
}
|
|
13399
13366
|
export default defineConfig({
|
|
13400
13367
|
plugins: [
|
|
13401
13368
|
react(),
|
|
@@ -13435,29 +13402,12 @@ export default defineConfig({
|
|
|
13435
13402
|
if (!projectState || typeof slug !== 'string') { sendJson(res, 400, { error: 'Missing projectState or slug' }); return; }
|
|
13436
13403
|
if (!fs.existsSync(DATA_CONFIG_DIR)) fs.mkdirSync(DATA_CONFIG_DIR, { recursive: true });
|
|
13437
13404
|
if (!fs.existsSync(DATA_PAGES_DIR)) fs.mkdirSync(DATA_PAGES_DIR, { recursive: true });
|
|
13438
|
-
|
|
13439
|
-
if (projectState.
|
|
13440
|
-
|
|
13441
|
-
writeJsonWithoutWatcher(server, sitePath, projectState.site);
|
|
13442
|
-
touchedFiles.push(sitePath);
|
|
13443
|
-
}
|
|
13444
|
-
if (projectState.theme != null) {
|
|
13445
|
-
const themePath = path.join(DATA_CONFIG_DIR, 'theme.json');
|
|
13446
|
-
writeJsonWithoutWatcher(server, themePath, projectState.theme);
|
|
13447
|
-
touchedFiles.push(themePath);
|
|
13448
|
-
}
|
|
13449
|
-
if (projectState.menu != null) {
|
|
13450
|
-
const menuPath = path.join(DATA_CONFIG_DIR, 'menu.json');
|
|
13451
|
-
writeJsonWithoutWatcher(server, menuPath, projectState.menu);
|
|
13452
|
-
touchedFiles.push(menuPath);
|
|
13453
|
-
}
|
|
13405
|
+
if (projectState.site != null) fs.writeFileSync(path.join(DATA_CONFIG_DIR, 'site.json'), JSON.stringify(projectState.site, null, 2), 'utf8');
|
|
13406
|
+
if (projectState.theme != null) fs.writeFileSync(path.join(DATA_CONFIG_DIR, 'theme.json'), JSON.stringify(projectState.theme, null, 2), 'utf8');
|
|
13407
|
+
if (projectState.menu != null) fs.writeFileSync(path.join(DATA_CONFIG_DIR, 'menu.json'), JSON.stringify(projectState.menu, null, 2), 'utf8');
|
|
13454
13408
|
if (projectState.page != null) {
|
|
13455
|
-
const safeSlug =
|
|
13456
|
-
|
|
13457
|
-
const isInsidePagesDir = pagePath.startsWith(`${DATA_PAGES_DIR}${path.sep}`) || pagePath === DATA_PAGES_DIR;
|
|
13458
|
-
if (!isInsidePagesDir) { sendJson(res, 400, { error: 'Invalid page slug path' }); return; }
|
|
13459
|
-
writeJsonWithoutWatcher(server, pagePath, projectState.page);
|
|
13460
|
-
touchedFiles.push(pagePath);
|
|
13409
|
+
const safeSlug = (slug.replace(/[^a-zA-Z0-9-_]/g, '_') || 'page');
|
|
13410
|
+
fs.writeFileSync(path.join(DATA_PAGES_DIR, `${safeSlug}.json`), JSON.stringify(projectState.page, null, 2), 'utf8');
|
|
13461
13411
|
}
|
|
13462
13412
|
sendJson(res, 200, { ok: true });
|
|
13463
13413
|
} catch (e) { sendJson(res, 500, { error: e?.message || 'Save to file failed' }); }
|
|
@@ -13487,26 +13437,16 @@ export default defineConfig({
|
|
|
13487
13437
|
},
|
|
13488
13438
|
},
|
|
13489
13439
|
],
|
|
13490
|
-
server: {
|
|
13491
|
-
fs: {
|
|
13492
|
-
allow: [MONOREPO_ROOT_DIR],
|
|
13493
|
-
},
|
|
13494
|
-
},
|
|
13495
|
-
optimizeDeps: {
|
|
13496
|
-
exclude: ['@olonjs/core', '@jsonpages/core'],
|
|
13497
|
-
},
|
|
13498
13440
|
resolve: {
|
|
13499
|
-
dedupe: ['react', 'react-dom'],
|
|
13500
13441
|
alias: {
|
|
13501
13442
|
'@': path.resolve(__dirname, './src'),
|
|
13502
|
-
'
|
|
13503
|
-
'@jsonpages/core': CORE_SRC_INDEX,
|
|
13443
|
+
'next/link': path.resolve(__dirname, './src/shims/next-link.tsx'),
|
|
13504
13444
|
},
|
|
13505
13445
|
},
|
|
13506
13446
|
});
|
|
13507
13447
|
|
|
13508
|
-
|
|
13509
|
-
|
|
13510
|
-
|
|
13448
|
+
|
|
13449
|
+
|
|
13450
|
+
|
|
13511
13451
|
|
|
13512
13452
|
END_OF_FILE_CONTENT
|
|
@@ -596,7 +596,7 @@ cat << 'END_OF_FILE_CONTENT' > "package.json"
|
|
|
596
596
|
"@tiptap/extension-link": "^2.11.5",
|
|
597
597
|
"@tiptap/react": "^2.11.5",
|
|
598
598
|
"@tiptap/starter-kit": "^2.11.5",
|
|
599
|
-
"@olonjs/core": "^1.0.
|
|
599
|
+
"@olonjs/core": "^1.0.81",
|
|
600
600
|
"clsx": "^2.1.1",
|
|
601
601
|
"lucide-react": "^0.474.0",
|
|
602
602
|
"react": "^19.0.0",
|
|
@@ -1645,7 +1645,7 @@ cat << 'END_OF_FILE_CONTENT' > "package.json"
|
|
|
1645
1645
|
"@tiptap/extension-link": "^2.11.5",
|
|
1646
1646
|
"@tiptap/react": "^2.11.5",
|
|
1647
1647
|
"@tiptap/starter-kit": "^2.11.5",
|
|
1648
|
-
"@olonjs/core": "^1.0.
|
|
1648
|
+
"@olonjs/core": "^1.0.81",
|
|
1649
1649
|
"class-variance-authority": "^0.7.1",
|
|
1650
1650
|
"clsx": "^2.1.1",
|
|
1651
1651
|
"lucide-react": "^0.474.0",
|
|
@@ -11195,9 +11195,9 @@ cat << 'END_OF_FILE_CONTENT' > "src/data/pages/platform/overview.json"
|
|
|
11195
11195
|
}
|
|
11196
11196
|
],
|
|
11197
11197
|
"badge": "",
|
|
11198
|
-
"title": "
|
|
11199
|
-
"titleItalic": "
|
|
11200
|
-
"description": "
|
|
11198
|
+
"title": "Platform",
|
|
11199
|
+
"titleItalic": "Overview",
|
|
11200
|
+
"description": "The platform overview page."
|
|
11201
11201
|
}
|
|
11202
11202
|
}
|
|
11203
11203
|
]
|
|
@@ -13308,7 +13308,7 @@ END_OF_FILE_CONTENT
|
|
|
13308
13308
|
echo "Creating vite.config.ts..."
|
|
13309
13309
|
cat << 'END_OF_FILE_CONTENT' > "vite.config.ts"
|
|
13310
13310
|
/**
|
|
13311
|
-
* Generated by @
|
|
13311
|
+
* Generated by @jsonpages/cli. Dev server API: /api/save-to-file, /api/upload-asset, /api/list-assets.
|
|
13312
13312
|
*/
|
|
13313
13313
|
import { defineConfig } from 'vite';
|
|
13314
13314
|
import react from '@vitejs/plugin-react';
|
|
@@ -13322,8 +13322,6 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
13322
13322
|
const ASSETS_IMAGES_DIR = path.resolve(__dirname, 'public', 'assets', 'images');
|
|
13323
13323
|
const DATA_CONFIG_DIR = path.resolve(__dirname, 'src', 'data', 'config');
|
|
13324
13324
|
const DATA_PAGES_DIR = path.resolve(__dirname, 'src', 'data', 'pages');
|
|
13325
|
-
const MONOREPO_ROOT_DIR = path.resolve(__dirname, '../..');
|
|
13326
|
-
const CORE_SRC_INDEX = path.resolve(__dirname, '../../packages/core/src/index.ts');
|
|
13327
13325
|
const IMAGE_EXT = new Set(['.jpg', '.jpeg', '.png', '.gif', '.webp', '.svg', '.avif']);
|
|
13328
13326
|
const IMAGE_MIMES = new Set([
|
|
13329
13327
|
'image/jpeg', 'image/png', 'image/webp', 'image/gif', 'image/svg+xml', 'image/avif',
|
|
@@ -13365,37 +13363,6 @@ function isTenantPageJsonRequest(req, pathname) {
|
|
|
13365
13363
|
const viteOrStaticPrefixes = ['/api/', '/assets/', '/src/', '/node_modules/', '/public/', '/@'];
|
|
13366
13364
|
return !viteOrStaticPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
13367
13365
|
}
|
|
13368
|
-
|
|
13369
|
-
function sanitizeNestedSlug(rawSlug) {
|
|
13370
|
-
const normalized = String(rawSlug || '')
|
|
13371
|
-
.replace(/\\/g, '/')
|
|
13372
|
-
.replace(/^\/+|\/+$/g, '');
|
|
13373
|
-
const segments = normalized
|
|
13374
|
-
.split('/')
|
|
13375
|
-
.map((segment) => segment.trim())
|
|
13376
|
-
.filter(Boolean)
|
|
13377
|
-
.map((segment) => segment.replace(/[^a-zA-Z0-9-_]/g, '_'))
|
|
13378
|
-
.filter((segment) => segment && segment !== '.' && segment !== '..');
|
|
13379
|
-
return segments.join('/');
|
|
13380
|
-
}
|
|
13381
|
-
|
|
13382
|
-
function writeJsonWithoutWatcher(server, targetPath, value) {
|
|
13383
|
-
const normalized = path.resolve(targetPath);
|
|
13384
|
-
try {
|
|
13385
|
-
server.watcher.unwatch(normalized);
|
|
13386
|
-
} catch {
|
|
13387
|
-
// best-effort
|
|
13388
|
-
}
|
|
13389
|
-
fs.mkdirSync(path.dirname(normalized), { recursive: true });
|
|
13390
|
-
fs.writeFileSync(normalized, JSON.stringify(value, null, 2), 'utf8');
|
|
13391
|
-
setTimeout(() => {
|
|
13392
|
-
try {
|
|
13393
|
-
server.watcher.add(normalized);
|
|
13394
|
-
} catch {
|
|
13395
|
-
// best-effort
|
|
13396
|
-
}
|
|
13397
|
-
}, 250);
|
|
13398
|
-
}
|
|
13399
13366
|
export default defineConfig({
|
|
13400
13367
|
plugins: [
|
|
13401
13368
|
react(),
|
|
@@ -13435,29 +13402,12 @@ export default defineConfig({
|
|
|
13435
13402
|
if (!projectState || typeof slug !== 'string') { sendJson(res, 400, { error: 'Missing projectState or slug' }); return; }
|
|
13436
13403
|
if (!fs.existsSync(DATA_CONFIG_DIR)) fs.mkdirSync(DATA_CONFIG_DIR, { recursive: true });
|
|
13437
13404
|
if (!fs.existsSync(DATA_PAGES_DIR)) fs.mkdirSync(DATA_PAGES_DIR, { recursive: true });
|
|
13438
|
-
|
|
13439
|
-
if (projectState.
|
|
13440
|
-
|
|
13441
|
-
writeJsonWithoutWatcher(server, sitePath, projectState.site);
|
|
13442
|
-
touchedFiles.push(sitePath);
|
|
13443
|
-
}
|
|
13444
|
-
if (projectState.theme != null) {
|
|
13445
|
-
const themePath = path.join(DATA_CONFIG_DIR, 'theme.json');
|
|
13446
|
-
writeJsonWithoutWatcher(server, themePath, projectState.theme);
|
|
13447
|
-
touchedFiles.push(themePath);
|
|
13448
|
-
}
|
|
13449
|
-
if (projectState.menu != null) {
|
|
13450
|
-
const menuPath = path.join(DATA_CONFIG_DIR, 'menu.json');
|
|
13451
|
-
writeJsonWithoutWatcher(server, menuPath, projectState.menu);
|
|
13452
|
-
touchedFiles.push(menuPath);
|
|
13453
|
-
}
|
|
13405
|
+
if (projectState.site != null) fs.writeFileSync(path.join(DATA_CONFIG_DIR, 'site.json'), JSON.stringify(projectState.site, null, 2), 'utf8');
|
|
13406
|
+
if (projectState.theme != null) fs.writeFileSync(path.join(DATA_CONFIG_DIR, 'theme.json'), JSON.stringify(projectState.theme, null, 2), 'utf8');
|
|
13407
|
+
if (projectState.menu != null) fs.writeFileSync(path.join(DATA_CONFIG_DIR, 'menu.json'), JSON.stringify(projectState.menu, null, 2), 'utf8');
|
|
13454
13408
|
if (projectState.page != null) {
|
|
13455
|
-
const safeSlug =
|
|
13456
|
-
|
|
13457
|
-
const isInsidePagesDir = pagePath.startsWith(`${DATA_PAGES_DIR}${path.sep}`) || pagePath === DATA_PAGES_DIR;
|
|
13458
|
-
if (!isInsidePagesDir) { sendJson(res, 400, { error: 'Invalid page slug path' }); return; }
|
|
13459
|
-
writeJsonWithoutWatcher(server, pagePath, projectState.page);
|
|
13460
|
-
touchedFiles.push(pagePath);
|
|
13409
|
+
const safeSlug = (slug.replace(/[^a-zA-Z0-9-_]/g, '_') || 'page');
|
|
13410
|
+
fs.writeFileSync(path.join(DATA_PAGES_DIR, `${safeSlug}.json`), JSON.stringify(projectState.page, null, 2), 'utf8');
|
|
13461
13411
|
}
|
|
13462
13412
|
sendJson(res, 200, { ok: true });
|
|
13463
13413
|
} catch (e) { sendJson(res, 500, { error: e?.message || 'Save to file failed' }); }
|
|
@@ -13487,26 +13437,16 @@ export default defineConfig({
|
|
|
13487
13437
|
},
|
|
13488
13438
|
},
|
|
13489
13439
|
],
|
|
13490
|
-
server: {
|
|
13491
|
-
fs: {
|
|
13492
|
-
allow: [MONOREPO_ROOT_DIR],
|
|
13493
|
-
},
|
|
13494
|
-
},
|
|
13495
|
-
optimizeDeps: {
|
|
13496
|
-
exclude: ['@olonjs/core', '@jsonpages/core'],
|
|
13497
|
-
},
|
|
13498
13440
|
resolve: {
|
|
13499
|
-
dedupe: ['react', 'react-dom'],
|
|
13500
13441
|
alias: {
|
|
13501
13442
|
'@': path.resolve(__dirname, './src'),
|
|
13502
|
-
'
|
|
13503
|
-
'@jsonpages/core': CORE_SRC_INDEX,
|
|
13443
|
+
'next/link': path.resolve(__dirname, './src/shims/next-link.tsx'),
|
|
13504
13444
|
},
|
|
13505
13445
|
},
|
|
13506
13446
|
});
|
|
13507
13447
|
|
|
13508
|
-
|
|
13509
|
-
|
|
13510
|
-
|
|
13448
|
+
|
|
13449
|
+
|
|
13450
|
+
|
|
13511
13451
|
|
|
13512
13452
|
END_OF_FILE_CONTENT
|