gcanti / fp-ts

Functional programming in TypeScript
https://gcanti.github.io/fp-ts/
MIT License
10.85k stars 503 forks source link

Run build when package is installed via git #1429

Open m-bock opened 3 years ago

m-bock commented 3 years ago

🚀 Feature request

Current Behavior

Only states of fp-ts that are published to NPM can be installed easily in project. E.G. npm install fp-ts@2.9.5

Desired Behavior

Sometimes it's useful to install a specific commit or generally ref, maybe to test an unpublished feature.

npm install git+https://github.com/gcanti/fp-ts#ed311365eac2e0db67aa25e63702bef189a56a09

Currently, the installation works but no build artefacts are generated.

Suggested Solution

The prepare script is supposed to work for this purpose, however it does not seem to work.

m-bock commented 3 years ago

Update on this: adding an empty .npmignore to the fp-ts repo makes the prepare script run the build and emit files into dist.

That's already close to what I am looking for. imports now work like fp-ts/dist/Array Here's a ref from a fork, that can be used to try out: https://github.com/no-day/fp-ts/commit/a47f1bccdf9de6e9b5607ac41bd572490aa532bf

I could not figure out how the publishing process puts the dist folder into top level. Is npm publish it run manually from inside dist?