Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[infra] Bring in latest docsy-starter changes, mainly check-format workflow #8

Merged
merged 7 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/check-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Files

on:
merge_group:
pull_request:
push: { branches: [main] }

jobs:
check-filenames:
name: FILENAME check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm run check:filenames

check-formatting:
name: FILE FORMAT
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Create NPM cache-hash input file
run: |
mkdir -p tmp
jq '{devDependencies, engines, gitHubActionCacheKey}' package.json > tmp/package-ci.json

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: tmp/package-ci.json

- name: Check file format
run: npm run check:format --ignore-scripts
28 changes: 17 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,35 @@
"__check:links": "make --keep-going check-links",
"_build": "npm run _hugo-dev --",
"_check:format": "npx prettier --check .",
"_check:links": "HTMLTEST_ARGS='--log-level 1 --skip-external' npm run __check:links",
"_check:links--warn": "npm run _check:links || (echo; echo 'WARNING: see link-checker output for issues.'; echo)",
"_check:links": "HTMLTEST_ARGS='--log-level 1 --skip-external' npm run __check:links",
"_diff:check": "git diff --name-only --exit-code",
"_filename-error": "echo 'ERROR: the following files violate naming conventions; fix using: `npm run fix:filenames`'; echo; npm run -s _ls-bad-filenames; exit 1",
"_filenames-to-kebab-case": "find assets content -name '*_*' ! -name '[_.]*' -exec sh -c 'mv \"$1\" \"${1//_/-}\"' _ {} \\;",
"_get:no": "echo SKIPPING get operation",
"_get:submodule": "set -x && git submodule update --init ${DEPTH:- --depth 1}",
"_hugo": "hugo --cleanDestinationDir",
"_hugo-dev": "npm run _hugo -- -e dev -DFE",
"_hugo": "hugo --cleanDestinationDir",
"_ls-bad-filenames": "find assets content -name '*_*' ! -name '[_.]*'",
"_prepare:docsy": "cd themes/docsy && npm install",
"_serve": "npm run _hugo-dev -- --minify serve",
"_serve": "npm run _hugo-dev -- serve --minify --disableFastRender --renderToMemory",
"build:preview": "npm run _hugo-dev -- --minify --baseURL \"${DEPLOY_PRIME_URL:-http://localhost}\"",
"build:production": "npm run _hugo -- --minify",
"build": "npm run _build --",
"check:filenames": "test -z \"$(npm run -s _ls-bad-filenames)\" || npm run -s _filename-error",
"check:format": "npm run _check:format || (echo '[help] Run: npm run fix:format'; exit 1)",
"check:links:all": "HTMLTEST_ARGS= npm run _check:links",
"check:links": "npm run _check:links",
"clean": "rm -Rf public",
"diff:check": "npm run _diff:check || (echo; echo 'WARNING: the files above have not been committed'; echo)",
"fix:filenames": "npm run _filenames-to-kebab-case",
"fix:format": "npm run _check:format -- --write",
"get:submodule": "npm run _get:${GET:-submodule}",
"make:public": "git init -b main public",
"precheck:links:all": "npm run build",
"precheck:links": "npm run build",
"postbuild:preview": "npm run _check:links--warn",
"postbuild:production": "npm run _check:links--warn",
"precheck:links:all": "npm run build",
"precheck:links": "npm run build",
"prepare": "npm run seq -- get:submodule _prepare:docsy",
"seq": "bash -c 'for cmd in \"$@\"; do npm run $cmd || exit 1; done' - ",
"serve": "npm run _serve",
Expand All @@ -35,15 +41,15 @@
"update:pkgs": "npx npm-check-updates -u"
},
"devDependencies": {
"autoprefixer": "^10.4.19",
"cspell": "^8.8.4",
"hugo-extended": "0.127.0",
"autoprefixer": "^10.4.20",
"cspell": "^8.13.1",
"hugo-extended": "0.131.0",
"postcss-cli": "^11.0.0",
"prettier": "^3.3.1"
"prettier": "^3.3.3"
},
"optionalDependencies": {
"netlify-cli": "^17.26.1",
"npm-check-updates": "^16.14.20"
"netlify-cli": "^17.33.6",
"npm-check-updates": "^17.0.5"
},
"enginesComment": "Ensure that engines.node value stays consistent with the project's .nvmrc",
"engines": {
Expand Down