diff --git a/.npmrc b/.npmrc index 3dd9fa7..cc67295 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ public-hoist-pattern=[] +ignore-workspace-root-check=true \ No newline at end of file diff --git a/package.json b/package.json index f1d8f99..0061af0 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,11 @@ "directory": "packages/release-it-pnpm" }, "bugs": "https://github.com/hyoban/release-it-pnpm/issues", - "keywords": ["release", "release-it", "release-it-plugin"], + "keywords": [ + "release", + "release-it", + "release-it-plugin" + ], "sideEffects": false, "exports": { ".": { @@ -28,7 +32,10 @@ }, "main": "./dist/index.cjs", "module": "./dist/index.js", - "files": ["dist", "package.json"], + "files": [ + "dist", + "package.json" + ], "scripts": { "build": "bunchee", "dev": "bunchee -w", @@ -60,6 +67,7 @@ "conventional-recommended-bump": "^9.0.0", "fast-glob": "^3.3.2", "semver": "^7.6.0", + "should-semantic-release": "^0.2.1", "yaml": "^2.3.4" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8a49f0f..93c9d48 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: semver: specifier: ^7.6.0 version: 7.6.0 + should-semantic-release: + specifier: ^0.2.1 + version: 0.2.1 yaml: specifier: ^2.3.4 version: 2.3.4 @@ -536,8 +539,6 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} requiresBuild: true - dev: true - optional: true /@pkgr/core@0.1.1: resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} @@ -1057,8 +1058,8 @@ packages: resolution: {integrity: sha512-OLvgeBv3vXlnnJGIAgCLYKjgMEU+wBGj07MQ/nxAaON+3mLzX7mJbhRYrVGiVvFiXtwFlkcBa/TtmglHy0UbzQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: - '@typescript-eslint/parser': '>=7.0.1' - eslint: '>=8.56.0' + '@typescript-eslint/parser': ^7.0.0 + eslint: ^8.56.0 typescript: '*' peerDependenciesMeta: typescript: @@ -4798,6 +4799,15 @@ packages: rechoir: 0.6.2 dev: true + /should-semantic-release@0.2.1: + resolution: {integrity: sha512-YZ4woZpk11mIj1Aq4I70w6Rm4oOWqMqROHdZuX08nT2JADuW12vb6S5GFtQd+lUdedYbmI6WInD8dF4zuq1a1Q==} + engines: {node: '>=18'} + hasBin: true + dependencies: + '@pkgjs/parseargs': 0.11.0 + conventional-commits-parser: 5.0.0 + dev: false + /side-channel@1.0.5: resolution: {integrity: sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ==} engines: {node: '>= 0.4'} diff --git a/src/index.js b/src/index.js index 47bd61a..b9fa8a7 100644 --- a/src/index.js +++ b/src/index.js @@ -5,6 +5,7 @@ import conventionalRecommendedBump from 'conventional-recommended-bump' import fg from 'fast-glob' import { Plugin } from 'release-it' import semver from 'semver' +import { shouldSemanticRelease } from 'should-semantic-release' import { parse } from 'yaml' function hasAccess(path) { @@ -143,6 +144,10 @@ class ReleaseItPnpmPlugin extends Plugin { async getRecommendedVersion({ latestVersion, increment, isPreRelease, preReleaseId }) { this.debug({ latestVersion, increment, isPreRelease, preReleaseId }) // we don not respect the increment option, only prerelease related options are respected + const { version } = this.getContext() + if (version) { + this.setContext({ version: null }) + } try { const result = await conventionalRecommendedBump({ preset: { @@ -151,6 +156,14 @@ class ReleaseItPnpmPlugin extends Plugin { }, }) this.debug({ result }) + + if ( + result.releaseType === 'patch' + && !await shouldSemanticRelease({ verbose: false }) + ) { + return null + } + let { releaseType } = result if (isPreRelease) { const type