Skip to content

Commit 85a7987

Browse files
committed
fixup: use jq
1 parent 3eb9200 commit 85a7987

File tree

3 files changed

+5
-37
lines changed

3 files changed

+5
-37
lines changed

.github/workflows/ci.yaml

-9
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,6 @@ jobs:
203203
name: "npm-package"
204204
path: release-npm-package
205205

206-
# NOTE@jsjoeio - we need to make sure we're using
207-
# v7 or higher of the npm CLI because it's used
208-
# in the yarn publish:npm script in development builds
209-
# to modify package.json name.
210-
- name: Install Node & npm v8
211-
uses: actions/setup-node@v3
212-
with:
213-
node-version: "16.14.0"
214-
215206
- name: Run ./ci/steps/publish-npm.sh
216207
run: yarn publish:npm
217208
env:

.github/workflows/npm-brew.yaml

-9
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ jobs:
2929
name: "npm-package"
3030
path: release-npm-package
3131

32-
# NOTE@jsjoeio - we need to make sure we're using
33-
# v7 or higher of the npm CLI because it's used
34-
# in the yarn publish:npm script in development builds
35-
# to modify package.json name.
36-
- name: Install Node & npm v8
37-
uses: actions/setup-node@v3
38-
with:
39-
node-version: "16.14.0"
40-
4132
- name: Publish npm package and tag with "latest"
4233
run: yarn publish:npm
4334
env:

ci/steps/publish-npm.sh

+5-19
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,9 @@ main() {
5252
fi
5353

5454
# Check that we're using at least v7 of npm CLI
55-
if ! command -v npm &> /dev/null; then
56-
echo "Couldn't find the npm CLI"
57-
echo "Are you sure you have it installed?"
58-
echo "Please check again with: npm -v"
59-
echo "And re-run the script."
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."
6058
exit 1
6159
fi
6260

@@ -95,18 +93,6 @@ main() {
9593
# See: https://github.com/coder/code-server/pull/3935
9694
echo "node_modules.asar" > release/.npmignore
9795

98-
# NOTE@jsjoeio - this needs to run inside the release dir
99-
# where the package.json for code-server is.
100-
pushd release
101-
if npm pkg get name && [ $? -eq 1 ]; then
102-
echo "Couldn't get package.json name with 'npm pkg get name'"
103-
echo "This usually means npm v7 or higher could not be found."
104-
echo "We use this to modify the package.json name for dev builds."
105-
echo "Please upgrade to npm v7 or higher and re-run the script."
106-
exit 1
107-
fi
108-
popd
109-
11096
# We use this to set the name of the package in the
11197
# package.json
11298
PACKAGE_NAME="code-server"
@@ -159,8 +145,8 @@ main() {
159145
# Use the development package name
160146
# This is so we don't clutter the code-server versions on npm
161147
# with development versions.
162-
# Requires npm Version 7.x or higher
163-
npm pkg set name="$PACKAGE_NAME"
148+
updated_package_json="$(jq '.name = "$PACKAGE_NAME"' package.json)"
149+
echo -E "${updated_package_json}" > package.json
164150
popd
165151
fi
166152

0 commit comments

Comments
 (0)