From 0dfbbb3e10b41022415383b5b1c99b62bd483562 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 18 Aug 2024 20:02:47 +0300 Subject: [PATCH] refactor: move `package.json` scripts to ci (#424) Co-authored-by: Almanov Nikita <131481562+nikkeyl@users.noreply.github.com> --- .github/workflows/editorconfig.yaml | 2 +- .github/workflows/eslint.yaml | 9 +------ .github/workflows/prettier.yaml | 2 +- .github/workflows/release.yaml | 2 +- .github/workflows/remark.yaml | 2 +- .github/workflows/spec.yaml | 9 +------ README.md | 41 ++--------------------------- lint-staged.config.js | 3 +-- package.json | 10 +------ 9 files changed, 10 insertions(+), 70 deletions(-) diff --git a/.github/workflows/editorconfig.yaml b/.github/workflows/editorconfig.yaml index 6e40d76..2d26efe 100644 --- a/.github/workflows/editorconfig.yaml +++ b/.github/workflows/editorconfig.yaml @@ -26,4 +26,4 @@ jobs: run: bun i - name: Lint - run: bun lint:editorconfig + run: bun editorconfig-checker diff --git a/.github/workflows/eslint.yaml b/.github/workflows/eslint.yaml index a3acd34..8940b43 100644 --- a/.github/workflows/eslint.yaml +++ b/.github/workflows/eslint.yaml @@ -1,11 +1,6 @@ name: ESLint on: - workflow_run: - workflows: - - CodeQL - types: - - completed pull_request: branches: - main @@ -17,8 +12,6 @@ jobs: eslint: name: ESLint - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest timeout-minutes: 10 @@ -33,4 +26,4 @@ jobs: run: bun i - name: Lint - run: bun lint:ts + run: bun eslint src/**/*.ts diff --git a/.github/workflows/prettier.yaml b/.github/workflows/prettier.yaml index f2d4bd1..12be4f4 100644 --- a/.github/workflows/prettier.yaml +++ b/.github/workflows/prettier.yaml @@ -26,4 +26,4 @@ jobs: run: bun i - name: Lint - run: bun lint:formatting + run: bun prettier . --check diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 10c76f8..37e767d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -43,4 +43,4 @@ jobs: env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} # NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} - run: bun release + run: bun semantic-release diff --git a/.github/workflows/remark.yaml b/.github/workflows/remark.yaml index 22ee412..6a72b08 100644 --- a/.github/workflows/remark.yaml +++ b/.github/workflows/remark.yaml @@ -30,4 +30,4 @@ jobs: run: bun i - name: Lint - run: bun lint:md + run: bun remark . --quiet --frail diff --git a/.github/workflows/spec.yaml b/.github/workflows/spec.yaml index 5d340f2..9666e16 100644 --- a/.github/workflows/spec.yaml +++ b/.github/workflows/spec.yaml @@ -1,11 +1,6 @@ name: Spec on: - workflow_run: - workflows: - - ESLint - types: - - completed pull_request: branches: - main @@ -17,8 +12,6 @@ jobs: spec: name: Spec - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest timeout-minutes: 10 @@ -33,4 +26,4 @@ jobs: run: bun i - name: Specs - run: bun spec + run: bun test diff --git a/README.md b/README.md index fe4f84c..88d340d 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,8 @@ This template includes ready-made solutions for integration with: - **GitHub**. - **Commitlint**. - **Conventional Commits**. -- **Husky & Lint Staged**. +- **Husky**. +- **Lint Staged**. - **GitHub Actions**. - **Semantic Release**. - **Bun**. @@ -127,44 +128,6 @@ This template includes ready-made solutions for integration with: - `init`: Installs dependencies and **Husky**. -- `spec`: Runs **Bun** and the tests in the **specs/** folder. - - > Also runs using the [`spec.yaml`](.github/workflows/spec.yaml) workflow. - -- `spec:coverage`: Runs **Bun** with `--coverage` flag. - -- `release`: Runs **Semantic Release**. - -- `lint:editorconfig`: Runs **Editorconfig Checker** and - checks all files in the project. - - > Also runs with the [`editorconfig.yaml`](.github/workflows/editorconfig.yaml) - > workflow. - -- `lint:formatting`: Runs **Prettier** with the `--check` flag - for all files. - - > Runs with the [`prettier.yaml`](.github/workflows/prettier.yaml) - > - > Also run with a `pre-commit` hook. - -- `lint:md`: Runs **Remark** with the `--quiet` flag and - checks all **Markdown** files. - - > Also runs with the [`remark.yaml`](.github/workflows/remark.yaml) - > workflow. - -- `lint:ts`: Runs **ESLint** with the flag `--fix` - for all **TypeScript** files. - - > Runs with the [`eslint.yaml`](.github/workflows/eslint.yaml) - > workflow. - > - > Also run with a `pre-commit` hook. - -- `prettify`: Runs **Prettier** with the `--write` flag - for all files. - ## Workflows - [`auto-merge-dependabot-pull-request.yaml`](.github/workflows/auto-merge-dependabot-pull-request.yaml): diff --git a/lint-staged.config.js b/lint-staged.config.js index f6d4b52..a2063fc 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -1,5 +1,4 @@ export default { - '**/*.md': 'remark --quiet --frail', - '**/*': 'prettier --write', + '*': 'prettier --write', 'src/**/*.ts': 'eslint --fix', }; diff --git a/package.json b/package.json index 63c9083..06ada85 100644 --- a/package.json +++ b/package.json @@ -32,15 +32,7 @@ "index.js" ], "scripts": { - "init": "bun i && husky", - "spec": "bun test", - "spec:coverage": "bun test --coverage", - "release": "semantic-release", - "lint:editorconfig": "editorconfig-checker", - "lint:formatting": "prettier . --check", - "lint:md": "remark . --quiet --frail", - "lint:ts": "eslint src/**/*.ts --fix", - "prettify": "prettier . --write" + "init": "bun i && husky" }, "devDependencies": { "@archoleat/commitlint-define-config": "^1.0.9",