From 0bb40b0f0453c2d7faeddc5fdfb94fd8a45a55bd Mon Sep 17 00:00:00 2001 From: James Donnelly <4444684+JDIZM@users.noreply.github.com> Date: Sun, 28 Jul 2024 16:14:47 +0100 Subject: [PATCH 1/4] change file format --- .eslintrc.js => .eslintrc.cjs | 2 +- .prettierrc.js | 9 --------- .prettierrc.json | 10 ++++++++++ 3 files changed, 11 insertions(+), 10 deletions(-) rename .eslintrc.js => .eslintrc.cjs (98%) delete mode 100644 .prettierrc.js create mode 100644 .prettierrc.json diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 98% rename from .eslintrc.js rename to .eslintrc.cjs index 5b582af..47bab1b 100644 --- a/.eslintrc.js +++ b/.eslintrc.cjs @@ -1,7 +1,7 @@ module.exports = { root: true, env: { - es2021: true, + es2022: true, node: true }, extends: [ diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 036e67d..0000000 --- a/.prettierrc.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - trailingComma: "none", - tabWidth: 2, - semi: true, - singleQuote: false, - printWidth: 120, - bracketSpacing: true, - endOfLine: "lf" -}; diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..fb8ce5e --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://json.schemastore.org/prettierrc", + "semi": true, + "tabWidth": 2, + "singleQuote": false, + "printWidth": 120, + "trailingComma": "none", + "bracketSpacing": true, + "endOfLine": "lf" +} From e7f21627d464d99558518d395406f25c55816673 Mon Sep 17 00:00:00 2001 From: James Donnelly <4444684+JDIZM@users.noreply.github.com> Date: Sun, 28 Jul 2024 16:24:16 +0100 Subject: [PATCH 2/4] switch coverage to istanbul --- vitest.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/vitest.config.ts b/vitest.config.ts index e765636..bfdeda2 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -4,6 +4,7 @@ import { defineConfig } from "vite"; export default defineConfig({ test: { coverage: { + provider: "istanbul", // or 'v8' exclude: ["**/node_modules/**", "test*", "build.*", ".*.js", "types", "index.ts"] } } From 62a5d00dc8a8112875dcd89cac54a2d68ae5ba68 Mon Sep 17 00:00:00 2001 From: James Donnelly <4444684+JDIZM@users.noreply.github.com> Date: Sun, 28 Jul 2024 16:55:38 +0100 Subject: [PATCH 3/4] chore(deps): update deps --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 020b550..ab21e9c 100644 --- a/package.json +++ b/package.json @@ -19,17 +19,17 @@ "author": "JDIZM", "license": "ISC", "devDependencies": { - "@types/node": "^20.2.1", - "@typescript-eslint/eslint-plugin": "^7.0.0", - "@typescript-eslint/parser": "^7.0.0", - "@vitest/coverage-v8": "^2.0.0", + "@types/node": "^22.0.0", + "@typescript-eslint/eslint-plugin": "^7.17.0", + "@typescript-eslint/parser": "^7.17.0", + "@vitest/coverage-istanbul": "^2.0.4", "eslint": "^8.37.0", "eslint-config-prettier": "^9.0.0", "eslint-import-resolver-alias": "^1.1.2", - "eslint-plugin-import": "^2.27.5", + "eslint-plugin-import": "^2.29.1", "npm-dts": "^1.3.12", - "prettier": "^3.0.0", - "typescript": "^5.4.0", + "prettier": "^3.3.3", + "typescript": "^5.5.4", "vite-node": "^2.0.0", "vitest": "^2.0.0" }, From 63ac3b6531567b1a2f41435aac6ce63425d418f1 Mon Sep 17 00:00:00 2001 From: James Donnelly <4444684+JDIZM@users.noreply.github.com> Date: Sun, 28 Jul 2024 17:01:50 +0100 Subject: [PATCH 4/4] ci: update workflows --- .github/workflows/node.yml | 2 +- .github/workflows/release.yml | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 23cf111..907df19 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -21,5 +21,5 @@ jobs: - run: npm run lint - run: npm run format:check - run: npm run tsc:check - - run: npm run build - run: npm run test + - run: npm run build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0afbfe1..49ca253 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: node tests +name: release on: release: @@ -19,8 +19,8 @@ jobs: - run: npm run lint - run: npm run format:check - run: npm run tsc:check - - run: npm run build - run: npm run test + - run: npm run build publish: runs-on: ubuntu-latest needs: test-and-build @@ -33,6 +33,24 @@ jobs: registry-url: "https://registry.npmjs.org" - run: npm install - run: npm run build - - run: npm publish --access public + + - name: Update version based on tag + run: | + VERSION=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//') + echo "Updating package.json version to $VERSION" + npm version $VERSION --no-git-tag-version + + - name: Commit version change + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add package.json + git commit -m "chore(release): update version to $VERSION" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish to npm + run: npm publish --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}