Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/common/SetProjectReferencesOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export interface SetProjectReferencesOptions {
root: string
save: boolean
indentationTsConfig: string | undefined
useExitCode: boolean
Comment thread
Bessonov marked this conversation as resolved.
}
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from 'fs'
import program from 'commander'
import path from 'path'
import {
difference, isEqual, merge, sortBy
difference, isEqual, merge, sortBy,
} from 'lodash'
import JSON from 'comment-json'
import { version } from './package.json'
Expand Down Expand Up @@ -176,6 +176,10 @@ function setProjectReferences(options: SetProjectReferencesOptions): void {
saveTsConfigJson,
options,
})

if (!everythingIsFine && options.useExitCode) {
process.exitCode = 1
}
Comment thread
Bessonov marked this conversation as resolved.
}

program.version(version)
Expand All @@ -184,6 +188,7 @@ program
.option('-r, --root <path>', 'path to the root of monorepo', process.cwd())
.option('-s, --save', 'write changes to the files', false)
.option('-t, --indentation-ts-config <chars>', `indentation of tsconfig.json. Use $'\\t' for a tab`)
.option('-e, --use-exit-code', 'return a non-zero exit code if there are any discrepancies', false)
.action(setProjectReferences)

program.parse(process.argv)