From 942f6a011350de159865205787d402803147da42 Mon Sep 17 00:00:00 2001 From: aria Date: Sat, 14 Dec 2024 21:05:52 -0600 Subject: [PATCH] chore: add github actions --- .eslintrc | 4 ++++ .github/workflows/lint.js.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/typecheck.js.yml | 29 +++++++++++++++++++++++++++++ package.json | 4 ++++ tsconfig.json | 4 ++++ 5 files changed, 70 insertions(+) create mode 100644 .github/workflows/lint.js.yml create mode 100644 .github/workflows/typecheck.js.yml diff --git a/.eslintrc b/.eslintrc index a0c2eb9..5cb4f76 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,6 +8,10 @@ "@typescript-eslint", "import" ], + "ignorePatterns": [ + "node_modules/", + "dist/" + ], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", diff --git a/.github/workflows/lint.js.yml b/.github/workflows/lint.js.yml new file mode 100644 index 0000000..4885e8f --- /dev/null +++ b/.github/workflows/lint.js.yml @@ -0,0 +1,29 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Lint + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: lint diff --git a/.github/workflows/typecheck.js.yml b/.github/workflows/typecheck.js.yml new file mode 100644 index 0000000..77788bc --- /dev/null +++ b/.github/workflows/typecheck.js.yml @@ -0,0 +1,29 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Typecheck + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: typecheck diff --git a/package.json b/package.json index 40fbce3..3e60ecc 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,10 @@ "description": "Easily find any image inside your vault", "main": "dist/main.js", "scripts": { + "typecheck": "tsc --noEmit", + "lint": "eslint . --ext .js,.jsx,.ts,.tsx", + "lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix", + "ci": "npm run typecheck && npm run lint", "dev": "node esbuild.config.mjs", "prebuild": "rimraf dist", "build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", diff --git a/tsconfig.json b/tsconfig.json index 41a55fc..0046e36 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,5 +24,9 @@ "include": [ "**/*.ts", "src/main.tsx" + ], + "ignore": [ + "node_modules", + "dist" ] } \ No newline at end of file