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

prepublishOnly is ignored #3626

Closed
kboda opened this issue Jul 28, 2021 · 5 comments · Fixed by #3627
Closed

prepublishOnly is ignored #3626

kboda opened this issue Jul 28, 2021 · 5 comments · Fixed by #3627
Milestone

Comments

@kboda
Copy link

kboda commented Jul 28, 2021

pnpm version: 6.11.1

Code to reproduce the issue:

add a prepublishOnly script to a project

Expected behavior:

pnpm publish runs the prepublishOnly script

Actual behavior:

pnpm publish does not run the prepublishOnly script

Additional information:

  • node -v prints: v14.17.3
  • Windows, macOS, or Linux?: Windows 10
  • npm -v prints: 7.20.2

in 6.10.3 it works as expected.

I have noticed that --ignore-scipts was added here: https://github.com/pnpm/pnpm/blame/bff84dbca25cacc052d02d8324f394f47cb07be9/packages/plugin-commands-publishing/src/publish.ts#L167
Can this be the reason? Is it intended (and so the prepublishOnly script is ignored in the next version) or just accidentally left there?

@zkochan
Copy link
Member

zkochan commented Jul 28, 2021

--ignore-scripts was always there. The scripts are executed by pnpm, they should not be re-executed with npm.

@kboda
Copy link
Author

kboda commented Jul 29, 2021

--ignore-scripts was always there. The scripts are executed by pnpm, they should not be re-executed with npm.

Thanks for your quick feedback!

Sorry I don't get your point, maybe I explained it in the wrong way, let me try it differently.

With the following steps I can reproduce it any time:

  1. npm install pnpm@latest -g

  2. from my project dir: pnpm publish

  3. it starts the prepublishOnly script, builds the stuff and publishes it as expected 👍

  4. npm install pnpm@next -g (I really like the new pnpm audit --fix feature)

  5. from my project dir: pnpm publish

  6. it does not run the prepublishOnly script, but exits with this error message:
    No package.json (or package.yaml, or package.json5) was found in "<path_to_my_package>\dist"

I have the following config in package.json:
"publishConfig": { "directory": "dist" }
I would expect pnpm to run the prepublishOnly script which actually creates the dist folder.

Note: my prepublishOnly script creates a package.json file inside the dist folder, and as I said, it works perfectly with the latest version, the problem exists only in next, but I would really like to use the latter to have the --fix flag for audit.

Thanks in advance

@zkochan
Copy link
Member

zkochan commented Jul 29, 2021 via email

@kboda
Copy link
Author

kboda commented Jul 29, 2021

Yes, I can confirm this, it does not happen if I remove publishConfig.

@kboda
Copy link
Author

kboda commented Jul 30, 2021

Thank you very much for fixing it so quickly, you do awesome work here, keep up!

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.

2 participants