Skip to content

Commit 9763f20

Browse files
authored
build: enable npm for php/python builds (#1133)
* build: enable npm for php/python builds * update comment
1 parent 2514a99 commit 9763f20

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.kokoro-autosynth/build-in-docker.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,23 @@ ssh-keyscan github.com >> "$HOME/.ssh/known_hosts"
2828
# Kokoro exposes this as a file, but the scripts expect just a plain variable.
2929
export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key)
3030

31+
# Install npm to facilitate installation of a code formatter for PHP: https://github.com/prettier/plugin-php
32+
# Use `nvm` to bootstrap the installation of node.js and npm.
33+
# To learn more: https://github.com/nvm-sh/nvm
34+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
35+
36+
# Activate `nvm` so the binary is available on the path
37+
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
38+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
39+
40+
# Use the latest LTS version of nodejs. This can change over time, but
41+
# should prevent the need to modify this file every year.
42+
nvm install --lts
43+
44+
# Verify expected versions of nodejs and npm
45+
node --version
46+
npm --version
47+
3148
# Setup git credentials
3249
echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials
3350
git config --global credential.helper 'store --file ~/.git-credentials'

0 commit comments

Comments
 (0)