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

buildDependencies? #29

Open
piranna opened this issue Jan 12, 2017 · 6 comments
Open

buildDependencies? #29

piranna opened this issue Jan 12, 2017 · 6 comments

Comments

@piranna
Copy link
Member

piranna commented Jan 12, 2017

By using prebuild-install I've found mostly is the only one dependency I need, except when it can resolve to a prebuild image and needs to be compiled, for example nan and similar ones that are useless for prebuild images. I could set them as devDependencies, but in that case they would not be available if the prebuild is not available, so that dependencies are in a no-man-land status.

For that situation, I think a solution would be a buildDependencies where to set the dependencies needed only when the prebuild image could not be fetch (because it's not available or due to download failure), that would be installed by prebuild-install itself. This could be done being that buildDependencies an independent field object with no relationship with the other dependencies, or it could be an array with the name of the devDependencies that are in fact build ones, so this way it could be integrated with current workflows and being compatible with tools like node-check-updates and similar ones.

Thoughts?

@lgeiger
Copy link
Member

lgeiger commented Jan 12, 2017

Interesting idea! 👍

Would the following install script work for you?

"scripts": {
    "install": "prebuild-install || (npm install nan && node-gyp rebuild)"
  }

This way prebuild-install will remain lightweight and will only handle the downloading of the prebuilts.

@piranna
Copy link
Member Author

piranna commented Jan 12, 2017

Would the following install script work for you?

"scripts": {
"install": "prebuild-install || (npm install nan && node-gyp rebuild)"
}

Yes, you got the idea ;-) In fact I was thinking about doing it like this in a first time, but when you have several buildDependencies the install line gets too long and complex, and also there's the problem that doing it that way these dependencies get unversioned and will always install the latests ones, that's not always desirable (or set them as package@version, making the install line more long and complex...).

@lgeiger
Copy link
Member

lgeiger commented Jan 12, 2017

npm also supports a syntax like npm install nan@^2.4.0 node-ninja@^1.0.0 which is versioned and for me not much bulkier than implementing buildDependencies.

@piranna
Copy link
Member Author

piranna commented Jan 12, 2017

When I said "versioned" I mean "automatic versioned", it's said, dependencies could be check and updated using node-check-updates and similar tools.

@lgeiger
Copy link
Member

lgeiger commented Jan 12, 2017

When I said "versioned" I mean "automatic versioned", it's said, dependencies could be check and updated using node-check-updates and similar tools.

Ooh I see, that wouldn't work.

Though one could still add them as a devDependency and and make use of update notifications via node-check-updates. This way one could update the install command with minimal effort.

@piranna
Copy link
Member Author

piranna commented Jan 12, 2017

Though one could still add them as a devDependency and and make use of update notifications via node-check-updates. This way one could update the install command with minimal effort.

Yeah, but this way you need to have them defined in two places that would get unsync.

I've giving a look at your idea of the install script and I've created the buildDependencies module :-P It's just a simple command that look for the buildDependencies and devDependencies fields and exec npm install with them, and I've give it the possiblity to define the name of the field with the list of dependencies instead of the default buildDependencies. With that, now there's no need to add this functionality to prebuild-install, although the module is importable so we could add it as a dependency and done it automatically too. If not, I think it would a good idea at least add a reference on the docs about it in case others are in the same situation... What do you think?

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