@jsonpages/cli 3.0.6 → 3.0.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/package.json CHANGED
@@ -1,29 +1,28 @@
1
- {
2
- "name": "@jsonpages/cli",
3
- "version": "3.0.6",
4
- "description": "JsonPages CLI - Sovereign Projection Engine",
5
- "type": "module",
6
- "bin": {
7
- "jsonpages": "./src/index.js"
8
- },
9
- "files": [
10
- "src",
11
- "assets"
12
- ],
13
- "scripts": {
14
- "build": "tsc -p .",
15
- "build:manifest": "node scripts/build-projection-manifest.mjs"
16
- },
17
- "dependencies": {
18
- "chalk": "^5.3.0",
19
- "commander": "^12.1.0",
20
- "execa": "^9.0.2",
21
- "fs-extra": "^11.2.0",
22
- "ora": "^8.0.1"
23
- },
24
- "devDependencies": {
25
- "@types/fs-extra": "^11.0.4",
26
- "@types/node": "^22.13.1",
27
- "typescript": "^5.7.3"
28
- }
29
- }
1
+ {
2
+ "name": "@jsonpages/cli",
3
+ "version": "3.0.8",
4
+ "description": "JsonPages CLI - Sovereign Projection Engine",
5
+ "type": "module",
6
+ "bin": {
7
+ "jsonpages": "./src/index.js"
8
+ },
9
+ "files": [
10
+ "src",
11
+ "assets"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsc -p ."
15
+ },
16
+ "dependencies": {
17
+ "chalk": "^5.3.0",
18
+ "commander": "^12.1.0",
19
+ "execa": "^9.0.2",
20
+ "fs-extra": "^11.2.0",
21
+ "ora": "^8.0.1"
22
+ },
23
+ "devDependencies": {
24
+ "@types/fs-extra": "^11.0.4",
25
+ "@types/node": "^22.13.1",
26
+ "typescript": "^5.7.3"
27
+ }
28
+ }
package/src/index.js CHANGED
@@ -138,11 +138,11 @@ program
138
138
  spinner.start('Installing dependencies (this may take a minute)...');
139
139
 
140
140
  const deps = [
141
- 'react', 'react-dom', 'zod', 'react-router-dom@^6.29.0',
142
- 'lucide-react', 'radix-ui',
143
- 'tailwind-merge', 'clsx',
141
+ 'react', 'react-dom', 'zod', 'react-router-dom',
142
+ 'lucide-react', 'radix-ui',
143
+ 'tailwind-merge', 'clsx',
144
144
  'file-saver', 'jszip',
145
- '@jsonpages/core@^1.0.0',
145
+ '@jsonpages/core' // Scarica dal registry pubblico
146
146
  ];
147
147
 
148
148
  const devDeps = [
@@ -153,10 +153,9 @@ program
153
153
 
154
154
  await execa(npmCmd, ['install', ...deps], { cwd: targetDir });
155
155
  await execa(npmCmd, ['install', '-D', ...devDeps], { cwd: targetDir });
156
-
156
+
157
157
  spinner.succeed(chalk.green.bold('✨ Tenant Ready!'));
158
158
 
159
- console.log(chalk.gray(' (Ensure @jsonpages/core is published: npm view @jsonpages/core)'));
160
159
  console.log(`\n${chalk.white.bgBlue(' NEXT STEPS ')}`);
161
160
  console.log(` ${chalk.cyan(`cd ${name}`)}`);
162
161
  console.log(` ${chalk.cyan(`npm run dev`)} <- Start development`);
package/src/projection.js DELETED
@@ -1,76 +0,0 @@
1
- /**
2
- * Cross-platform source projection: parses the deterministic shell script
3
- * (heredoc format) and writes all files via Node.js fs. No shell execution.
4
- * Single source of truth: assets/src_tenant_alpha.sh
5
- */
6
- import fs from 'fs-extra';
7
- import path from 'path';
8
- import { fileURLToPath } from 'url';
9
-
10
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
-
12
- const HEREDOC_MARKER = 'END_OF_FILE_CONTENT';
13
- const HEREDOC_PATTERN = /cat << 'END_OF_FILE_CONTENT' > "([^"]+)"\n/g;
14
-
15
- /**
16
- * Parse shell script content (heredoc format) into a map of relativePath -> content.
17
- * @param {string} shContent - Raw content of src_tenant_alpha.sh
18
- * @returns {Record<string, string>}
19
- */
20
- export function parseShToManifest(shContent) {
21
- const manifest = Object.create(null);
22
- let match;
23
- while ((match = HEREDOC_PATTERN.exec(shContent)) !== null) {
24
- const filePath = match[1];
25
- const contentStart = match.index + match[0].length;
26
- const contentEnd = findHeredocEnd(shContent, contentStart);
27
- const content =
28
- contentEnd === -1
29
- ? shContent.slice(contentStart)
30
- : shContent.slice(contentStart, contentEnd);
31
- manifest[filePath] = content;
32
- }
33
- return manifest;
34
- }
35
-
36
- function findHeredocEnd(text, fromIndex) {
37
- let i = fromIndex;
38
- while (i < text.length) {
39
- const lineEnd = text.indexOf('\n', i);
40
- const line = lineEnd === -1 ? text.slice(i) : text.slice(i, lineEnd);
41
- if (line.trim() === HEREDOC_MARKER) {
42
- return i;
43
- }
44
- i = lineEnd === -1 ? text.length : lineEnd + 1;
45
- }
46
- return -1;
47
- }
48
-
49
- /**
50
- * Project all tenant source files into targetDir using only Node.js.
51
- * Reads the script from scriptPath (default: CLI assets/src_tenant_alpha.sh).
52
- * @param {string} targetDir - Absolute path to the new tenant directory
53
- * @param {string} [scriptPath] - Optional path to .sh script (default: bundled asset)
54
- * @returns {Promise<{ fileCount: number }>}
55
- */
56
- export async function projectSrc(targetDir, scriptPath) {
57
- const resolvedPath =
58
- scriptPath ||
59
- path.resolve(__dirname, '../assets/src_tenant_alpha.sh');
60
-
61
- if (!(await fs.pathExists(resolvedPath))) {
62
- throw new Error(`Projection script not found: ${resolvedPath}`);
63
- }
64
-
65
- const shContent = await fs.readFile(resolvedPath, 'utf8');
66
- const manifest = parseShToManifest(shContent);
67
- const entries = Object.entries(manifest);
68
-
69
- for (const [relativePath, content] of entries) {
70
- const absolutePath = path.join(targetDir, relativePath);
71
- await fs.ensureDir(path.dirname(absolutePath));
72
- await fs.writeFile(absolutePath, content, 'utf8');
73
- }
74
-
75
- return { fileCount: entries.length };
76
- }