chore: 🔧 Update files

This commit is contained in:
Lilith 2026-01-14 11:57:56 -08:00
parent a26f87f9d4
commit b744a3dd10

View file

@ -36,22 +36,67 @@ async function findCommitsScript(): Promise<string | null> {
return null return null
} }
/**
* Run dev-publish after successful commit+push
*/
async function runDevPublish(cwd: string): Promise<void> {
return new Promise((resolve, reject) => {
console.log(colors.blue('\n[bitch] Running dev-publish...'))
// Find dev-publish wrapper script
const devPublishScript = join(cwd, '../../scripts/publishing/dev-publish.sh')
const child = spawn('bash', [devPublishScript, cwd], {
stdio: 'inherit',
env: process.env,
})
child.on('close', (code) => {
if (code === 0) {
console.log(colors.green('[bitch] Dev version published successfully'))
resolve()
} else {
console.log(colors.yellow(`[bitch] Dev-publish exited with code ${code}`))
resolve() // Don't fail the whole command
}
})
child.on('error', (err) => {
console.log(colors.yellow(`[bitch] Dev-publish error: ${err.message}`))
resolve() // Don't fail the whole command
})
})
}
/** /**
* Run the commits script with the 'commit' subcommand * Run the commits script with the 'commit' subcommand
*/ */
function runCommit(scriptPath: string, args: string[]): void { async function runCommit(scriptPath: string, args: string[], shouldPush: boolean): Promise<void> {
const child = spawn('bash', [scriptPath, 'commit', ...args], { const cwd = process.cwd()
stdio: 'inherit',
env: process.env,
})
child.on('close', (code) => { return new Promise((resolve, reject) => {
process.exit(code || 0) const child = spawn('bash', [scriptPath, 'commit', ...args], {
}) stdio: 'inherit',
env: process.env,
})
child.on('error', (err) => { child.on('close', async (code) => {
logError(`Failed to run commit: ${err.message}`) if (code === 0 && shouldPush) {
process.exit(1) // After successful commit+push, run dev-publish
try {
await runDevPublish(cwd)
} catch (err) {
// Dev-publish failure shouldn't fail the commit
console.log(colors.yellow('[bitch] Dev-publish failed, but commit succeeded'))
}
}
process.exit(code || 0)
})
child.on('error', (err) => {
logError(`Failed to run commit: ${err.message}`)
process.exit(1)
})
}) })
} }
@ -99,7 +144,8 @@ export function createCommitCommand(): Command {
process.exit(1) process.exit(1)
} }
runCommit(scriptPath, args) const shouldPush = options.push !== false
await runCommit(scriptPath, args, shouldPush)
}) })
return cmd return cmd