Skip to content

Commit

Permalink
Merge pull request #83 from chelkyl/add-dry-run-fail
Browse files Browse the repository at this point in the history
feat: support fail arg to --dry
  • Loading branch information
jeffijoe committed Mar 21, 2022
2 parents 4a012b7 + a46dc05 commit 3706c3f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/cli.ts
Expand Up @@ -27,7 +27,7 @@ export async function startCli() {
typeSyncer: asFunction(createTypeSyncer),
})
await run(container.resolve<ITypeSyncer>('typeSyncer'))
} catch (err) {
} catch (err: any) {
C.error(err)
process.exitCode = 1
}
Expand Down Expand Up @@ -69,6 +69,13 @@ async function run(syncer: ITypeSyncer) {
}),
{ newTypings: 0, removedTypings: 0 }
)
if (
flags.dry === 'fail' &&
totals.newTypings > 0 &&
totals.removedTypings > 0
) {
throw new Error('Typings changed, check failed.')
}
C.success(
totals.newTypings === 0
? `No new typings added, looks like you're all synced up!${
Expand Down

0 comments on commit 3706c3f

Please sign in to comment.