Add pnpm in Node (#450)

* Add pnpm in Node

* pnpm from npm

* Restore README.md

* Update install.sh

* Update tests
This commit is contained in:
Akihiro Nagai 2023-02-28 02:12:21 +09:00 committed by GitHub
parent d84e46be47
commit 83c6103db2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 3 deletions

View file

@ -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",

View file

@ -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..."

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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