Throw an error if JS is empty

This commit is contained in:
Jeroen Engels 2021-10-01 23:51:47 +02:00
parent 89100d5ae9
commit 5d43f746a1

View File

@ -87,7 +87,11 @@ export async function run(
} else {
throw new Error(`Please provide a path to an Elm file.\n${helpInformation}`.trim());
}
if (jsSource != '') {
if (jsSource == '') {
throw new Error('Target JS file is empty.');
}
const transformed = await Transform.transform(
dirname,
jsSource,
@ -109,5 +113,4 @@ export async function run(
log(` ${fileName} ───> ${options.outputFilePath}`);
log('');
return options.outputFilePath;
}
}