diff --git a/.changeset/blue-wombats-help.md b/.changeset/blue-wombats-help.md new file mode 100644 index 0000000000..a5c1f62a76 --- /dev/null +++ b/.changeset/blue-wombats-help.md @@ -0,0 +1,5 @@ +--- +"@pnpm/plugin-commands-publishing": major +--- + +Git checks are on by default. diff --git a/packages/plugin-commands-publishing/src/publish.ts b/packages/plugin-commands-publishing/src/publish.ts index fd294eaa8f..58e55371aa 100644 --- a/packages/plugin-commands-publishing/src/publish.ts +++ b/packages/plugin-commands-publishing/src/publish.ts @@ -52,8 +52,8 @@ export function help () { list: [ { - description: 'Checks if current branch is your publish branch, clean, and up-to-date', - name: '--git-checks', + description: "Don't check if current branch is your publish branch, clean, and up-to-date", + name: '--no-git-checks', }, { description: 'Sets branch name to publish. Default is master', @@ -94,7 +94,7 @@ export async function handler ( } & Pick, params: string[], ) { - if (opts.gitChecks && await isGitRepo()) { + if (opts.gitChecks !== false && await isGitRepo()) { const branch = opts.publishBranch ?? 'master' if (await getCurrentBranch() !== branch) { const { confirm } = await prompt({ diff --git a/packages/plugin-commands-publishing/test/gitChecks.ts b/packages/plugin-commands-publishing/test/gitChecks.ts index cc02b3112a..616b9d5d28 100644 --- a/packages/plugin-commands-publishing/test/gitChecks.ts +++ b/packages/plugin-commands-publishing/test/gitChecks.ts @@ -41,7 +41,6 @@ test('publish: fails git check if branch is not on master', async (t) => { ...DEFAULT_OPTS, argv: { original: ['publish', ...CREDENTIALS] }, dir: process.cwd(), - gitChecks: true, }, []) } catch (_err) { err = _err @@ -72,7 +71,6 @@ test('publish: fails git check if branch is not on specified branch', async (t) ...DEFAULT_OPTS, argv: { original: ['publish', ...CREDENTIALS] }, dir: process.cwd(), - gitChecks: true, publishBranch: 'latest', }, []) } catch (_err) { @@ -103,7 +101,6 @@ test('publish: fails git check if branch is not clean', async (t) => { ...DEFAULT_OPTS, argv: { original: ['publish', ...CREDENTIALS] }, dir: process.cwd(), - gitChecks: true, }, []) } catch (_err) { err = _err @@ -138,7 +135,6 @@ test('publish: fails git check if branch is not up-to-date', async (t) => { ...DEFAULT_OPTS, argv: { original: ['publish', ...CREDENTIALS] }, dir: process.cwd(), - gitChecks: true, }, []) } catch (_err) { err = _err