-
-
Notifications
You must be signed in to change notification settings - Fork 914
Support lifecycle scripts for node #3259
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
Conversation
c282e23 to
e89705b
Compare
The `npm pack` runs lifecycle scripts which can spoil the standard output of the command and prevent correct parsing of the created tarball. For details see: https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts Include a simple fix to parse out the tarball from the last line and cover the fix with a simple test. Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
|
The failed test fails for me also on |
e89705b to
1cee827
Compare
asottile
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test you broke doesn't fail for me and didn't fail on main so you've got something to fix at least
please also start with an issue demonstrating the problem. I'm not convinced something is broken based on what you've written here and my experience with npm pack
| def _make_hello_world(tmp_path): | ||
| package_json = '''\ | ||
| def _make_hello_world(tmp_path, package_json=None): | ||
| package_json = package_json or '''\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than overload this function -- simply call it and then overwrite the output afterwards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, if you prefer it that way, will do once I resolve the breakage
Interesting, it failes on my system on main. Anyway, the problem was discovered while trying to add a It can be easily reproduced this way: The standard output is now spoiled with a few lines added by npm, at least this is what I see on the version I have. |
|
I will try on ubuntu :) |
Yeah, cannot reproduce the problem on |
ubuntu:devel (24.10) has also npm 9.2.0 So ubuntu will start hitting this when it gets npm 10.x :( In any case, I expect if users start using new npm, more bug reports will come in from users using pre-commit hooks for |
|
hmm that feels like a pretty annoying regression in npm itself :S -- the output used to be on stdout in the past and was "fixed" in npm 7, seems like it's back again? is it every npm 10 or just the lastest fedora has packaged recently? (npm 10.x has been around for quite a while so I would have expected this sooner?) |
So npm is bundled with nodejs according to the documentation, so I checked these versions 18.20.4 19.9.0 20.15.1 21.7.3 22.5.0 (some of them are EOL now) using nvm: |
|
fwiw the other failure is likely the same as #3261 -- a bug in node |
|
a better solution would be to use |
|
#3460 is a better approach to this -- but needs a less slow test |
The
npm packruns lifecycle scripts which canspoil the standard output of the command and prevent
correct parsing of the created tarball.
For details see:
https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts
Include a simple fix to parse out the tarball from the last line
and cover the fix with a simple test.
Signed-off-by: Miroslav Vadkerti mvadkert@redhat.com