feat(plugin-commands-store): add store path command#3571
Conversation
zkochan
reviewed
Jun 30, 2021
|
|
||
| async function pathCmd (opts: StoreCommandOptions) { | ||
| logger.info({ | ||
| message: await storePath(opts.dir, opts.storeDir), |
Member
There was a problem hiding this comment.
just return the string. The CLI will print it. And it is easy to cover with a test.
Contributor
Author
There was a problem hiding this comment.
Oh nice, yes that does make things easier 👍
zkochan
reviewed
Jun 30, 2021
|
|
||
| async function pathCmd (opts: StoreCommandOptions) { | ||
| return await storePath(opts.dir, opts.storeDir) | ||
| } |
Member
There was a problem hiding this comment.
why do you need this function at all? just run storePath at line 76
zkochan
approved these changes
Jul 1, 2021
zkochan
reviewed
Jul 1, 2021
Contributor
Author
|
I've fixed the test failure locally |
Add a `pnpm store path` command to print the location of the pnpm store as the CLI would resolve it. This allows the user to inspect the current store location, as well as allows external tooling (like shell scripts) to locate the pnpm store without needing to make assumptions about its location or needing to load the `@pnpm/store-path` module. This command differs from running `pnpm get store`, as `pnpm get store` prints "undefined" in the case that no custom store path has been set, which requires external tooling to have knowledge about where pnpm locates its store in the default case.
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.
Add a
pnpm store pathcommand to print the location of the pnpm storeas the CLI would resolve it. This allows the user to inspect the current
store location, as well as allows external tooling (like shell scripts)
to locate the pnpm store without needing to make assumptions about its
location or needing to load the
@pnpm/store-pathmodule.This command differs from running
pnpm get store, aspnpm get storeprints "undefined" in the case that no custom store path has been set,
which requires external tooling to have knowledge about where pnpm
locates its store in the default case.
Please let me know if you would like anything changed or improved. The test I added simply tests that
pnpm store pathdoesn't throw an error, but if you have any pointers on how to test the logger output, I'm happy to add a test that validates the printed output. I didn't see any other examples of testing the logger output from a quick glance, though I'm not very familiar with the codebase here and could have missed something obvious.Fixes #2575