Skip to content
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

feat(exec): support shell interpreter #4328

Merged
merged 6 commits into from Feb 13, 2022

Conversation

BlackHole1
Copy link
Member

Fixed: #4320

Once this PR has been merged, the following commands will be supported:

pnpm --recursive --shell-mode exec -- echo \"\$PNPM_PACKAGE_NAME\"
{
    "scripts": {
        "check": " pnpm --recursive --shell-mode exec -- echo \"\\$PNPM_PACKAGE_NAME\""
    }
}

@zkochan
Copy link
Member

zkochan commented Feb 12, 2022

Does it need to be configurable or should we just make it on by default?

@BlackHole1
Copy link
Member Author

it need to be configurable. Otherwise the following command will report an error:

pnpm --recursive --shell-mode exec -- node -e "console.log(process.env.PNPM_PACKAGE_NAME)"

image

@zkochan
Copy link
Member

zkochan commented Feb 13, 2022

Run pnpm changeset in the root of the repository and describe your changes. The resulting files should be committed as they will be used during release.

@BlackHole1 BlackHole1 force-pushed the fix-shell-env-variable-not-parse branch from daebed5 to ff53e94 Compare February 13, 2022 11:51
@BlackHole1
Copy link
Member Author

Run pnpm changeset in the root of the repository and describe your changes. The resulting files should be committed as they will be used during release.

Okey. Done.

@zkochan
Copy link
Member

zkochan commented Feb 13, 2022

I wonder if Lerna uses the same solution. They claim that env variables work with exec: https://github.com/lerna/lerna/tree/main/commands/exec

@zkochan
Copy link
Member

zkochan commented Feb 13, 2022

@BlackHole1
Copy link
Member Author

BlackHole1 commented Feb 13, 2022

lerna (shell: always is true):
image

yarn (shell: always is false):
image

@zkochan
Copy link
Member

zkochan commented Feb 13, 2022

OK, it makes sense to follow Yarn's approach. Does Yarn have a similar option as well?

@BlackHole1
Copy link
Member Author

yarn does not provide the relevant configuration, see: https://github.com/yarnpkg/yarn/blob/6db39cf0ff684ce4e7de29669046afb8103fce3d/src/cli/commands/exec.js#L23

it makes sense to follow Yarn's approach.

By default, pnpm behaves in the same way as yarn, but it would be better if we just provided a switch on top of this.

@BlackHole1
Copy link
Member Author

Maybe in the future I can also provide a cli options for yarn and make yarn support shell as well. 🪄

@zkochan zkochan merged commit 8d32555 into pnpm:main Feb 13, 2022
@BlackHole1 BlackHole1 deleted the fix-shell-env-variable-not-parse branch February 13, 2022 12:28
@zkochan zkochan added this to the v6.31 milestone Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PNPM_PACKAGE_NAME doesn't seem to be set in exec
2 participants