@junejs/cli 0.0.9 → 0.0.10
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/package.json +3 -3
- package/src/cli.ts +32 -2
- package/src/watch.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junejs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "The `june` CLI — dev / build / deploy / gen / info. A thin bin over @junejs/server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"typecheck": "tsc --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@junejs/core": "0.0.
|
|
24
|
-
"@junejs/server": "0.0.
|
|
23
|
+
"@junejs/core": "0.0.10",
|
|
24
|
+
"@junejs/server": "0.0.10"
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
package/src/cli.ts
CHANGED
|
@@ -41,8 +41,9 @@ Usage: june <command> [dir] [options]
|
|
|
41
41
|
Commands:
|
|
42
42
|
dev Start the dev server --port <n> --no-watch
|
|
43
43
|
build Build a workerd-ready bundle --out <dir>
|
|
44
|
-
deploy Build + deploy (
|
|
44
|
+
deploy Build + deploy (workers/vercel) --dry-run --prod --skip-migrate --allow-destructive
|
|
45
45
|
gen Freeze content/schema --check
|
|
46
|
+
db Database tasks (db migrate) --allow-destructive
|
|
46
47
|
info Show routes + the agent surface
|
|
47
48
|
help Show this help
|
|
48
49
|
|
|
@@ -123,7 +124,12 @@ export async function run(argv: string[]): Promise<number | undefined> {
|
|
|
123
124
|
}
|
|
124
125
|
case "deploy": {
|
|
125
126
|
const { juneDeploy } = await import("@junejs/server");
|
|
126
|
-
const r = await juneDeploy(root, {
|
|
127
|
+
const r = await juneDeploy(root, {
|
|
128
|
+
dryRun: !!flags["dry-run"],
|
|
129
|
+
skipMigrate: !!flags["skip-migrate"],
|
|
130
|
+
allowDestructive: !!flags["allow-destructive"],
|
|
131
|
+
prod: !!flags["prod"], // vercel: production deploy (default is a preview)
|
|
132
|
+
});
|
|
127
133
|
console.log(r.url ? `deployed → ${r.url}` : r.dryRun ? "dry-run ok" : "deployed");
|
|
128
134
|
return 0;
|
|
129
135
|
}
|
|
@@ -133,6 +139,30 @@ export async function run(argv: string[]): Promise<number | undefined> {
|
|
|
133
139
|
console.log(cols.length ? `generated content: ${cols.join(", ")}` : "no content/ collections");
|
|
134
140
|
return 0;
|
|
135
141
|
}
|
|
142
|
+
case "db": {
|
|
143
|
+
// `june db migrate [dir] --allow-destructive`. The subcommand is
|
|
144
|
+
// positional[0], so the app dir (if any) is positional[1] — not `root`.
|
|
145
|
+
const sub = positional[0];
|
|
146
|
+
if (sub !== "migrate") {
|
|
147
|
+
console.error(`june db: unknown subcommand "${sub ?? ""}" (try: june db migrate)`);
|
|
148
|
+
return 1;
|
|
149
|
+
}
|
|
150
|
+
const dbRoot = positional[1] ? resolve(positional[1]) : process.cwd();
|
|
151
|
+
const { loadJuneConfig, migrateApp, blockedMessage } = await import("@junejs/server");
|
|
152
|
+
const config = await loadJuneConfig(dbRoot);
|
|
153
|
+
if (!config.resources?.db) {
|
|
154
|
+
console.error("june db migrate: no `db` resource declared in june.config.ts.");
|
|
155
|
+
return 1;
|
|
156
|
+
}
|
|
157
|
+
const r = await migrateApp(dbRoot, config, { allowDestructive: !!flags["allow-destructive"] });
|
|
158
|
+
if (r?.applied.length) console.log(`migrated: ${r.applied.join(", ")}`);
|
|
159
|
+
else if (r && !r.blocked) console.log("migrations up to date");
|
|
160
|
+
if (r?.blocked) {
|
|
161
|
+
console.error(blockedMessage(r.blocked));
|
|
162
|
+
return 1;
|
|
163
|
+
}
|
|
164
|
+
return 0;
|
|
165
|
+
}
|
|
136
166
|
case "info":
|
|
137
167
|
return info(root);
|
|
138
168
|
case "":
|
package/src/watch.ts
CHANGED
|
@@ -15,6 +15,10 @@ const IGNORED_DIRS = new Set(["node_modules", ".git", "dist", ".june"]);
|
|
|
15
15
|
export function ignoredPath(file: string): boolean {
|
|
16
16
|
const parts = file.split(sep);
|
|
17
17
|
if (parts.some((p) => IGNORED_DIRS.has(p))) return true;
|
|
18
|
+
// Stylesheets are hot-swapped by the dev server (CSS HMR), not a restart — so
|
|
19
|
+
// the supervisor must NOT respawn over a .css edit, or the swap degrades to a
|
|
20
|
+
// full reload. A .tsx edit still restarts (its rendered markup changed too).
|
|
21
|
+
if (file.endsWith(".css")) return true;
|
|
18
22
|
return parts.length === 2 && parts[0] === "app" && /^_content\.[^/]+$/.test(parts[1]!);
|
|
19
23
|
}
|
|
20
24
|
|