@@ -51,6 +51,13 @@ main() {
51
51
exit 1
52
52
fi
53
53
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
+
54
61
# This allows us to publish to npm in CI workflows
55
62
if [[ ${CI-} ]]; then
56
63
echo " //registry.npmjs.org/:_authToken=${NPM_TOKEN} " > ~ /.npmrc
@@ -86,6 +93,10 @@ main() {
86
93
# See: https://github.com/coder/code-server/pull/3935
87
94
echo " node_modules.asar" > release/.npmignore
88
95
96
+ # We use this to set the name of the package in the
97
+ # package.json
98
+ PACKAGE_NAME=" code-server"
99
+
89
100
# NOTES:@jsjoeio
90
101
# We only need to run npm version for "development" and "staging".
91
102
# This is because our release:prep script automatically bumps the version
@@ -112,22 +123,29 @@ main() {
112
123
# Source: https://github.com/actions/checkout/issues/58#issuecomment-614041550
113
124
PR_NUMBER=$( echo " $GITHUB_REF " | awk ' BEGIN { FS = "/" } ; { print $3 }' )
114
125
NPM_VERSION=" $VERSION -$PR_NUMBER -$COMMIT_SHA "
126
+ PACKAGE_NAME=" @coder/code-server-pr"
115
127
# This means the npm version will be tagged with "<pr number>"
116
128
# and installed when a user runs `yarn install code-server@<pr number>`
117
129
NPM_TAG=" $PR_NUMBER "
118
130
fi
119
131
120
132
echo " using tag: $NPM_TAG "
133
+ echo " using package name: $PACKAGE_NAME "
121
134
122
135
# We modify the version in the package.json
123
136
# to be the current version + the PR number + commit SHA
124
137
# or we use current version + beta + commit SHA
125
138
# Example: "version": "4.0.1-4769-ad7b23cfe6ffd72914e34781ef7721b129a23040"
126
139
# Example: "version": "4.0.1-beta-ad7b23cfe6ffd72914e34781ef7721b129a23040"
127
140
pushd release
128
- # NOTE: @jsjoeio
141
+ # NOTE@jsjoeio
129
142
# I originally tried to use `yarn version` but ran into issues and abandoned it.
130
143
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
131
149
popd
132
150
fi
133
151
@@ -141,7 +159,10 @@ main() {
141
159
return
142
160
fi
143
161
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
145
166
}
146
167
147
168
main " $@ "
0 commit comments