juxscript 1.0.12 → 1.0.13
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/cli.js +4 -1
- package/machinery/compiler.js +41 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { compileJuxFile, copyLibToOutput, copyProjectAssets, transpileProjectTypeScript } from '../machinery/compiler.js';
|
|
3
|
+
import { compileJuxFile, copyLibToOutput, copyProjectAssets, transpileProjectTypeScript, copyPresetsToOutput } from '../machinery/compiler.js';
|
|
4
4
|
import { generateDocs } from '../machinery/doc-generator.js';
|
|
5
5
|
import { start } from '../machinery/server.js';
|
|
6
6
|
import path from 'path';
|
|
@@ -105,6 +105,9 @@ async function buildProject(isServe = false) {
|
|
|
105
105
|
// Step 2: Copy jux lib to frontend dist
|
|
106
106
|
await copyLibToOutput(PATHS.juxLib, PATHS.frontendDist);
|
|
107
107
|
|
|
108
|
+
// Step 2.5: Copy presets folder
|
|
109
|
+
await copyPresetsToOutput(PATHS.juxLib, PATHS.frontendDist);
|
|
110
|
+
|
|
108
111
|
// Step 3: Copy project assets from jux/ (CSS, JS, images)
|
|
109
112
|
await copyProjectAssets(PATHS.juxSource, PATHS.frontendDist);
|
|
110
113
|
|
package/machinery/compiler.js
CHANGED
|
@@ -277,6 +277,47 @@ export async function transpileProjectTypeScript(srcDir, destDir) {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
+
/**
|
|
281
|
+
* Copy presets folder from lib to dist
|
|
282
|
+
*
|
|
283
|
+
* @param {string} libDir - Source lib directory
|
|
284
|
+
* @param {string} distDir - Destination directory
|
|
285
|
+
*/
|
|
286
|
+
export async function copyPresetsToOutput(libDir, distDir) {
|
|
287
|
+
console.log('📦 Copying presets...');
|
|
288
|
+
|
|
289
|
+
const presetsSrc = path.join(libDir, 'presets');
|
|
290
|
+
const presetsDest = path.join(distDir, 'presets');
|
|
291
|
+
|
|
292
|
+
if (!fs.existsSync(presetsSrc)) {
|
|
293
|
+
console.log(' No presets directory found');
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (fs.existsSync(presetsDest)) {
|
|
298
|
+
fs.rmSync(presetsDest, { recursive: true });
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
fs.mkdirSync(presetsDest, { recursive: true });
|
|
302
|
+
|
|
303
|
+
// Copy all files in presets directory
|
|
304
|
+
const files = fs.readdirSync(presetsSrc);
|
|
305
|
+
let copiedCount = 0;
|
|
306
|
+
|
|
307
|
+
for (const file of files) {
|
|
308
|
+
const srcPath = path.join(presetsSrc, file);
|
|
309
|
+
const destPath = path.join(presetsDest, file);
|
|
310
|
+
|
|
311
|
+
if (fs.statSync(srcPath).isFile()) {
|
|
312
|
+
fs.copyFileSync(srcPath, destPath);
|
|
313
|
+
console.log(` ✓ ${file}`);
|
|
314
|
+
copiedCount++;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
console.log(`✅ Copied ${copiedCount} preset file(s)\n`);
|
|
319
|
+
}
|
|
320
|
+
|
|
280
321
|
/**
|
|
281
322
|
* Recursively find files with a specific extension
|
|
282
323
|
*
|