Unverified Commit 83c6103d authored by Akihiro Nagai's avatar Akihiro Nagai Committed by GitHub

Add pnpm in Node (#450)

* Add pnpm in Node

* pnpm from npm

* Restore README.md

* Update install.sh

* Update tests
parent d84e46be
{ {
"id": "node", "id": "node",
"version": "1.1.5", "version": "1.2.0",
"name": "Node.js (via nvm) and yarn", "name": "Node.js (via nvm), yarn and pnpm",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/node", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/node",
"description": "Installs Node.js, nvm, yarn, and needed dependencies.", "description": "Installs Node.js, nvm, yarn, pnpm, and needed dependencies.",
"options": { "options": {
"version": { "version": {
"type": "string", "type": "string",
......
...@@ -183,6 +183,17 @@ if [ ! -z "${ADDITIONAL_VERSIONS}" ]; then ...@@ -183,6 +183,17 @@ if [ ! -z "${ADDITIONAL_VERSIONS}" ]; then
IFS=$OLDIFS IFS=$OLDIFS
fi fi
# Install pnpm
if type pnpm > /dev/null 2>&1; then
echo "pnpm already installed."
else
if type npm > /dev/null 2>&1; then
npm install -g pnpm
else
echo "Skip installing pnpm because npm is missing"
fi
fi
# If enabled, verify "python3", "make", "gcc", "g++" commands are available so node-gyp works - https://github.com/nodejs/node-gyp # If enabled, verify "python3", "make", "gcc", "g++" commands are available so node-gyp works - https://github.com/nodejs/node-gyp
if [ "${INSTALL_TOOLS_FOR_NODE_GYP}" = "true" ]; then if [ "${INSTALL_TOOLS_FOR_NODE_GYP}" = "true" ]; then
echo "Verifying node-gyp OS requirements..." echo "Verifying node-gyp OS requirements..."
......
...@@ -7,6 +7,7 @@ source dev-container-features-test-lib ...@@ -7,6 +7,7 @@ source dev-container-features-test-lib
# 'lts' is some version of node 18 for a while. # 'lts' is some version of node 18 for a while.
check "version_on_path" node -v | grep 18 check "version_on_path" node -v | grep 18
check "pnpm" pnpm -v
check "v18_installed" ls -1 /usr/local/share/nvm/versions/node | grep 18 check "v18_installed" ls -1 /usr/local/share/nvm/versions/node | grep 18
check "v14_installed" ls -1 /usr/local/share/nvm/versions/node | grep 14.19.3 check "v14_installed" ls -1 /usr/local/share/nvm/versions/node | grep 14.19.3
......
...@@ -7,6 +7,7 @@ source dev-container-features-test-lib ...@@ -7,6 +7,7 @@ source dev-container-features-test-lib
# Definition specific tests # Definition specific tests
check "version" bash -c "node --version | grep 16" check "version" bash -c "node --version | grep 16"
check "pnpm" pnpm -v
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10" check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
# Report result # Report result
......
...@@ -6,6 +6,7 @@ set -e ...@@ -6,6 +6,7 @@ set -e
source dev-container-features-test-lib source dev-container-features-test-lib
check "version_on_path" bash -c "node -v | grep 'v19.1.0'" check "version_on_path" bash -c "node -v | grep 'v19.1.0'"
check "pnpm" pnpm -v
# Report result # Report result
reportResults reportResults
...@@ -7,6 +7,7 @@ source dev-container-features-test-lib ...@@ -7,6 +7,7 @@ source dev-container-features-test-lib
# Definition specific tests # Definition specific tests
check "version" node --version check "version" node --version
check "pnpm" pnpm -v
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10" check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
# Report result # Report result
......
...@@ -7,6 +7,7 @@ source dev-container-features-test-lib ...@@ -7,6 +7,7 @@ source dev-container-features-test-lib
# Definition specific tests # Definition specific tests
check "version" node --version check "version" node --version
check "pnpm" pnpm -v
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10" check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
# Report result # Report result
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment