@jxrstudios/jxr 1.0.5 → 1.0.7
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/jxr.js +67 -3
- package/dist/index.js +9 -1
- package/dist/jxr-server-manager.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/jxr-server-manager.ts +34 -1
package/bin/jxr.js
CHANGED
|
@@ -1,10 +1,73 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { JXRServerManager, JXRDeployer } from "../src/index.ts";
|
|
3
3
|
|
|
4
|
+
import { mkdir, writeFile, cp } from "fs/promises";
|
|
5
|
+
import { existsSync } from "fs";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
4
10
|
const args = process.argv.slice(2);
|
|
5
11
|
const command = args[0] || "dev";
|
|
6
12
|
|
|
7
|
-
if (command === "
|
|
13
|
+
if (command === "init") {
|
|
14
|
+
// Init command - create new project
|
|
15
|
+
const projectName = args[1] || "my-jxr-app";
|
|
16
|
+
const projectDir = path.resolve(process.cwd(), projectName);
|
|
17
|
+
|
|
18
|
+
if (existsSync(projectDir)) {
|
|
19
|
+
console.error(`❌ Directory ${projectName} already exists`);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
console.log(`🚀 Creating new JXR project: ${projectName}`);
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
// Create directories
|
|
27
|
+
await mkdir(projectDir, { recursive: true });
|
|
28
|
+
await mkdir(path.join(projectDir, "src"), { recursive: true });
|
|
29
|
+
|
|
30
|
+
// Create package.json
|
|
31
|
+
const packageJson = {
|
|
32
|
+
name: projectName,
|
|
33
|
+
version: "1.0.0",
|
|
34
|
+
type: "module",
|
|
35
|
+
scripts: {
|
|
36
|
+
dev: "jxr dev",
|
|
37
|
+
deploy: "jxr deploy"
|
|
38
|
+
},
|
|
39
|
+
dependencies: {
|
|
40
|
+
"@jxrstudios/jxr": "^1.0.5"
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
await writeFile(
|
|
44
|
+
path.join(projectDir, "package.json"),
|
|
45
|
+
JSON.stringify(packageJson, null, 2)
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// Copy template from zzz_react_template
|
|
49
|
+
const templateDir = path.join(__dirname, "..", "zzz_react_template");
|
|
50
|
+
const files = ["App.tsx", "index.css", "main.tsx"];
|
|
51
|
+
for (const file of files) {
|
|
52
|
+
await cp(
|
|
53
|
+
path.join(templateDir, file),
|
|
54
|
+
path.join(projectDir, "src", file)
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.log(`✅ Project created: ${projectDir}`);
|
|
59
|
+
console.log("");
|
|
60
|
+
console.log("Next steps:");
|
|
61
|
+
console.log(` cd ${projectName}`);
|
|
62
|
+
console.log(" npm install");
|
|
63
|
+
console.log(" jxr dev");
|
|
64
|
+
|
|
65
|
+
} catch (err) {
|
|
66
|
+
console.error("❌ Failed to create project:", err.message);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
} else if (command === "deploy") {
|
|
8
71
|
// Deploy command
|
|
9
72
|
const projectPath = args[1] || "./dist";
|
|
10
73
|
const env = args.find((a) => a.startsWith("--env="))?.split("=")[1] || "production";
|
|
@@ -54,7 +117,8 @@ if (command === "deploy") {
|
|
|
54
117
|
|
|
55
118
|
} else {
|
|
56
119
|
console.log("Usage:");
|
|
57
|
-
console.log(" jxr
|
|
58
|
-
console.log(" jxr
|
|
120
|
+
console.log(" jxr init <project-name> Create new project");
|
|
121
|
+
console.log(" jxr dev [--port=3000] Start dev server");
|
|
122
|
+
console.log(" jxr deploy <path> Deploy to production");
|
|
59
123
|
process.exit(1);
|
|
60
124
|
}
|
package/dist/index.js
CHANGED
|
@@ -1900,7 +1900,15 @@ export default \`${escapedCSS}\`;
|
|
|
1900
1900
|
"react": "https://esm.sh/react@19.2.4",
|
|
1901
1901
|
"react/jsx-runtime": "https://esm.sh/react@19.2.4/jsx-runtime",
|
|
1902
1902
|
"react/jsx-dev-runtime": "https://esm.sh/react@19.2.4/jsx-dev-runtime",
|
|
1903
|
-
"react-dom/client": "https://esm.sh/react-dom@19.2.4/client"
|
|
1903
|
+
"react-dom/client": "https://esm.sh/react-dom@19.2.4/client",
|
|
1904
|
+
"wouter": "https://esm.sh/wouter@3.6.0?external=react",
|
|
1905
|
+
"lucide-react": "https://esm.sh/lucide-react@0.483.0?external=react",
|
|
1906
|
+
"sonner": "https://esm.sh/sonner@2.0.1?external=react",
|
|
1907
|
+
"@radix-ui/react-dialog": "https://esm.sh/@radix-ui/react-dialog@1.1.6?external=react",
|
|
1908
|
+
"@radix-ui/react-tooltip": "https://esm.sh/@radix-ui/react-tooltip@1.1.8?external=react",
|
|
1909
|
+
"clsx": "https://esm.sh/clsx@2.1.1",
|
|
1910
|
+
"tailwind-merge": "https://esm.sh/tailwind-merge@3.0.2",
|
|
1911
|
+
"class-variance-authority": "https://esm.sh/class-variance-authority@0.7.1"
|
|
1904
1912
|
}
|
|
1905
1913
|
};
|
|
1906
1914
|
const hasMainFile = this.projectFiles.some(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jxr-server-manager.d.ts","sourceRoot":"","sources":["../src/jxr-server-manager.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,MAAM,CAA4B;IAC1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AoB;IAYlC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YASnB,gBAAgB;IAoC9B,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,iBAAiB;IAsBzB,OAAO,CAAC,gBAAgB;IAqBxB,OAAO,CAAC,cAAc;YAUR,qBAAqB;IAqBnC,OAAO,CAAC,eAAe;IAOjB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA2HtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B3B,OAAO,CAAC,YAAY;CAqFrB"}
|
package/package.json
CHANGED
|
@@ -347,12 +347,45 @@ export default \`${escapedCSS}\`;
|
|
|
347
347
|
</script>` : '';
|
|
348
348
|
|
|
349
349
|
// Import map with react/jsx-runtime for Babel's automatic runtime
|
|
350
|
+
// Includes common dependencies used by JXR projects
|
|
350
351
|
const importMap = {
|
|
351
352
|
"imports": {
|
|
352
353
|
"react": "https://esm.sh/react@19.2.4",
|
|
353
354
|
"react/jsx-runtime": "https://esm.sh/react@19.2.4/jsx-runtime",
|
|
354
355
|
"react/jsx-dev-runtime": "https://esm.sh/react@19.2.4/jsx-dev-runtime",
|
|
355
|
-
"react-dom/client": "https://esm.sh/react-dom@19.2.4/client"
|
|
356
|
+
"react-dom/client": "https://esm.sh/react-dom@19.2.4/client",
|
|
357
|
+
"wouter": "https://esm.sh/wouter@3.6.0?external=react",
|
|
358
|
+
"lucide-react": "https://esm.sh/lucide-react@0.483.0?external=react",
|
|
359
|
+
"sonner": "https://esm.sh/sonner@2.0.1?external=react",
|
|
360
|
+
"next-themes": "https://esm.sh/next-themes@0.4.6?external=react",
|
|
361
|
+
"@radix-ui/react-dialog": "https://esm.sh/@radix-ui/react-dialog@1.1.6?external=react",
|
|
362
|
+
"@radix-ui/react-tooltip": "https://esm.sh/@radix-ui/react-tooltip@1.1.8?external=react",
|
|
363
|
+
"@radix-ui/react-slot": "https://esm.sh/@radix-ui/react-slot@1.1.2?external=react",
|
|
364
|
+
"@radix-ui/react-primitive": "https://esm.sh/@radix-ui/react-primitive@2.0.2?external=react",
|
|
365
|
+
"@radix-ui/react-compose-refs": "https://esm.sh/@radix-ui/react-compose-refs@1.1.1?external=react",
|
|
366
|
+
"@radix-ui/react-context": "https://esm.sh/@radix-ui/react-context@1.1.1?external=react",
|
|
367
|
+
"@radix-ui/react-use-controllable-state": "https://esm.sh/@radix-ui/react-use-controllable-state@1.1.0?external=react",
|
|
368
|
+
"@radix-ui/react-use-escape-keydown": "https://esm.sh/@radix-ui/react-use-escape-keydown@1.1.0?external=react",
|
|
369
|
+
"@radix-ui/react-use-layout-effect": "https://esm.sh/@radix-ui/react-use-layout-effect@1.1.0?external=react",
|
|
370
|
+
"@radix-ui/react-dismissable-layer": "https://esm.sh/@radix-ui/react-dismissable-layer@1.1.5?external=react",
|
|
371
|
+
"@radix-ui/react-focus-guards": "https://esm.sh/@radix-ui/react-focus-guards@1.1.1?external=react",
|
|
372
|
+
"@radix-ui/react-focus-scope": "https://esm.sh/@radix-ui/react-focus-scope@1.1.2?external=react",
|
|
373
|
+
"@radix-ui/react-portal": "https://esm.sh/@radix-ui/react-portal@1.1.4?external=react",
|
|
374
|
+
"@radix-ui/react-presence": "https://esm.sh/@radix-ui/react-presence@1.1.2?external=react",
|
|
375
|
+
"@radix-ui/react-id": "https://esm.sh/@radix-ui/react-id@1.1.0?external=react",
|
|
376
|
+
"@radix-ui/primitive": "https://esm.sh/@radix-ui/primitive@1.1.1",
|
|
377
|
+
"aria-hidden": "https://esm.sh/aria-hidden@1.2.4",
|
|
378
|
+
"react-remove-scroll": "https://esm.sh/react-remove-scroll@2.6.3?external=react",
|
|
379
|
+
"tslib": "https://esm.sh/tslib@2.8.1",
|
|
380
|
+
"get-nonce": "https://esm.sh/get-nonce@1.0.1",
|
|
381
|
+
"use-callback-ref": "https://esm.sh/use-callback-ref@1.3.3?external=react",
|
|
382
|
+
"use-sidecar": "https://esm.sh/use-sidecar@1.1.3?external=react",
|
|
383
|
+
"detect-node-es": "https://esm.sh/detect-node-es@1.1.0",
|
|
384
|
+
"copy-to-clipboard": "https://esm.sh/copy-to-clipboard@3.3.3",
|
|
385
|
+
"toggle-selection": "https://esm.sh/toggle-selection@1.0.6",
|
|
386
|
+
"clsx": "https://esm.sh/clsx@2.1.1",
|
|
387
|
+
"tailwind-merge": "https://esm.sh/tailwind-merge@3.0.2",
|
|
388
|
+
"class-variance-authority": "https://esm.sh/class-variance-authority@0.7.1"
|
|
356
389
|
}
|
|
357
390
|
};
|
|
358
391
|
|