@korajs/cli 0.3.2 → 0.4.0
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 +385 -288
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +25 -11
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-KTSRAPSE.js → chunk-CMSX76KM.js} +108 -65
- package/dist/chunk-CMSX76KM.js.map +1 -0
- package/dist/{chunk-ZGYRDYXS.js → chunk-MVP5PDT4.js} +22 -4
- package/dist/chunk-MVP5PDT4.js.map +1 -0
- package/dist/{chunk-E7OCVRYL.js → chunk-YGVO4POI.js} +242 -215
- package/dist/chunk-YGVO4POI.js.map +1 -0
- package/dist/create.cjs +122 -66
- package/dist/create.cjs.map +1 -1
- package/dist/create.js +2 -2
- package/dist/index.cjs +348 -278
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -26
- package/dist/index.d.ts +31 -26
- package/dist/index.js +2 -2
- package/package.json +2 -2
- package/templates/tauri-react/.env.example +7 -0
- package/templates/tauri-react/.github/workflows/release-desktop.yml +107 -0
- package/templates/tauri-react/README.md.hbs +148 -0
- package/templates/tauri-react/dev.ts +37 -0
- package/templates/tauri-react/index.html.hbs +16 -0
- package/templates/tauri-react/kora.config.ts +17 -0
- package/templates/tauri-react/package.json.hbs +44 -0
- package/templates/tauri-react/server.ts +23 -0
- package/templates/tauri-react/src/App.tsx +578 -0
- package/templates/tauri-react/src/AppShell.tsx +116 -0
- package/templates/tauri-react/src/SetupScreen.tsx +239 -0
- package/templates/tauri-react/src/main.tsx +9 -0
- package/templates/tauri-react/src/schema.ts +15 -0
- package/templates/tauri-react/src/sync-config.ts +103 -0
- package/templates/tauri-react/src/updater.ts +38 -0
- package/templates/tauri-react/src-tauri/Cargo.toml +19 -0
- package/templates/tauri-react/src-tauri/build.rs +3 -0
- package/templates/tauri-react/src-tauri/capabilities/default.json +12 -0
- package/templates/tauri-react/src-tauri/icons/128x128.png +0 -0
- package/templates/tauri-react/src-tauri/icons/128x128@2x.png +0 -0
- package/templates/tauri-react/src-tauri/icons/32x32.png +0 -0
- package/templates/tauri-react/src-tauri/icons/icon.icns +0 -0
- package/templates/tauri-react/src-tauri/icons/icon.ico +0 -0
- package/templates/tauri-react/src-tauri/src/lib.rs +8 -0
- package/templates/tauri-react/src-tauri/src/main.rs +6 -0
- package/templates/tauri-react/src-tauri/tauri.conf.json +44 -0
- package/templates/tauri-react/tsconfig.json +15 -0
- package/templates/tauri-react/vite.config.ts +15 -0
- package/dist/chunk-E7OCVRYL.js.map +0 -1
- package/dist/chunk-KTSRAPSE.js.map +0 -1
- package/dist/chunk-ZGYRDYXS.js.map +0 -1
package/dist/bin.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createCommand
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MVP5PDT4.js";
|
|
5
5
|
import {
|
|
6
6
|
deployCommand,
|
|
7
7
|
generateTypes
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YGVO4POI.js";
|
|
9
9
|
import {
|
|
10
10
|
DevServerError,
|
|
11
11
|
InvalidProjectError,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
hasTsxInstalled,
|
|
17
17
|
promptConfirm,
|
|
18
18
|
resolveProjectBinaryEntryPoint
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-CMSX76KM.js";
|
|
20
20
|
|
|
21
21
|
// src/bin.ts
|
|
22
22
|
import { defineCommand as defineCommand4, runMain } from "citty";
|
|
@@ -236,7 +236,14 @@ var SchemaWatcher = class {
|
|
|
236
236
|
this.watcher = null;
|
|
237
237
|
}
|
|
238
238
|
async regenerate() {
|
|
239
|
-
const koraBinJs = join2(
|
|
239
|
+
const koraBinJs = join2(
|
|
240
|
+
this.config.projectRoot,
|
|
241
|
+
"node_modules",
|
|
242
|
+
"@korajs",
|
|
243
|
+
"cli",
|
|
244
|
+
"dist",
|
|
245
|
+
"bin.js"
|
|
246
|
+
);
|
|
240
247
|
const hasTsx = await hasTsxInstalled(this.config.projectRoot);
|
|
241
248
|
const command = process.execPath;
|
|
242
249
|
const args = hasTsx ? ["--import", "tsx", koraBinJs, "generate", "types", "--schema", this.config.schemaPath] : [koraBinJs, "generate", "types", "--schema", this.config.schemaPath];
|
|
@@ -372,7 +379,9 @@ var devCommand = defineCommand({
|
|
|
372
379
|
if (await fileExists(candidate)) {
|
|
373
380
|
configuredSchemaPath = candidate;
|
|
374
381
|
} else {
|
|
375
|
-
logger.warn(
|
|
382
|
+
logger.warn(
|
|
383
|
+
`Configured schema file not found: ${candidate}. Falling back to auto-detection.`
|
|
384
|
+
);
|
|
376
385
|
}
|
|
377
386
|
}
|
|
378
387
|
const schemaPath = configuredSchemaPath ?? await findSchemaFile(projectRoot);
|
|
@@ -526,7 +535,8 @@ function isPostgresEnvRequested(config) {
|
|
|
526
535
|
const sync = config?.dev?.sync;
|
|
527
536
|
if (typeof sync !== "object" || sync === null) return false;
|
|
528
537
|
if (sync.store === "postgres") return true;
|
|
529
|
-
if (typeof sync.store === "object" && sync.store !== null && sync.store.type === "postgres")
|
|
538
|
+
if (typeof sync.store === "object" && sync.store !== null && sync.store.type === "postgres")
|
|
539
|
+
return true;
|
|
530
540
|
return false;
|
|
531
541
|
}
|
|
532
542
|
var MANAGED_SYNC_BOOTSTRAP_SCRIPT = `
|
|
@@ -748,7 +758,8 @@ function isBreakingChange(change) {
|
|
|
748
758
|
if (change.type === "field-changed") {
|
|
749
759
|
if (change.before.kind !== change.after.kind) return true;
|
|
750
760
|
if (change.before.itemKind !== change.after.itemKind) return true;
|
|
751
|
-
if (serializeEnum(change.before.enumValues) !== serializeEnum(change.after.enumValues))
|
|
761
|
+
if (serializeEnum(change.before.enumValues) !== serializeEnum(change.after.enumValues))
|
|
762
|
+
return true;
|
|
752
763
|
if (change.before.required !== change.after.required && change.after.required) return true;
|
|
753
764
|
return false;
|
|
754
765
|
}
|
|
@@ -1131,9 +1142,7 @@ async function runSqliteMigration(path, statements, migrationId, fromVersion, to
|
|
|
1131
1142
|
async function loadSqliteDriver(projectRoot) {
|
|
1132
1143
|
try {
|
|
1133
1144
|
const { createRequire } = await import("module");
|
|
1134
|
-
const requireFrom = createRequire(
|
|
1135
|
-
projectRoot ? `${projectRoot}/package.json` : import.meta.url
|
|
1136
|
-
);
|
|
1145
|
+
const requireFrom = createRequire(projectRoot ? `${projectRoot}/package.json` : import.meta.url);
|
|
1137
1146
|
const Database = requireFrom("better-sqlite3");
|
|
1138
1147
|
return {
|
|
1139
1148
|
open(path) {
|
|
@@ -1411,7 +1420,12 @@ var migrateCommand = defineCommand3({
|
|
|
1411
1420
|
return;
|
|
1412
1421
|
}
|
|
1413
1422
|
await mkdir2(outputDir, { recursive: true });
|
|
1414
|
-
const migrationPath = await writeMigrationFile(
|
|
1423
|
+
const migrationPath = await writeMigrationFile(
|
|
1424
|
+
outputDir,
|
|
1425
|
+
diff.fromVersion,
|
|
1426
|
+
diff.toVersion,
|
|
1427
|
+
generated
|
|
1428
|
+
);
|
|
1415
1429
|
await writeSchemaSnapshot(snapshotFile, currentSchema);
|
|
1416
1430
|
logger.blank();
|
|
1417
1431
|
logger.success(`Generated migration: ${migrationPath}`);
|