From 33a44f35c1fbe5ae3901fd5120071a1c23c941cc Mon Sep 17 00:00:00 2001 From: oscnord <6131004+oscnord@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:18:05 +0100 Subject: [PATCH] fix: github actions --- .github/workflows/lint.yml | 17 +++++++++++++++++ .github/workflows/prettier.yml | 17 +++++++++++++++++ .github/workflows/test.yml | 26 ++++++++++++-------------- .github/workflows/typescript.yml | 17 +++++++++++++++++ tsconfig.base.json | 24 ++++++++++++++++++++++++ tsconfig.json | 29 ++++++++++++++--------------- 6 files changed, 101 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/prettier.yml create mode 100644 .github/workflows/typescript.yml create mode 100644 tsconfig.base.json diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..7620767 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,17 @@ +name: Linting +on: [pull_request] + +jobs: + lint: + if: "!contains(github.event.pull_request.title, 'WIP!')" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.x' + - name: Install Dependencies + run: npm ci + - name: Run Eslint + run: npm run lint diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml new file mode 100644 index 0000000..ca4475f --- /dev/null +++ b/.github/workflows/prettier.yml @@ -0,0 +1,17 @@ +name: Prettier +on: [pull_request] + +jobs: + pretty: + if: "!contains(github.event.pull_request.title, 'WIP!')" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.x' + - name: Install Dependencies + run: npm ci + - name: Run Prettier + run: npm run pretty diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9662099..3faad09 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,18 +1,16 @@ -name: Run tests -on: push +name: Unit Tests +on: [push] + jobs: - test: + unittests: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.x] steps: - - uses: actions/checkout@v1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} - - name: Install dependencies and run tests - run: | - npm install - npm test + node-version: '18.x' + - name: Install Dependencies + run: npm ci + - name: Run Unit Tests + run: npm test diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml new file mode 100644 index 0000000..9ca981d --- /dev/null +++ b/.github/workflows/typescript.yml @@ -0,0 +1,17 @@ +name: Type Check +on: [pull_request] + +jobs: + ts: + if: "!contains(github.event.pull_request.title, 'WIP!')" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.x' + - name: Install Dependencies + run: npm ci + - name: Run Type Check + run: npm run typecheck diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 0000000..a7c1f1f --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* JavaScript Support */ + "allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */, + "checkJs": true /* Enable error reporting in type-checked JavaScript files. */, + + /* Emit */ + "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, + "declarationMap": true /* Create sourcemaps for d.ts files. */, + "sourceMap": true /* Create source map files for emitted JavaScript files. */, + + /* Interop Constraints */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + + /* Type Checking */ + "strict": true /* Enable all strict type-checking options. */, + + /* Completeness */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/tsconfig.json b/tsconfig.json index bac08f0..4726840 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,18 +1,17 @@ - -// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs { + "extends": "./tsconfig.base.json", "compilerOptions": { - "module": "commonjs", - "esModuleInterop": true, - "target": "es6", - "moduleResolution": "node", - "sourceMap": true, - "outDir": "dist", - "resolveJsonModule": true, - "strictNullChecks": true, - "declaration": true, - "declarationDir": "./dist" - }, - "lib": ["es2016"], - "include": ["src", "types"], + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Language and Environment */ + "target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + "lib": [ + "es2022" + ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, + + /* Modules */ + "module": "commonjs" /* Specify what module code is generated. */, + "resolveJsonModule": true /* Enable importing .json files. */, + "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */ + } }