File tree 5 files changed +75
-43
lines changed
5 files changed +75
-43
lines changed Original file line number Diff line number Diff line change
1
+ name : Files
2
+
3
+ on :
4
+ merge_group :
5
+ pull_request :
6
+
7
+ jobs :
8
+ check-expired :
9
+ name : EXPIRED FILE check
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - uses : actions/checkout@v4
13
+ - run : npm run check:expired
14
+ - run : npm run _diff:fail
15
+
16
+ check-filenames :
17
+ name : FILENAME check
18
+ runs-on : ubuntu-latest
19
+ steps :
20
+ - uses : actions/checkout@v4
21
+ - run : npm run check:filenames
22
+
23
+ check-formatting :
24
+ name : FILE FORMAT
25
+ runs-on : ubuntu-latest
26
+ steps :
27
+ - uses : actions/checkout@v4
28
+ - run : npm run check:format
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -26,16 +26,19 @@ jobs:
26
26
suggestions : true
27
27
28
28
dict-check :
29
- name : CSPELL:IGNORE check
29
+ name : CSPELL page-local word list check
30
30
runs-on : ubuntu-latest
31
+ env :
32
+ FIX_CMD : fix:dict
31
33
steps :
32
34
- uses : actions/checkout@v4
33
- - run : npm run fix:dict
35
+ - run : npm run ${{ env.FIX_CMD }}
34
36
- name : Any changed files?
35
37
run : |
36
38
CHANGES=`git status --porcelain`
37
39
if [[ $CHANGES ]]; then
38
- echo "Locally run `npm run fix:dict` and commit the changes:"
40
+ echo "Add comment '/fix:${{ env.FIX_CMD }}' to your PR in GitHub,"
41
+ echo "or locally run 'npm run ${{ env.FIX_CMD }}' and commit the changes:"
39
42
echo "$CHANGES"
40
43
exit 1
41
44
else
Original file line number Diff line number Diff line change 6
6
"scripts" : {
7
7
"__check:links" : " make --keep-going check-links" ,
8
8
"_build" : " npm run _hugo -- -e dev --buildDrafts --buildFuture --baseURL \" ${DEPLOY_PRIME_URL:-http://localhost}\" " ,
9
- "__check:format" : " npx prettier${PRETTIER_AT_VERS} " ,
9
+ "__check:format" : " ./scripts/ npx-helper.sh prettier" ,
10
10
"_check:format:any" : " npm run __check:format -- --check --ignore-path ''" ,
11
11
"_check:format:ja+zh" : " npm run _check:format:nowrap -- content/ja content/zh" ,
12
12
"_check:format:nowrap" : " npm run _check:format:any -- --prose-wrap preserve" ,
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ # Runs the given command with npx, ensuring that the version of the
4
+ # command/package as declared in `package.json` is first installed.
5
+
6
+ if [ $# -eq 0 ]; then
7
+ echo " Usage: $0 [--no-ignore-scripts] <npm-command-and-package-name> [args...]"
8
+ exit 1
9
+ fi
10
+
11
+ npx_vers_from_pkg_json () {
12
+ local npm_i_flags=" --no-save"
13
+ if [[ " $1 " == " --no-ignore-scripts" ]]; then
14
+ shift
15
+ else
16
+ npm_i_flags+=" --ignore-scripts"
17
+ fi
18
+ local command=$1 ; shift ;
19
+ # For now we assume that the package name is the same as the command name.
20
+ local package=$command
21
+ if ! [[ $package =~ ^[a-zA-Z0-9_-]+$ ]]; then
22
+ echo " ERROR: Invalid package name '$package '"
23
+ exit 1
24
+ fi
25
+ local args=$@
26
+
27
+ local version=$( npm pkg get devDependencies.$package | tr -d ' ^"' )
28
+ if [[ $version == " {}" ]]; then
29
+ echo " ERROR: Could not determine version of '$package ' from package.json"
30
+ exit 1
31
+ fi
32
+ local pkgAtVers=" $package @$version "
33
+
34
+ if ! npm ls $pkgAtVers ; then
35
+ (set -x; npm install $npm_i_flags $pkgAtVers )
36
+ fi
37
+ set -x && npx $pkgAtVers $args
38
+ }
39
+
40
+ npx_vers_from_pkg_json $@ ;
You can’t perform that action at this time.
0 commit comments