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

Do not append, instead clobber. #1

Open
jordwalke opened this issue Mar 15, 2017 · 2 comments
Open

Do not append, instead clobber. #1

jordwalke opened this issue Mar 15, 2017 · 2 comments

Comments

@jordwalke
Copy link

I found it much more useful in my fork of npm-hooks, to clobber instead of append the file. Do you agree this should be a supported mode?

@mikkoh
Copy link
Owner

mikkoh commented Mar 15, 2017

Yep you're probably right. Could allow clobbering via option. Not sure what the default should be.

I haven't used this module in awhile. Initially I was wanting to create a module that would track installed modules. A sort of analytics module.

@jordwalke
Copy link
Author

jordwalke commented Mar 15, 2017

I found an incredibly important use case for this (or hooks in general). We created a far superior postinstall for the purpose of architecture specific compilation, but it could be used for any build step in postinstall. It's called esy.

  • Parallel builds among all packages.
  • Caches artifacts across projects (important for native compilation which takes minutes/hours).
  • Recoverable builds.
  • Out of source builds - doesn't touch your actual node_modules and write artifacts into them.

Here's what the package.json would look like:

{
  "name": "testtop",
  "version": "1.0.0",
  "scripts": {
    "install": "esybuild"
  },
  "esy": {
    "build": ["your commands here"]
  },
  "dependencies": {
    "esy": "*"
  }
}

Here's where I use my fork of this library to do that. What it does is, it attaches a hook to ensure that only the top level package's post install runs, which kicks of the parallel builds from the top down in a system we control, not npm.

Notice how it just looks like you're running esybuild on install - which you are, but that's not the real build :D

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

No branches or pull requests

2 participants