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

pnpm deploy probably shouldn't allow trashing the workspace by default #7351

Closed
1 of 4 tasks
akx opened this issue Nov 28, 2023 · 0 comments · Fixed by #7360
Closed
1 of 4 tasks

pnpm deploy probably shouldn't allow trashing the workspace by default #7351

akx opened this issue Nov 28, 2023 · 0 comments · Fixed by #7360

Comments

@akx
Copy link

akx commented Nov 28, 2023

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

8.11.0

Which area(s) of pnpm are affected? (leave empty if unsure)

CLI

Link to the code that reproduces this issue or a replay of the bug

No response

Reproduction steps

~ $ docker run -it node:20 bash
root@709a7866b8d8:/# npm i -g pnpm
added 1 package in 998ms
root@709a7866b8d8:/# cd $(mktemp -d)
root@709a7866b8d8:/tmp/tmp.jE86enQhhI# pnpm --version
8.11.0
root@709a7866b8d8:/tmp/tmp.jE86enQhhI# pnpm init
root@709a7866b8d8:/tmp/tmp.jE86enQhhI# touch pnpm-workspace.yaml
root@709a7866b8d8:/tmp/tmp.jE86enQhhI# mkdir -p packages/foo
root@709a7866b8d8:/tmp/tmp.jE86enQhhI# pushd packages/foo && pnpm init && popd
root@709a7866b8d8:/tmp/tmp.jE86enQhhI# pnpm deploy --filter=foo .
 ENOENT  ENOENT: no such file or directory, scandir '/tmp/tmp.jE86enQhhI/packages/foo'
root@709a7866b8d8:/tmp/tmp.jE86enQhhI# ls
root@709a7866b8d8:/tmp/tmp.jE86enQhhI#

Describe the Bug

When (accidentally, inadvertently, etc) setting deploy's target directory to ., the workspace is rimraf'd. (Or any target directory for that matter.)

Stack Overflow question referring to this: https://stackoverflow.com/q/77561255/51685

Expected Behavior

deploy should probably not rimraf the target directory if it's non-empty unless told to, and it should probably refuse to work on the present pnpm workspace's root too.

Which Node.js version are you using?

v20.9.0

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

Debian (node:20 Docker image)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant