From 699ecd0736d1a4d07700fa50ca9a295fb04fcb5e Mon Sep 17 00:00:00 2001 From: David Houweling Date: Sat, 19 Oct 2024 21:45:15 +1100 Subject: [PATCH 1/4] add CI steps --- .github/dependabot.yml | 19 +++++++++++++++++ .github/workflows/build.yml | 31 +++++++++++++++++++++++++++ .github/workflows/lint.yml | 42 +++++++++++++++++++++++++++++++++++++ .gitignore | 2 ++ package.json | 3 ++- tsconfig.build.json | 9 ++++++++ 6 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/lint.yml create mode 100644 tsconfig.build.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f679d2e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,19 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "npm" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + groups: + all: + patterns: + - "*" + update-types: + - "minor" + - "patch" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c2c0563 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: Build + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + run-linters: + name: Run linters + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "npm" + + # ESLint and Prettier must be in `package.json` + - name: Install Node.js dependencies + run: npm ci + + - name: Run build + run: npm run build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..086a8c6 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,42 @@ +name: Lint + +on: + push: + branches: + - main + pull_request: + branches: + - main + +permissions: + checks: write + contents: write + +jobs: + run-linters: + name: Run linters + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "npm" + + # ESLint and Prettier must be in `package.json` + - name: Install Node.js dependencies + run: npm ci + + - name: Run linters + uses: wearerequired/lint-action@v2 + with: + auto_fix: true + eslint: true + eslint_auto_fix: true + eslint_args: "--max-warnings 0" + prettier: true + prettier_auto_fix: true diff --git a/.gitignore b/.gitignore index a6bb977..f3883fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +dist + # Logs logs *.log diff --git a/package.json b/package.json index c3b0c90..1f1cb4b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "format": "npx prettier . --check", "format:fix": "npx prettier . --write", "lint": "npx eslint .", - "lint:fix": "npx eslint . --fix" + "lint:fix": "npx eslint . --fix", + "build": "tsc --project tsconfig.build.json" }, "devDependencies": { "@eslint/js": "^9.12.0", diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..f9420a1 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist", + "declaration": true, + "declarationMap": true, + "sourceMap": true + } +} From 1cad22abcf224be60efca3f8cb07cb5d26703f0e Mon Sep 17 00:00:00 2001 From: David Houweling Date: Sat, 19 Oct 2024 21:50:02 +1100 Subject: [PATCH 2/4] fix eslint config path --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 086a8c6..03ddd43 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -37,6 +37,6 @@ jobs: auto_fix: true eslint: true eslint_auto_fix: true - eslint_args: "--max-warnings 0" + eslint_args: "-c eslint.config.mjs --max-warnings 0" prettier: true prettier_auto_fix: true From 967dcd080e678d5060ec579ef50e03f7aee43354 Mon Sep 17 00:00:00 2001 From: David Houweling Date: Sat, 19 Oct 2024 21:50:43 +1100 Subject: [PATCH 3/4] fix build naming --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c2c0563..305b969 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,8 +9,8 @@ on: - main jobs: - run-linters: - name: Run linters + run-build: + name: Run Build runs-on: ubuntu-latest steps: From 5dde0b75144702cbe2e2c2f77e82633b82332b49 Mon Sep 17 00:00:00 2001 From: David Houweling Date: Sat, 19 Oct 2024 21:56:15 +1100 Subject: [PATCH 4/4] temporarily use normal lint rather than lint-actions --- .github/workflows/lint.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 03ddd43..2386131 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -27,16 +27,22 @@ jobs: node-version: 20 cache: "npm" - # ESLint and Prettier must be in `package.json` - name: Install Node.js dependencies run: npm ci + # TODO: remove once lint-action supports eslint v9 + - name: Run eslint + run: npm run lint + - name: Run linters uses: wearerequired/lint-action@v2 with: auto_fix: true - eslint: true - eslint_auto_fix: true - eslint_args: "-c eslint.config.mjs --max-warnings 0" + # TODO: enable again once eslint v9 is supported + # eslint: true + # eslint_auto_fix: true + # eslint_args: "--max-warnings 0" prettier: true prettier_auto_fix: true + tsc: true + tsc_auto_fix: true