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]: prepublish script npm hook #1169
Comments
No, the Of course, npm5 has deprecated The problem with a |
To avoid such problems, I avoid calling any custom tasks ‘publish’ and go
for ‘release’ in order to avoid collisions and interferance with ‘yarn/npm
publish’ pre and post hooks.
And I can safely use ‘prerelease’ and ‘prepublish’ hooks for two seperate
things during the publish cycle.
…On Sun, 21 Jan 2018 at 00:24, Daniel Stockman ***@***.***> wrote:
No, the prepublish (if it exists) in every package to be published is
always run (by npm/yarn), because we are just calling npm publish/yarn
publish in those directories (which is done in topological dependency
order, so dependents always have their local sibling devDependencies built).
Of course, npm5 has deprecated prepublish and it should probably be
replaced with prepare or prepublishOnly. I personally don't see much use
in the scripts/<lifecycle>.js pattern, but I don't have any plans to
remove it.
The problem with a prepublish in the root is that it (currently) will run
any time anyone runs npm install with no arguments in the root, complete
with scary looking log and possibly executing something you don't really
want to have happen then.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1169 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQv-Whrg0ibYiLl2emENY2MId7YwF1hCks5tMnWQgaJpZM4RFbts>
.
|
Excuse me! Where is the documentation about |
@evocateur small correction to what you have said:
It seems that you are calling publish with Any reason why that's there and how to overwrite it? |
It's already run by a previously executed |
@evocateur you are right. I was thinking about |
Ah, yes, that particular lifecycle does not appear to be run when publishing a tarball (as far as I recall when I traced through the npm source). It also doesn't run during |
I have a monorepo with multiple packages that are written in typescript, and in |
You should be running compilers to generate build output once, from the root. Or move to the prepack lifecycle, if typescript can't handle building multiple packages at once. |
Where can I read more about prepack lifecycle? |
This was lost when the unitary `npm publish` was split into `npm pack && npm publish <tgz>`. Fixes #1169
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
At the moment, in order to run a
prepublish
step when publishing you need to create a script under each modules likescripts/prepublish.js
.This is quite limiting considering the fact one, you are liberality forcing using to have that folder structure and also in most cases one would want to use the same script and not copy and paste it in all modules.
Expected Behaviour
scripts/prepublish.js
file script as per current workflow.Current Behaviour
There is no prepublish npm hook
The text was updated successfully, but these errors were encountered: