Skip to content

Add prepublish script#71

Open
ljharb wants to merge 2 commits into59naga:masterfrom
ljharb:prepublish
Open

Add prepublish script#71
ljharb wants to merge 2 commits into59naga:masterfrom
ljharb:prepublish

Conversation

@ljharb
Copy link
Copy Markdown

@ljharb ljharb commented Oct 23, 2018

This ensures that the build process isn't forgotten.

Additionally, it ensures that backports won't be mistakenly published as "latest", it cleans up the build output before recreating it, and it removes lockfiles, since this is a published package.

 - clean up `lib` before rebuilding it
 - ensure the build process runs prepublish
 - ensure that backports aren't unintentionally published as "latest"
Comment thread .gitignore
# Only apps should have lockfiles
npm-shrinkwrap.json
package-lock.json
yarn.lock
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It can be useful for a library to have a lockfile checked in (and not published) so that build and test dependencies are locked to known-good versions.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I don’t agree; that allows the package to pass tests while consumers fail them. Dev-only lockfiles are only appropriate for apps, not for packages.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I mainly mention because I feel like I've had build and test specific dev-dependencies (such as babel-plugin-add-module-exports today :P ) break much more often than regular dependencies. It's a very painful experience to clone an old repository to make a quick tweak and find it can't even build. I find it important to guarantee that a project is in a buildable (and hopefully even fully-reproducible) state as it was in the last commit. Finding out about breakages in non-dev-dependencies is important, but omitting a lockfile so the next repo-cloner runs into it isn't the specific way I like to go about it for my own projects. (Personally, I like using greenkeeper for that sort of thing.)

I'm happy with whichever way this project goes, just wanted to dump some of my experiences and reasoning here! The main meat of this PR seems really needed and I definitely wouldn't want to delay that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Indeed you should use something like greenkeeper to keep up with that, rather than letting a project bitrot until you try to maintain it later.

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.

3 participants