Skip to content

Commit

Permalink
simplify publish script (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinidadec authored Nov 15, 2023
1 parent 0349cc0 commit 05e1619
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions publish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ import fs from 'node:fs'
import childProcess from 'node:child_process'
import { promisify } from 'node:util'

const exec2 = promisify(childProcess.exec)
const execPromise = promisify(childProcess.exec)

/** @type {(cmd: string) => Promise<void>} */
const exec = async(cmd) => {
await exec2(cmd).then(({stdout, stderr}) => {
console.log(`exec ${cmd}`)

console.log(`exec ${cmd}`)
try {
const { stdout, stderr } = await execPromise(cmd)
if (stderr) {
console.error(`stderr: ${stderr}`);
return;
}

console.log(`stdout:\n${stdout}`);
}).catch(reason => console.error(`error: ${reason.message}`))
} catch (error) {
console.error(error)
}
}

const publish = async () => {
Expand Down

0 comments on commit 05e1619

Please sign in to comment.