@junejs/cli 0.0.4 → 0.0.5

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/cli.ts +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junejs/cli",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
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.4",
24
- "@junejs/server": "0.0.4"
23
+ "@junejs/core": "0.0.5",
24
+ "@junejs/server": "0.0.5"
25
25
  },
26
26
  "repository": {
27
27
  "type": "git",
package/src/cli.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  // @junejs/server. Exposed as run(argv) so it is testable without spawning a
3
3
  // process; the bin (june.ts) just forwards process.argv. See docs/cli.md.
4
4
 
5
+ import { existsSync } from "node:fs";
5
6
  import { join, resolve } from "node:path";
6
7
 
7
8
  export type Parsed = {
@@ -85,6 +86,19 @@ export async function run(argv: string[]): Promise<number | undefined> {
85
86
 
86
87
  switch (verb) {
87
88
  case "dev": {
89
+ // Validate BEFORE the supervisor: watching a directory that doesn't
90
+ // exist throws a raw ENOENT, and the classic mistake `npm run dev -p
91
+ // 3001` hands us "3001" as the app dir (npm eats the flag).
92
+ if (!existsSync(join(root, "app"))) {
93
+ console.error(`june dev: ${root} doesn't look like a June app (no app/ directory).`);
94
+ if (/^\d+$/.test(positional[0] ?? "")) {
95
+ console.error(
96
+ ` to choose a port, use --port: june dev --port ${positional[0]}` +
97
+ ` · npm run dev -- --port ${positional[0]}`,
98
+ );
99
+ }
100
+ return 1;
101
+ }
88
102
  // A restart is the reload: the watch supervisor respawns the serving
89
103
  // child on file change (see watch.ts). Children carry JUNE_DEV_CHILD.
90
104
  if (!process.env.JUNE_DEV_CHILD && !flags["no-watch"]) {