feat(publish)!: git checks are on by default

ref #2329
This commit is contained in:
Zoltan Kochan
2020-04-29 23:17:11 +03:00
committed by Zoltan Kochan
parent 9e2a5b827e
commit 4063f1bee7
3 changed files with 8 additions and 7 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/plugin-commands-publishing": major
---
Git checks are on by default.

View File

@@ -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<Config, 'allProjects' | 'gitChecks' | 'ignoreScripts' | 'publishBranch'>,
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({

View File

@@ -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