feat: add {PORT}, {HOST}, {PORTLESS_URL} placeholders for command args#167
Open
oosawy wants to merge 1 commit intovercel-labs:mainfrom
Open
feat: add {PORT}, {HOST}, {PORTLESS_URL} placeholders for command args#167oosawy wants to merge 1 commit intovercel-labs:mainfrom
oosawy wants to merge 1 commit intovercel-labs:mainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@oosawy is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
PORTenv var and require CLI flags instead, with no standard flag name across toolsinjectFrameworkFlagswhitelist can't cover all tools, and Vite-based tools with their own CLI keep growing$PORTin command args because the shell expands it before portless assigns a port;sh -c "..."works but is awkward{PORT},{HOST}, and{PORTLESS_URL}placeholders in command args are now replaced with the assigned values before the command runs:--port/--hostinjection is skipped{...}syntax has no special meaning in bash, zsh, fish, PowerShell, or cmd.exe, so it passes through to portless as-isImplementation Details
hasPlaceholders()andreplacePlaceholders()added tocli-utils.ts; exact-match only, uppercase only, unknown tokens ignoredrunApp(), placeholders are replaced after port assignment and beforeinjectFrameworkFlags; if any placeholder was present, framework injection is skipped entirelyPORT/HOST/PORTLESS_URLenv vars are still set regardless of placeholder usageTest plan
pnpm exec vitest run src/cli-utils.test.ts-- 92 tests pass (16 new forhasPlaceholders/replacePlaceholders)portless run my-server --port {PORT}-- confirm port is replaced and server starts on the assigned portportless run vite dev-- confirm auto-injection still works when no placeholders are used--helpoutput includes the new Placeholders section