fix(cli): honor PORT, ignore *.log in dev watch, help without side effects - #156
Open
lipowen wants to merge 1 commit into
Open
fix(cli): honor PORT, ignore *.log in dev watch, help without side effects#156lipowen wants to merge 1 commit into
lipowen wants to merge 1 commit into
Conversation
…fects - june dev port precedence is now --port > PORT env > 3000; a shared coercePort also stops --port with no value binding port 1 and rejects junk values. - *.log files no longer trigger the dev watcher (a dev.log written into the tree looped restarts forever). - --help in any position prints usage instead of running the command (june dev --help started the server; june build --help built).
There was a problem hiding this comment.
Pull request overview
Improves june dev startup behavior and prevents unwanted command side effects.
Changes:
- Honors CLI and environment port configuration.
- Ignores log files in the development watcher.
- Handles post-command
--helpwithout executing commands.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.changeset/cli-dev-friction.md |
Documents the CLI fixes. |
packages/cli/src/cli.ts |
Adds port coercion and help interception. |
packages/cli/src/watch.ts |
Excludes log files from watching. |
packages/cli/test/cli.test.ts |
Tests ports and help behavior. |
packages/cli/test/watch.test.ts |
Tests log-file exclusions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export function coercePort(value: unknown, fallback: number): number { | ||
| if (typeof value === "boolean") return fallback; | ||
| const n = Number(value); | ||
| return Number.isInteger(n) && n > 0 && n < 65536 ? n : fallback; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three first-run
june devfriction points, each hit while building a real app on June and each a few lines to fix.Fixes
PORTis honored. Port precedence is now--port>PORTenv >3000.PORT=4100 june devwas silently ignored (it started on 3000 and walked forward). A sharedcoercePortalso fixes a pre-existing footgun where--portwith no value bound port 1 (Number(true) === 1), and rejects junk (PORT=abc,PORT=, out-of-range) with a clean fallback.*.logno longer restarts the dev watcher. A log written into the project tree (e.g.dev.login CI) matched no ignore rule and looped[june] … changed — restartingforever. A.logis app output, never a source edit — ignored everywhere, alongside the existing.cssrule inignoredPath.--helpafter a verb prints help instead of running the command.june dev --helpstarted the dev server (and hung);june build --helpbuilt. The parser attaches--helpto the verb as a flag, so the switch's verb-position help case never caught it. A single guard at the top ofrun()now prints usage for--helpin any position, with no side effect. (june --help/june helpstill route through the existing switch case — no regression.)Notes
coercePortis exported for unit tests, matching the existingparseexport in the same file.PORTis read in the CLI/host layer, notjune.config—JuneConfighas no port field; the dev port is a runtime concern, not app config.-hafter a verb is still unsupported (the minimal parser only recognizes---prefixed flags); out of scope here, unchanged behavior.Tests
coercePortprecedence + boundary matrix (65535 valid, 65536 rejected, boolean/NaN/empty/out-of-range fall back).ignoredPath("dev.log")andapp/logs/server.logignored.run(["dev","--help"])/run(["build","--help"])return 0 without starting/building.Changeset:
@junejs/clipatch.