From 67d97469950f1b27d5ebdd6ed8da29d16d581074 Mon Sep 17 00:00:00 2001 From: Nicolas Sutter Date: Wed, 29 Nov 2023 11:53:23 +0100 Subject: [PATCH] refactor: use `changelogen` instead of `changelogithub` --- .github/workflows/release.yml | 11 ++- CHANGELOG.md | 27 ++++++ changelogithub.config.ts | 37 -------- package.json | 6 +- pnpm-lock.yaml | 153 +++++++++++++++++----------------- scripts/slack.ts | 14 +--- 6 files changed, 119 insertions(+), 129 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 changelogithub.config.ts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5743adf..005a4fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,8 +3,8 @@ name: Release on: push: tags: - - "v*" - - "!v*-beta*" + - 'v*' + - '!v*-beta*' jobs: release: @@ -27,7 +27,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - registry-url: "https://registry.npmjs.org" + registry-url: 'https://registry.npmjs.org' - name: Install deps run: pnpm install @@ -35,7 +35,10 @@ jobs: - name: Builds run: pnpm build - - run: pnpm changelogithub + - name: Echo tag name + run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - run: pnpm changelogen gh release ${{ env.TAG_NAME }} env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0101b5b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,27 @@ + +## v1.5.0...v2.0.0 + +[compare changes](https://github.com/alsacreations/eslint/compare/v1.5.0...v2.0.0) + +### 🚀 Enhancements + +- ⚠️ Stop modifying users eslint config file with ast ([af48e86](https://github.com/alsacreations/eslint/commit/af48e86)) + +### 💅 Refactors + +- Use `changelogen` instead of `changelogithub` ([e211e12](https://github.com/alsacreations/eslint/commit/e211e12)) + +### 🏡 Chore + +- Use `.mjs` prettier config ([f0b602b](https://github.com/alsacreations/eslint/commit/f0b602b)) +- Remove useless vs code setting ([60927dd](https://github.com/alsacreations/eslint/commit/60927dd)) +- Release v2.0.0 ([6991ab0](https://github.com/alsacreations/eslint/commit/6991ab0)) + +#### ⚠️ Breaking Changes + +- ⚠️ Stop modifying users eslint config file with ast ([af48e86](https://github.com/alsacreations/eslint/commit/af48e86)) + +### ❤️ Contributors + +- Nicolas Sutter + diff --git a/changelogithub.config.ts b/changelogithub.config.ts deleted file mode 100644 index 439e538..0000000 --- a/changelogithub.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { defineConfig } from 'changelogithub' -import { execaCommandSync } from 'execa' -import { readPackageSync } from 'read-pkg' - -const { version } = readPackageSync() - -const { stdout: tagsResult } = execaCommandSync( - 'git tag --sort=version:refname', -) - -const betaReleaseRegexp = /^v.*-beta\.?\d?/ -const mainReleaseRegexp = /^v.*(? oldest -const tags = tagsResult.split('\n').reverse() - -// prettier-ignore -const from = isMainRelease - ? tags.find((tag) => mainReleaseRegexp.test(tag) && tag !== `v${version}`) - : isBetaRelease - ? tags.find((tag) => (mainReleaseRegexp.test(tag) || betaReleaseRegexp.test(tag) && tag !== `v${version}`)) - : undefined - -if (!from) { - throw new Error('Unable to find previous release.') -} - -export default defineConfig({ - /** - * When pushing a new main release, the `from` should be the last main release tag (and not a beta version) - * When pushing a new beta release, the `from` should be the last release (beta or main) - */ - from, -}) diff --git a/package.json b/package.json index ceeb2a7..f2c0a07 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "bin": "dist/bin/bin.js", "scripts": { "build": "tsup", - "release": "bumpp package.json --commit --push --tag", + "release": "pnpm changelogen --output CHANGELOG.md --release --bump --push", "prepare": "husky install", "bin-exec": "tsx bin/bin.ts init" }, @@ -65,7 +65,7 @@ "@types/node": "^20.8.4", "@types/prettier": "^2.7.3", "bumpp": "^9.2.0", - "changelogithub": "^0.13.1", + "changelogen": "^0.5.5", "eslint": "^8.54.0", "husky": "^8.0.3", "read-pkg": "^8.1.0", @@ -90,4 +90,4 @@ "tsup": "^7.2.0", "type-fest": "^4.4.0" } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2a88c05..9a21391 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -73,9 +73,9 @@ devDependencies: bumpp: specifier: ^9.2.0 version: 9.2.0 - changelogithub: - specifier: ^0.13.1 - version: 0.13.1 + changelogen: + specifier: ^0.5.5 + version: 0.5.5 eslint: specifier: ^8.54.0 version: 8.54.0 @@ -98,10 +98,6 @@ packages: resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==} engines: {node: '>=0.10.0'} - /@antfu/utils@0.7.6: - resolution: {integrity: sha512-pvFiLP2BeOKA/ZOS6jxx4XhKzdVLHDhGlFEaZ2flWWYf2xOqVniqpk38I04DFRyz+L0ASggl7SkItTc+ZLju4w==} - dev: true - /@babel/code-frame@7.22.5: resolution: {integrity: sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ==} engines: {node: '>=6.9.0'} @@ -816,6 +812,15 @@ packages: - supports-color dev: true + /agent-base@7.1.0: + resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} + engines: {node: '>= 14'} + dependencies: + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + /ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: @@ -953,13 +958,6 @@ packages: load-tsconfig: 0.2.5 dev: false - /busboy@1.6.0: - resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} - engines: {node: '>=10.16.0'} - dependencies: - streamsearch: 1.1.0 - dev: true - /c12@1.4.2: resolution: {integrity: sha512-3IP/MuamSVRVw8W8+CHWAz9gKN4gd+voF2zm/Ln6D25C2RhytEZ1ABbC8MjKr4BR9rhoV1JQ7jJA158LDiTkLg==} dependencies: @@ -978,6 +976,24 @@ packages: - supports-color dev: true + /c12@1.5.1: + resolution: {integrity: sha512-BWZRJgDEveT8uI+cliCwvYSSSSvb4xKoiiu5S0jaDbKBopQLQF7E+bq9xKk1pTcG+mUa3yXuFO7bD9d8Lr9Xxg==} + dependencies: + chokidar: 3.5.3 + defu: 6.1.2 + dotenv: 16.3.1 + giget: 1.1.3 + jiti: 1.21.0 + mlly: 1.4.2 + ohash: 1.1.3 + pathe: 1.1.1 + perfect-debounce: 1.0.0 + pkg-types: 1.0.3 + rc9: 2.1.1 + transitivePeerDependencies: + - supports-color + dev: true + /cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} @@ -1029,13 +1045,13 @@ packages: resolution: {integrity: sha512-IzgToIJ/R9NhVKmL+PW33ozYkv53bXvufDNUSH3GTKXq1iCHGgkbgbtqEWbo8tnWNnt7nPDpjL8PwSG2iS8RVw==} hasBin: true dependencies: - c12: 1.4.2 + c12: 1.5.1 colorette: 2.0.20 consola: 3.2.3 convert-gitmoji: 0.1.3 execa: 8.0.1 mri: 1.2.0 - node-fetch-native: 1.2.0 + node-fetch-native: 1.4.0 ofetch: 1.3.3 open: 9.1.0 pathe: 1.1.1 @@ -1048,23 +1064,6 @@ packages: - supports-color dev: true - /changelogithub@0.13.1: - resolution: {integrity: sha512-JeNhQCtMKOrVfGVFhTaXGmgA+BfMhpZTKxgysKHrvZZsCL99quqaEkYHtn4FXrwXX0ADi7Rt1OqCE8BIdxXRQw==} - engines: {node: '>=12.0.0'} - hasBin: true - dependencies: - '@antfu/utils': 0.7.6 - c12: 1.4.2 - cac: 6.7.14 - changelogen: 0.5.5 - convert-gitmoji: 0.1.3 - execa: 8.0.1 - kolorist: 1.8.0 - ohmyfetch: 0.4.21 - transitivePeerDependencies: - - supports-color - dev: true - /chokidar@3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} engines: {node: '>= 8.10.0'} @@ -1269,10 +1268,6 @@ packages: resolution: {integrity: sha512-+uO4+qr7msjNNWKYPHqN/3+Dx3NFkmIzayk2L1MyZQlvgZb/J1A0fo410dpKrN2SnqFjt8n4JL8fDJE0wIgjFQ==} dev: true - /destr@1.2.2: - resolution: {integrity: sha512-lrbCJwD9saUQrqUfXvl6qoM+QN3W7tLV5pAOs+OqOmopCCz/JkE05MHedJR1xfk4IAnZuJXPVuN5+7jNA2ZCiA==} - dev: true - /destr@2.0.1: resolution: {integrity: sha512-M1Ob1zPSIvlARiJUkKqvAZ3VAqQY6Jcuth/pBKQ2b1dX/Qx0OnJ8Vux6J2H5PTMQeRzWrrbTu70VxBfv/OPDJA==} @@ -1627,13 +1622,28 @@ packages: defu: 6.1.2 https-proxy-agent: 5.0.1 mri: 1.2.0 - node-fetch-native: 1.2.0 + node-fetch-native: 1.4.0 pathe: 1.1.1 tar: 6.1.15 transitivePeerDependencies: - supports-color dev: true + /giget@1.1.3: + resolution: {integrity: sha512-zHuCeqtfgqgDwvXlR84UNgnJDuUHQcNI5OqWqFxxuk2BshuKbYhJWdxBsEo4PvKqoGh23lUAIvBNpChMLv7/9Q==} + hasBin: true + dependencies: + colorette: 2.0.20 + defu: 6.1.2 + https-proxy-agent: 7.0.2 + mri: 1.2.0 + node-fetch-native: 1.4.0 + pathe: 1.1.1 + tar: 6.2.0 + transitivePeerDependencies: + - supports-color + dev: true + /git-raw-commits@2.0.11: resolution: {integrity: sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A==} engines: {node: '>=10'} @@ -1760,6 +1770,16 @@ packages: - supports-color dev: true + /https-proxy-agent@7.0.2: + resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==} + engines: {node: '>= 14'} + dependencies: + agent-base: 7.1.0 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + /human-signals@2.1.0: resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} engines: {node: '>=10.17.0'} @@ -1911,6 +1931,11 @@ packages: hasBin: true dev: true + /jiti@1.21.0: + resolution: {integrity: sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==} + hasBin: true + dev: true + /joycon@3.1.1: resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} engines: {node: '>=10'} @@ -1971,10 +1996,6 @@ packages: engines: {node: '>=6'} dev: true - /kolorist@1.8.0: - resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} - dev: true - /levn@0.4.1: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} @@ -2214,14 +2235,6 @@ packages: /natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - /node-fetch-native@0.1.8: - resolution: {integrity: sha512-ZNaury9r0NxaT2oL65GvdGDy+5PlSaHTovT6JV5tOW07k1TQmgC0olZETa4C9KZg0+6zBr99ctTYa3Utqj9P/Q==} - dev: true - - /node-fetch-native@1.2.0: - resolution: {integrity: sha512-5IAMBTl9p6PaAjYCnMv5FmqIF6GcZnawAVnzaCG0rX2aYZJ4CxEkZNtVPuTRug7fL7wyM5BQYTlAzcyMPi6oTQ==} - dev: true - /node-fetch-native@1.4.0: resolution: {integrity: sha512-F5kfEj95kX8tkDhUCYdV8dg3/8Olx/94zB8+ZNthFs6Bz31UpUi8Xh40TN3thLwXgrwXry1pEg9lJ++tLWTcqA==} @@ -2240,7 +2253,7 @@ packages: dependencies: hosted-git-info: 4.1.0 is-core-module: 2.12.1 - semver: 7.5.1 + semver: 7.5.4 validate-npm-package-license: 3.0.4 dev: true @@ -2286,14 +2299,8 @@ packages: resolution: {integrity: sha512-9CIOSq5945rI045GFtcO3uudyOkYVY1nyfFxVQp+9BRgslr8jPNiSSrsFGg/BNTUFOLqx0P5tng6G32brIPw0w==} dev: true - /ohmyfetch@0.4.21: - resolution: {integrity: sha512-VG7f/JRvqvBOYvL0tHyEIEG7XHWm7OqIfAs6/HqwWwDfjiJ1g0huIpe5sFEmyb+7hpFa1EGNH2aERWR72tlClw==} - deprecated: Package renamed to https://github.com/unjs/ofetch - dependencies: - destr: 1.2.2 - node-fetch-native: 0.1.8 - ufo: 0.8.6 - undici: 5.22.1 + /ohash@1.1.3: + resolution: {integrity: sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==} dev: true /once@1.4.0: @@ -2738,11 +2745,6 @@ packages: resolution: {integrity: sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==} dev: true - /streamsearch@1.1.0: - resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} - engines: {node: '>=10.0.0'} - dev: true - /string-argv@0.3.2: resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==} engines: {node: '>=0.6.19'} @@ -2839,6 +2841,18 @@ packages: yallist: 4.0.0 dev: true + /tar@6.2.0: + resolution: {integrity: sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==} + engines: {node: '>=10'} + dependencies: + chownr: 2.0.0 + fs-minipass: 2.1.0 + minipass: 5.0.0 + minizlib: 2.1.2 + mkdirp: 1.0.4 + yallist: 4.0.0 + dev: true + /text-extensions@1.9.0: resolution: {integrity: sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==} engines: {node: '>=0.10'} @@ -3031,23 +3045,12 @@ packages: engines: {node: '>=14.17'} hasBin: true - /ufo@0.8.6: - resolution: {integrity: sha512-fk6CmUgwKCfX79EzcDQQpSCMxrHstvbLswFChHS0Vump+kFkw7nJBfTZoC1j0bOGoY9I7R3n2DGek5ajbcYnOw==} - dev: true - /ufo@1.3.1: resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==} /undici-types@5.25.3: resolution: {integrity: sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==} - /undici@5.22.1: - resolution: {integrity: sha512-Ji2IJhFXZY0x/0tVBXeQwgPlLWw13GVzpsWPQ3rV50IFMMof2I55PZZxtm4P6iNq+L5znYN9nSTAq0ZyE6lSJw==} - engines: {node: '>=14.0'} - dependencies: - busboy: 1.6.0 - dev: true - /universalify@2.0.0: resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} engines: {node: '>= 10.0.0'} diff --git a/scripts/slack.ts b/scripts/slack.ts index 4787c9e..47a6b37 100644 --- a/scripts/slack.ts +++ b/scripts/slack.ts @@ -17,19 +17,13 @@ async function start() { const { version, name: pkgName } = await readPackage() - const contentRegexp = /----+\n\n(?(?:.|\s)*)\n\n----+/m - - let { stdout: changelog } = await execaCommand('pnpm changelogithub --dry') + let { stdout: changelog } = await execaCommand( + 'pnpm changelogen --no-output', + ) changelog = stripAnsi(changelog) - const releaseContent = changelog.match(contentRegexp)?.groups?.content - - if (!releaseContent) { - throw new Error('`releaseContent` does not contain text.') - } - - const text = releaseContent + const text = changelog .trim() // Gestion du gras pour Slack .replace(/\*\*/gm, '*')