Skip to content

Commit 79c6fac

Browse files
committed
clean up scripts
1 parent 1d1e12d commit 79c6fac

File tree

4 files changed

+92
-30
lines changed

4 files changed

+92
-30
lines changed

.github/workflows/build-test-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
# For repository named username.github.io, use https://username.github.io
5555
# For other repositories, use https://username.github.io/repository-name
5656
SITE_URL: ${{ github.event.repository.name == format('{0}.github.io', github.repository_owner) && format('https://{0}.github.io', github.repository_owner) || format('https://{0}.github.io/{1}', github.repository_owner, github.event.repository.name) }}
57-
run: yarn run generate-sitemap
57+
run: yarn build:sitemap
5858
- name: Upload build artifact, ready for GitHub Pages deployment
5959
uses: actions/upload-pages-artifact@v4
6060
with:

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Access your site at <http://127.0.0.1:4000> (or see other "server address" in co
4545
### Serve/run the site
4646

4747
```sh
48-
bundle exec jekyll serve --livereload
48+
yarn dev
4949
```
5050

5151
### Linting
@@ -62,7 +62,17 @@ And automatically fix with:
6262
yarn format
6363
```
6464

65-
**Note:** Prettier caching is enabled using the `cache/` folder to speed up formatting checks. The cache is only written during `--write` operations (not `--check`), so CI environments should not expect cache benefits on lint-only operations.
65+
You can also run these commands on specific files:
66+
67+
```sh
68+
yarn lint source/index.html README.md
69+
yarn format source/index.html README.md
70+
```
71+
72+
**Notes:**
73+
- Prettier caching is enabled using the `cache/` folder to speed up formatting checks. The cache is only written during `--write` operations (not `--check`), so CI environments should not expect cache benefits on lint-only operations.
74+
- Markdown files (`.md`) are formatted by markdownlint, not Prettier (see `.prettierignore`).
75+
- When you pass specific files, only `.md` files are processed by markdownlint; other file types are silently skipped.
6676

6777
### Testing
6878

package.json

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,55 @@
11
{
22
"--": [
33
"Notes:",
4-
"Our scripts use a special POSIX shim that allows you to run i.e. yarn markdownlint-check and specify files to check, or omit the files and it has a default.",
5-
"The magic is in the ${@:-\"**/*.md\"} part:",
6-
"$@: This represents all the arguments passed to the script (e.g., the files you want to lint).",
7-
"${...:-...}: This is the shell's 'use default value' operator.",
8-
"In plain English, it means: If $@ (the list of arguments) is empty or not set, use the default value **/*.md. Otherwise, use the arguments that were provided."
4+
"",
5+
"Script argument handling:",
6+
"- Our scripts use a special POSIX shim that allows you to run i.e. yarn lint:markdown and specify files to check, or omit the files and it has a default.",
7+
"- The magic is in the ${@:-\"**/*.md\"} part:",
8+
" - $@: This represents all the arguments passed to the script (e.g., the files you want to lint).",
9+
" - ${...:-...}: This is the shell's 'use default value' operator.",
10+
" - In plain English: If $@ (the list of arguments) is empty or not set, use the default value **/*.md. Otherwise, use the arguments that were provided.",
11+
"",
12+
"Markdown file filtering:",
13+
"- lint:markdown and format:markdown only process .md files when specific files are passed.",
14+
"- If you run 'yarn format source/index.html README.md', only README.md gets passed to markdownlint.",
15+
"- This is necessary because markdownlint-cli2 does not filter by extension - it will attempt to lint any file you explicitly pass to it.",
16+
"- The shell loop 'for file in \"$@\"; do case \"$file\" in *.md) ...' implements this filtering.",
17+
"",
18+
"Prettier ignore behavior:",
19+
"- Prettier respects .prettierignore even when you pass specific file paths.",
20+
"- .prettierignore contains '*.md' so Prettier silently skips Markdown files.",
21+
"- This means 'yarn format README.md' will skip Prettier but run markdownlint on README.md.",
22+
"- This is intentional: we want markdownlint (not Prettier) to format Markdown files.",
23+
"",
24+
"Known issues:",
25+
"- yarn test:html-validate returns exit code 129 when run through yarn, despite tests passing.",
26+
"- This appears to be related to how Yarn Berry handles worker_threads termination.",
27+
"- Workaround: run tests individually or use CI/CD which may handle this differently.",
28+
"- The tests themselves pass correctly (see output), only the exit code is affected."
929
],
1030
"license": "UNLICENSED",
1131
"devDependencies": {
12-
"@fulldecent/nice-checkers-plugin": "^1.2.0",
32+
"@fulldecent/nice-checkers-plugin": "^1.2.1",
1333
"@shopify/prettier-plugin-liquid": "^1.10.0",
1434
"cheerio": "^1.1.2",
1535
"css": "^3.0.0",
1636
"glob": "^13.0.0",
1737
"html-validate": "^10.4.0",
18-
"markdownlint-cli2": "^0.19.1",
38+
"markdownlint-cli2": "^0.20.0",
1939
"prettier": "^3.7.4"
2040
},
2141
"scripts": {
2242
"lint": "sh -c 'yarn lint:prettier \"$@\" && yarn lint:markdown \"$@\"' --",
2343
"lint:prettier": "sh -c 'yarn prettier --cache --cache-location=cache/.prettiercache --check ${@:-\".\"}' --",
24-
"lint:markdown": "sh -c 'yarn markdownlint-cli2 ${@:-\"**/*.md\"}' --",
25-
"format": "sh -c 'yarn prettier --cache --cache-location=cache/.prettiercache --write ${@:-\".\"} && yarn markdownlint-cli2 --fix ${@:-\"**/*.md\"}' --",
26-
"build": "bundle exec jekyll build",
27-
"generate-sitemap": "node scripts/generate-sitemap.mjs",
28-
"test": "sh -c 'yarn test:html-validate \"$@\" && yarn test:dirty-file-paths-checker \"$@\" && yarn test:unused-assets' --",
44+
"lint:markdown": "sh -c 'if [ $# -eq 0 ]; then yarn markdownlint-cli2 \"**/*.md\"; else for file in \"$@\"; do case \"$file\" in *.md) yarn markdownlint-cli2 \"$file\";; esac; done; fi' --",
45+
"format": "sh -c 'yarn format:prettier \"$@\" && yarn format:markdown \"$@\"' --",
46+
"format:prettier": "sh -c 'yarn prettier --cache --cache-location=cache/.prettiercache --write ${@:-\".\"}' --",
47+
"format:markdown": "sh -c 'if [ $# -eq 0 ]; then yarn markdownlint-cli2 --fix \"**/*.md\"; else for file in \"$@\"; do case \"$file\" in *.md) yarn markdownlint-cli2 --fix \"$file\";; esac; done; fi' --",
48+
"dev": "bundle exec jekyll serve --livereload",
49+
"build": "yarn build:jekyll && yarn build:sitemap",
50+
"build:jekyll": "bundle exec jekyll build",
51+
"build:sitemap": "node scripts/generate-sitemap.mjs",
52+
"test": "sh -c 'yarn test:html-validate \"$@\" && yarn test:dirty-file-paths-checker && yarn test:unused-assets' --",
2953
"test:html-validate": "node test/html-validate.mjs",
3054
"test:dirty-file-paths-checker": "node test/dirty-file-paths-checker.mjs",
3155
"test:unused-assets": "node test/unused-assets.mjs",

yarn.lock

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ __metadata:
55
version: 8
66
cacheKey: 10c0
77

8-
"@fulldecent/nice-checkers-plugin@npm:^1.2.0":
9-
version: 1.2.0
10-
resolution: "@fulldecent/nice-checkers-plugin@npm:1.2.0"
8+
"@fulldecent/nice-checkers-plugin@npm:^1.2.1":
9+
version: 1.2.1
10+
resolution: "@fulldecent/nice-checkers-plugin@npm:1.2.1"
1111
dependencies:
1212
better-sqlite3: "npm:^12.5.0"
13+
cheerio: "npm:^1.1.2"
1314
shell-quote: "npm:^1.8.3"
1415
peerDependencies:
1516
html-validate: ^10.0.0
16-
checksum: 10c0/d0249c4547a3249e5ca5c008c0f42041f3132f21827b731fa2aad5bb4fc69f776c014a2845d3c228ff07baf038ab97858e87a6d420e00714d748048ca5420fa5
17+
checksum: 10c0/fa5d2a12a8d44cbe39fe9da496b372749cba602bb33815a6958dd280c27e4e604e8adc09d0b9440ebd998a65c1514e78d08d52b06230b29182e6cfb2eb19afd3
1718
languageName: node
1819
linkType: hard
1920

@@ -839,6 +840,13 @@ __metadata:
839840
languageName: node
840841
linkType: hard
841842

843+
"get-east-asian-width@npm:^1.3.0":
844+
version: 1.4.0
845+
resolution: "get-east-asian-width@npm:1.4.0"
846+
checksum: 10c0/4e481d418e5a32061c36fbb90d1b225a254cc5b2df5f0b25da215dcd335a3c111f0c2023ffda43140727a9cafb62dac41d022da82c08f31083ee89f714ee3b83
847+
languageName: node
848+
linkType: hard
849+
842850
"github-from-package@npm:0.0.0":
843851
version: 0.0.0
844852
resolution: "github-from-package@npm:0.0.0"
@@ -1325,26 +1333,26 @@ __metadata:
13251333
languageName: node
13261334
linkType: hard
13271335

1328-
"markdownlint-cli2@npm:^0.19.1":
1329-
version: 0.19.1
1330-
resolution: "markdownlint-cli2@npm:0.19.1"
1336+
"markdownlint-cli2@npm:^0.20.0":
1337+
version: 0.20.0
1338+
resolution: "markdownlint-cli2@npm:0.20.0"
13311339
dependencies:
13321340
globby: "npm:15.0.0"
13331341
js-yaml: "npm:4.1.1"
13341342
jsonc-parser: "npm:3.3.1"
13351343
markdown-it: "npm:14.1.0"
1336-
markdownlint: "npm:0.39.0"
1344+
markdownlint: "npm:0.40.0"
13371345
markdownlint-cli2-formatter-default: "npm:0.0.6"
13381346
micromatch: "npm:4.0.8"
13391347
bin:
13401348
markdownlint-cli2: markdownlint-cli2-bin.mjs
1341-
checksum: 10c0/fdac00f87a0a4ad155a332f5926d6ce4be153f4fac0362722d9620821bb638f2def29991ede102d245975a62084323f1a3032dfc4f39f17899b38f11f79619e5
1349+
checksum: 10c0/6c5dfc16b93db4adb39a890a745e71eda91e43e0abbd3e70f9f96057bf2c07de9df982c0be2868be170dbfa59e162c9b8632849096a177cf164f9dbd9c5f67b4
13421350
languageName: node
13431351
linkType: hard
13441352

1345-
"markdownlint@npm:0.39.0":
1346-
version: 0.39.0
1347-
resolution: "markdownlint@npm:0.39.0"
1353+
"markdownlint@npm:0.40.0":
1354+
version: 0.40.0
1355+
resolution: "markdownlint@npm:0.40.0"
13481356
dependencies:
13491357
micromark: "npm:4.0.2"
13501358
micromark-core-commonmark: "npm:2.0.3"
@@ -1354,7 +1362,8 @@ __metadata:
13541362
micromark-extension-gfm-table: "npm:2.1.1"
13551363
micromark-extension-math: "npm:3.1.0"
13561364
micromark-util-types: "npm:2.0.2"
1357-
checksum: 10c0/aaa079902fa1585e3769a0f699478cdcca0e2bf205916e5cc90a362746548b5530aa8e0a762e255b5e05dc481d86f9e8859780d4e5943e3ace8a5fb48023b6af
1365+
string-width: "npm:8.1.0"
1366+
checksum: 10c0/1543fcf4a433bc54e0e565cb1c8111e5e3d0df3742df0cc840d470bced21a1e3b5593e4e380ad0d8d5e490d9b399699d48aeabed33719f3fbdc6d00128138f20
13581367
languageName: node
13591368
linkType: hard
13601369

@@ -2167,14 +2176,14 @@ __metadata:
21672176
version: 0.0.0-use.local
21682177
resolution: "root-workspace-0b6124@workspace:."
21692178
dependencies:
2170-
"@fulldecent/nice-checkers-plugin": "npm:^1.2.0"
2179+
"@fulldecent/nice-checkers-plugin": "npm:^1.2.1"
21712180
"@shopify/prettier-plugin-liquid": "npm:^1.10.0"
21722181
cheerio: "npm:^1.1.2"
21732182
css: "npm:^3.0.0"
21742183
front-matter: "npm:^4.0.2"
21752184
glob: "npm:^13.0.0"
21762185
html-validate: "npm:^10.4.0"
2177-
markdownlint-cli2: "npm:^0.19.1"
2186+
markdownlint-cli2: "npm:^0.20.0"
21782187
prettier: "npm:^3.7.4"
21792188
xml2js: "npm:^0.6.2"
21802189
dependenciesMeta:
@@ -2363,6 +2372,16 @@ __metadata:
23632372
languageName: node
23642373
linkType: hard
23652374

2375+
"string-width@npm:8.1.0":
2376+
version: 8.1.0
2377+
resolution: "string-width@npm:8.1.0"
2378+
dependencies:
2379+
get-east-asian-width: "npm:^1.3.0"
2380+
strip-ansi: "npm:^7.1.0"
2381+
checksum: 10c0/749b5d0dab2532b4b6b801064230f4da850f57b3891287023117ab63a464ad79dd208f42f793458f48f3ad121fe2e1f01dd525ff27ead957ed9f205e27406593
2382+
languageName: node
2383+
linkType: hard
2384+
23662385
"string-width@npm:^5.0.1, string-width@npm:^5.1.2":
23672386
version: 5.1.2
23682387
resolution: "string-width@npm:5.1.2"
@@ -2401,6 +2420,15 @@ __metadata:
24012420
languageName: node
24022421
linkType: hard
24032422

2423+
"strip-ansi@npm:^7.1.0":
2424+
version: 7.1.2
2425+
resolution: "strip-ansi@npm:7.1.2"
2426+
dependencies:
2427+
ansi-regex: "npm:^6.0.1"
2428+
checksum: 10c0/0d6d7a023de33368fd042aab0bf48f4f4077abdfd60e5393e73c7c411e85e1b3a83507c11af2e656188511475776215df9ca589b4da2295c9455cc399ce1858b
2429+
languageName: node
2430+
linkType: hard
2431+
24042432
"strip-json-comments@npm:~2.0.1":
24052433
version: 2.0.1
24062434
resolution: "strip-json-comments@npm:2.0.1"

0 commit comments

Comments
 (0)