Streamline installation, reorganize utils and use node-build. #221
Streamline installation, reorganize utils and use node-build. #221seivan wants to merge 5 commits intoasdf-vm:masterfrom
Conversation
8724a7e to
6f51f50
Compare
|
If I understand correctly the patch is to build nodejs with node-build every install, independently of prebuilt releases? Is that correct? |
|
It will default to prebuilt and only fallback for source if necessary. |
|
Maybe @Stratus3D could help me here, but I don't think using node-build is in alignment with the premise of this project, we should be an alternative implementation for other node versioning tools (nvm, n, nodenv/nodebuild) not a wrapper around them. Even though node-build is highly stable and mature we are targeting a much simpler approach to node versioning and building. I'm not a full fledged maintainer of this project, so feel free to keep the idea and discuss it further About the installation of node-build, there are some problems about updating and versioning node-build itself, have you considered writing an asdf plugin for |
5459042 to
095313f
Compare
|
@augustobmoura it all depends on what is best. There is nothing inherently wrong with using node-build for installing node inside an asdf plugin. Plugins should ideally be as simple as possible, and one of the ways we can keep them simple is be relying on existing software. In the case of the https://github.com/asdf-vm/asdf-ruby plugin, we use ruby-build to handle building Ruby. ruby-build is a well maintained tool that automates a lot and allows us to keep the ruby plugin relatively simple. I'm all for using node-build if it results in a better experience for asdf-nodejs users. The experience we are providing right now with this plugin isn't great, and there is a ton of room for improvement. If node-build is going to make this plugin easier to manage, and give our users a better experience then I think it worth doing, assuming it is stable. One important distinction here is that ruby-build and node-build are tools that build, asdf is a tool that manages versions, so they aren't really at odds with each other.
You are now 😄
See how we handle things with the https://github.com/asdf-vm/asdf-ruby plugin. We have a hardcoded ruby-build version that we bump whenever a new ruby-build version comes out that is compatible. We could do the same thing here for node-build if you think that makes sense. I'm hoping over time you can become somewhat of a domain expert on this plugin and free me up to work more on asdf core. |
|
@seivan feel free to leave this PR open, we are all very busy and the lack of a response doesn't mean we've rejected it. |
node-buildfrom$PATHor fetch specific version when settingASDF_NODE_BUILD_VERSION.installand reorganizedutilsto be cleaner.gitrelated commands to be quiet as to not pollute the prompt.exec-pathin favour of putting.npm/binhigher since it doesn't rely on comparing hardcoded commands.Requirements
macOS
Linux
curl,wgetoraria2c-apt-get install curlopenssl,shasum, orsha256sumUse
To build from source, make sure all requisite libraries are available.
When installing Node.js using
asdf install, you can pass custom configure options with the following env vars:Building from source
NODE_CONFIGURE_OPTS-./configureNODE_MAKE_OPTS-makeNODE_MAKE_INSTALL_OPTS-make installAnd additional build options.
Additional options
ASDF_NPM_DEFAULT_PACKAGES_FILE- Defaultsdefault-npm-packagesASDF_SKIP_RESHIM- Defaults to 1, for skipping reshim on installs.ASDF_NODE_BUILD_VERSION- Defaults tov4.9.33ASDF_NODE_BUILD_MIRROR_URL- Defaults to official mirrorhttps://nodejs.org/dist/.If you are in China, you can set it to
ASDF_NODE_BUILD_MIRROR_URL=https://npm.taobao.org/mirrors/node/.