diff --git a/.eslintrc b/.eslintrc index 309317b..c5bdc8b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,10 +1,9 @@ { - "extends": [ - "eslint-config-unjs" - ], + "extends": ["eslint-config-unjs"], "rules": { "unicorn/no-null": 0, "unicorn/prefer-top-level-await": 0, - "unicorn/template-indent": 0 + "unicorn/template-indent": 0, + "unicorn/no-process-exit": 0 } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 27dc8d3..7bb48e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,62 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## v0.5.1 + +[compare changes](https://github.com/unjs/changelogen/compare/v0.5.0...v0.5.1) + + +### 🩹 Fixes + + - Allow providing no versions ([ac84c39](https://github.com/unjs/changelogen/commit/ac84c39)) + - Use parsed release body ([aec2341](https://github.com/unjs/changelogen/commit/aec2341)) + - Strip title line from release ([319f7ce](https://github.com/unjs/changelogen/commit/319f7ce)) + +### 🏡 Chore + + - Simplify release command ([225fa64](https://github.com/unjs/changelogen/commit/225fa64)) + +### ❤️ Contributors + +- Pooya Parsa ([@pi0](http://github.com/pi0)) + +## v0.5.0 + +[compare changes](https://github.com/unjs/changelogen/compare/v0.4.1...v0.5.0) + + +### 🚀 Enhancements + + - Update execa to v7 ([e61e2f6](https://github.com/unjs/changelogen/commit/e61e2f6)) + - ⚠️ Support different repository providers ([#55](https://github.com/unjs/changelogen/pull/55)) + - Github release integration ([#67](https://github.com/unjs/changelogen/pull/67)) + - Support explicit bumping as major, minor, or patch via cli ([c8afa86](https://github.com/unjs/changelogen/commit/c8afa86)) + - Automatically resolve github token from gh cli ([231a3ec](https://github.com/unjs/changelogen/commit/231a3ec)) + - Default `gh release` to latest version ([44788f5](https://github.com/unjs/changelogen/commit/44788f5)) + +### 🩹 Fixes + + - Stage `CHANGELOG.md` and `package.json` when releasing ([69d375c](https://github.com/unjs/changelogen/commit/69d375c)) + - Add correct output file to git ([#64](https://github.com/unjs/changelogen/pull/64)) + - Update ungh link ([a5ab510](https://github.com/unjs/changelogen/commit/a5ab510)) + - Only access latest tag accessible from current branch ([#69](https://github.com/unjs/changelogen/pull/69)) + - **cli:** Don't eat up first `-*` arg ([77b483b](https://github.com/unjs/changelogen/commit/77b483b)) + +### 🏡 Chore + + - Fix lint issue and update snapshots ([e162ab8](https://github.com/unjs/changelogen/commit/e162ab8)) + - Mention gh cli login ([7f4a05f](https://github.com/unjs/changelogen/commit/7f4a05f)) + +#### ⚠️ Breaking Changes + + - ⚠️ Support different repository providers ([#55](https://github.com/unjs/changelogen/pull/55)) + +### ❤️ Contributors + +- Pooya Parsa ([@pi0](http://github.com/pi0)) +- Daniel Roe +- Donald Shtjefni ([@dnldsht](http://github.com/dnldsht)) + ## v0.4.1 [compare changes](https://github.com/unjs/changelogen/compare/v0.4.0...v0.4.1) diff --git a/README.md b/README.md index e67c819..1afcf5b 100644 --- a/README.md +++ b/README.md @@ -30,18 +30,42 @@ npx changelogen@latest --release ## CLI Usage ```sh -npx changelogen@latest [...args] [] +npx changelogen@latest [...args] [--dir ] ``` **Arguments:** - `--from`: Start commit reference. When not provided, **latest git tag** will be used as default. - `--to`: End commit reference. When not provided, **latest commit in HEAD** will be used as default. -- `--rootDir`: Path to git repository. When not provided, **current working directory** will be used as as default. -- `--output`: Changelog file name to create or update. Defaults to `CHANGELOG.md` and resolved relative to rootDir. Use `--no-output` to write to console only. +- `--dir`: Path to git repository. When not provided, **current working directory** will be used as as default. +- `--output`: Changelog file name to create or update. Defaults to `CHANGELOG.md` and resolved relative to dir. Use `--no-output` to write to console only. - `--bump`: Determine semver change and update version in `package.json`. - `--release`. Bumps version in `package.json` and creates commit and git tags using local `git`. You can disable commit using `--no-commit` and tag using `--no-tag`. - `-r`: Release as specific version. +- `--major`: Bump as a semver-major version +- `--minor`: Bump as a semver-minor version +- `--patch`: Bump as a semver-patch version + +### `changelogen gh release` + +Changelogen has built-in functionality to sync with with Github releases! + +In order to manually sync a release, you can use `changelogen gh release`. It will parse current `CHANGELOG.md` from current repository (local, then remote) and create or update releases. + +Usage: + +```sh +npx changelogen@latest gh release [all|versions...] [--dir] [--token] +``` + +To enable this integration, make sure there is a valid `repository` field in `package.json` or `repo` is set in `.changelogenrc`. + +By default in unauthenticated mode, changelogen will open a browser link to make manual release. By providing github token, it can be automated. + +- Using environment variables or `.env`, use `CHANGELOGEN_TOKENS_GITHUB` or `GITHUB_TOKEN` or `GH_TOKEN` +- Using CLI args, use `--token ` +- Using global configuration, put `tokens.github=` inside `~/.changlogenrc` +- Using [GitHub CLI](https://cli.github.com/) token when authenticated with `gh auth login` ## Configuration @@ -49,7 +73,6 @@ Configuration is loaded by [unjs/c12](https://github.com/unjs/c12) from cwd. You See [./src/config.ts](./src/config.ts) for available options and defaults. - ## 💻 Development - Clone this repository @@ -64,14 +87,12 @@ Made with 💛 Published under [MIT License](./LICENSE). + [npm-version-src]: https://img.shields.io/npm/v/changelogen?style=flat-square [npm-version-href]: https://npmjs.com/package/changelogen - [npm-downloads-src]: https://img.shields.io/npm/dm/changelogen?style=flat-square [npm-downloads-href]: https://npmjs.com/package/changelogen - [github-actions-src]: https://img.shields.io/github/workflow/status/unjs/changelogen/ci/main?style=flat-square [github-actions-href]: https://github.com/unjs/changelogen/actions?query=workflow%3Aci - [codecov-src]: https://img.shields.io/codecov/c/gh/unjs/changelogen/main?style=flat-square [codecov-href]: https://codecov.io/gh/unjs/changelogen diff --git a/package.json b/package.json index d0a6e47..b118443 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "changelogen", - "version": "0.4.1", + "version": "0.5.1", "description": "Generate Beautiful Changelogs using Conventional Commits", "repository": "unjs/changelogen", "license": "MIT", @@ -26,33 +26,39 @@ "changelogen": "jiti ./src/cli.ts", "dev": "vitest dev", "lint": "eslint --ext .ts,.js,.mjs,.cjs . && prettier -c src test", + "lint:fix": "eslint --fix --ext .ts,.js,.mjs,.cjs . && prettier -w src test", "prepack": "unbuild", - "release": "pnpm test && pnpm changelogen --release && git push --follow-tags && pnpm publish", + "release": "pnpm test && pnpm changelogen --release --push && pnpm publish", "test": "pnpm lint && vitest run --coverage" }, "dependencies": { - "c12": "^1.1.0", + "c12": "^1.1.2", + "colorette": "^2.0.19", "consola": "^2.15.3", "convert-gitmoji": "^0.1.3", - "execa": "^6.1.0", + "execa": "^7.0.0", "mri": "^1.2.0", - "node-fetch-native": "^1.0.1", - "pkg-types": "^1.0.1", + "node-fetch-native": "^1.0.2", + "ofetch": "^1.0.1", + "open": "^8.4.2", + "pathe": "^1.1.0", + "pkg-types": "^1.0.2", "scule": "^1.0.0", - "semver": "^7.3.8" + "semver": "^7.3.8", + "yaml": "^2.2.1" }, "devDependencies": { - "@types/node": "^18.11.18", + "@types/node": "^18.14.2", "@types/semver": "^7.3.13", - "@vitest/coverage-c8": "^0.28.3", - "eslint": "^8.33.0", + "@vitest/coverage-c8": "^0.29.2", + "eslint": "^8.35.0", "eslint-config-unjs": "^0.1.0", - "jiti": "^1.16.2", - "prettier": "^2.8.3", + "jiti": "^1.17.1", + "prettier": "^2.8.4", "standard-version": "^9.5.0", "typescript": "^4.9.5", - "unbuild": "^1.1.1", - "vitest": "^0.28.3" + "unbuild": "^1.1.2", + "vitest": "^0.29.2" }, - "packageManager": "pnpm@7.26.3" + "packageManager": "pnpm@7.28.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 926324c..935ebe4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,50 +1,60 @@ lockfileVersion: 5.4 specifiers: - '@types/node': ^18.11.18 + '@types/node': ^18.14.2 '@types/semver': ^7.3.13 - '@vitest/coverage-c8': ^0.28.3 - c12: ^1.1.0 + '@vitest/coverage-c8': ^0.29.2 + c12: ^1.1.2 + colorette: ^2.0.19 consola: ^2.15.3 convert-gitmoji: ^0.1.3 - eslint: ^8.33.0 + eslint: ^8.35.0 eslint-config-unjs: ^0.1.0 - execa: ^6.1.0 - jiti: ^1.16.2 + execa: ^7.0.0 + jiti: ^1.17.1 mri: ^1.2.0 - node-fetch-native: ^1.0.1 - pkg-types: ^1.0.1 - prettier: ^2.8.3 + node-fetch-native: ^1.0.2 + ofetch: ^1.0.1 + open: ^8.4.2 + pathe: ^1.1.0 + pkg-types: ^1.0.2 + prettier: ^2.8.4 scule: ^1.0.0 semver: ^7.3.8 standard-version: ^9.5.0 typescript: ^4.9.5 - unbuild: ^1.1.1 - vitest: ^0.28.3 + unbuild: ^1.1.2 + vitest: ^0.29.2 + yaml: ^2.2.1 dependencies: - c12: 1.1.0 + c12: 1.1.2 + colorette: 2.0.19 consola: 2.15.3 convert-gitmoji: 0.1.3 - execa: 6.1.0 + execa: 7.0.0 mri: 1.2.0 - node-fetch-native: 1.0.1 - pkg-types: 1.0.1 + node-fetch-native: 1.0.2 + ofetch: 1.0.1 + open: 8.4.2 + pathe: 1.1.0 + pkg-types: 1.0.2 scule: 1.0.0 semver: 7.3.8 + yaml: 2.2.1 devDependencies: - '@types/node': 18.11.18 + '@types/node': 18.14.2 '@types/semver': 7.3.13 - '@vitest/coverage-c8': 0.28.3 - eslint: 8.33.0 - eslint-config-unjs: 0.1.0_4vsywjlpuriuw3tl5oq6zy5a64 - jiti: 1.16.2 - prettier: 2.8.3 + '@vitest/coverage-c8': 0.29.2_vitest@0.29.2 + eslint: 8.35.0 + eslint-config-unjs: 0.1.0_ycpbpc6yetojsgtrx3mwntkhsu + jiti: 1.17.1 + prettier: 2.8.4 standard-version: 9.5.0 typescript: 4.9.5 - unbuild: 1.1.1 - vitest: 0.28.3 + unbuild: 1.1.2 + vitest: 0.29.2 packages: @@ -268,6 +278,15 @@ packages: dev: true optional: true + /@esbuild/android-arm/0.17.10: + resolution: {integrity: sha512-7YEBfZ5lSem9Tqpsz+tjbdsEshlO9j/REJrfv4DXgKTt1+/MHqGwbtlyxQuaSlMeUZLxUKBaX8wdzlTfHkmnLw==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm64/0.16.17: resolution: {integrity: sha512-MIGl6p5sc3RDTLLkYL1MyL8BMRN4tLMRCn+yRJJmEDvYZ2M7tmAf80hx1kbNEUX2KJ50RRtxZ4JHLvCfuB6kBg==} engines: {node: '>=12'} @@ -277,6 +296,15 @@ packages: dev: true optional: true + /@esbuild/android-arm64/0.17.10: + resolution: {integrity: sha512-ht1P9CmvrPF5yKDtyC+z43RczVs4rrHpRqrmIuoSvSdn44Fs1n6DGlpZKdK6rM83pFLbVaSUwle8IN+TPmkv7g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-x64/0.16.17: resolution: {integrity: sha512-a3kTv3m0Ghh4z1DaFEuEDfz3OLONKuFvI4Xqczqx4BqLyuFaFkuaG4j2MtA6fuWEFeC5x9IvqnX7drmRq/fyAQ==} engines: {node: '>=12'} @@ -286,6 +314,15 @@ packages: dev: true optional: true + /@esbuild/android-x64/0.17.10: + resolution: {integrity: sha512-CYzrm+hTiY5QICji64aJ/xKdN70IK8XZ6iiyq0tZkd3tfnwwSWTYH1t3m6zyaaBxkuj40kxgMyj1km/NqdjQZA==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-arm64/0.16.17: resolution: {integrity: sha512-/2agbUEfmxWHi9ARTX6OQ/KgXnOWfsNlTeLcoV7HSuSTv63E4DqtAc+2XqGw1KHxKMHGZgbVCZge7HXWX9Vn+w==} engines: {node: '>=12'} @@ -295,6 +332,15 @@ packages: dev: true optional: true + /@esbuild/darwin-arm64/0.17.10: + resolution: {integrity: sha512-3HaGIowI+nMZlopqyW6+jxYr01KvNaLB5znXfbyyjuo4lE0VZfvFGcguIJapQeQMS4cX/NEispwOekJt3gr5Dg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-x64/0.16.17: resolution: {integrity: sha512-2By45OBHulkd9Svy5IOCZt376Aa2oOkiE9QWUK9fe6Tb+WDr8hXL3dpqi+DeLiMed8tVXspzsTAvd0jUl96wmg==} engines: {node: '>=12'} @@ -304,6 +350,15 @@ packages: dev: true optional: true + /@esbuild/darwin-x64/0.17.10: + resolution: {integrity: sha512-J4MJzGchuCRG5n+B4EHpAMoJmBeAE1L3wGYDIN5oWNqX0tEr7VKOzw0ymSwpoeSpdCa030lagGUfnfhS7OvzrQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-arm64/0.16.17: resolution: {integrity: sha512-mt+cxZe1tVx489VTb4mBAOo2aKSnJ33L9fr25JXpqQqzbUIw/yzIzi+NHwAXK2qYV1lEFp4OoVeThGjUbmWmdw==} engines: {node: '>=12'} @@ -313,6 +368,15 @@ packages: dev: true optional: true + /@esbuild/freebsd-arm64/0.17.10: + resolution: {integrity: sha512-ZkX40Z7qCbugeK4U5/gbzna/UQkM9d9LNV+Fro8r7HA7sRof5Rwxc46SsqeMvB5ZaR0b1/ITQ/8Y1NmV2F0fXQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-x64/0.16.17: resolution: {integrity: sha512-8ScTdNJl5idAKjH8zGAsN7RuWcyHG3BAvMNpKOBaqqR7EbUhhVHOqXRdL7oZvz8WNHL2pr5+eIT5c65kA6NHug==} engines: {node: '>=12'} @@ -322,6 +386,15 @@ packages: dev: true optional: true + /@esbuild/freebsd-x64/0.17.10: + resolution: {integrity: sha512-0m0YX1IWSLG9hWh7tZa3kdAugFbZFFx9XrvfpaCMMvrswSTvUZypp0NFKriUurHpBA3xsHVE9Qb/0u2Bbi/otg==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm/0.16.17: resolution: {integrity: sha512-iihzrWbD4gIT7j3caMzKb/RsFFHCwqqbrbH9SqUSRrdXkXaygSZCZg1FybsZz57Ju7N/SHEgPyaR0LZ8Zbe9gQ==} engines: {node: '>=12'} @@ -331,6 +404,15 @@ packages: dev: true optional: true + /@esbuild/linux-arm/0.17.10: + resolution: {integrity: sha512-whRdrrl0X+9D6o5f0sTZtDM9s86Xt4wk1bf7ltx6iQqrIIOH+sre1yjpcCdrVXntQPCNw/G+XqsD4HuxeS+2QA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm64/0.16.17: resolution: {integrity: sha512-7S8gJnSlqKGVJunnMCrXHU9Q8Q/tQIxk/xL8BqAP64wchPCTzuM6W3Ra8cIa1HIflAvDnNOt2jaL17vaW+1V0g==} engines: {node: '>=12'} @@ -340,6 +422,15 @@ packages: dev: true optional: true + /@esbuild/linux-arm64/0.17.10: + resolution: {integrity: sha512-g1EZJR1/c+MmCgVwpdZdKi4QAJ8DCLP5uTgLWSAVd9wlqk9GMscaNMEViG3aE1wS+cNMzXXgdWiW/VX4J+5nTA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ia32/0.16.17: resolution: {integrity: sha512-kiX69+wcPAdgl3Lonh1VI7MBr16nktEvOfViszBSxygRQqSpzv7BffMKRPMFwzeJGPxcio0pdD3kYQGpqQ2SSg==} engines: {node: '>=12'} @@ -349,6 +440,15 @@ packages: dev: true optional: true + /@esbuild/linux-ia32/0.17.10: + resolution: {integrity: sha512-1vKYCjfv/bEwxngHERp7huYfJ4jJzldfxyfaF7hc3216xiDA62xbXJfRlradiMhGZbdNLj2WA1YwYFzs9IWNPw==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-loong64/0.16.17: resolution: {integrity: sha512-dTzNnQwembNDhd654cA4QhbS9uDdXC3TKqMJjgOWsC0yNCbpzfWoXdZvp0mY7HU6nzk5E0zpRGGx3qoQg8T2DQ==} engines: {node: '>=12'} @@ -358,6 +458,15 @@ packages: dev: true optional: true + /@esbuild/linux-loong64/0.17.10: + resolution: {integrity: sha512-mvwAr75q3Fgc/qz3K6sya3gBmJIYZCgcJ0s7XshpoqIAIBszzfXsqhpRrRdVFAyV1G9VUjj7VopL2HnAS8aHFA==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-mips64el/0.16.17: resolution: {integrity: sha512-ezbDkp2nDl0PfIUn0CsQ30kxfcLTlcx4Foz2kYv8qdC6ia2oX5Q3E/8m6lq84Dj/6b0FrkgD582fJMIfHhJfSw==} engines: {node: '>=12'} @@ -367,6 +476,15 @@ packages: dev: true optional: true + /@esbuild/linux-mips64el/0.17.10: + resolution: {integrity: sha512-XilKPgM2u1zR1YuvCsFQWl9Fc35BqSqktooumOY2zj7CSn5czJn279j9TE1JEqSqz88izJo7yE4x3LSf7oxHzg==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ppc64/0.16.17: resolution: {integrity: sha512-dzS678gYD1lJsW73zrFhDApLVdM3cUF2MvAa1D8K8KtcSKdLBPP4zZSLy6LFZ0jYqQdQ29bjAHJDgz0rVbLB3g==} engines: {node: '>=12'} @@ -376,6 +494,15 @@ packages: dev: true optional: true + /@esbuild/linux-ppc64/0.17.10: + resolution: {integrity: sha512-kM4Rmh9l670SwjlGkIe7pYWezk8uxKHX4Lnn5jBZYBNlWpKMBCVfpAgAJqp5doLobhzF3l64VZVrmGeZ8+uKmQ==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-riscv64/0.16.17: resolution: {integrity: sha512-ylNlVsxuFjZK8DQtNUwiMskh6nT0vI7kYl/4fZgV1llP5d6+HIeL/vmmm3jpuoo8+NuXjQVZxmKuhDApK0/cKw==} engines: {node: '>=12'} @@ -385,6 +512,15 @@ packages: dev: true optional: true + /@esbuild/linux-riscv64/0.17.10: + resolution: {integrity: sha512-r1m9ZMNJBtOvYYGQVXKy+WvWd0BPvSxMsVq8Hp4GzdMBQvfZRvRr5TtX/1RdN6Va8JMVQGpxqde3O+e8+khNJQ==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-s390x/0.16.17: resolution: {integrity: sha512-gzy7nUTO4UA4oZ2wAMXPNBGTzZFP7mss3aKR2hH+/4UUkCOyqmjXiKpzGrY2TlEUhbbejzXVKKGazYcQTZWA/w==} engines: {node: '>=12'} @@ -394,6 +530,15 @@ packages: dev: true optional: true + /@esbuild/linux-s390x/0.17.10: + resolution: {integrity: sha512-LsY7QvOLPw9WRJ+fU5pNB3qrSfA00u32ND5JVDrn/xG5hIQo3kvTxSlWFRP0NJ0+n6HmhPGG0Q4jtQsb6PFoyg==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-x64/0.16.17: resolution: {integrity: sha512-mdPjPxfnmoqhgpiEArqi4egmBAMYvaObgn4poorpUaqmvzzbvqbowRllQ+ZgzGVMGKaPkqUmPDOOFQRUFDmeUw==} engines: {node: '>=12'} @@ -403,6 +548,15 @@ packages: dev: true optional: true + /@esbuild/linux-x64/0.17.10: + resolution: {integrity: sha512-zJUfJLebCYzBdIz/Z9vqwFjIA7iSlLCFvVi7glMgnu2MK7XYigwsonXshy9wP9S7szF+nmwrelNaP3WGanstEg==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/netbsd-x64/0.16.17: resolution: {integrity: sha512-/PzmzD/zyAeTUsduZa32bn0ORug+Jd1EGGAUJvqfeixoEISYpGnAezN6lnJoskauoai0Jrs+XSyvDhppCPoKOA==} engines: {node: '>=12'} @@ -412,6 +566,15 @@ packages: dev: true optional: true + /@esbuild/netbsd-x64/0.17.10: + resolution: {integrity: sha512-lOMkailn4Ok9Vbp/q7uJfgicpDTbZFlXlnKT2DqC8uBijmm5oGtXAJy2ZZVo5hX7IOVXikV9LpCMj2U8cTguWA==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/openbsd-x64/0.16.17: resolution: {integrity: sha512-2yaWJhvxGEz2RiftSk0UObqJa/b+rIAjnODJgv2GbGGpRwAfpgzyrg1WLK8rqA24mfZa9GvpjLcBBg8JHkoodg==} engines: {node: '>=12'} @@ -421,6 +584,15 @@ packages: dev: true optional: true + /@esbuild/openbsd-x64/0.17.10: + resolution: {integrity: sha512-/VE0Kx6y7eekqZ+ZLU4AjMlB80ov9tEz4H067Y0STwnGOYL8CsNg4J+cCmBznk1tMpxMoUOf0AbWlb1d2Pkbig==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/sunos-x64/0.16.17: resolution: {integrity: sha512-xtVUiev38tN0R3g8VhRfN7Zl42YCJvyBhRKw1RJjwE1d2emWTVToPLNEQj/5Qxc6lVFATDiy6LjVHYhIPrLxzw==} engines: {node: '>=12'} @@ -430,6 +602,15 @@ packages: dev: true optional: true + /@esbuild/sunos-x64/0.17.10: + resolution: {integrity: sha512-ERNO0838OUm8HfUjjsEs71cLjLMu/xt6bhOlxcJ0/1MG3hNqCmbWaS+w/8nFLa0DDjbwZQuGKVtCUJliLmbVgg==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-arm64/0.16.17: resolution: {integrity: sha512-ga8+JqBDHY4b6fQAmOgtJJue36scANy4l/rL97W+0wYmijhxKetzZdKOJI7olaBaMhWt8Pac2McJdZLxXWUEQw==} engines: {node: '>=12'} @@ -439,6 +620,15 @@ packages: dev: true optional: true + /@esbuild/win32-arm64/0.17.10: + resolution: {integrity: sha512-fXv+L+Bw2AeK+XJHwDAQ9m3NRlNemG6Z6ijLwJAAVdu4cyoFbBWbEtyZzDeL+rpG2lWI51cXeMt70HA8g2MqIg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-ia32/0.16.17: resolution: {integrity: sha512-WnsKaf46uSSF/sZhwnqE4L/F89AYNMiD4YtEcYekBt9Q7nj0DiId2XH2Ng2PHM54qi5oPrQ8luuzGszqi/veig==} engines: {node: '>=12'} @@ -448,6 +638,15 @@ packages: dev: true optional: true + /@esbuild/win32-ia32/0.17.10: + resolution: {integrity: sha512-3s+HADrOdCdGOi5lnh5DMQEzgbsFsd4w57L/eLKKjMnN0CN4AIEP0DCP3F3N14xnxh3ruNc32A0Na9zYe1Z/AQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-x64/0.16.17: resolution: {integrity: sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q==} engines: {node: '>=12'} @@ -457,8 +656,17 @@ packages: dev: true optional: true - /@eslint/eslintrc/1.4.1: - resolution: {integrity: sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==} + /@esbuild/win32-x64/0.17.10: + resolution: {integrity: sha512-oP+zFUjYNaMNmjTwlFtWep85hvwUu19cZklB3QsBOcZSs6y7hmH4LNCJ7075bsqzYaNvZFXJlAVaQ2ApITDXtw==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@eslint/eslintrc/2.0.0: + resolution: {integrity: sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 @@ -474,6 +682,11 @@ packages: - supports-color dev: true + /@eslint/js/8.35.0: + resolution: {integrity: sha512-JXdzbRiWclLVoD8sNUjR443VVlYqiYmDVT6rGUEIEHU5YJW0gaVZwV2xgM7D4arkvASqD0IlLUVjHiFuxaftRw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true + /@humanwhocodes/config-array/0.11.8: resolution: {integrity: sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==} engines: {node: '>=10.10.0'} @@ -569,14 +782,14 @@ packages: dependencies: cross-spawn: 7.0.3 is-glob: 4.0.3 - open: 8.4.0 + open: 8.4.2 picocolors: 1.0.0 tiny-glob: 0.2.9 tslib: 2.4.1 dev: true - /@rollup/plugin-alias/4.0.2_rollup@3.10.1: - resolution: {integrity: sha512-1hv7dBOZZwo3SEupxn4UA2N0EDThqSSS+wI1St1TNTBtOZvUchyIClyHcnDcjjrReTPZ47Faedrhblv4n+T5UQ==} + /@rollup/plugin-alias/4.0.3_rollup@3.17.3: + resolution: {integrity: sha512-ZuDWE1q4PQDhvm/zc5Prun8sBpLJy41DMptYrS6MhAy9s9kL/doN1613BWfEchGVfKxzliJ3BjbOPizXX38DbQ==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^1.20.0||^2.0.0||^3.0.0 @@ -584,12 +797,12 @@ packages: rollup: optional: true dependencies: - rollup: 3.10.1 + rollup: 3.17.3 slash: 4.0.0 dev: true - /@rollup/plugin-commonjs/24.0.0_rollup@3.10.1: - resolution: {integrity: sha512-0w0wyykzdyRRPHOb0cQt14mIBLujfAv6GgP6g8nvg/iBxEm112t3YPPq+Buqe2+imvElTka+bjNlJ/gB56TD8g==} + /@rollup/plugin-commonjs/24.0.1_rollup@3.17.3: + resolution: {integrity: sha512-15LsiWRZk4eOGqvrJyu3z3DaBu5BhXIMeWnijSRvd8irrrg9SHpQ1pH+BUK4H6Z9wL9yOxZJMTLU+Au86XHxow==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^2.68.0||^3.0.0 @@ -597,16 +810,16 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.10.1 + '@rollup/pluginutils': 5.0.2_rollup@3.17.3 commondir: 1.0.1 estree-walker: 2.0.2 glob: 8.1.0 is-reference: 1.2.1 magic-string: 0.27.0 - rollup: 3.10.1 + rollup: 3.17.3 dev: true - /@rollup/plugin-json/6.0.0_rollup@3.10.1: + /@rollup/plugin-json/6.0.0_rollup@3.17.3: resolution: {integrity: sha512-i/4C5Jrdr1XUarRhVu27EEwjt4GObltD7c+MkCIpO2QIbojw8MUs+CCTqOphQi3Qtg1FLmYt+l+6YeoIf51J7w==} engines: {node: '>=14.0.0'} peerDependencies: @@ -615,11 +828,11 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.10.1 - rollup: 3.10.1 + '@rollup/pluginutils': 5.0.2_rollup@3.17.3 + rollup: 3.17.3 dev: true - /@rollup/plugin-node-resolve/15.0.1_rollup@3.10.1: + /@rollup/plugin-node-resolve/15.0.1_rollup@3.17.3: resolution: {integrity: sha512-ReY88T7JhJjeRVbfCyNj+NXAG3IIsVMsX9b5/9jC98dRP8/yxlZdz7mHZbHk5zHr24wZZICS5AcXsFZAXYUQEg==} engines: {node: '>=14.0.0'} peerDependencies: @@ -628,16 +841,16 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.10.1 + '@rollup/pluginutils': 5.0.2_rollup@3.17.3 '@types/resolve': 1.20.2 deepmerge: 4.2.2 is-builtin-module: 3.2.0 is-module: 1.0.0 resolve: 1.22.1 - rollup: 3.10.1 + rollup: 3.17.3 dev: true - /@rollup/plugin-replace/5.0.2_rollup@3.10.1: + /@rollup/plugin-replace/5.0.2_rollup@3.17.3: resolution: {integrity: sha512-M9YXNekv/C/iHHK+cvORzfRYfPbq0RDD8r0G+bMiTXjNGKulPnCT9O3Ss46WfhI6ZOCgApOP7xAdmCQJ+U2LAA==} engines: {node: '>=14.0.0'} peerDependencies: @@ -646,12 +859,12 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.10.1 + '@rollup/pluginutils': 5.0.2_rollup@3.17.3 magic-string: 0.27.0 - rollup: 3.10.1 + rollup: 3.17.3 dev: true - /@rollup/pluginutils/5.0.2_rollup@3.10.1: + /@rollup/pluginutils/5.0.2_rollup@3.17.3: resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==} engines: {node: '>=14.0.0'} peerDependencies: @@ -663,7 +876,7 @@ packages: '@types/estree': 1.0.0 estree-walker: 2.0.2 picomatch: 2.3.1 - rollup: 3.10.1 + rollup: 3.17.3 dev: true /@types/chai-subset/1.3.3: @@ -696,8 +909,8 @@ packages: resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} dev: true - /@types/node/18.11.18: - resolution: {integrity: sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==} + /@types/node/18.14.2: + resolution: {integrity: sha512-1uEQxww3DaghA0RxqHx0O0ppVlo43pJhepY51OxuQIKHpjbnYLA7vcdwioNPzIqmC2u3I/dmylcqjlh0e7AyUA==} dev: true /@types/normalize-package-data/2.4.1: @@ -712,7 +925,7 @@ packages: resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==} dev: true - /@typescript-eslint/eslint-plugin/5.48.2_rhuplbbkbcrmfpueggn54ylaty: + /@typescript-eslint/eslint-plugin/5.48.2_l5zoa2nxwyvjfojyirvsx2jm4u: resolution: {integrity: sha512-sR0Gja9Ky1teIq4qJOl0nC+Tk64/uYdX+mi+5iB//MH8gwyx8e3SOyhEzeLZEFEEfCaLf8KJq+Bd/6je1t+CAg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -723,12 +936,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.48.2_4vsywjlpuriuw3tl5oq6zy5a64 + '@typescript-eslint/parser': 5.48.2_ycpbpc6yetojsgtrx3mwntkhsu '@typescript-eslint/scope-manager': 5.48.2 - '@typescript-eslint/type-utils': 5.48.2_4vsywjlpuriuw3tl5oq6zy5a64 - '@typescript-eslint/utils': 5.48.2_4vsywjlpuriuw3tl5oq6zy5a64 + '@typescript-eslint/type-utils': 5.48.2_ycpbpc6yetojsgtrx3mwntkhsu + '@typescript-eslint/utils': 5.48.2_ycpbpc6yetojsgtrx3mwntkhsu debug: 4.3.4 - eslint: 8.33.0 + eslint: 8.35.0 ignore: 5.2.4 natural-compare-lite: 1.4.0 regexpp: 3.2.0 @@ -739,7 +952,7 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.48.2_4vsywjlpuriuw3tl5oq6zy5a64: + /@typescript-eslint/parser/5.48.2_ycpbpc6yetojsgtrx3mwntkhsu: resolution: {integrity: sha512-38zMsKsG2sIuM5Oi/olurGwYJXzmtdsHhn5mI/pQogP+BjYVkK5iRazCQ8RGS0V+YLk282uWElN70zAAUmaYHw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -753,7 +966,7 @@ packages: '@typescript-eslint/types': 5.48.2 '@typescript-eslint/typescript-estree': 5.48.2_typescript@4.9.5 debug: 4.3.4 - eslint: 8.33.0 + eslint: 8.35.0 typescript: 4.9.5 transitivePeerDependencies: - supports-color @@ -767,7 +980,7 @@ packages: '@typescript-eslint/visitor-keys': 5.48.2 dev: true - /@typescript-eslint/type-utils/5.48.2_4vsywjlpuriuw3tl5oq6zy5a64: + /@typescript-eslint/type-utils/5.48.2_ycpbpc6yetojsgtrx3mwntkhsu: resolution: {integrity: sha512-QVWx7J5sPMRiOMJp5dYshPxABRoZV1xbRirqSk8yuIIsu0nvMTZesKErEA3Oix1k+uvsk8Cs8TGJ6kQ0ndAcew==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -778,9 +991,9 @@ packages: optional: true dependencies: '@typescript-eslint/typescript-estree': 5.48.2_typescript@4.9.5 - '@typescript-eslint/utils': 5.48.2_4vsywjlpuriuw3tl5oq6zy5a64 + '@typescript-eslint/utils': 5.48.2_ycpbpc6yetojsgtrx3mwntkhsu debug: 4.3.4 - eslint: 8.33.0 + eslint: 8.35.0 tsutils: 3.21.0_typescript@4.9.5 typescript: 4.9.5 transitivePeerDependencies: @@ -813,7 +1026,7 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.48.2_4vsywjlpuriuw3tl5oq6zy5a64: + /@typescript-eslint/utils/5.48.2_ycpbpc6yetojsgtrx3mwntkhsu: resolution: {integrity: sha512-2h18c0d7jgkw6tdKTlNaM7wyopbLRBiit8oAxoP89YnuBOzCZ8g8aBCaCqq7h208qUTroL7Whgzam7UY3HVLow==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -824,9 +1037,9 @@ packages: '@typescript-eslint/scope-manager': 5.48.2 '@typescript-eslint/types': 5.48.2 '@typescript-eslint/typescript-estree': 5.48.2_typescript@4.9.5 - eslint: 8.33.0 + eslint: 8.35.0 eslint-scope: 5.1.1 - eslint-utils: 3.0.0_eslint@8.33.0 + eslint-utils: 3.0.0_eslint@8.35.0 semver: 7.3.8 transitivePeerDependencies: - supports-color @@ -841,51 +1054,41 @@ packages: eslint-visitor-keys: 3.3.0 dev: true - /@vitest/coverage-c8/0.28.3: - resolution: {integrity: sha512-3Toi4flNyxwSSYohhV3/euFSyrHjaD9vJVwFVcy84lcRHMEkv0W7pxlqZZeCvPdktN+WETbNazx3WWBs0jqhVQ==} + /@vitest/coverage-c8/0.29.2_vitest@0.29.2: + resolution: {integrity: sha512-NmD3WirQCeQjjKfHu4iEq18DVOBFbLn9TKVdMpyi5YW2EtnS+K22/WE+9/wRrepOhyeTxuEFgxUVkCAE1GhbnQ==} + peerDependencies: + vitest: '>=0.29.0 <1' dependencies: - c8: 7.12.0 + c8: 7.13.0 picocolors: 1.0.0 std-env: 3.3.1 - vitest: 0.28.3 - transitivePeerDependencies: - - '@edge-runtime/vm' - - '@vitest/browser' - - '@vitest/ui' - - happy-dom - - jsdom - - less - - sass - - stylus - - sugarss - - supports-color - - terser + vitest: 0.29.2 dev: true - /@vitest/expect/0.28.3: - resolution: {integrity: sha512-dnxllhfln88DOvpAK1fuI7/xHwRgTgR4wdxHldPaoTaBu6Rh9zK5b//v/cjTkhOfNP/AJ8evbNO8H7c3biwd1g==} + /@vitest/expect/0.29.2: + resolution: {integrity: sha512-wjrdHB2ANTch3XKRhjWZN0UueFocH0cQbi2tR5Jtq60Nb3YOSmakjdAvUa2JFBu/o8Vjhj5cYbcMXkZxn1NzmA==} dependencies: - '@vitest/spy': 0.28.3 - '@vitest/utils': 0.28.3 + '@vitest/spy': 0.29.2 + '@vitest/utils': 0.29.2 chai: 4.3.7 dev: true - /@vitest/runner/0.28.3: - resolution: {integrity: sha512-P0qYbATaemy1midOLkw7qf8jraJszCoEvjQOSlseiXZyEDaZTZ50J+lolz2hWiWv6RwDu1iNseL9XLsG0Jm2KQ==} + /@vitest/runner/0.29.2: + resolution: {integrity: sha512-A1P65f5+6ru36AyHWORhuQBJrOOcmDuhzl5RsaMNFe2jEkoj0faEszQS4CtPU/LxUYVIazlUtZTY0OEZmyZBnA==} dependencies: - '@vitest/utils': 0.28.3 + '@vitest/utils': 0.29.2 p-limit: 4.0.0 pathe: 1.1.0 dev: true - /@vitest/spy/0.28.3: - resolution: {integrity: sha512-jULA6suS6CCr9VZfr7/9x97pZ0hC55prnUNHNrg5/q16ARBY38RsjsfhuUXt6QOwvIN3BhSS0QqPzyh5Di8g6w==} + /@vitest/spy/0.29.2: + resolution: {integrity: sha512-Hc44ft5kaAytlGL2PyFwdAsufjbdOvHklwjNy/gy/saRbg9Kfkxfh+PklLm1H2Ib/p586RkQeNFKYuJInUssyw==} dependencies: tinyspy: 1.0.2 dev: true - /@vitest/utils/0.28.3: - resolution: {integrity: sha512-YHiQEHQqXyIbhDqETOJUKx9/psybF7SFFVCNfOvap0FvyUqbzTSDCa3S5lL4C0CLXkwVZttz9xknDoyHMguFRQ==} + /@vitest/utils/0.29.2: + resolution: {integrity: sha512-F14/Uc+vCdclStS2KEoXJlOLAEyqRhnw0gM27iXw9bMTcyKRPJrQ+rlC6XZ125GIPvvKYMPpVxNhiou6PsEeYQ==} dependencies: cli-truncate: 3.1.0 diff: 5.1.0 @@ -919,6 +1122,12 @@ packages: resolution: {integrity: sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==} engines: {node: '>=0.4.0'} hasBin: true + dev: true + + /acorn/8.8.2: + resolution: {integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==} + engines: {node: '>=0.4.0'} + hasBin: true /add-stream/1.0.0: resolution: {integrity: sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ==} @@ -1084,23 +1293,23 @@ packages: semver: 7.3.8 dev: true - /c12/1.1.0: - resolution: {integrity: sha512-9KRFWEng+TH8sGST4NNdiKzZGw1Z1CHnPGAmNqAyVP7suluROmBjD8hsiR34f94DdlrvtGvvmiGDsoFXlCBWIw==} + /c12/1.1.2: + resolution: {integrity: sha512-fHT5HDEHNMb2oImnqJ88/UlpEOkY/chdyYxSd3YCpvBqBvU0IDlHTkNc7GnjObDMxdis2lL+rwlQcNq8VeZESA==} dependencies: - defu: 6.1.1 + defu: 6.1.2 dotenv: 16.0.3 - giget: 1.0.0 - jiti: 1.16.2 - mlly: 1.1.0 - pathe: 1.0.0 - pkg-types: 1.0.1 - rc9: 2.0.0 + giget: 1.1.2 + jiti: 1.17.1 + mlly: 1.1.1 + pathe: 1.1.0 + pkg-types: 1.0.2 + rc9: 2.0.1 transitivePeerDependencies: - supports-color dev: false - /c8/7.12.0: - resolution: {integrity: sha512-CtgQrHOkyxr5koX1wEUmN/5cfDa2ckbHRA4Gy5LAL0zaCFtVWJS5++n+w4/sr2GWGerBxgTjpKeDclk/Qk6W/A==} + /c8/7.13.0: + resolution: {integrity: sha512-/NL4hQTv1gBL6J6ei80zu3IiTrmePDKXKXOTLpHvcIWZTVYQlDhVWjjWvkhICylE8EwwnMVzDZugCvdx0/DIIA==} engines: {node: '>=10.12.0'} hasBin: true dependencies: @@ -1526,7 +1735,6 @@ packages: /define-lazy-prop/2.0.0: resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==} engines: {node: '>=8'} - dev: true /define-properties/1.1.4: resolution: {integrity: sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==} @@ -1536,8 +1744,8 @@ packages: object-keys: 1.1.1 dev: true - /defu/6.1.1: - resolution: {integrity: sha512-aA964RUCsBt0FGoNIlA3uFgo2hO+WWC0fiC6DBps/0SFzkKcYoM/3CzVLIa5xSsrFjdioMdYgAIbwo80qp2MoA==} + /defu/6.1.2: + resolution: {integrity: sha512-+uO4+qr7msjNNWKYPHqN/3+Dx3NFkmIzayk2L1MyZQlvgZb/J1A0fo410dpKrN2SnqFjt8n4JL8fDJE0wIgjFQ==} /destr/1.2.2: resolution: {integrity: sha512-lrbCJwD9saUQrqUfXvl6qoM+QN3W7tLV5pAOs+OqOmopCCz/JkE05MHedJR1xfk4IAnZuJXPVuN5+7jNA2ZCiA==} @@ -1722,6 +1930,36 @@ packages: '@esbuild/win32-x64': 0.16.17 dev: true + /esbuild/0.17.10: + resolution: {integrity: sha512-n7V3v29IuZy5qgxx25TKJrEm0FHghAlS6QweUcyIgh/U0zYmQcvogWROitrTyZId1mHSkuhhuyEXtI9OXioq7A==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/android-arm': 0.17.10 + '@esbuild/android-arm64': 0.17.10 + '@esbuild/android-x64': 0.17.10 + '@esbuild/darwin-arm64': 0.17.10 + '@esbuild/darwin-x64': 0.17.10 + '@esbuild/freebsd-arm64': 0.17.10 + '@esbuild/freebsd-x64': 0.17.10 + '@esbuild/linux-arm': 0.17.10 + '@esbuild/linux-arm64': 0.17.10 + '@esbuild/linux-ia32': 0.17.10 + '@esbuild/linux-loong64': 0.17.10 + '@esbuild/linux-mips64el': 0.17.10 + '@esbuild/linux-ppc64': 0.17.10 + '@esbuild/linux-riscv64': 0.17.10 + '@esbuild/linux-s390x': 0.17.10 + '@esbuild/linux-x64': 0.17.10 + '@esbuild/netbsd-x64': 0.17.10 + '@esbuild/openbsd-x64': 0.17.10 + '@esbuild/sunos-x64': 0.17.10 + '@esbuild/win32-arm64': 0.17.10 + '@esbuild/win32-ia32': 0.17.10 + '@esbuild/win32-x64': 0.17.10 + dev: true + /escalade/3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -1737,16 +1975,16 @@ packages: engines: {node: '>=10'} dev: true - /eslint-config-prettier/8.6.0_eslint@8.33.0: + /eslint-config-prettier/8.6.0_eslint@8.35.0: resolution: {integrity: sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.33.0 + eslint: 8.35.0 dev: true - /eslint-config-standard/17.0.0_xh3wrndcszbt2l7hdksdjqnjcq: + /eslint-config-standard/17.0.0_hwjsujmtoc7k47rjh5qfu7woty: resolution: {integrity: sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==} peerDependencies: eslint: ^8.0.1 @@ -1754,29 +1992,29 @@ packages: eslint-plugin-n: ^15.0.0 eslint-plugin-promise: ^6.0.0 dependencies: - eslint: 8.33.0 - eslint-plugin-import: 2.27.5_if77esrytrhk7yc75txn6gudsm - eslint-plugin-n: 15.6.1_eslint@8.33.0 - eslint-plugin-promise: 6.1.1_eslint@8.33.0 + eslint: 8.35.0 + eslint-plugin-import: 2.27.5_g5v5jvb42lldotjrv5sxs7j4xi + eslint-plugin-n: 15.6.1_eslint@8.35.0 + eslint-plugin-promise: 6.1.1_eslint@8.35.0 dev: true - /eslint-config-unjs/0.1.0_4vsywjlpuriuw3tl5oq6zy5a64: + /eslint-config-unjs/0.1.0_ycpbpc6yetojsgtrx3mwntkhsu: resolution: {integrity: sha512-P51/jQg3RoLKqDTR6/x5637iOBYIEka/Ec6TwaNKiLhSOeYBKRVPsg/FdbV8MBExC9q4j/wRoTYBKj7sEVNUgQ==} peerDependencies: eslint: '*' typescript: '*' dependencies: - '@typescript-eslint/eslint-plugin': 5.48.2_rhuplbbkbcrmfpueggn54ylaty - '@typescript-eslint/parser': 5.48.2_4vsywjlpuriuw3tl5oq6zy5a64 - eslint: 8.33.0 - eslint-config-prettier: 8.6.0_eslint@8.33.0 - eslint-config-standard: 17.0.0_xh3wrndcszbt2l7hdksdjqnjcq - eslint-import-resolver-typescript: 3.5.3_ohdts44xlqyeyrlje4qnefqeay - eslint-plugin-import: 2.27.5_if77esrytrhk7yc75txn6gudsm - eslint-plugin-n: 15.6.1_eslint@8.33.0 - eslint-plugin-node: 11.1.0_eslint@8.33.0 - eslint-plugin-promise: 6.1.1_eslint@8.33.0 - eslint-plugin-unicorn: 43.0.2_eslint@8.33.0 + '@typescript-eslint/eslint-plugin': 5.48.2_l5zoa2nxwyvjfojyirvsx2jm4u + '@typescript-eslint/parser': 5.48.2_ycpbpc6yetojsgtrx3mwntkhsu + eslint: 8.35.0 + eslint-config-prettier: 8.6.0_eslint@8.35.0 + eslint-config-standard: 17.0.0_hwjsujmtoc7k47rjh5qfu7woty + eslint-import-resolver-typescript: 3.5.3_yckic57kx266ph64dhq6ozvb54 + eslint-plugin-import: 2.27.5_g5v5jvb42lldotjrv5sxs7j4xi + eslint-plugin-n: 15.6.1_eslint@8.35.0 + eslint-plugin-node: 11.1.0_eslint@8.35.0 + eslint-plugin-promise: 6.1.1_eslint@8.35.0 + eslint-plugin-unicorn: 43.0.2_eslint@8.35.0 typescript: 4.9.5 transitivePeerDependencies: - eslint-import-resolver-webpack @@ -1793,7 +2031,7 @@ packages: - supports-color dev: true - /eslint-import-resolver-typescript/3.5.3_ohdts44xlqyeyrlje4qnefqeay: + /eslint-import-resolver-typescript/3.5.3_yckic57kx266ph64dhq6ozvb54: resolution: {integrity: sha512-njRcKYBc3isE42LaTcJNVANR3R99H9bAxBDMNDr2W7yq5gYPxbU3MkdhsQukxZ/Xg9C2vcyLlDsbKfRDg0QvCQ==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -1802,8 +2040,8 @@ packages: dependencies: debug: 4.3.4 enhanced-resolve: 5.12.0 - eslint: 8.33.0 - eslint-plugin-import: 2.27.5_if77esrytrhk7yc75txn6gudsm + eslint: 8.35.0 + eslint-plugin-import: 2.27.5_g5v5jvb42lldotjrv5sxs7j4xi get-tsconfig: 4.3.0 globby: 13.1.3 is-core-module: 2.11.0 @@ -1813,7 +2051,7 @@ packages: - supports-color dev: true - /eslint-module-utils/2.7.4_bg2inndrnsca3qrlavn5qkmhtq: + /eslint-module-utils/2.7.4_bugauwnvmtvg4nrn7oqavpv3du: resolution: {integrity: sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==} engines: {node: '>=4'} peerDependencies: @@ -1834,38 +2072,38 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.48.2_4vsywjlpuriuw3tl5oq6zy5a64 + '@typescript-eslint/parser': 5.48.2_ycpbpc6yetojsgtrx3mwntkhsu debug: 3.2.7 - eslint: 8.33.0 + eslint: 8.35.0 eslint-import-resolver-node: 0.3.7 - eslint-import-resolver-typescript: 3.5.3_ohdts44xlqyeyrlje4qnefqeay + eslint-import-resolver-typescript: 3.5.3_yckic57kx266ph64dhq6ozvb54 transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-es/3.0.1_eslint@8.33.0: + /eslint-plugin-es/3.0.1_eslint@8.35.0: resolution: {integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==} engines: {node: '>=8.10.0'} peerDependencies: eslint: '>=4.19.1' dependencies: - eslint: 8.33.0 + eslint: 8.35.0 eslint-utils: 2.1.0 regexpp: 3.2.0 dev: true - /eslint-plugin-es/4.1.0_eslint@8.33.0: + /eslint-plugin-es/4.1.0_eslint@8.35.0: resolution: {integrity: sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==} engines: {node: '>=8.10.0'} peerDependencies: eslint: '>=4.19.1' dependencies: - eslint: 8.33.0 + eslint: 8.35.0 eslint-utils: 2.1.0 regexpp: 3.2.0 dev: true - /eslint-plugin-import/2.27.5_if77esrytrhk7yc75txn6gudsm: + /eslint-plugin-import/2.27.5_g5v5jvb42lldotjrv5sxs7j4xi: resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==} engines: {node: '>=4'} peerDependencies: @@ -1875,15 +2113,15 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.48.2_4vsywjlpuriuw3tl5oq6zy5a64 + '@typescript-eslint/parser': 5.48.2_ycpbpc6yetojsgtrx3mwntkhsu array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 debug: 3.2.7 doctrine: 2.1.0 - eslint: 8.33.0 + eslint: 8.35.0 eslint-import-resolver-node: 0.3.7 - eslint-module-utils: 2.7.4_bg2inndrnsca3qrlavn5qkmhtq + eslint-module-utils: 2.7.4_bugauwnvmtvg4nrn7oqavpv3du has: 1.0.3 is-core-module: 2.11.0 is-glob: 4.0.3 @@ -1898,16 +2136,16 @@ packages: - supports-color dev: true - /eslint-plugin-n/15.6.1_eslint@8.33.0: + /eslint-plugin-n/15.6.1_eslint@8.35.0: resolution: {integrity: sha512-R9xw9OtCRxxaxaszTQmQAlPgM+RdGjaL1akWuY/Fv9fRAi8Wj4CUKc6iYVG8QNRjRuo8/BqVYIpfqberJUEacA==} engines: {node: '>=12.22.0'} peerDependencies: eslint: '>=7.0.0' dependencies: builtins: 5.0.1 - eslint: 8.33.0 - eslint-plugin-es: 4.1.0_eslint@8.33.0 - eslint-utils: 3.0.0_eslint@8.33.0 + eslint: 8.35.0 + eslint-plugin-es: 4.1.0_eslint@8.35.0 + eslint-utils: 3.0.0_eslint@8.35.0 ignore: 5.2.4 is-core-module: 2.11.0 minimatch: 3.1.2 @@ -1915,14 +2153,14 @@ packages: semver: 7.3.8 dev: true - /eslint-plugin-node/11.1.0_eslint@8.33.0: + /eslint-plugin-node/11.1.0_eslint@8.35.0: resolution: {integrity: sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==} engines: {node: '>=8.10.0'} peerDependencies: eslint: '>=5.16.0' dependencies: - eslint: 8.33.0 - eslint-plugin-es: 3.0.1_eslint@8.33.0 + eslint: 8.35.0 + eslint-plugin-es: 3.0.1_eslint@8.35.0 eslint-utils: 2.1.0 ignore: 5.2.4 minimatch: 3.1.2 @@ -1930,16 +2168,16 @@ packages: semver: 6.3.0 dev: true - /eslint-plugin-promise/6.1.1_eslint@8.33.0: + /eslint-plugin-promise/6.1.1_eslint@8.35.0: resolution: {integrity: sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - eslint: 8.33.0 + eslint: 8.35.0 dev: true - /eslint-plugin-unicorn/43.0.2_eslint@8.33.0: + /eslint-plugin-unicorn/43.0.2_eslint@8.35.0: resolution: {integrity: sha512-DtqZ5mf/GMlfWoz1abIjq5jZfaFuHzGBZYIeuJfEoKKGWRHr2JiJR+ea+BF7Wx2N1PPRoT/2fwgiK1NnmNE3Hg==} engines: {node: '>=14.18'} peerDependencies: @@ -1948,9 +2186,9 @@ packages: '@babel/helper-validator-identifier': 7.19.1 ci-info: 3.7.1 clean-regexp: 1.0.0 - eslint: 8.33.0 - eslint-utils: 3.0.0_eslint@8.33.0 - esquery: 1.4.0 + eslint: 8.35.0 + eslint-utils: 3.0.0_eslint@8.35.0 + esquery: 1.4.2 indent-string: 4.0.0 is-builtin-module: 3.2.0 lodash: 4.17.21 @@ -1985,13 +2223,13 @@ packages: eslint-visitor-keys: 1.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.33.0: + /eslint-utils/3.0.0_eslint@8.35.0: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.33.0 + eslint: 8.35.0 eslint-visitor-keys: 2.1.0 dev: true @@ -2010,12 +2248,13 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint/8.33.0: - resolution: {integrity: sha512-WjOpFQgKK8VrCnAtl8We0SUOy/oVZ5NHykyMiagV1M9r8IFpIJX7DduK6n1mpfhlG7T1NLWm2SuD8QB7KFySaA==} + /eslint/8.35.0: + resolution: {integrity: sha512-BxAf1fVL7w+JLRQhWl2pzGeSiGqbWumV4WNvc9Rhp6tiCtm4oHnyPBSEtMGZwrQgudFQ+otqzWoPB7x+hxoWsw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint/eslintrc': 1.4.1 + '@eslint/eslintrc': 2.0.0 + '@eslint/js': 8.35.0 '@humanwhocodes/config-array': 0.11.8 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 @@ -2026,10 +2265,10 @@ packages: doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.1.1 - eslint-utils: 3.0.0_eslint@8.33.0 + eslint-utils: 3.0.0_eslint@8.35.0 eslint-visitor-keys: 3.3.0 espree: 9.4.1 - esquery: 1.4.0 + esquery: 1.4.2 esutils: 2.0.3 fast-deep-equal: 3.1.3 file-entry-cache: 6.0.1 @@ -2067,8 +2306,8 @@ packages: eslint-visitor-keys: 3.3.0 dev: true - /esquery/1.4.0: - resolution: {integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==} + /esquery/1.4.2: + resolution: {integrity: sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==} engines: {node: '>=0.10'} dependencies: estraverse: 5.3.0 @@ -2100,13 +2339,13 @@ packages: engines: {node: '>=0.10.0'} dev: true - /execa/6.1.0: - resolution: {integrity: sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + /execa/7.0.0: + resolution: {integrity: sha512-tQbH0pH/8LHTnwTrsKWideqi6rFB/QNUawEwrn+WHyz7PX1Tuz2u7wfTvbaNBdP5JD5LVWxNo8/A8CHNZ3bV6g==} + engines: {node: ^14.18.0 || ^16.14.0 || >=18.0.0} dependencies: cross-spawn: 7.0.3 get-stream: 6.0.1 - human-signals: 3.0.1 + human-signals: 4.3.0 is-stream: 3.0.0 merge-stream: 2.0.0 npm-run-path: 5.1.0 @@ -2322,16 +2561,16 @@ packages: resolution: {integrity: sha512-YCcF28IqSay3fqpIu5y3Krg/utCBHBeoflkZyHj/QcqI2nrLPC3ZegS9CmIo+hJb8K7aiGsuUl7PwWVjNG2HQQ==} dev: true - /giget/1.0.0: - resolution: {integrity: sha512-KWELZn3Nxq5+0So485poHrFriK9Bn3V/x9y+wgqrHkbmnGbjfLmZ685/SVA/ovW+ewoqW0gVI47pI4yW/VNobQ==} + /giget/1.1.2: + resolution: {integrity: sha512-HsLoS07HiQ5oqvObOI+Qb2tyZH4Gj5nYGfF9qQcZNrPw+uEFhdXtgJr01aO2pWadGHucajYDLxxbtQkm97ON2A==} hasBin: true dependencies: colorette: 2.0.19 - defu: 6.1.1 + defu: 6.1.2 https-proxy-agent: 5.0.1 mri: 1.2.0 - node-fetch-native: 1.0.1 - pathe: 1.0.0 + node-fetch-native: 1.0.2 + pathe: 1.1.0 tar: 6.1.13 transitivePeerDependencies: - supports-color @@ -2563,9 +2802,9 @@ packages: - supports-color dev: false - /human-signals/3.0.1: - resolution: {integrity: sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ==} - engines: {node: '>=12.20.0'} + /human-signals/4.3.0: + resolution: {integrity: sha512-zyzVyMjpGBX2+6cDVZeFPCdtOtdsxOeseRhB9tkQ6xXmGUNrcnBzdEKPy3VPNYz+4gy1oukVOXcrJCunSyc6QQ==} + engines: {node: '>=14.18.0'} dev: false /ignore/5.2.4: @@ -2670,7 +2909,6 @@ packages: resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} engines: {node: '>=8'} hasBin: true - dev: true /is-extglob/2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} @@ -2798,7 +3036,6 @@ packages: engines: {node: '>=8'} dependencies: is-docker: 2.2.1 - dev: true /isarray/1.0.0: resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} @@ -2829,8 +3066,8 @@ packages: istanbul-lib-report: 3.0.0 dev: true - /jiti/1.16.2: - resolution: {integrity: sha512-OKBOVWmU3FxDt/UH4zSwiKPuc1nihFZiOD722FuJlngvLz2glX1v2/TJIgoA4+mrpnXxHV6dSAoCvPcYQtoG5A==} + /jiti/1.17.1: + resolution: {integrity: sha512-NZIITw8uZQFuzQimqjUxIrIcEdxYDFIe/0xYfIlVXTkiBjjyBEvgasj5bb0/cHtPRD/NziPbT312sFrkI5ALpw==} hasBin: true /js-sdsl/4.3.0: @@ -3002,6 +3239,13 @@ packages: '@jridgewell/sourcemap-codec': 1.4.14 dev: true + /magic-string/0.29.0: + resolution: {integrity: sha512-WcfidHrDjMY+eLjlU+8OvwREqHwpgCeKVBUpQ3OhYYuvfaYCUgcbuBzappNzZvg/v8onU3oQj+BYpkOJe9Iw4Q==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.14 + dev: true + /make-dir/3.1.0: resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} engines: {node: '>=8'} @@ -3115,36 +3359,37 @@ packages: resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} engines: {node: '>=10'} hasBin: true + dev: false - /mkdist/1.1.0_typescript@4.9.5: - resolution: {integrity: sha512-eTw467KIfd/ilsY/yS6N/fjCe/glP99bTU+ydVJFRUZYaZ3UnL09Q5SGVhMrHLr4Q5qL1pDVDgitQTmLLpUa2A==} + /mkdist/1.1.1_typescript@4.9.5: + resolution: {integrity: sha512-9cEzCsBD0qpybR/lJMB0vRIDZiHP7hJHTN2mQtFU2qt0vr7lFnghxersOJbKLshaDsl4GlnY2OBzmRRUTfuaDg==} hasBin: true peerDependencies: - sass: ^1.57.1 - typescript: '>=4.9.4' + sass: ^1.58.0 + typescript: '>=4.9.5' peerDependenciesMeta: sass: optional: true typescript: optional: true dependencies: - defu: 6.1.1 - esbuild: 0.16.17 + defu: 6.1.2 + esbuild: 0.17.10 fs-extra: 11.1.0 globby: 13.1.3 - jiti: 1.16.2 + jiti: 1.17.1 mri: 1.2.0 pathe: 1.1.0 typescript: 4.9.5 dev: true - /mlly/1.1.0: - resolution: {integrity: sha512-cwzBrBfwGC1gYJyfcy8TcZU1f+dbH/T+TuOhtYP2wLv/Fb51/uV7HJQfBPtEupZ2ORLRU1EKFS/QfS3eo9+kBQ==} + /mlly/1.1.1: + resolution: {integrity: sha512-Jnlh4W/aI4GySPo6+DyTN17Q75KKbLTyFK8BrGhjNP4rxuUjbRWhE6gHg3bs33URWAF44FRm7gdQA348i3XxRw==} dependencies: - acorn: 8.8.1 + acorn: 8.8.2 pathe: 1.1.0 - pkg-types: 1.0.1 - ufo: 1.0.1 + pkg-types: 1.0.2 + ufo: 1.1.1 /modify-values/1.0.1: resolution: {integrity: sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==} @@ -3180,8 +3425,8 @@ packages: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} dev: true - /node-fetch-native/1.0.1: - resolution: {integrity: sha512-VzW+TAk2wE4X9maiKMlT+GsPU4OMmR1U9CrHSmd3DFLn2IcZ9VJ6M6BBugGfYUnPCLSYxXdZy17M0BEJyhUTwg==} + /node-fetch-native/1.0.2: + resolution: {integrity: sha512-KIkvH1jl6b3O7es/0ShyCgWLcfXxlBrLBbP3rOr23WArC66IMcU4DeZEeYEOwnopYhawLTn7/y+YtmASe8DFVQ==} dev: false /node-releases/2.0.8: @@ -3242,6 +3487,14 @@ packages: es-abstract: 1.21.1 dev: true + /ofetch/1.0.1: + resolution: {integrity: sha512-icBz2JYfEpt+wZz1FRoGcrMigjNKjzvufE26m9+yUiacRQRHwnNlGRPiDnW4op7WX/MR6aniwS8xw8jyVelF2g==} + dependencies: + destr: 1.2.2 + node-fetch-native: 1.0.2 + ufo: 1.1.1 + dev: false + /once/1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: @@ -3255,14 +3508,13 @@ packages: mimic-fn: 4.0.0 dev: false - /open/8.4.0: - resolution: {integrity: sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==} + /open/8.4.2: + resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==} engines: {node: '>=12'} dependencies: define-lazy-prop: 2.0.0 is-docker: 2.2.1 is-wsl: 2.2.0 - dev: true /optionator/0.9.1: resolution: {integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==} @@ -3407,9 +3659,6 @@ packages: engines: {node: '>=8'} dev: true - /pathe/1.0.0: - resolution: {integrity: sha512-nPdMG0Pd09HuSsr7QOKUXO2Jr9eqaDiZvDwdyIhNG5SHYujkQHYKDfGQkulBxvbDHz8oHLsTgKN86LSwYzSHAg==} - /pathe/1.1.0: resolution: {integrity: sha512-ODbEPR0KKHqECXW1GoxdDb+AZvULmXjVPy4rt+pGo2+TnjJTIPJQSVS6N63n8T2Ip+syHhbn52OewKicV0373w==} @@ -3436,12 +3685,12 @@ packages: engines: {node: '>=4'} dev: true - /pkg-types/1.0.1: - resolution: {integrity: sha512-jHv9HB+Ho7dj6ItwppRDDl0iZRYBD0jsakHXtFgoLr+cHSF6xC+QL54sJmWxyGxOLYSHm0afhXhXcQDQqH9z8g==} + /pkg-types/1.0.2: + resolution: {integrity: sha512-hM58GKXOcj8WTqUXnsQyJYXdeAPbythQgEF3nTcEo+nkD49chjQ9IKm/QJy9xf6JakXptz86h7ecP2024rrLaQ==} dependencies: jsonc-parser: 3.2.0 - mlly: 1.1.0 - pathe: 1.0.0 + mlly: 1.1.1 + pathe: 1.1.0 /pluralize/8.0.0: resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} @@ -3462,14 +3711,14 @@ packages: engines: {node: '>= 0.8.0'} dev: true - /prettier/2.8.3: - resolution: {integrity: sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==} + /prettier/2.8.4: + resolution: {integrity: sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==} engines: {node: '>=10.13.0'} hasBin: true dev: true - /pretty-bytes/6.0.0: - resolution: {integrity: sha512-6UqkYefdogmzqAZWzJ7laYeJnaXDy2/J+ZqiiMtS7t7OfpXWTlaeGMwX8U6EFvPV/YWWEKRkS8hKS4k60WHTOg==} + /pretty-bytes/6.1.0: + resolution: {integrity: sha512-Rk753HI8f4uivXi4ZCIYdhmG1V+WKzvRMg/X+M42a6t7D07RcmopXJMDNk6N++7Bl75URRGsb40ruvg7Hcp2wQ==} engines: {node: ^14.13.1 || >=16.0.0} dev: true @@ -3505,10 +3754,10 @@ packages: engines: {node: '>=8'} dev: true - /rc9/2.0.0: - resolution: {integrity: sha512-yVeYJHOpJLOhs3V6RKwz7RPPwPurrx3JjwK264sPgvo/lFdhuUrLien7iSvAO6STVkN0gSMk/MehQNHQhflqZw==} + /rc9/2.0.1: + resolution: {integrity: sha512-9EfjLgNmzP9255YX8bGnILQcmdtOXKtUlFTu8bOZPJVtaUDZ2imswcUdpK51tMjTRQyB7r5RebNijrzuyGXcVA==} dependencies: - defu: 6.1.1 + defu: 6.1.2 destr: 1.2.2 flat: 5.0.2 dev: false @@ -3632,22 +3881,22 @@ packages: glob: 7.2.3 dev: true - /rollup-plugin-dts/5.1.1_3md6k4iljipbt7fzll35epzd3m: - resolution: {integrity: sha512-zpgo52XmnLg8w4k3MScinFHZK1+ro6r7uVe34fJ0Ee8AM45FvgvTuvfWWaRgIpA4pQ1BHJuu2ospncZhkcJVeA==} + /rollup-plugin-dts/5.2.0_5h3uv6h5hdci4akcbsseut5pjq: + resolution: {integrity: sha512-B68T/haEu2MKcz4kNUhXB8/h5sq4gpplHAJIYNHbh8cp4ZkvzDvNca/11KQdFrB9ZeKucegQIotzo5T0JUtM8w==} engines: {node: '>=v14'} peerDependencies: rollup: ^3.0.0 typescript: ^4.1 dependencies: - magic-string: 0.27.0 - rollup: 3.10.1 + magic-string: 0.29.0 + rollup: 3.17.3 typescript: 4.9.5 optionalDependencies: '@babel/code-frame': 7.18.6 dev: true - /rollup/3.10.1: - resolution: {integrity: sha512-3Er+yel3bZbZX1g2kjVM+FW+RUWDxbG87fcqFM5/9HbPCTpbVp6JOLn7jlxnNlbu7s/N/uDA4EV/91E2gWnxzw==} + /rollup/3.17.3: + resolution: {integrity: sha512-p5LaCXiiOL/wrOkj8djsIDFmyU9ysUxcyW+EKRLHb6TKldJzXpImjcRSR+vgo09DBdofGcOoLOsRyxxG2n5/qQ==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: @@ -3750,13 +3999,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /source-map-support/0.5.21: - resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} - dependencies: - buffer-from: 1.1.2 - source-map: 0.6.1 - dev: true - /source-map/0.6.1: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} @@ -3915,7 +4157,7 @@ packages: /strip-literal/1.0.0: resolution: {integrity: sha512-5o4LsH1lzBzO9UFH63AJ2ad2/S2AVx6NtjOcaz+VTT2h1RiRvbipW72z8M/lxEhcPHDBQwpDrnTF7sXy/7OwCQ==} dependencies: - acorn: 8.8.1 + acorn: 8.8.2 dev: true /supports-color/5.5.0: @@ -4112,8 +4354,8 @@ packages: hasBin: true dev: true - /ufo/1.0.1: - resolution: {integrity: sha512-boAm74ubXHY7KJQZLlXrtMz52qFvpsbOxDcZOnw/Wf+LS4Mmyu7JxmzD4tDLtUQtmZECypJ0FrCz4QIe6dvKRA==} + /ufo/1.1.1: + resolution: {integrity: sha512-MvlCc4GHrmZdAllBc0iUDowff36Q9Ndw/UzqmEKyrfSzokTd9ZCy1i+IIk5hrYKkjoYVQyNbrw7/F8XJ2rEwTg==} /uglify-js/3.17.4: resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==} @@ -4132,33 +4374,32 @@ packages: which-boxed-primitive: 1.0.2 dev: true - /unbuild/1.1.1: - resolution: {integrity: sha512-HlhHj6cUPBQJmhoczQoU6dzdTFO0Jr9EiGWEZ1EwHGXlGRR6LXcKyfX3PMrkM48uWJjBWiCgTQdkFOAk3tlK6Q==} + /unbuild/1.1.2: + resolution: {integrity: sha512-EK5LeABThyn5KbX0eo5c7xKRQhnHVxKN8/e5Y+YQEf4ZobJB6OZ766756wbVqzIY/G/MvAfLbc6EwFPdSNnlpA==} hasBin: true dependencies: - '@rollup/plugin-alias': 4.0.2_rollup@3.10.1 - '@rollup/plugin-commonjs': 24.0.0_rollup@3.10.1 - '@rollup/plugin-json': 6.0.0_rollup@3.10.1 - '@rollup/plugin-node-resolve': 15.0.1_rollup@3.10.1 - '@rollup/plugin-replace': 5.0.2_rollup@3.10.1 - '@rollup/pluginutils': 5.0.2_rollup@3.10.1 + '@rollup/plugin-alias': 4.0.3_rollup@3.17.3 + '@rollup/plugin-commonjs': 24.0.1_rollup@3.17.3 + '@rollup/plugin-json': 6.0.0_rollup@3.17.3 + '@rollup/plugin-node-resolve': 15.0.1_rollup@3.17.3 + '@rollup/plugin-replace': 5.0.2_rollup@3.17.3 + '@rollup/pluginutils': 5.0.2_rollup@3.17.3 chalk: 5.2.0 consola: 2.15.3 - defu: 6.1.1 - esbuild: 0.16.17 + defu: 6.1.2 + esbuild: 0.17.10 globby: 13.1.3 hookable: 5.4.2 - jiti: 1.16.2 - magic-string: 0.27.0 - mkdirp: 1.0.4 - mkdist: 1.1.0_typescript@4.9.5 - mlly: 1.1.0 + jiti: 1.17.1 + magic-string: 0.29.0 + mkdist: 1.1.1_typescript@4.9.5 + mlly: 1.1.1 mri: 1.2.0 - pathe: 1.0.0 - pkg-types: 1.0.1 - pretty-bytes: 6.0.0 - rollup: 3.10.1 - rollup-plugin-dts: 5.1.1_3md6k4iljipbt7fzll35epzd3m + pathe: 1.1.0 + pkg-types: 1.0.2 + pretty-bytes: 6.1.0 + rollup: 3.17.3 + rollup-plugin-dts: 5.2.0_5h3uv6h5hdci4akcbsseut5pjq scule: 1.0.0 typescript: 4.9.5 untyped: 1.2.2 @@ -4220,19 +4461,17 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /vite-node/0.28.3_@types+node@18.11.18: - resolution: {integrity: sha512-uJJAOkgVwdfCX8PUQhqLyDOpkBS5+j+FdbsXoPVPDlvVjRkb/W/mLYQPSL6J+t8R0UV8tJSe8c9VyxVQNsDSyg==} + /vite-node/0.29.2_@types+node@18.14.2: + resolution: {integrity: sha512-5oe1z6wzI3gkvc4yOBbDBbgpiWiApvuN4P55E8OI131JGrSuo4X3SOZrNmZYo4R8Zkze/dhi572blX0zc+6SdA==} engines: {node: '>=v14.16.0'} hasBin: true dependencies: cac: 6.7.14 debug: 4.3.4 - mlly: 1.1.0 + mlly: 1.1.1 pathe: 1.1.0 picocolors: 1.0.0 - source-map: 0.6.1 - source-map-support: 0.5.21 - vite: 4.0.4_@types+node@18.11.18 + vite: 4.0.4_@types+node@18.14.2 transitivePeerDependencies: - '@types/node' - less @@ -4243,7 +4482,7 @@ packages: - terser dev: true - /vite/4.0.4_@types+node@18.11.18: + /vite/4.0.4_@types+node@18.14.2: resolution: {integrity: sha512-xevPU7M8FU0i/80DMR+YhgrzR5KS2ORy1B4xcX/cXLsvnUWvfHuqMmVU6N0YiJ4JWGRJJsLCgjEzKjG9/GKoSw==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -4268,17 +4507,17 @@ packages: terser: optional: true dependencies: - '@types/node': 18.11.18 + '@types/node': 18.14.2 esbuild: 0.16.17 postcss: 8.4.21 resolve: 1.22.1 - rollup: 3.10.1 + rollup: 3.17.3 optionalDependencies: fsevents: 2.3.2 dev: true - /vitest/0.28.3: - resolution: {integrity: sha512-N41VPNf3VGJlWQizGvl1P5MGyv3ZZA2Zvh+2V8L6tYBAAuqqDK4zExunT1Cdb6dGfZ4gr+IMrnG8d4Z6j9ctPw==} + /vitest/0.29.2: + resolution: {integrity: sha512-ydK9IGbAvoY8wkg29DQ4ivcVviCaUi3ivuPKfZEVddMTenFHUfB8EEDXQV8+RasEk1ACFLgMUqAaDuQ/Nk+mQA==} engines: {node: '>=v14.16.0'} hasBin: true peerDependencies: @@ -4301,11 +4540,11 @@ packages: dependencies: '@types/chai': 4.3.4 '@types/chai-subset': 1.3.3 - '@types/node': 18.11.18 - '@vitest/expect': 0.28.3 - '@vitest/runner': 0.28.3 - '@vitest/spy': 0.28.3 - '@vitest/utils': 0.28.3 + '@types/node': 18.14.2 + '@vitest/expect': 0.29.2 + '@vitest/runner': 0.29.2 + '@vitest/spy': 0.29.2 + '@vitest/utils': 0.29.2 acorn: 8.8.1 acorn-walk: 8.2.0 cac: 6.7.14 @@ -4320,8 +4559,8 @@ packages: tinybench: 2.3.1 tinypool: 0.3.1 tinyspy: 1.0.2 - vite: 4.0.4_@types+node@18.11.18 - vite-node: 0.28.3_@types+node@18.11.18 + vite: 4.0.4_@types+node@18.14.2 + vite-node: 0.29.2_@types+node@18.14.2 why-is-node-running: 2.2.2 transitivePeerDependencies: - less @@ -4409,6 +4648,11 @@ packages: /yallist/4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + /yaml/2.2.1: + resolution: {integrity: sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==} + engines: {node: '>= 14'} + dev: false + /yargs-parser/20.2.9: resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} engines: {node: '>=10'} diff --git a/src/cli.ts b/src/cli.ts index 78dc41a..d18364e 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,98 +1,28 @@ #!/usr/bin/env node -import { resolve } from "node:path"; -import { existsSync, promises as fsp } from "node:fs"; import consola from "consola"; import mri from "mri"; -import { execa } from "execa"; -import { getGitDiff, parseCommits, filterCommits } from "./git"; -import { loadChangelogConfig } from "./config"; -import { generateMarkDown } from "./markdown"; -import { bumpVersion } from "./semver"; -async function main() { - const args = mri(process.argv.splice(2)); - const cwd = resolve(args._[0] || ""); - process.chdir(cwd); - - const config = await loadChangelogConfig(cwd, { - from: args.from, - to: args.to, - output: args.output, - newVersion: args.r, - }); - - const logger = consola.create({ stdout: process.stderr }); - logger.info(`Generating changelog for ${config.from}...${config.to}`); - - const rawCommits = await getGitDiff(config.from, config.to); - - // Parse commits as conventional commits - const commits = parseCommits(rawCommits, config); - const filteredCommits = filterCommits(commits, config); - - // Bump version optionally - if (args.bump || args.release) { - const newVersion = await bumpVersion(filteredCommits, config); - if (!newVersion) { - consola.error("Unable to bump version based on changes."); - process.exit(1); - } - config.newVersion = newVersion; - } +const subCommands = { + _default: () => import("./commands/default"), + gh: () => import("./commands/github"), + github: () => import("./commands/github"), +}; - // Generate markdown - const markdown = await generateMarkDown(filteredCommits, config); - - // Show changelog in CLI unless bumping or releasing - const displayOnly = !args.bump && !args.release; - if (displayOnly) { - consola.log("\n\n" + markdown + "\n\n"); +async function main() { + const args = process.argv.slice(2); + let subCommand = args[0]; + if (!subCommand || subCommand.startsWith("-")) { + subCommand = "_default"; + } else { + args.shift(); } - // Update changelog file (only when bumping or releasing or when --output is specified as a file) - if (typeof config.output === "string" && (args.output || !displayOnly)) { - let changelogMD: string; - if (existsSync(config.output)) { - consola.info(`Updating ${config.output}`); - changelogMD = await fsp.readFile(config.output, "utf8"); - } else { - consola.info(`Creating ${config.output}`); - changelogMD = "# Changelog\n\n"; - } - - const lastEntry = changelogMD.match(/^###?\s+.*$/m); - - if (lastEntry) { - changelogMD = - changelogMD.slice(0, lastEntry.index) + - markdown + - "\n\n" + - changelogMD.slice(lastEntry.index); - } else { - changelogMD += "\n" + markdown + "\n\n"; - } - - await fsp.writeFile(config.output, changelogMD); + if (!(subCommand in subCommands)) { + consola.error(`Unknown command ${subCommand}`); + process.exit(1); } - // Commit and tag changes for release mode - if (args.release) { - if (args.commit !== false) { - await execa("git", ["add", "CHANGELOG.md", "package.json"], { cwd }); - await execa( - "git", - ["commit", "-m", `chore(release): v${config.newVersion}`], - { cwd } - ); - } - if (args.tag !== false) { - await execa( - "git", - ["tag", "-am", "v" + config.newVersion, "v" + config.newVersion], - { cwd } - ); - } - } + await subCommands[subCommand]().then((r) => r.default(mri(args))); } main().catch(consola.error); diff --git a/src/commands/default.ts b/src/commands/default.ts new file mode 100644 index 0000000..29cf44d --- /dev/null +++ b/src/commands/default.ts @@ -0,0 +1,122 @@ +import { existsSync, promises as fsp } from "node:fs"; +import type { Argv } from "mri"; +import { resolve } from "pathe"; +import consola from "consola"; +import { execa } from "execa"; +import { + loadChangelogConfig, + getGitDiff, + parseCommits, + bumpVersion, + generateMarkDown, +} from ".."; +import { githubRelease } from "./github"; + +export default async function defaultMain(args: Argv) { + const cwd = resolve(args._[0] /* bw compat */ || args.dir || ""); + process.chdir(cwd); + consola.wrapConsole(); + + const config = await loadChangelogConfig(cwd, { + from: args.from, + to: args.to, + output: args.output, + newVersion: args.r, + }); + + const logger = consola.create({ stdout: process.stderr }); + logger.info(`Generating changelog for ${config.from}...${config.to}`); + + const rawCommits = await getGitDiff(config.from, config.to); + + // Parse commits as conventional commits + const commits = parseCommits(rawCommits, config).filter( + (c) => + config.types[c.type] && + !(c.type === "chore" && c.scope === "deps" && !c.isBreaking) + ); + + // Bump version optionally + if (args.bump || args.release) { + let type; + if (args.major) { + type = "major"; + } else if (args.minor) { + type = "minor"; + } else if (args.patch) { + type = "patch"; + } + const newVersion = await bumpVersion(commits, config, { type }); + if (!newVersion) { + consola.error("Unable to bump version based on changes."); + process.exit(1); + } + config.newVersion = newVersion; + } + + // Generate markdown + const markdown = await generateMarkDown(commits, config); + + // Show changelog in CLI unless bumping or releasing + const displayOnly = !args.bump && !args.release; + if (displayOnly) { + consola.log("\n\n" + markdown + "\n\n"); + } + + // Update changelog file (only when bumping or releasing or when --output is specified as a file) + if (typeof config.output === "string" && (args.output || !displayOnly)) { + let changelogMD: string; + if (existsSync(config.output)) { + consola.info(`Updating ${config.output}`); + changelogMD = await fsp.readFile(config.output, "utf8"); + } else { + consola.info(`Creating ${config.output}`); + changelogMD = "# Changelog\n\n"; + } + + const lastEntry = changelogMD.match(/^###?\s+.*$/m); + + if (lastEntry) { + changelogMD = + changelogMD.slice(0, lastEntry.index) + + markdown + + "\n\n" + + changelogMD.slice(lastEntry.index); + } else { + changelogMD += "\n" + markdown + "\n\n"; + } + + await fsp.writeFile(config.output, changelogMD); + } + + // Commit and tag changes for release mode + if (args.release) { + if (args.commit !== false) { + const filesToAdd = [config.output, "package.json"].filter( + (f) => f && typeof f === "string" + ) as string[]; + await execa("git", ["add", ...filesToAdd], { cwd }); + await execa( + "git", + ["commit", "-m", `chore(release): v${config.newVersion}`], + { cwd } + ); + } + if (args.tag !== false) { + await execa( + "git", + ["tag", "-am", "v" + config.newVersion, "v" + config.newVersion], + { cwd } + ); + } + if (args.push === true) { + await execa("git", ["push", "--follow-tags"], { cwd }); + } + if (args.github !== false && config.repo.provider === "github") { + await githubRelease(config, { + version: config.newVersion, + body: markdown.split("\n").slice(2).join("\n"), + }); + } + } +} diff --git a/src/commands/github.ts b/src/commands/github.ts new file mode 100644 index 0000000..79e039d --- /dev/null +++ b/src/commands/github.ts @@ -0,0 +1,127 @@ +import { promises as fsp } from "node:fs"; +import type { Argv } from "mri"; +import { resolve } from "pathe"; +import consola from "consola"; +import { underline, cyan } from "colorette"; +import open from "open"; +import { + getGithubChangelog, + resolveGithubToken, + syncGithubRelease, +} from "../github"; +import { + ChangelogConfig, + loadChangelogConfig, + parseChangelogMarkdown, +} from ".."; + +export default async function githubMain(args: Argv) { + const cwd = resolve(args.dir || ""); + process.chdir(cwd); + + const [subCommand, ..._versions] = args._; + if (subCommand !== "release") { + consola.log( + "Usage: changelogen gh release [all|versions...] [--dir] [--token]" + ); + process.exit(1); + } + + const config = await loadChangelogConfig(cwd, {}); + + if (config.repo?.provider !== "github") { + consola.error( + "This command is only supported for github repository provider." + ); + process.exit(1); + } + + if (args.token) { + config.tokens.github = args.token; + } + + let changelogMd: string; + if (typeof config.output === "string") { + changelogMd = await fsp + .readFile(resolve(config.output), "utf8") + .catch(() => null); + } + if (!changelogMd) { + changelogMd = await getGithubChangelog(config).catch(() => null); + } + if (!changelogMd) { + consola.error(`Cannot resolve CHANGELOG.md`); + process.exit(1); + } + + const changelogReleases = parseChangelogMarkdown(changelogMd).releases; + + let versions = [..._versions].map((v) => v.replace(/^v/, "")); + if (versions[0] === "all") { + versions = changelogReleases.map((r) => r.version).sort(); + } else if (versions.length === 0) { + if (config.newVersion) { + versions = [config.newVersion]; + } else if (changelogReleases.length > 0) { + versions = [changelogReleases[0].version]; + } + } + + if (versions.length === 0) { + consola.error(`No versions specified to release!`); + process.exit(1); + } + + for (const version of versions) { + const release = changelogReleases.find((r) => r.version === version); + if (!release) { + consola.warn( + `No matching changelog entry found for ${version} in CHANGELOG.md. Skipping!` + ); + continue; + } + if (!release.body || !release.version) { + consola.warn( + `Changelog entry for ${version} in CHANGELOG.md is missing body or version. Skipping!` + ); + continue; + } + await githubRelease(config, { + version: release.version, + body: release.body, + }); + } +} + +export async function githubRelease( + config: ChangelogConfig, + release: { version: string; body: string } +) { + if (!config.tokens.github) { + config.tokens.github = await resolveGithubToken(config).catch( + () => undefined + ); + } + const result = await syncGithubRelease(config, release); + if (result.status === "manual") { + if (result.error) { + consola.error(result.error); + process.exitCode = 1; + } + await open(result.url) + .then(() => { + consola.info(`Followup in the browser to manually create the release.`); + }) + .catch(() => { + consola.info( + `Open this link to manually create a release: \n` + + underline(cyan(result.url)) + + "\n" + ); + }); + } else { + consola.success( + `Synced ${cyan(`v${release.version}`)} to Github releases!` + ); + } +} diff --git a/src/config.ts b/src/config.ts index da5ced1..3d65302 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,51 +1,62 @@ import { resolve } from "node:path"; -import { loadConfig } from "c12"; +import { loadConfig, setupDotenv } from "c12"; import { readPackageJSON } from "pkg-types"; import { getLastGitTag, getCurrentGitRef } from "./git"; +import { getRepoConfig, RepoProvider } from "./repo"; import type { SemverBumpType } from "./semver"; +import type { RepoConfig } from "./repo"; export interface ChangelogConfig { cwd: string; types: Record; scopeMap: Record; - github: string; + repo?: RepoConfig; + tokens: Partial>; from: string; to: string; newVersion?: string; output: string | boolean; } -const ConfigDefaults: ChangelogConfig = { - types: { - feat: { title: "🚀 Enhancements", semver: "minor" }, - perf: { title: "🔥 Performance", semver: "patch" }, - fix: { title: "🩹 Fixes", semver: "patch" }, - refactor: { title: "💅 Refactors", semver: "patch" }, - docs: { title: "📖 Documentation", semver: "patch" }, - build: { title: "📦 Build", semver: "patch" }, - types: { title: "🌊 Types", semver: "patch" }, - chore: { title: "🏡 Chore" }, - examples: { title: "🏀 Examples" }, - test: { title: "✅ Tests" }, - style: { title: "🎨 Styles" }, - ci: { title: "🤖 CI" }, - }, - cwd: null, - github: "", - from: "", - to: "", - output: "CHANGELOG.md", - scopeMap: {}, -}; +const getDefaultConfig = () => + { + types: { + feat: { title: "🚀 Enhancements", semver: "minor" }, + perf: { title: "🔥 Performance", semver: "patch" }, + fix: { title: "🩹 Fixes", semver: "patch" }, + refactor: { title: "💅 Refactors", semver: "patch" }, + docs: { title: "📖 Documentation", semver: "patch" }, + build: { title: "📦 Build", semver: "patch" }, + types: { title: "🌊 Types", semver: "patch" }, + chore: { title: "🏡 Chore" }, + examples: { title: "🏀 Examples" }, + test: { title: "✅ Tests" }, + style: { title: "🎨 Styles" }, + ci: { title: "🤖 CI" }, + }, + cwd: null, + from: "", + to: "", + output: "CHANGELOG.md", + scopeMap: {}, + tokens: { + github: + process.env.CHANGELOGEN_TOKENS_GITHUB || + process.env.GITHUB_TOKEN || + process.env.GH_TOKEN, + }, + }; export async function loadChangelogConfig( cwd: string, overrides?: Partial ): Promise { + await setupDotenv({ cwd }); + const defaults = getDefaultConfig(); const { config } = await loadConfig({ cwd, name: "changelog", - defaults: ConfigDefaults, + defaults, overrides: { cwd, ...(overrides as ChangelogConfig), @@ -64,21 +75,17 @@ export async function loadChangelogConfig( config.output = false; } else if (config.output) { config.output = - config.output === true - ? ConfigDefaults.output - : resolve(cwd, config.output); + config.output === true ? defaults.output : resolve(cwd, config.output); } - if (!config.github) { + if (!config.repo) { const pkg = await readPackageJSON(cwd).catch(() => {}); if (pkg && pkg.repository) { - const repo = + const repoUrl = typeof pkg.repository === "string" ? pkg.repository : pkg.repository.url; - if (/^\w+\/\w+$/.test(repo)) { - config.github = repo; - } + config.repo = getRepoConfig(repoUrl); } } diff --git a/src/git.ts b/src/git.ts index addab2e..0ded01f 100644 --- a/src/git.ts +++ b/src/git.ts @@ -33,12 +33,9 @@ export interface RevertPair { } export async function getLastGitTag() { - const r = await execCommand("git", [ - "--no-pager", - "tag", - "-l", - "--sort=creatordate", - ]).then((r) => r.split("\n")); + const r = await execCommand("git", ["describe", "--tags", "--abbrev=0"]).then( + (r) => r.split("\n") + ); return r[r.length - 1]; } diff --git a/src/github.ts b/src/github.ts new file mode 100644 index 0000000..0137d7e --- /dev/null +++ b/src/github.ts @@ -0,0 +1,160 @@ +import { existsSync, promises as fsp } from "node:fs"; +import { homedir } from "node:os"; +import { $fetch, FetchOptions } from "ofetch"; +import { join } from "pathe"; +import { ChangelogConfig } from "./config"; + +export interface GithubOptions { + repo: string; + token: string; +} + +export interface GithubRelease { + id?: string; + tag_name: string; + name?: string; + body?: string; + draft?: boolean; + prerelease?: boolean; +} + +export async function listGithubReleases( + config: ChangelogConfig +): Promise { + return await githubFetch(config, `/repos/${config.repo.repo}/releases`, { + query: { per_page: 100 }, + }); +} + +export async function getGithubReleaseByTag( + config: ChangelogConfig, + tag: string +): Promise { + return await githubFetch( + config, + `/repos/${config.repo.repo}/releases/tags/${tag}`, + {} + ); +} + +export async function getGithubChangelog(config: ChangelogConfig) { + return await githubFetch( + config, + `https://raw.githubusercontent.com/${config.repo.repo}/main/CHANGELOG.md` + ); +} + +export async function createGithubRelease( + config: ChangelogConfig, + body: GithubRelease +) { + return await githubFetch(config, `/repos/${config.repo.repo}/releases`, { + method: "POST", + body, + }); +} + +export async function updateGithubRelease( + config: ChangelogConfig, + id: string, + body: GithubRelease +) { + return await githubFetch( + config, + `/repos/${config.repo.repo}/releases/${id}`, + { + method: "PATCH", + body, + } + ); +} + +export async function syncGithubRelease( + config: ChangelogConfig, + release: { version: string; body: string } +) { + const currentGhRelease = await getGithubReleaseByTag( + config, + `v${release.version}` + ).catch(() => {}); + + const ghRelease: GithubRelease = { + tag_name: `v${release.version}`, + name: `v${release.version}`, + body: release.body, + }; + + if (!config.tokens.github) { + return { + status: "manual", + url: githubNewReleaseURL(config, release), + }; + } + + try { + const newGhRelease = await (currentGhRelease + ? updateGithubRelease(config, currentGhRelease.id, ghRelease) + : createGithubRelease(config, ghRelease)); + return { + status: currentGhRelease ? "updated" : "created", + id: newGhRelease.id, + }; + } catch (error) { + return { + status: "manual", + error, + url: githubNewReleaseURL(config, release), + }; + } +} + +export function githubNewReleaseURL( + config: ChangelogConfig, + release: { version: string; body: string } +) { + return `https://${config.repo.domain}/${config.repo.repo}/releases/new?tag=v${ + release.version + }&title=v${release.version}&body=${encodeURIComponent(release.body)}`; +} + +export async function resolveGithubToken(config: ChangelogConfig) { + const env = + process.env.CHANGELOGEN_TOKENS_GITHUB || + process.env.GITHUB_TOKEN || + process.env.GH_TOKEN; + if (env) { + return env; + } + + const configHome = process.env.XDG_CONFIG_HOME || join(homedir(), ".config"); + const ghCLIPath = join(configHome, "gh", "hosts.yml"); + if (existsSync(ghCLIPath)) { + const yamlContents = await fsp.readFile(ghCLIPath, "utf8"); + const parseYAML = await import("yaml").then((r) => r.parse); + const ghCLIConfig = parseYAML(yamlContents); + if (ghCLIConfig && ghCLIConfig[config.repo.domain]) { + return ghCLIConfig["github.com"].oauth_token; + } + } +} + +// --- Internal utils --- +async function githubFetch( + config: ChangelogConfig, + url: string, + opts: FetchOptions = {} +) { + return await $fetch(url, { + ...opts, + baseURL: + config.repo.domain === "github.com" + ? "https://api.github.com" + : `https://${config.repo.domain}/api/v3`, + headers: { + ...opts.headers, + authorization: config.tokens.github + ? `Token ${config.tokens.github}` + : undefined, + }, + }); +} diff --git a/src/index.ts b/src/index.ts index 5881b27..84ce912 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,6 @@ export * from "./git"; +export * from "./github"; export * from "./markdown"; export * from "./config"; export * from "./semver"; +export * from "./repo"; diff --git a/src/markdown.ts b/src/markdown.ts index a62960c..e2a45e3 100644 --- a/src/markdown.ts +++ b/src/markdown.ts @@ -3,6 +3,7 @@ import { convert } from "convert-gitmoji"; import { fetch } from "node-fetch-native"; import type { ChangelogConfig } from "./config"; import type { GitCommit, Reference } from "./git"; +import { formatReference, formatCompareChanges } from "./repo"; export async function generateMarkDown( commits: GitCommit[], @@ -17,13 +18,8 @@ export async function generateMarkDown( const v = config.newVersion && `v${config.newVersion}`; markdown.push("", "## " + (v || `${config.from}...${config.to}`), ""); - if (config.github) { - markdown.push( - `[compare changes](https://github.com/${config.github}/compare/${ - config.from - }...${v || config.to})`, - "" - ); + if (config.repo) { + markdown.push(formatCompareChanges(v, config), ""); } for (const type in config.types) { @@ -68,7 +64,7 @@ export async function generateMarkDown( [..._authors.keys()].map(async (authorName) => { const meta = _authors.get(authorName); for (const email of meta.email) { - const { user } = await fetch(`https://ungh.unjs.io/user/find/${email}`) + const { user } = await fetch(`https://ungh.cc/users/find/${email}`) .then((r) => r.json()) .catch(() => ({ user: null })); if (user) { @@ -102,6 +98,34 @@ export async function generateMarkDown( return convert(markdown.join("\n").trim(), true); } +export function parseChangelogMarkdown(contents: string) { + const headings = [...contents.matchAll(CHANGELOG_RELEASE_HEAD_RE)]; + const releases: { version?: string; body: string }[] = []; + + for (let i = 0; i < headings.length; i++) { + const heading = headings[i]; + const nextHeading = headings[i + 1]; + const [, title] = heading; + const version = title.match(VERSION_RE); + const release = { + version: version ? version[1] : undefined, + body: contents + .slice( + heading.index + heading[0].length, + nextHeading?.index ?? contents.length + ) + .trim(), + }; + releases.push(release); + } + + return { + releases, + }; +} + +// --- Internal utils --- + function formatCommit(commit: GitCommit, config: ChangelogConfig) { return ( " - " + @@ -112,33 +136,20 @@ function formatCommit(commit: GitCommit, config: ChangelogConfig) { ); } -const refTypeMap: Record = { - "pull-request": "pull", - hash: "commit", - issue: "ssue", -}; - -function formatReference(ref: Reference, config: ChangelogConfig) { - if (!config.github) { - return ref.value; - } - return `[${ref.value}](https://github.com/${config.github}/${ - refTypeMap[ref.type] - }/${ref.value.replace(/^#/, "")})`; -} - function formatReferences(references: Reference[], config: ChangelogConfig) { const pr = references.filter((ref) => ref.type === "pull-request"); const issue = references.filter((ref) => ref.type === "issue"); if (pr.length > 0 || issue.length > 0) { return ( " (" + - [...pr, ...issue].map((ref) => formatReference(ref, config)).join(", ") + + [...pr, ...issue] + .map((ref) => formatReference(ref, config.repo)) + .join(", ") + ")" ); } if (references.length > 0) { - return " (" + formatReference(references[0], config) + ")"; + return " (" + formatReference(references[0], config.repo) + ")"; } return ""; } @@ -162,3 +173,6 @@ function groupBy(items: any[], key: string) { } return groups; } + +const CHANGELOG_RELEASE_HEAD_RE = /^#{2,}\s+.*(v?(\d+\.\d+\.\d+)).*$/gm; +const VERSION_RE = /^v?(\d+\.\d+\.\d+)$/; diff --git a/src/repo.ts b/src/repo.ts new file mode 100644 index 0000000..4a0fa19 --- /dev/null +++ b/src/repo.ts @@ -0,0 +1,102 @@ +import type { Reference } from "./git"; +import type { ChangelogConfig } from "./config"; + +export type RepoProvider = "github" | "gitlab" | "bitbucket"; + +export type RepoConfig = { + domain?: string; + repo?: string; + provider?: RepoProvider; + token?: string; +}; + +const providerToRefSpec: Record< + RepoProvider, + Record +> = { + github: { "pull-request": "pull", hash: "commit", issue: "issues" }, + gitlab: { "pull-request": "merge_requests", hash: "commit", issue: "issues" }, + bitbucket: { + "pull-request": "pull-requests", + hash: "commit", + issue: "issues", + }, +}; + +const providerToDomain: Record = { + github: "github.com", + gitlab: "gitlab.com", + bitbucket: "bitbucket.org", +}; + +const domainToProvider: Record = { + "github.com": "github", + "gitlab.com": "gitlab", + "bitbucket.org": "bitbucket", +}; + +// https://regex101.com/r/NA4Io6/1 +const providerURLRegex = + /^(?:(?\w+)@)?(?:(?[^/:]+):)?(?\w+\/\w+)(?:\.git)?$/; + +function baseUrl(config: RepoConfig) { + return `https://${config.domain}/${config.repo}`; +} + +export function formatReference(ref: Reference, repo?: RepoConfig) { + if (!repo || !(repo.provider in providerToRefSpec)) { + return ref.value; + } + const refSpec = providerToRefSpec[repo.provider]; + return `[${ref.value}](${baseUrl(repo)}/${ + refSpec[ref.type] + }/${ref.value.replace(/^#/, "")})`; +} + +export function formatCompareChanges(v: string, config: ChangelogConfig) { + const part = + config.repo.provider === "bitbucket" ? "branches/compare" : "compare"; + return `[compare changes](${baseUrl(config.repo)}/${part}/${config.from}...${ + v || config.to + })`; +} + +export function getRepoConfig(repoUrl = ""): RepoConfig { + let provider; + let repo; + let domain; + + let url; + try { + url = new URL(repoUrl); + } catch {} + + const m = repoUrl.match(providerURLRegex)?.groups ?? {}; + if (m.repo && m.provider) { + repo = m.repo; + provider = + m.provider in domainToProvider + ? domainToProvider[m.provider] + : m.provider; + domain = + provider in providerToDomain ? providerToDomain[provider] : provider; + } else if (url) { + domain = url.hostname; + repo = url.pathname + .split("/") + .slice(1, 3) + .join("/") + .replace(/\.git$/, ""); + provider = domainToProvider[domain]; + } else if (m.repo) { + repo = m.repo; + provider = "github"; + domain = providerToDomain[provider]; + } + + return { + provider, + repo, + domain, + }; +} diff --git a/src/semver.ts b/src/semver.ts index d92e6d6..abdfc50 100644 --- a/src/semver.ts +++ b/src/semver.ts @@ -29,9 +29,10 @@ export function determineSemverChange( export async function bumpVersion( commits: GitCommit[], - config: ChangelogConfig + config: ChangelogConfig, + opts: { type?: SemverBumpType } = {} ): Promise { - let type = determineSemverChange(commits, config) || "patch"; + let type = opts.type || determineSemverChange(commits, config) || "patch"; const originalType = type; const pkgPath = resolve(config.cwd, "package.json"); diff --git a/test/fixtures/CHANGELOG.md b/test/fixtures/CHANGELOG.md new file mode 100644 index 0000000..21a8e29 --- /dev/null +++ b/test/fixtures/CHANGELOG.md @@ -0,0 +1,44 @@ +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## v0.4.1 + +[compare changes](https://github.com/unjs/changelogen/compare/v0.4.0...v0.4.1) + +### 🩹 Fixes + +- Bump by patch by default ([7e38438](https://github.com/unjs/changelogen/commit/7e38438)) + +### 🏡 Chore + +- Update renovate config ([#54](https://github.com/unjs/changelogen/pull/54)) +- Update dependencies ([4216bc6](https://github.com/unjs/changelogen/commit/4216bc6)) +- Update repo ([83c349f](https://github.com/unjs/changelogen/commit/83c349f)) + +### ❤️ Contributors + +- Pooya Parsa +- Nozomu Ikuta + +## 0.4.0 + +[compare changes](https://github.com/unjs/changelogen/compare/v0.3.5...v0.4.0) + +### 🚀 Enhancements + +- ⚠️ Resolve github usernames using `ungh/ungh` ([#46](https://github.com/unjs/changelogen/pull/46)) + +### 🩹 Fixes + +- **markdown:** Avoid rendering `noreply.github.com` emails ([4871721](https://github.com/unjs/changelogen/commit/4871721)) +- Avoid rendering authors with `[bot]` in their name ([4f3f644](https://github.com/unjs/changelogen/commit/4f3f644)) +- Format name to avoid duplicates ([f74a988](https://github.com/unjs/changelogen/commit/f74a988)) + +#### ⚠️ Breaking Changes + +- ⚠️ Resolve github usernames using `ungh/ungh` ([#46](https://github.com/unjs/changelogen/pull/46)) + +### ❤️ Contributors + +- Pooya Parsa ([@pi0](http://github.com/pi0)) diff --git a/test/git.test.ts b/test/git.test.ts index 8930a1a..fe9c298 100644 --- a/test/git.test.ts +++ b/test/git.test.ts @@ -7,7 +7,10 @@ import { loadChangelogConfig, parseCommits, filterCommits, + getRepoConfig, + formatReference, } from "../src"; +import { RepoConfig } from "./../src/repo"; describe("git", () => { test("getGitDiff should work", async () => { @@ -308,7 +311,7 @@ describe("git", () => { ### 🩹 Fixes - Consider docs and refactor as semver patch for bump ([648ccf1](https://github.com/unjs/changelogen/commit/648ccf1)) - - **scope:** ⚠️ Breaking change example, close #123 ([#134](https://github.com/unjs/changelogen/pull/134), [#123](https://github.com/unjs/changelogen/ssue/123)) + - **scope:** ⚠️ Breaking change example, close #123 ([#134](https://github.com/unjs/changelogen/pull/134), [#123](https://github.com/unjs/changelogen/issues/123)) ### 🏡 Chore @@ -321,7 +324,7 @@ describe("git", () => { #### ⚠️ Breaking Changes - - **scope:** ⚠️ Breaking change example, close #123 ([#134](https://github.com/unjs/changelogen/pull/134), [#123](https://github.com/unjs/changelogen/ssue/123)) + - **scope:** ⚠️ Breaking change example, close #123 ([#134](https://github.com/unjs/changelogen/pull/134), [#123](https://github.com/unjs/changelogen/issues/123)) ### ❤️ Contributors @@ -416,4 +419,161 @@ describe("git", () => { } as unknown as GitCommit, ]); }); + + test("parse host config", () => { + expect(getRepoConfig(undefined)).toMatchObject({}); + expect(getRepoConfig("")).toMatchObject({}); + expect(getRepoConfig("unjs")).toMatchObject({}); + + const github = { + provider: "github", + repo: "unjs/changelogen", + domain: "github.com", + }; + expect(getRepoConfig("unjs/changelogen")).toStrictEqual(github); + expect(getRepoConfig("github:unjs/changelogen")).toStrictEqual(github); + expect(getRepoConfig("https://github.com/unjs/changelogen")).toStrictEqual( + github + ); + expect( + getRepoConfig("https://github.com/unjs/changelogen.git") + ).toStrictEqual(github); + expect(getRepoConfig("git@github.com:unjs/changelogen.git")).toStrictEqual( + github + ); + + const gitlab = { + provider: "gitlab", + repo: "unjs/changelogen", + domain: "gitlab.com", + }; + + expect(getRepoConfig("gitlab:unjs/changelogen")).toStrictEqual(gitlab); + expect(getRepoConfig("https://gitlab.com/unjs/changelogen")).toStrictEqual( + gitlab + ); + expect( + getRepoConfig("https://gitlab.com/unjs/changelogen.git") + ).toStrictEqual(gitlab); + expect(getRepoConfig("git@gitlab.com:unjs/changelogen.git")).toStrictEqual( + gitlab + ); + + const bitbucket = { + provider: "bitbucket", + repo: "unjs/changelogen", + domain: "bitbucket.org", + }; + + expect(getRepoConfig("bitbucket:unjs/changelogen")).toStrictEqual( + bitbucket + ); + expect( + getRepoConfig("https://bitbucket.org/unjs/changelogen") + ).toStrictEqual(bitbucket); + expect( + getRepoConfig("https://bitbucket.org/unjs/changelogen.git") + ).toStrictEqual(bitbucket); + expect( + getRepoConfig("https://donaldsh@bitbucket.org/unjs/changelogen.git") + ).toStrictEqual(bitbucket); + expect( + getRepoConfig("git@bitbucket.org:unjs/changelogen.git") + ).toStrictEqual(bitbucket); + + const selfhosted = { + repo: "unjs/changelogen", + domain: "git.unjs.io", + }; + + expect(getRepoConfig("selfhosted:unjs/changelogen")).toMatchObject({ + provider: "selfhosted", + repo: "unjs/changelogen", + }); + + expect(getRepoConfig("https://git.unjs.io/unjs/changelogen")).toMatchObject( + selfhosted + ); + + expect( + getRepoConfig("https://git.unjs.io/unjs/changelogen.git") + ).toMatchObject(selfhosted); + expect( + getRepoConfig("https://donaldsh@git.unjs.io/unjs/changelogen.git") + ).toMatchObject(selfhosted); + expect(getRepoConfig("git@git.unjs.io:unjs/changelogen.git")).toMatchObject( + selfhosted + ); + }); + + test("format reference", () => { + expect(formatReference({ type: "hash", value: "3828bda" })).toBe("3828bda"); + expect(formatReference({ type: "pull-request", value: "#123" })).toBe( + "#123" + ); + expect(formatReference({ type: "issue", value: "#14" })).toBe("#14"); + + const github: RepoConfig = { + provider: "github", + repo: "unjs/changelogen", + domain: "github.com", + }; + + expect(formatReference({ type: "hash", value: "3828bda" }, github)).toBe( + "[3828bda](https://github.com/unjs/changelogen/commit/3828bda)" + ); + expect( + formatReference({ type: "pull-request", value: "#123" }, github) + ).toBe("[#123](https://github.com/unjs/changelogen/pull/123)"); + expect(formatReference({ type: "issue", value: "#14" }, github)).toBe( + "[#14](https://github.com/unjs/changelogen/issues/14)" + ); + + const gitlab: RepoConfig = { + provider: "gitlab", + repo: "unjs/changelogen", + domain: "gitlab.com", + }; + + expect(formatReference({ type: "hash", value: "3828bda" }, gitlab)).toBe( + "[3828bda](https://gitlab.com/unjs/changelogen/commit/3828bda)" + ); + expect( + formatReference({ type: "pull-request", value: "#123" }, gitlab) + ).toBe("[#123](https://gitlab.com/unjs/changelogen/merge_requests/123)"); + expect(formatReference({ type: "issue", value: "#14" }, gitlab)).toBe( + "[#14](https://gitlab.com/unjs/changelogen/issues/14)" + ); + + const bitbucket: RepoConfig = { + provider: "bitbucket", + repo: "unjs/changelogen", + domain: "bitbucket.org", + }; + + expect(formatReference({ type: "hash", value: "3828bda" }, bitbucket)).toBe( + "[3828bda](https://bitbucket.org/unjs/changelogen/commit/3828bda)" + ); + expect( + formatReference({ type: "pull-request", value: "#123" }, bitbucket) + ).toBe("[#123](https://bitbucket.org/unjs/changelogen/pull-requests/123)"); + expect(formatReference({ type: "issue", value: "#14" }, bitbucket)).toBe( + "[#14](https://bitbucket.org/unjs/changelogen/issues/14)" + ); + + const unkown: RepoConfig = { + repo: "unjs/changelogen", + domain: "git.unjs.io", + }; + + expect(formatReference({ type: "hash", value: "3828bda" }, unkown)).toBe( + "3828bda" + ); + expect( + formatReference({ type: "pull-request", value: "#123" }, unkown) + ).toBe("#123"); + expect(formatReference({ type: "issue", value: "#14" }, unkown)).toBe( + "#14" + ); + }); }); diff --git a/test/markdown.test.ts b/test/markdown.test.ts new file mode 100644 index 0000000..5624808 --- /dev/null +++ b/test/markdown.test.ts @@ -0,0 +1,59 @@ +import { promises as fsp } from "node:fs"; +import { describe, expect, test } from "vitest"; +import { parseChangelogMarkdown } from "../src"; + +describe("markdown", () => { + test("should parse markdown", async () => { + const contents = await fsp.readFile( + new URL("fixtures/CHANGELOG.md", import.meta.url), + "utf8" + ); + expect(parseChangelogMarkdown(contents)).toMatchInlineSnapshot(` + { + "releases": [ + { + "body": "[compare changes](https://github.com/unjs/changelogen/compare/v0.4.0...v0.4.1) + + ### 🩹 Fixes + + - Bump by patch by default ([7e38438](https://github.com/unjs/changelogen/commit/7e38438)) + + ### 🏡 Chore + + - Update renovate config ([#54](https://github.com/unjs/changelogen/pull/54)) + - Update dependencies ([4216bc6](https://github.com/unjs/changelogen/commit/4216bc6)) + - Update repo ([83c349f](https://github.com/unjs/changelogen/commit/83c349f)) + + ### ❤️ Contributors + + - Pooya Parsa + - Nozomu Ikuta ", + "version": "0.4.1", + }, + { + "body": "[compare changes](https://github.com/unjs/changelogen/compare/v0.3.5...v0.4.0) + + ### 🚀 Enhancements + + - ⚠️ Resolve github usernames using \`ungh/ungh\` ([#46](https://github.com/unjs/changelogen/pull/46)) + + ### 🩹 Fixes + + - **markdown:** Avoid rendering \`noreply.github.com\` emails ([4871721](https://github.com/unjs/changelogen/commit/4871721)) + - Avoid rendering authors with \`[bot]\` in their name ([4f3f644](https://github.com/unjs/changelogen/commit/4f3f644)) + - Format name to avoid duplicates ([f74a988](https://github.com/unjs/changelogen/commit/f74a988)) + + #### ⚠️ Breaking Changes + + - ⚠️ Resolve github usernames using \`ungh/ungh\` ([#46](https://github.com/unjs/changelogen/pull/46)) + + ### ❤️ Contributors + + - Pooya Parsa ([@pi0](http://github.com/pi0))", + "version": "0.4.0", + }, + ], + } + `); + }); +});