Skip to content
This repository was archived by the owner on Sep 21, 2019. It is now read-only.

Commit fc3e9f6

Browse files
committed
Exit with error code 1 when there were compilation errors
1 parent b32c812 commit fc3e9f6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/cli.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ program
4646
ignorePrettierErrors: !!program.ignorePrettierErrors,
4747
};
4848
const files = glob.sync(globPattern, {});
49+
let errors = false;
4950
for (const file of files) {
5051
const filePath = path.resolve(file);
5152
const newPath = filePath.replace(/\.jsx?$/, '.tsx');
@@ -60,13 +61,17 @@ program
6061
} catch (error) {
6162
console.warn(`Failed to convert ${file}`);
6263
console.warn(error);
64+
errors = true;
6365
}
6466
if (!program.keepTemporaryFiles) {
6567
if (fs.existsSync(temporaryPath)) {
6668
fs.unlinkSync(temporaryPath);
6769
}
6870
}
6971
}
72+
if (errors) {
73+
process.exit(1);
74+
}
7075
});
7176

7277
program.parse(process.argv);

0 commit comments

Comments
 (0)