juxscript 1.0.53 ā 1.0.55
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 +9 -8
- package/juxconfig.example.js +15 -35
- package/machinery/compiler.js +8 -45
- package/machinery/config.js +4 -22
- package/machinery/server.js +2 -2
- package/package.json +1 -1
- package/presets/default/index.jux +1 -1
package/bin/cli.js
CHANGED
|
@@ -68,7 +68,7 @@ if (command === 'create') {
|
|
|
68
68
|
execSync('npx jux init', { stdio: 'inherit' });
|
|
69
69
|
|
|
70
70
|
console.log(`\nš Creating .gitignore...`);
|
|
71
|
-
fs.writeFileSync('.gitignore', `.jux/\nnode_modules/\n.DS_Store\n.env\n*.log\n`);
|
|
71
|
+
fs.writeFileSync('.gitignore', `.jux-dist/\nnode_modules/\n.DS_Store\n.env\n*.log\n`);
|
|
72
72
|
console.log(` ā .gitignore created`);
|
|
73
73
|
|
|
74
74
|
// ā REMOVE: Don't copy example file during create
|
|
@@ -420,7 +420,7 @@ jux.paragraph('counter')
|
|
|
420
420
|
|
|
421
421
|
// Create .gitignore with config.distDir
|
|
422
422
|
const gitignorePath = path.join(PATHS.projectRoot, '.gitignore');
|
|
423
|
-
const gitignoreContent = `${config.distDir}/\nnode_modules/\n.DS_Store\n`;
|
|
423
|
+
const gitignoreContent = `${config.distDir}/\nnode_modules/\n.DS_Store\n`; // ā
Uses config.distDir
|
|
424
424
|
|
|
425
425
|
if (!fs.existsSync(gitignorePath)) {
|
|
426
426
|
fs.writeFileSync(gitignorePath, gitignoreContent);
|
|
@@ -437,12 +437,12 @@ jux.paragraph('counter')
|
|
|
437
437
|
console.log('+ Created juxconfig.js');
|
|
438
438
|
}
|
|
439
439
|
|
|
440
|
-
//
|
|
441
|
-
const configExampleDest = path.join(PATHS.projectRoot, 'juxconfig.example.js');
|
|
442
|
-
if (!fs.existsSync(configExampleDest)) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
440
|
+
// ā REMOVE: Don't copy example - it's available in node_modules
|
|
441
|
+
// const configExampleDest = path.join(PATHS.projectRoot, 'juxconfig.example.js');
|
|
442
|
+
// if (!fs.existsSync(configExampleDest)) {
|
|
443
|
+
// fs.copyFileSync(configExampleSrc, configExampleDest);
|
|
444
|
+
// console.log('+ Created juxconfig.example.js (reference)');
|
|
445
|
+
// }
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
console.log('\nā
JUX project initialized!\n');
|
|
@@ -454,6 +454,7 @@ jux.paragraph('counter')
|
|
|
454
454
|
console.log('Next steps:');
|
|
455
455
|
console.log(' npm install # Install dependencies');
|
|
456
456
|
console.log(' npm run dev # Start dev server\n');
|
|
457
|
+
console.log('š Config reference: node_modules/juxscript/juxconfig.example.js\n');
|
|
457
458
|
|
|
458
459
|
} else if (command === 'build') {
|
|
459
460
|
// ā
Run bootstrap before build
|
package/juxconfig.example.js
CHANGED
|
@@ -7,63 +7,43 @@
|
|
|
7
7
|
* Copy this file to your project root as 'juxconfig.js' to customize.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
// Route overrides
|
|
10
11
|
export const routeOverrides = {
|
|
11
|
-
|
|
12
|
-
// Example: Override the route for 'about' page
|
|
13
12
|
// 'about': '/about-us',
|
|
14
|
-
|
|
15
13
|
}
|
|
16
|
-
export default {
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
export default {
|
|
16
|
+
// Application settings
|
|
19
17
|
appName: 'My JUX App',
|
|
20
|
-
autoRoutes: true,
|
|
21
|
-
|
|
18
|
+
autoRoutes: true,
|
|
19
|
+
|
|
20
|
+
// Directories
|
|
22
21
|
sourceDir: 'jux',
|
|
22
|
+
distDir: '.jux-dist',
|
|
23
23
|
|
|
24
|
-
//
|
|
25
|
-
distDir: '.jux', // ā
Changed from 'jux-dist',
|
|
26
|
-
|
|
24
|
+
// External services
|
|
27
25
|
services: {
|
|
28
26
|
database: 'http://localhost:4000/api/db',
|
|
29
27
|
auth: 'http://localhost:4000/api/auth',
|
|
30
28
|
monday: 'http://api.rxtrail.monday.com/api/'
|
|
31
29
|
},
|
|
32
30
|
|
|
33
|
-
//
|
|
31
|
+
// Dev server ports
|
|
34
32
|
ports: {
|
|
35
|
-
http: 3000,
|
|
36
|
-
ws: 3001
|
|
33
|
+
http: 3000,
|
|
34
|
+
ws: 3001
|
|
37
35
|
},
|
|
38
36
|
|
|
39
|
-
// Build options
|
|
37
|
+
// Build options
|
|
40
38
|
build: {
|
|
41
|
-
minify: false,
|
|
42
|
-
sourcemap: true
|
|
39
|
+
minify: false,
|
|
40
|
+
sourcemap: true
|
|
43
41
|
},
|
|
44
42
|
|
|
45
|
-
// Bootstrap functions (run
|
|
46
|
-
// Useful for: auth setup, environment loading, feature flags, etc.
|
|
47
|
-
// Similar to Laravel service providers
|
|
43
|
+
// Bootstrap functions (run on startup)
|
|
48
44
|
bootstrap: [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// Example 1: Initialize authentication
|
|
52
45
|
// async function initAuth() {
|
|
53
46
|
// console.log('š Initializing auth...');
|
|
54
|
-
// // Your auth setup here
|
|
55
47
|
// },
|
|
56
|
-
|
|
57
|
-
// Example 2: Load environment config
|
|
58
|
-
// async function loadConfig() {
|
|
59
|
-
// console.log('āļø Loading environment config...');
|
|
60
|
-
// // Your config loading here
|
|
61
|
-
// },
|
|
62
|
-
|
|
63
|
-
// Example 3: Set up analytics
|
|
64
|
-
// async function setupAnalytics() {
|
|
65
|
-
// console.log('š Setting up analytics...');
|
|
66
|
-
// // Your analytics setup here
|
|
67
|
-
// }
|
|
68
48
|
]
|
|
69
49
|
};
|
package/machinery/compiler.js
CHANGED
|
@@ -179,47 +179,8 @@ export async function transpileProjectTypeScript(srcDir, destDir) {
|
|
|
179
179
|
* @param {string} distDir - Destination directory
|
|
180
180
|
*/
|
|
181
181
|
export async function copyPresetsToOutput(packageRoot, distDir) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const presetsSrc = path.join(packageRoot, 'presets');
|
|
185
|
-
const presetsDest = path.join(distDir, 'presets');
|
|
186
|
-
|
|
187
|
-
if (!fs.existsSync(presetsSrc)) {
|
|
188
|
-
console.log(' No presets directory found');
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (fs.existsSync(presetsDest)) {
|
|
193
|
-
fs.rmSync(presetsDest, { recursive: true });
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
fs.mkdirSync(presetsDest, { recursive: true });
|
|
197
|
-
|
|
198
|
-
// Recursively copy entire presets directory structure
|
|
199
|
-
let copiedCount = 0;
|
|
200
|
-
|
|
201
|
-
function copyRecursive(src, dest) {
|
|
202
|
-
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
203
|
-
|
|
204
|
-
for (const entry of entries) {
|
|
205
|
-
const srcPath = path.join(src, entry.name);
|
|
206
|
-
const destPath = path.join(dest, entry.name);
|
|
207
|
-
|
|
208
|
-
if (entry.isDirectory()) {
|
|
209
|
-
fs.mkdirSync(destPath, { recursive: true });
|
|
210
|
-
copyRecursive(srcPath, destPath);
|
|
211
|
-
} else if (entry.isFile()) {
|
|
212
|
-
fs.copyFileSync(srcPath, destPath);
|
|
213
|
-
const relativePath = path.relative(presetsSrc, srcPath);
|
|
214
|
-
console.log(` ā ${relativePath}`);
|
|
215
|
-
copiedCount++;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
copyRecursive(presetsSrc, presetsDest);
|
|
221
|
-
|
|
222
|
-
console.log(`ā
Copied ${copiedCount} preset file(s)\n`);
|
|
182
|
+
// ā
No-op - presets stay in node_modules only
|
|
183
|
+
console.log('ā¹ļø Presets available via import maps (not copied to dist)\n');
|
|
223
184
|
}
|
|
224
185
|
|
|
225
186
|
/**
|
|
@@ -249,9 +210,7 @@ function findFiles(dir, extension, fileList = []) {
|
|
|
249
210
|
|
|
250
211
|
/**
|
|
251
212
|
* Copy non-TypeScript files (CSS, JSON, JS, SVG, etc.)
|
|
252
|
-
*
|
|
253
|
-
* @param {string} src - Source directory
|
|
254
|
-
* @param {string} dest - Destination directory
|
|
213
|
+
* ā
Skip layouts folder
|
|
255
214
|
*/
|
|
256
215
|
function copyNonTsFiles(src, dest) {
|
|
257
216
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
@@ -261,13 +220,17 @@ function copyNonTsFiles(src, dest) {
|
|
|
261
220
|
const destPath = path.join(dest, entry.name);
|
|
262
221
|
|
|
263
222
|
if (entry.isDirectory()) {
|
|
223
|
+
// ā
Skip layouts folder
|
|
224
|
+
if (entry.name === 'layouts') {
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
|
|
264
228
|
if (!fs.existsSync(destPath)) {
|
|
265
229
|
fs.mkdirSync(destPath, { recursive: true });
|
|
266
230
|
}
|
|
267
231
|
copyNonTsFiles(srcPath, destPath);
|
|
268
232
|
} else if (entry.isFile()) {
|
|
269
233
|
const ext = path.extname(entry.name);
|
|
270
|
-
// Copy CSS, JSON, SVG, and JS files (but not .ts files)
|
|
271
234
|
if (['.css', '.json', '.js', '.svg', '.png', '.jpg', '.jpeg', '.gif', '.webp'].includes(ext)) {
|
|
272
235
|
fs.copyFileSync(srcPath, destPath);
|
|
273
236
|
}
|
package/machinery/config.js
CHANGED
|
@@ -5,37 +5,22 @@ import { fileURLToPath } from 'url';
|
|
|
5
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = path.dirname(__filename);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
* Default JUX configuration
|
|
10
|
-
*/
|
|
8
|
+
// Default configuration
|
|
11
9
|
export const defaultConfig = {
|
|
12
|
-
// Source directory for .jux files
|
|
13
10
|
sourceDir: 'jux',
|
|
14
|
-
|
|
15
|
-
// Output directory for built files (hidden like .git)
|
|
16
|
-
distDir: '.jux',
|
|
17
|
-
|
|
18
|
-
// Dev server ports
|
|
11
|
+
distDir: '.jux-dist',
|
|
19
12
|
ports: {
|
|
20
13
|
http: 3000,
|
|
21
14
|
ws: 3001
|
|
22
15
|
},
|
|
23
|
-
|
|
24
|
-
// Build options
|
|
25
16
|
build: {
|
|
26
17
|
minify: false,
|
|
27
18
|
sourcemap: true
|
|
28
19
|
},
|
|
29
|
-
|
|
30
|
-
// Bootstrap functions (run before app starts)
|
|
31
20
|
bootstrap: []
|
|
32
21
|
};
|
|
33
22
|
|
|
34
|
-
|
|
35
|
-
* Load configuration from juxconfig.js or use defaults
|
|
36
|
-
* @param {string} projectRoot - Project root directory
|
|
37
|
-
* @returns {Promise<object>} Configuration object
|
|
38
|
-
*/
|
|
23
|
+
// Load user configuration
|
|
39
24
|
export async function loadConfig(projectRoot) {
|
|
40
25
|
const configPath = path.join(projectRoot, 'juxconfig.js');
|
|
41
26
|
|
|
@@ -61,10 +46,7 @@ export async function loadConfig(projectRoot) {
|
|
|
61
46
|
return defaultConfig;
|
|
62
47
|
}
|
|
63
48
|
|
|
64
|
-
|
|
65
|
-
* Run bootstrap functions from config
|
|
66
|
-
* @param {Function[]} bootstrapFunctions - Array of async functions to run
|
|
67
|
-
*/
|
|
49
|
+
// Run bootstrap functions
|
|
68
50
|
export async function runBootstrap(bootstrapFunctions = []) {
|
|
69
51
|
if (!Array.isArray(bootstrapFunctions) || bootstrapFunctions.length === 0) {
|
|
70
52
|
return;
|
package/machinery/server.js
CHANGED
|
@@ -47,7 +47,7 @@ async function tryPort(startPort, maxAttempts = 5, reservedPorts = []) {
|
|
|
47
47
|
throw new Error(`Could not find available port after ${maxAttempts} attempts starting from ${startPort}`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
async function serve(httpPort = 3000, wsPort = 3001, distDir = './.jux') {
|
|
50
|
+
async function serve(httpPort = 3000, wsPort = 3001, distDir = './.jux-dist') {
|
|
51
51
|
const app = express();
|
|
52
52
|
const absoluteDistDir = path.resolve(distDir);
|
|
53
53
|
const projectRoot = path.resolve('.');
|
|
@@ -147,6 +147,6 @@ async function serve(httpPort = 3000, wsPort = 3001, distDir = './.jux') {
|
|
|
147
147
|
return { server, httpPort: availableHttpPort, wsPort: availableWsPort };
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
export async function start(httpPort = 3000, wsPort = 3001, distDir = './.jux') {
|
|
150
|
+
export async function start(httpPort = 3000, wsPort = 3001, distDir = './.jux-dist') {
|
|
151
151
|
return serve(httpPort, wsPort, distDir);
|
|
152
152
|
}
|
package/package.json
CHANGED
|
@@ -38,7 +38,7 @@ jux.list('quick-tips', {
|
|
|
38
38
|
items: [
|
|
39
39
|
'Run npx jux serve for dev mode with hot reload',
|
|
40
40
|
'Run npx jux build to compile for production',
|
|
41
|
-
'Serve jux-dist/ from your backend',
|
|
41
|
+
'Serve .jux-dist/ from your backend',
|
|
42
42
|
'Check out the docs at juxscript.com/docs'
|
|
43
43
|
]
|
|
44
44
|
}).render('#appmain-content');
|