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

Add pre-publish build step to fix installing insect from npm #238

Merged
merged 4 commits into from
Sep 27, 2020

Conversation

n4bb12
Copy link
Contributor

@n4bb12 n4bb12 commented Sep 26, 2020

Fixes #224

I renamed the postinstall script to setup to avoid it being run when used as a CLI tool or dependency.

The setup and build script are run in the prepack phase of the publish command, so you don't need to do anything. Just run npm publish as per usual.

For convenience the setup script is also run on npm start. It's fast, so it's ok to do that and it's convenient to not need to think about any of this when contributing.

I listed the files required for publishing in the package.json to avoid uploading unnecessary files. From testing it seems to only need the output folder to run. If I'm mistaken, please correct me. I also added the insect.png because it is used in the README. README, LICENSE and index.js are included by default.

As a small improvement I changed the copy script to copy files in parallel.

You can try this out:

# terminal 1
npx verdaccio
# terminal 2
export npm_config_registry=http://localhost:4873
npm version patch
npm publish
npx insect@5.4.1 '1 + 1'

If you want to just see what's being published and the above does not work, you can also do

npm pack

This will give you the archive that would be published and you can just open it and have a look inside.

@sharkdp
Copy link
Owner

sharkdp commented Sep 26, 2020

Thank you very much for working on this!

For some reason, the build fails: https://travis-ci.org/github/sharkdp/insect/builds/730488027

I have to admit that it currently also fails on master (it used to work, and the tests still run fine locally) .... but with a different error message: https://travis-ci.org/github/sharkdp/insect/builds/730376983

@n4bb12
Copy link
Contributor Author

n4bb12 commented Sep 26, 2020

I don't know why purescript is installed manually in the travis config. I think it shouldn't be because it's already installed through npm and that would also make it different from the local setup.

I also updated the build dependencies, maybe it fixes something.

@n4bb12
Copy link
Contributor Author

n4bb12 commented Sep 26, 2020

Fixed ✨

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much!

@sharkdp sharkdp merged commit 08c79d7 into sharkdp:master Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem with installation on npm
2 participants