Skip to content

Commit 02f1c56

Browse files
committed
fixup: always set package name
1 parent 6c826d9 commit 02f1c56

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

ci/steps/publish-npm.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ main() {
8585
# Ignore symlink when publishing npm package
8686
# See: https://github.com/coder/code-server/pull/3935
8787
echo "node_modules.asar" > release/.npmignore
88+
# We use this to set the name of the package in the
89+
# package.json
90+
PACKAGE_NAME="code-server"
8891

8992
# NOTES:@jsjoeio
9093
# We only need to run npm version for "development" and "staging".
@@ -112,15 +115,10 @@ main() {
112115
# Source: https://github.com/actions/checkout/issues/58#issuecomment-614041550
113116
PR_NUMBER=$(echo "$GITHUB_REF" | awk 'BEGIN { FS = "/" } ; { print $3 }')
114117
NPM_VERSION="$VERSION-$PR_NUMBER-$COMMIT_SHA"
115-
DEV_PACKAGE_NAME="@coder/code-server-pr"
118+
PACKAGE_NAME="@coder/code-server-pr"
116119
# This means the npm version will be tagged with "<pr number>"
117120
# and installed when a user runs `yarn install code-server@<pr number>`
118121
NPM_TAG="$PR_NUMBER"
119-
# Use the development package name
120-
# This is so we don't clutter the code-server versions on npm
121-
# with development versions.
122-
# NOTE: Requires npm Version 7.x or higher
123-
npm pkg set name="$DEV_PACKAGE_NAME"
124122
fi
125123

126124
echo "using tag: $NPM_TAG"
@@ -131,9 +129,15 @@ main() {
131129
# Example: "version": "4.0.1-4769-ad7b23cfe6ffd72914e34781ef7721b129a23040"
132130
# Example: "version": "4.0.1-beta-ad7b23cfe6ffd72914e34781ef7721b129a23040"
133131
pushd release
134-
# NOTE:@jsjoeio
132+
# NOTE@jsjoeio
135133
# I originally tried to use `yarn version` but ran into issues and abandoned it.
136134
npm version "$NPM_VERSION"
135+
# NOTE@jsjoeio
136+
# Use the development package name
137+
# This is so we don't clutter the code-server versions on npm
138+
# with development versions.
139+
# Requires npm Version 7.x or higher
140+
npm pkg set name="$PACKAGE_NAME"
137141
popd
138142
fi
139143

0 commit comments

Comments
 (0)