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

Support the prepublishOnly hook #89

Open
1 task done
savetheclocktower opened this issue Aug 15, 2023 · 3 comments
Open
1 task done

Support the prepublishOnly hook #89

savetheclocktower opened this issue Aug 15, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@savetheclocktower
Copy link
Sponsor Contributor

Have you checked for existing feature requests?

  • Completed

Summary

I wrote a TypeScript package as a way of dogfooding the IDE experience with my pulsar-ide-typescript-alpha package. By and large it's a smooth process, but the hardest part has been automatically transpiling to JavaScript before publish.

My understanding is that most NPM packages that are written in TypeScript use the prepublishOnly script hook for this task. prepublishOnly is called after the user runs npm publish, but before anything else happens.

Inspecting the artifacts of other high-profile Atom packages that were written in TypeScript implies that this might’ve worked for ppm at some point in the past, but I can’t imagine how that would be true.

My goal for my own project is (a) never to have to care about built files until publish time, and (b) never to run the risk of forgetting to transpile (and commit the transpilation) before publishing.

This is not a major priority, but I think it’s worth visiting at some point.

What benefits does this feature provide?

Feature parity with npm. Makes it much easier to do something that might be a common need for new package contributors.

Any alternatives?

I can't think of a good alternative to this. In my case, I've managed to build a system out of duct tape and twine that forces me to build code before I run ppm publish patch, but that's not a proper solution.

Other examples:

No response

@savetheclocktower savetheclocktower added the enhancement New feature or request label Aug 15, 2023
@confused-Techie
Copy link
Member

Since PPM, from my understanding, defers handling of scripts like this to NPM, we should support whatever is supported by version 8 on NPM. Which hasn't been bumped by us. We only bumped node-gyp within NPM, so I'd imagine it's supported. But we can always look at the source of our npm-cli to determine exactly what's supported.

And if anything is missing, hopefully cherry pick the commits adding them to upstream, to use the feature while keeping to NPM API of NPM 8

@confused-Techie
Copy link
Member

Looking into this, we do not currently support the prepublishOnly hook, as well as we actually do not support a huge number of other hooks.

I only now realize how many of them were created after NPM 8.
So I would really like to try and take some time to update our version of NPM to be something a bit more up to date, but we would have to do it totally custom, in order to keep the API functionality needed. So I have a feeling this may turn into a much larger project.

So it may be worth it for us to create an issue over there, and try to see what we can do to support some modern hooks and features.

@savetheclocktower
Copy link
Sponsor Contributor Author

It's odd because prepublishOnly was supposedly added to npm in version 4, and ppm --version insists that it's using npm version 6.14.18.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants