Skip to content

Commit

Permalink
chore: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jan 3, 2020
1 parent dd3dadb commit 79d800e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ const headerMap = {
}

const { version } = require('../packages/koishi-cli/package') as PackageJson
const tags = spawnSync('git tag -l').split(/\r?\n/)
const tags = spawnSync('git', ['tag', '-l']).split(/\r?\n/)
if (tags.includes(version)) {
return console.log(`Tag ${version} already exists.`)
}

const updates = { fix: '', feat: '' }
const lastTag = tags[tags.length - 1]
const commits = spawnSync(`git log ${lastTag}..HEAD --format="%H%s"`).split(/\r?\n/).reverse()
const commits = spawnSync('git', ['log', `${lastTag}..HEAD`, '--format="%H%s"']).split(/\r?\n/).reverse()
for (const commit of commits) {
const hash = commit.slice(0, 40)
const details = /^(fix|feat)(?:\((\S+)\))?: (.+)$/.exec(commit.slice(40))
Expand Down
6 changes: 3 additions & 3 deletions build/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export interface PackageJson extends Partial<Record<DependencyType, Record<strin
version?: string
}

export function spawnSync (command: string, silent?: boolean) {
export function spawnSync (command: string, args: string[], silent?: boolean) {
if (!silent) console.log(`$ ${command}`)
const result = spawn.sync(command + ' --color', { cwd, encoding: 'utf8' })
const result = spawn.sync(command, [...args, '--color'], { cwd, encoding: 'utf8' })
if (result.status) {
throw new Error(result.stderr)
} else {
Expand All @@ -32,7 +32,7 @@ export function spawnSync (command: string, silent?: boolean) {
}

export function spawnAsync (command: string, args: string[] = []) {
const child = spawn(command, { stdio: 'inherit' })
const child = spawn(command, args, { stdio: 'inherit' })
return new Promise((resolve, reject) => {
child.on('close', resolve)
})
Expand Down

0 comments on commit 79d800e

Please sign in to comment.