avajs / ava

Node.js test runner that lets you develop with confidence 🚀
MIT License
20.74k stars 1.41k forks source link

Use prepack npm lifecycle script to enable installing from GitHub directly #1541

Closed masaeedu closed 6 years ago

masaeedu commented 7 years ago

(Please refer to https://github.com/avajs/ava/issues/1541#issuecomment-335538385. Original issue below — @novemberborn).


Please publish a continuous build of ava to npm under a tag like next (see e.g. https://www.npmjs.com/package/typescript). This would be useful for users who want to use bleeding edge features that are already committed to master but haven't been cut into a release yet, and can help provide feedback from real world testing.

I brought this up in #1110, where @sindresorhus mentioned installing from github, but the issue was locked before I could respond. Installing from git URL doesn't work because ava isn't published as-is to the npm repository, it has a build step.

There is a feature request in https://github.com/npm/npm/issues/3055 to run build steps for git url packages; ostensibly you just need to use prepare instead of prepublish in ava's package.json to ensure the build step is executed. Unfortunately I tried this in a fork and it doesn't seem to work (and other users seem not to have had any luck with it either).

novemberborn commented 7 years ago

Installing from git URL doesn't work because ava isn't published as-is to the npm repository, it has a build step.

The build step generates the TypeScript definitions. It's not necessary for most users.

Looking at https://docs.npmjs.com/misc/scripts I see there's a prepack option:

prepack: run BEFORE a tarball is packed (on npm pack, npm publish, and when installing git dependencies)

Sounds like this should work for all our use cases. We'd need to change our prepublish to prepack and then verify everything still works as expected.

masaeedu commented 7 years ago

It's not necessary for most users.

@novemberborn It is necessary for me. I'm using TypeScript, which prevents me from using the git URL package reference.