@@ -51,6 +51,13 @@ main() {
5151 exit 1
5252 fi
5353
54+ # Check that we're using at least v7 of npm CLI
55+ if ! command -v jq & > /dev/null; then
56+ echo " Couldn't find jq"
57+ echo " We need this in order to modify the package.json for dev builds."
58+ exit 1
59+ fi
60+
5461 # This allows us to publish to npm in CI workflows
5562 if [[ ${CI-} ]]; then
5663 echo " //registry.npmjs.org/:_authToken=${NPM_TOKEN} " > ~ /.npmrc
@@ -86,6 +93,10 @@ main() {
8693 # See: https://github.com/coder/code-server/pull/3935
8794 echo " node_modules.asar" > release/.npmignore
8895
96+ # We use this to set the name of the package in the
97+ # package.json
98+ PACKAGE_NAME=" code-server"
99+
89100 # NOTES:@jsjoeio
90101 # We only need to run npm version for "development" and "staging".
91102 # This is because our release:prep script automatically bumps the version
@@ -112,22 +123,29 @@ main() {
112123 # Source: https://github.com/actions/checkout/issues/58#issuecomment-614041550
113124 PR_NUMBER=$( echo " $GITHUB_REF " | awk ' BEGIN { FS = "/" } ; { print $3 }' )
114125 NPM_VERSION=" $VERSION -$PR_NUMBER -$COMMIT_SHA "
126+ PACKAGE_NAME=" @coder/code-server-pr"
115127 # This means the npm version will be tagged with "<pr number>"
116128 # and installed when a user runs `yarn install code-server@<pr number>`
117129 NPM_TAG=" $PR_NUMBER "
118130 fi
119131
120132 echo " using tag: $NPM_TAG "
133+ echo " using package name: $PACKAGE_NAME "
121134
122135 # We modify the version in the package.json
123136 # to be the current version + the PR number + commit SHA
124137 # or we use current version + beta + commit SHA
125138 # Example: "version": "4.0.1-4769-ad7b23cfe6ffd72914e34781ef7721b129a23040"
126139 # Example: "version": "4.0.1-beta-ad7b23cfe6ffd72914e34781ef7721b129a23040"
127140 pushd release
128- # NOTE: @jsjoeio
141+ # NOTE@jsjoeio
129142 # I originally tried to use `yarn version` but ran into issues and abandoned it.
130143 npm version " $NPM_VERSION "
144+ # NOTE@jsjoeio
145+ # Use the development package name
146+ # This is so we don't clutter the code-server versions on npm
147+ # with development versions.
148+ jq " .name |= \" $PACKAGE_NAME \" " package.json
131149 popd
132150 fi
133151
@@ -141,7 +159,10 @@ main() {
141159 return
142160 fi
143161
144- yarn publish --non-interactive release --tag " $NPM_TAG "
162+ # NOTE@jsjoeio
163+ # Since the dev builds are scoped to @coder
164+ # We pass --access public to ensure npm knows it's not private.
165+ yarn publish --non-interactive release --tag " $NPM_TAG " --access public
145166}
146167
147168main " $@ "
0 commit comments