Learn how to rename a node after installation#284
Open
jasonkarns wants to merge 3 commits intomainfrom
Open
Conversation
The rename_node function is part of node-build that way the build definitions simply need to define their after_install_package function to invoke rename_node. The function accepts a specific name as the new name, but defaults the name to the actual response from `node --version`. PREFIX_PATH must be updated after the move such that the rest of node-build knows about the new location. After moving the installed node, a symlink is created at the original location pointing to the new location. This allows end users to set their selected node using the same name as the build definition. Further, this "hack" allows any other plugins that hook into after-install to continue operating unchanged. Without the symlink, `PREFIX` and `NODENV_VERSION` would be incorrect for all after-install hooks. However, as they now refer to an existing directory (symlink), the hooks will operate on the newly installed node correctly. TODO: handle the "new name" already existing
Member
Author
|
Now checking (and exiting) if the new_path already exists. Currently checking via Questions:
|
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The rename_node function is part of node-build that way the build
definitions simply need to define their after_install_package function
to invoke rename_node.
The function accepts a specific name as the new name, but defaults the
name to the actual response from
node --version.PREFIX_PATH must be updated after the move such that the rest of
node-build knows about the new location.
After moving the installed node, a symlink is created at the original
location pointing to the new location. This allows end users to set
their selected node using the same name as the build definition.
Further, this "hack" allows any other plugins that hook into
after-install to continue operating unchanged. Without the symlink,
PREFIXandNODENV_VERSIONwould be incorrect for all after-installhooks. However, as they now refer to an existing directory (symlink),
the hooks will operate on the newly installed node correctly.
Fixes #237
Unblocks #145
todo