@jsonpages/cli 3.0.13 → 3.0.14

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +9 -33
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonpages/cli",
3
- "version": "3.0.13",
3
+ "version": "3.0.14",
4
4
  "description": "JsonPages CLI - Sovereign Projection Engine",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -16,12 +16,10 @@ const program = new Command();
16
16
  program
17
17
  .name('jsonpages')
18
18
  .description('JsonPages CLI - Sovereign Projection Engine')
19
- .version('2.0.5'); // Bump version
19
+ .version('2.0.6'); // Bump version
20
20
 
21
21
  /**
22
22
  * 🧠 THE UNIVERSAL INTERPRETER
23
- * Legge lo script bash "DNA" e lo esegue usando le API di Node.js.
24
- * Rende la CLI compatibile con Windows (PowerShell/CMD) senza bisogno di Bash.
25
23
  */
26
24
  async function processScriptInNode(scriptPath, targetDir) {
27
25
  const content = await fs.readFile(scriptPath, 'utf-8');
@@ -35,35 +33,26 @@ async function processScriptInNode(scriptPath, targetDir) {
35
33
  for (const line of lines) {
36
34
  const trimmed = line.trim();
37
35
 
38
- // 1. Modalità Cattura (Siamo dentro un cat << 'DELIMITER')
39
36
  if (captureMode) {
40
37
  if (trimmed === delimiter) {
41
- // Fine del blocco: Scriviamo su disco
42
38
  const filePath = path.join(targetDir, currentFile);
43
39
  await fs.outputFile(filePath, fileBuffer.join('\n'));
44
40
  captureMode = false;
45
41
  fileBuffer = [];
46
42
  } else {
47
- fileBuffer.push(line); // Preserva l'indentazione originale
43
+ fileBuffer.push(line);
48
44
  }
49
45
  continue;
50
46
  }
51
47
 
52
- // 2. Parsing Comandi Bash -> Node Operations
53
-
54
- // Rileva: mkdir -p "path"
55
48
  if (trimmed.startsWith('mkdir -p')) {
56
49
  const match = trimmed.match(/"([^"]+)"/) || trimmed.match(/\s+([^\s]+)/);
57
- // Supporta sia mkdir -p "foo/bar" che mkdir -p foo/bar
58
50
  const dirPath = match ? match[1].replace(/"/g, '') : null;
59
51
  if (dirPath) {
60
52
  await fs.ensureDir(path.join(targetDir, dirPath));
61
53
  }
62
54
  }
63
-
64
- // Rileva: cat << 'DELIMITER' > "path"
65
55
  else if (trimmed.startsWith('cat <<')) {
66
- // Regex robusta per catturare il delimitatore e il path del file
67
56
  const match = trimmed.match(/<<\s*'([^']+)'\s*>\s*"([^"]+)"/);
68
57
  if (match) {
69
58
  delimiter = match[1];
@@ -71,7 +60,6 @@ async function processScriptInNode(scriptPath, targetDir) {
71
60
  captureMode = true;
72
61
  }
73
62
  }
74
- // Ignora echo, set -e, commenti #, ecc.
75
63
  }
76
64
  }
77
65
 
@@ -87,15 +75,11 @@ program
87
75
  }
88
76
 
89
77
  const targetDir = path.join(process.cwd(), name);
90
-
91
- // 🔍 Asset Resolution
92
- // Cerca lo script nella cartella assets installata col pacchetto
93
78
  const defaultScriptPath = path.resolve(__dirname, '../assets/src_tenant_alpha.sh');
94
79
  const scriptPath = options.script ? path.resolve(process.cwd(), options.script) : defaultScriptPath;
95
80
 
96
81
  if (!fs.existsSync(scriptPath)) {
97
82
  console.log(chalk.red(`❌ Error: DNA script not found at ${scriptPath}`));
98
- console.log(chalk.yellow(`Debug info: __dirname is ${__dirname}`));
99
83
  return;
100
84
  }
