aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/node/devcontainer-feature.json6
-rwxr-xr-xsrc/node/install.sh11
-rw-r--r--test/node/install_additional_node.sh1
-rwxr-xr-xtest/node/install_node_16_on_bionic.sh1
-rw-r--r--test/node/install_node_on_universal_image.sh1
-rwxr-xr-xtest/node/non_root_user.sh1
-rwxr-xr-xtest/node/test.sh1
7 files changed, 19 insertions, 3 deletions
diff --git a/src/node/devcontainer-feature.json b/src/node/devcontainer-feature.json
index 6450ce4..9bf90b6 100644
--- a/src/node/devcontainer-feature.json
+++ b/src/node/devcontainer-feature.json
@@ -1,9 +1,9 @@
{
"id": "node",
- "version": "1.1.5",
- "name": "Node.js (via nvm) and yarn",
+ "version": "1.2.0",
+ "name": "Node.js (via nvm), yarn and pnpm",
"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": {
"version": {
"type": "string",
diff --git a/src/node/install.sh b/src/node/install.sh
index 4c02c95..9048ac2 100755
--- a/src/node/install.sh
+++ b/src/node/install.sh
@@ -183,6 +183,17 @@ if [ ! -z "${ADDITIONAL_VERSIONS}" ]; then
IFS=$OLDIFS
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 [ "${INSTALL_TOOLS_FOR_NODE_GYP}" = "true" ]; then
echo "Verifying node-gyp OS requirements..."
diff --git a/test/node/install_additional_node.sh b/test/node/install_additional_node.sh
index 1a1abca..f47f928 100644
--- a/test/node/install_additional_node.sh
+++ b/test/node/install_additional_node.sh
@@ -7,6 +7,7 @@ source dev-container-features-test-lib
# 'lts' is some version of node 18 for a while.
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 "v14_installed" ls -1 /usr/local/share/nvm/versions/node | grep 14.19.3
diff --git a/test/node/install_node_16_on_bionic.sh b/test/node/install_node_16_on_bionic.sh
index 1b301d3..500e007 100755
--- a/test/node/install_node_16_on_bionic.sh
+++ b/test/node/install_node_16_on_bionic.sh
@@ -7,6 +7,7 @@ source dev-container-features-test-lib
# Definition specific tests
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"
# Report result
diff --git a/test/node/install_node_on_universal_image.sh b/test/node/install_node_on_universal_image.sh
index faca1eb..33a9d41 100644
--- a/test/node/install_node_on_universal_image.sh
+++ b/test/node/install_node_on_universal_image.sh
@@ -6,6 +6,7 @@ set -e
source dev-container-features-test-lib
check "version_on_path" bash -c "node -v | grep 'v19.1.0'"
+check "pnpm" pnpm -v
# Report result
reportResults
diff --git a/test/node/non_root_user.sh b/test/node/non_root_user.sh
index 6b6804d..499dbe6 100755
--- a/test/node/non_root_user.sh
+++ b/test/node/non_root_user.sh
@@ -7,6 +7,7 @@ source dev-container-features-test-lib
# Definition specific tests
check "version" node --version
+check "pnpm" pnpm -v
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
# Report result
diff --git a/test/node/test.sh b/test/node/test.sh
index 6b6804d..499dbe6 100755
--- a/test/node/test.sh
+++ b/test/node/test.sh
@@ -7,6 +7,7 @@ source dev-container-features-test-lib
# Definition specific tests
check "version" node --version
+check "pnpm" pnpm -v
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
# Report result