-
Notifications
You must be signed in to change notification settings - Fork 617
[node] Add support to pre-install npm packages (#763) #767
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -36,6 +36,11 @@ | |||||
| ], | ||||||
| "default": "latest", | ||||||
| "description": "Version of NVM to install." | ||||||
| }, | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we bump
|
||||||
| "npmInstallPackages": { | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| "type": "string", | ||||||
| "default": "", | ||||||
| "description": "Additional npm packages to install under the username env." | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we expect this ^ input and update the |
||||||
| } | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have another PR #768 which is trying to do a similar thing for the Python Feature. Hence, trying to make both of these in sync. |
||||||
| }, | ||||||
| "customizations": { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,7 @@ | |||||||
| export NODE_VERSION="${VERSION:-"lts"}" | ||||||||
| export NVM_VERSION="${NVMVERSION:-"latest"}" | ||||||||
| export NVM_DIR="${NVMINSTALLPATH:-"/usr/local/share/nvm"}" | ||||||||
| export NPM_INSTALL_PACKAGES="${NPMINSTALLPACKAGES:-""}" | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| INSTALL_TOOLS_FOR_NODE_GYP="${NODEGYPDEPENDENCIES:-true}" | ||||||||
|
|
||||||||
| # Comma-separated list of node versions to be installed (with nvm) | ||||||||
|
|
@@ -270,4 +271,8 @@ rm -rf /var/lib/apt/lists/* | |||||||
| mkdir -p "${NVM_DIR}/versions" | ||||||||
| chmod -R g+rw "${NVM_DIR}/versions" | ||||||||
|
|
||||||||
| if [ ! -z "${NPMINSTALLPACKAGES}" ]; then | ||||||||
| su ${USERNAME} -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm use default && npm install -g ${NPMINSTALLPACKAGES}" | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I don't think we'd need other commands. Example Line 235 in 0af6bc9
|
||||||||
| fi | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a possibility that we might run into #702 issue. Hence, can we move Lines 232 to 234 in 0af6bc9
|
||||||||
|
|
||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, can we wrap |
||||||||
| echo "Done!" | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add test scenarios to validate this new option? Thank you! |
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once this PR is merged, https://github.com/devcontainers/action will run automatically ; which opens a PR that updates the README file based on
devcontainer-feature.jsonandNOTES.md.Hence, can we revert the changes to this file to avoid merge conflicts? Thanks!