-
Notifications
You must be signed in to change notification settings - Fork 223
feat(cli): expose vpr as a package bin #1988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| import module from 'node:module'; | ||
| if (module.enableCompileCache) { | ||
| module.enableCompileCache(); | ||
| } | ||
|
|
||
| process.argv.splice(2, 0, 'run'); | ||
| await import('../dist/bin.js'); |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| // Print arguments passed to this script, one per line | ||
| for (const arg of process.argv.slice(2)) { | ||
| console.log(arg); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "name": "command-vpr", | ||
| "version": "1.0.0", | ||
| "scripts": { | ||
| "hello": "node args.mjs hello from script", | ||
| "greet": "node args.mjs greet" | ||
| }, | ||
| "packageManager": "pnpm@10.19.0" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| > vpr -h # should show vp run help | ||
| Run tasks | ||
|
|
||
| Usage: vp run [OPTIONS] [TASK_SPECIFIER] [ADDITIONAL_ARGS]... | ||
|
|
||
| Arguments: | ||
| [TASK_SPECIFIER] [ADDITIONAL_ARGS]... | ||
| Task to run, as `packageName#taskName` or just `taskName`. | ||
| Any arguments after the task name are forwarded to the task process. | ||
| Running `vp run` without a task name shows an interactive task selector. | ||
|
|
||
| Options: | ||
| -r, --recursive | ||
| Select all packages in the workspace | ||
| -t, --transitive | ||
| Select the current package and its transitive dependencies | ||
| -w, --workspace-root | ||
| Select the workspace root package | ||
| -F, --filter <FILTERS> | ||
| Match packages by name, directory, or glob pattern | ||
| --fail-if-no-match | ||
| Exit with a non-zero status if a `--filter` expression matches no packages | ||
| --ignore-depends-on | ||
| Do not run dependencies specified in `dependsOn` fields | ||
| -v, --verbose | ||
| Show full detailed summary after execution | ||
| --cache | ||
| Force caching on for all tasks and scripts | ||
| --no-cache | ||
| Force caching off for all tasks and scripts | ||
| --log <LOG> | ||
| How task output is displayed [default: interleaved] [possible values: interleaved, labeled, grouped] | ||
| --concurrency-limit <CONCURRENCY_LIMIT> | ||
| Maximum number of tasks to run concurrently. Defaults to 4 | ||
| --parallel | ||
| Run tasks without dependency ordering. Sets concurrency to unlimited unless `--concurrency-limit` is also specified | ||
| --last-details | ||
| Display the detailed summary of the last run | ||
| -h, --help | ||
| Print help (see more with '--help') | ||
|
|
||
| > vpr hello # should run script via vpr shorthand | ||
| $ node args.mjs hello from script ⊘ cache disabled | ||
| hello | ||
| from | ||
| script | ||
|
|
||
|
|
||
| > vpr greet --arg1 value1 # should pass through additional args | ||
| $ node args.mjs greet --arg1 value1 ⊘ cache disabled | ||
| greet | ||
| --arg1 | ||
| value1 | ||
|
|
||
|
|
||
| [1]> vpr nonexistent # should show pnpm missing script error | ||
| Task "nonexistent" not found. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "ignoredPlatforms": ["win32"], | ||
| "commands": [ | ||
| "vpr -h # should show vp run help", | ||
| "vpr hello # should run script via vpr shorthand", | ||
| "vpr greet --arg1 value1 # should pass through additional args", | ||
| "vpr nonexistent # should show pnpm missing script error" | ||
| ] | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.