Skip to content
This repository was archived by the owner on Feb 25, 2024. It is now read-only.

Commit 05e6e7c

Browse files
committed
2 parents 68d0ca8 + dcd6385 commit 05e6e7c

File tree

6 files changed

+182
-5
lines changed

6 files changed

+182
-5
lines changed

test/shellcheck/index.test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ it('ShellCheck', async () => {
1818
return
1919
}
2020

21-
cmd({
22-
defaultExecutable: shellcheck,
23-
argvSuffix: await listShellFiles(),
24-
})
21+
const shellFiles = await listShellFiles()
22+
23+
if (shellFiles.length) {
24+
cmd({
25+
defaultExecutable: shellcheck,
26+
argvSuffix: shellFiles,
27+
})
28+
}
2529
})

tools/publish-tag-push/bin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const { main, handleTerminationError } = require('./index')
33

44
main({
55
print: console.info,
6+
printErr: console.error,
67
process,
78
})
89
.catch(handleTerminationError)

tools/publish-tag-push/lib/command.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as places from '@tools/places'
12
import { StyledText, dim } from './styled-text'
23
import spawn, { TerminationError, SpawnFactory } from 'advanced-spawn-async'
34
import { Printer } from '../utils/types'
@@ -10,6 +11,7 @@ export function displayCommand(args: readonly StyledText[]): string {
1011

1112
const spawnOptions = {
1213
stdio: 'inherit',
14+
cwd: places.project,
1315
} as const
1416

1517
export async function executeCommand(command: StyledText, args: readonly StyledText[]) {

tools/publish-tag-push/lib/main.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import fs from 'fs'
2+
import { statusMatrix } from 'isomorphic-git'
3+
import * as places from '@tools/places'
14
import { Printer } from '../utils/types'
25
import { StyledText, normal, dim, bold } from './styled-text'
36
import { command } from './command'
@@ -15,17 +18,26 @@ export interface Process {
1518

1619
export interface Options {
1720
readonly print: Printer
21+
readonly printErr: Printer
1822
readonly process: Process
1923
}
2024

2125
export async function main(options: Options): Promise<number> {
22-
const { print, process } = options
26+
const { print, printErr, process } = options
2327
const { env } = process
2428
const npm = env.PUBLISH_TAG_PUSH_EXECUTOR || 'npm'
2529
const git = env.PUBLISH_TAG_PUSH_VCS || 'git'
2630
const remote = env.PUBLISH_TAG_PUSH_REMOTE || 'origin'
2731
const branch = env.PUBLISH_TAG_PUSH_BRANCH || 'master'
2832

33+
const changes = await statusMatrix({ fs, dir: places.project })
34+
if (changes.length) {
35+
printErr('[ERROR] Repo is not clean')
36+
for (const [filename] of changes) {
37+
printErr(' → ' + filename)
38+
}
39+
}
40+
2941
const exec = (cmd: StyledText, ...args: StyledText[]) => command(print, cmd, args)
3042
await exec(dim(npm), dim('run'), bold('project-publish'))
3143
await exec(dim(npm), dim('run'), bold('git-tag-versions'))

tools/publish-tag-push/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"bin": "bin.js",
66
"dependencies": {
77
"chalk": "^4.1.0",
8+
"isomorphic-git": "^1.7.4",
89
"advanced-spawn-async": "^0.1.3",
10+
"@tools/places": "file:../places",
911
"@tools/preloaded-node": "file:../preloaded-node"
1012
}
1113
}

tools/publish-tag-push/pnpm-lock.yaml

Lines changed: 156 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)