Skip to content

Commit f15d2d5

Browse files
committed
fix: check for npm and npm v7
1 parent 5f8ee02 commit f15d2d5

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

ci/steps/publish-npm.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,24 @@ main() {
5454
# TODO@jsjoeio
5555
# Check that we're using at least v7 of npm CLI
5656
if ! command -v npm &> /dev/null; then
57-
echo "npm v7 or higher could not be found."
57+
echo "Couldn't find the npm CLI"
58+
echo "Are you sure you have it installed?"
59+
echo "Please check again with: npm -v"
60+
echo "And re-run the script."
61+
exit 1
62+
fi
63+
64+
# NOTE@jsjoeio - this needs to run inside the release dir
65+
# where the package.json for code-server is.
66+
pushd release
67+
if npm pkg get name && [ $? -eq 1 ]; then
68+
echo "Couldn't get package.json name with 'npm pkg get name'"
69+
echo "This usually means npm v7 or higher could not be found."
5870
echo "We use this to modify the package.json name for dev builds."
59-
echo "Please upgrade and re-run the script."
71+
echo "Please upgrade to npm v7 or higher and re-run the script."
6072
exit 1
6173
fi
74+
popd
6275

6376
# This allows us to publish to npm in CI workflows
6477
if [[ ${CI-} ]]; then
@@ -161,7 +174,10 @@ main() {
161174
return
162175
fi
163176

164-
yarn publish --non-interactive release --tag "$NPM_TAG"
177+
# NOTE@jsjoeio
178+
# Since the dev builds are scoped to @coder
179+
# We pass --access public to ensure npm knows it's not private.
180+
yarn publish --non-interactive release --tag "$NPM_TAG" --access public
165181
}
166182

167183
main "$@"

0 commit comments

Comments
 (0)