From 9ad67fd92aa6e28dd32a3aac9ba762e0ae61f54d Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Sat, 18 Apr 2026 15:11:39 -0300 Subject: [PATCH] build: align scripts and workflows with actions/* convention Match the standard layout used by actions/checkout, actions/setup-node, etc.: - package.json scripts: split format/format-check (Prettier) from lint/lint:fix (ESLint), and have pre-checkin run all four (format, lint:fix, build, test) in that order. - validate.yml lint job runs format-check + lint as separate steps. - test.yml drops the redundant --coverage flag (now in the test script). - Drop dependabot-build.yml: actions/* don't auto-rebuild dist on dependabot PRs; the check-dist style validate / build job catches drift and a maintainer rebuilds locally if needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/dependabot-build.yml | 49 -------------------------- .github/workflows/test.yml | 2 +- .github/workflows/validate.yml | 3 ++ CONTRIBUTING.md | 10 +++--- package.json | 15 ++++---- 5 files changed, 16 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/dependabot-build.yml diff --git a/.github/workflows/dependabot-build.yml b/.github/workflows/dependabot-build.yml deleted file mode 100644 index 742757b..0000000 --- a/.github/workflows/dependabot-build.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: dependabot-build - -on: - pull_request: - paths: - - 'package.json' - - 'package-lock.json' - -# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions -permissions: - contents: write - -jobs: - build: - runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' - steps: - - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - ref: ${{ github.head_ref }} - - - name: Setup Node.js - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v6.0.0 - with: - node-version-file: '.node-version' - cache: npm - - - name: Install dependencies - run: npm ci - - - name: Build - run: npm run build - - - name: Format - run: npm run format - - - name: Commit and push changes - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add -A - if git diff --cached --quiet; then - echo "No changes to commit" - else - git commit -m "chore: update dist" - git push - fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d9c62fa..25d9d61 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: run: npm ci - name: Test - run: npm test -- --coverage + run: npm test - name: Upload coverage uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index d907399..92692c3 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -31,6 +31,9 @@ jobs: - name: Install dependencies run: npm ci + - + name: Format check + run: npm run format-check - name: Lint run: npm run lint diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 43ae3e6..eaa00d6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,10 +40,12 @@ or rerun `npm run build` locally with the Node version in `.node-version`. | Script | Purpose | | ------------------- | ------------------------------------------------ | | `npm run build` | Bundle `src/` to `dist/index.js` via `ncc` | -| `npm run lint` | Prettier check + ESLint | -| `npm run format` | Prettier write + ESLint --fix | -| `npm test` | Run Jest | -| `npm run pre-checkin` | `format` + `build` + `test` | +| `npm run format` | Run Prettier (write) | +| `npm run format-check` | Run Prettier (check only, used in CI) | +| `npm run lint` | Run ESLint (check only, used in CI) | +| `npm run lint:fix` | Run ESLint with `--fix` | +| `npm test` | Run Jest with coverage | +| `npm run pre-checkin` | `format` + `lint:fix` + `build` + `test` | ## Tests diff --git a/package.json b/package.json index ea24e52..64cc579 100644 --- a/package.json +++ b/package.json @@ -5,15 +5,12 @@ "type": "module", "scripts": { "build": "ncc build src/main.ts --minify --license licenses.txt", - "lint": "npm run prettier && npm run eslint", - "format": "npm run prettier:fix && npm run eslint:fix", - "eslint": "eslint --max-warnings=0 .", - "eslint:fix": "eslint --fix .", - "prettier": "prettier --check \"./**/*.ts\"", - "prettier:fix": "prettier --write \"./**/*.ts\"", - "test": "NODE_OPTIONS='--experimental-vm-modules' jest", - "pre-checkin": "npm run format && npm run build && npm test", - "all": "npm run build && npm run format && npm test" + "format": "prettier --write \"**/*.ts\"", + "format-check": "prettier --check \"**/*.ts\"", + "lint": "eslint --max-warnings=0 \"**/*.ts\"", + "lint:fix": "eslint --fix \"**/*.ts\"", + "test": "NODE_OPTIONS='--experimental-vm-modules' jest --coverage", + "pre-checkin": "npm run format && npm run lint:fix && npm run build && npm test" }, "repository": { "type": "git",