101
85
 
@@ -103,14 +87,11 @@ program
103
87
  const spinner = ora();
104
88
 
105
89
  try {
106
- // 1. SCAFFOLDING INFRA
90
+ // 1. SCAFFOLDING
107
91
  spinner.start('Setting up environment (Vite + TS)...');
108
92
  await fs.ensureDir(targetDir);
109
-
110
- // Windows fix: npm.cmd invece di npm
111
93
  const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
112
94
 
113
- // Usiamo create-vite ma poi sovrascriveremo il package.json
114
95
  await execa(npmCmd, ['create', 'vite@latest', '.', '--', '--template', 'react-ts'], { cwd: targetDir });
115
96
  spinner.succeed('Environment scaffolded.');
116
97
 
@@ -129,16 +110,13 @@ program
129
110
  await injectInfraFiles(targetDir, name);
130
111
  spinner.succeed('Infrastructure configured.');
131
112
 
132
- // 4. DETERMINISTIC PROJECTION (Node-based Interpreter)
113
+ // 4. DETERMINISTIC PROJECTION
133
114
  spinner.start('Executing deterministic src projection...');
134
- // Invece di execa('./script.sh'), usiamo il nostro interprete
135
115
  await processScriptInNode(scriptPath, targetDir);
136
116
  spinner.succeed('Source code and assets projected successfully.');
137
117
 
138
- // 5. INSTALLATION (Ora è solo un npm install pulito)
118
+ // 5. INSTALLATION
139
119
  spinner.start('Installing dependencies (this may take a minute)...');
140
-
141
- // Eseguiamo npm install senza argomenti, perché le dipendenze sono già nel package.json
142
120
  await execa(npmCmd, ['install'], { cwd: targetDir });
143
121
 
144
122
  spinner.succeed(chalk.green.bold('✨ Tenant Ready!'));
@@ -156,8 +134,6 @@ program
156
134
  });
157
135
 
158
136
  async function injectInfraFiles(targetDir, name) {
159
- // 🛡️ DEFINIZIONE ESPLICITA DELLE DIPENDENZE
160
- // Questo assicura che package.json sia la fonte di verità prima dell'installazione.
161
137
  const pkg = {
162
138
  name: name,
163
139
  private: true,
@@ -171,15 +147,15 @@ async function injectInfraFiles(targetDir, name) {
171
147
  dependencies: {
172
148
  "react": "^19.0.0",
173
149
  "react-dom": "^19.0.0",
174
- "react-router-dom": "^6.30.0", // Pinned v6 per compatibilità Core
150
+ "react-router-dom": "^6.30.0",
175
151
  "zod": "^3.24.1",
176
152
  "lucide-react": "^0.474.0",
177
153
  "radix-ui": "^1.0.1",
178
- "@base-ui/react": "^1.0.0-alpha.1",
154
+ "@base-ui/react": "^1.0.0-alpha.1",
179
155
  "class-variance-authority": "^0.7.0",
180
156
  "tailwind-merge": "^2.2.0",
181
157
  "clsx": "^2.1.0",
182
- "tw-animate-css": "^0.0.4",
158
+ "tailwindcss-animate": "^1.0.7", // 👈 FIX: Pacchetto corretto
183
159
  "file-saver": "^2.0.5",
184
160
  "jszip": "^3.10.1",
185
161
  "@jsonpages/core": "latest"
@@ -187,7 +163,7 @@ async function injectInfraFiles(targetDir, name) {
187
163
  devDependencies: {
188
164
  "vite": "^6.0.0",
189
165
  "@vitejs/plugin-react": "^4.2.1",
190
- "typescript": "^5.7.3", // 👈 Qui c'è TSC esplicitamente
166
+ "typescript": "^5.7.3",
191
167
  "@tailwindcss/vite": "^4.0.0",
192
168
  "tailwindcss": "^4.0.0",
193
169
  "@types/node": "^20.0.0",