@korajs/cli 0.1.4 → 0.1.6
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/dist/bin.cjs +11 -18
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +9 -18
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-BVPZDTYV.js → chunk-TZPACPP6.js} +4 -2
- package/dist/chunk-TZPACPP6.js.map +1 -0
- package/dist/create.cjs +3 -1
- package/dist/create.cjs.map +1 -1
- package/dist/create.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BVPZDTYV.js.map +0 -1
package/dist/bin.cjs
CHANGED
|
@@ -458,7 +458,9 @@ function resolveKoraVersion() {
|
|
|
458
458
|
if ((0, import_node_fs2.existsSync)(pkgPath)) {
|
|
459
459
|
const pkg = JSON.parse((0, import_node_fs2.readFileSync)(pkgPath, "utf-8"));
|
|
460
460
|
if (pkg.name === "@korajs/cli") {
|
|
461
|
-
|
|
461
|
+
if (pkg.version === "0.0.0") return "latest";
|
|
462
|
+
const parts = pkg.version.split(".");
|
|
463
|
+
return `^${parts[0]}.${parts[1]}.0`;
|
|
462
464
|
}
|
|
463
465
|
}
|
|
464
466
|
dir = (0, import_node_path3.dirname)(dir);
|
|
@@ -517,13 +519,7 @@ async function loadTypeScriptConfig(configPath, projectRoot) {
|
|
|
517
519
|
`Found TypeScript config at ${configPath}, but "tsx" is not installed in this project. Install tsx or use kora.config.js.`
|
|
518
520
|
);
|
|
519
521
|
}
|
|
520
|
-
const script = [
|
|
521
|
-
"import { pathToFileURL } from 'node:url'",
|
|
522
|
-
"const configPath = process.argv[process.argv.length - 1]",
|
|
523
|
-
"const mod = await import(pathToFileURL(configPath).href)",
|
|
524
|
-
"const value = mod.default ?? mod",
|
|
525
|
-
"process.stdout.write(JSON.stringify(value))"
|
|
526
|
-
].join(";");
|
|
522
|
+
const script = "const configPath = process.argv[process.argv.length - 1];import('node:url').then(u => import(u.pathToFileURL(configPath).href)).then(mod => { const v = mod.default ?? mod; process.stdout.write(JSON.stringify(v)) }).catch(e => { process.stderr.write(String(e)); process.exit(1) })";
|
|
527
523
|
const output = await runCommand(tsxBinary, ["--eval", script, configPath], projectRoot);
|
|
528
524
|
try {
|
|
529
525
|
return JSON.parse(output);
|
|
@@ -536,7 +532,8 @@ async function runCommand(command, args, cwd) {
|
|
|
536
532
|
const child = (0, import_node_child_process3.spawn)(command, args, {
|
|
537
533
|
cwd,
|
|
538
534
|
stdio: ["ignore", "pipe", "pipe"],
|
|
539
|
-
env: process.env
|
|
535
|
+
env: process.env,
|
|
536
|
+
shell: process.platform === "win32"
|
|
540
537
|
});
|
|
541
538
|
let stdout = "";
|
|
542
539
|
let stderr = "";
|
|
@@ -718,7 +715,8 @@ async function spawnCommand(command, args, cwd) {
|
|
|
718
715
|
const child = (0, import_node_child_process5.spawn)(command, args, {
|
|
719
716
|
cwd,
|
|
720
717
|
stdio: ["ignore", "pipe", "pipe"],
|
|
721
|
-
env: process.env
|
|
718
|
+
env: process.env,
|
|
719
|
+
shell: process.platform === "win32"
|
|
722
720
|
});
|
|
723
721
|
child.stdout?.on("data", (chunk) => {
|
|
724
722
|
writePrefixedLines(chunk, false);
|
|
@@ -1812,13 +1810,7 @@ async function loadTypeScriptModule(schemaPath, projectRoot) {
|
|
|
1812
1810
|
`Schema file is TypeScript (${schemaPath}) but local "tsx" was not found. Install tsx in the project.`
|
|
1813
1811
|
);
|
|
1814
1812
|
}
|
|
1815
|
-
const script = [
|
|
1816
|
-
"import { pathToFileURL } from 'node:url'",
|
|
1817
|
-
"const modulePath = process.argv[process.argv.length - 1]",
|
|
1818
|
-
"const mod = await import(pathToFileURL(modulePath).href)",
|
|
1819
|
-
"const value = mod.default ?? mod",
|
|
1820
|
-
"process.stdout.write(JSON.stringify(value))"
|
|
1821
|
-
].join(";");
|
|
1813
|
+
const script = "const modulePath = process.argv[process.argv.length - 1];import('node:url').then(u => import(u.pathToFileURL(modulePath).href)).then(mod => { const v = mod.default ?? mod; process.stdout.write(JSON.stringify(v)) }).catch(e => { process.stderr.write(String(e)); process.exit(1) })";
|
|
1822
1814
|
const output = await runCommand2(tsxBinary, ["--eval", script, schemaPath], projectRoot);
|
|
1823
1815
|
try {
|
|
1824
1816
|
return JSON.parse(output);
|
|
@@ -1831,7 +1823,8 @@ async function runCommand2(command, args, cwd) {
|
|
|
1831
1823
|
const child = (0, import_node_child_process6.spawn)(command, args, {
|
|
1832
1824
|
cwd,
|
|
1833
1825
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1834
|
-
env: process.env
|
|
1826
|
+
env: process.env,
|
|
1827
|
+
shell: process.platform === "win32"
|
|
1835
1828
|
});
|
|
1836
1829
|
let stdout = "";
|
|
1837
1830
|
let stderr = "";
|