Skip to content

Commit f80a9e1

Browse files
committed
fix: Fix scripts for CI building
1 parent 20d8a9f commit f80a9e1

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

scripts/build-npm-package.sh

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
#!/usr/bin/env bash
22
# shellcheck disable=SC2015
33

4+
#
5+
# Update: 2024-02-29
6+
#
7+
48
throw() { echo -e "fatal: $1" >&2; exit 1; }
59
execute() { echo "$ $*"; "$@" || throw "Failed to execute '$1'"; }
10+
command -v jq >/dev/null || throw "jq is not installed! (https://jqlang.github.io/jq/)";
611

712
# change the current directory to the project directory
813
pushd "$( dirname -- "${BASH_SOURCE[0]}" )/.." >/dev/null || exit 1;
914

10-
execute mkdir -p "./artifacts/npm";
11-
12-
PKG_NAME="$(awk '/"name"/{ print substr($2,2, length($2)-3); }' ./package.json)"
13-
PKG_VERSION="$(awk '/"version"/{ print substr($2,2, length($2)-3); }' ./package.json)"
14-
PKG="${PKG_NAME}-${PKG_VERSION}";
15+
PKG="$(jq -r '.name+"-"+.version' ./package.json)";
16+
TARGET_DIR="./artifacts/npm";
17+
LIST_FILE="./artifacts/npm/${PKG}.list";
18+
echo "PKG=${PKG}";
1519

16-
npm pack --dryrun 2>&1 |
17-
sed 's/npm notice//' |
18-
tee "./artifacts/npm/${PKG}.list";
20+
execute mkdir -p "$TARGET_DIR";
1921

20-
echo "created './artifacts/vscode/${PKG}.list'";
22+
echo "$ npm pack --dryrun | tee $LIST_FILE";
23+
npm pack --dryrun 2>&1 | sed 's/npm notice//' | tee "$LIST_FILE";
2124

2225
execute npm pack;
23-
execute mv -f "${PKG}.tgz" "./artifacts/npm";
26+
execute mv -f "${PKG}.tgz" "$TARGET_DIR";

scripts/build-vscode-artifact.sh

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
#!/usr/bin/env bash
22

3+
#
4+
# Update: 2024-02-29
5+
#
6+
throw() { echo -e "fatal: $1" >&2; exit 1; }
7+
execute() { echo "$ $*"; "$@" || throw "Failed to execute '$1'"; }
8+
command -v jq >/dev/null || throw "jq is not installed! (https://jqlang.github.io/jq/)";
9+
310
# change the current directory to the project directory
411
pushd "$( dirname -- "${BASH_SOURCE[0]}" )/.." >/dev/null || exit 1;
512

6-
mkdir -p "./artifacts/vscode";
13+
PKG="$(jq -r '.name+"-"+.version' ./package.json)";
14+
TARGET_DIR="./artifacts/vscode";
15+
LIST_FILE="./artifacts/vscode/${PKG}.list";
16+
echo "PKG=${PKG}";
717

8-
PKG_NAME="$(awk '/"name"/{ print substr($2,2, length($2)-3); }' ./package.json)"
9-
PKG_VERSION="$(awk '/"version"/{ print substr($2,2, length($2)-3); }' ./package.json)"
10-
PKG="${PKG_NAME}-${PKG_VERSION}";
18+
execute mkdir -p "$TARGET_DIR";
1119

20+
echo "$ ./scripts/vsce.sh ls | tee $LIST_FILE";
1221
bash ./scripts/vsce.sh ls |
1322
awk '!/Detected presence of yarn.lock/' |
14-
tee "./artifacts/vscode/${PKG}.list";
15-
16-
echo "created './artifacts/vscode/${PKG}.list'";
23+
tee "$LIST_FILE";
1724

18-
bash ./scripts/vsce.sh package --out "./artifacts/vscode/${PKG}.vsix"
25+
execute bash ./scripts/vsce.sh package --out "${TARGET_DIR}/${PKG}.vsix";

0 commit comments

Comments
 (0)