Skip to content

Commit 95a6e76

Browse files
MoLowRafaelGSS
authored andcommitted
tools: add @reporters/github to tools
PR-URL: #49129 Refs: #49120 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent e14f045 commit 95a6e76

File tree

5 files changed

+2672
-0
lines changed

5 files changed

+2672
-0
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ test/fixtures
55
test/message/esm_display_syntax_error.mjs
66
tools/icu
77
tools/lint-md/lint-md.mjs
8+
tools/github_reporter
89
benchmark/tmp
910
benchmark/fixtures
1011
doc/**/*.js

.github/workflows/tools.yml

+8
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ jobs:
140140
cat temp-output
141141
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
142142
rm temp-output
143+
- id: github_reporter
144+
subsystem: tools
145+
label: tools
146+
run: |
147+
./tools/dep_updaters/update-github-reporter.sh > temp-output
148+
cat temp-output
149+
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
150+
rm temp-output
143151
- id: googletest
144152
subsystem: deps
145153
label: dependencies, test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh
2+
3+
# Shell script to update @reporters/github in the source tree to the latest release.
4+
5+
# This script must be in the tools directory when it runs because it uses the
6+
# script source file path to determine directories to work in.
7+
8+
set -ex
9+
10+
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
11+
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
12+
[ -x "$NODE" ] || NODE=$(command -v node)
13+
NPM="$ROOT/deps/npm/bin/npm-cli.js"
14+
15+
# shellcheck disable=SC1091
16+
. "$ROOT/tools/dep_updaters/utils.sh"
17+
18+
NEW_VERSION=$("$NODE" "$NPM" view @reporters/github dist-tags.latest)
19+
CURRENT_VERSION=$("$NODE" -p "require('./tools/github_reporter/package.json').version")
20+
21+
# This function exit with 0 if new version and current version are the same
22+
compare_dependency_version "@reporters/github" "$NEW_VERSION" "$CURRENT_VERSION"
23+
24+
cd "$( dirname "$0" )/../.." || exit
25+
rm -rf tools/github_reporter
26+
27+
(
28+
rm -rf github-reporter-tmp
29+
mkdir github-reporter-tmp
30+
cd github-reporter-tmp || exit
31+
32+
"$NODE" "$NPM" init --yes
33+
"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts "@reporters/github@$NEW_VERSION"
34+
"$NODE" "$NPM" exec --package=esbuild@0.17.15 --yes -- esbuild ./node_modules/@reporters/github --bundle --platform=node --outfile=bundle.js
35+
)
36+
37+
mkdir tools/github_reporter
38+
mv github-reporter-tmp/bundle.js tools/github_reporter/index.js
39+
mv github-reporter-tmp/node_modules/@reporters/github/package.json tools/github_reporter/package.json
40+
rm -rf github-reporter-tmp/
41+
42+
# The last line of the script should always print the new version,
43+
# as we need to add it to $GITHUB_ENV variable.
44+
echo "NEW_VERSION=$NEW_VERSION"

0 commit comments

Comments
 (0)