mirror of
https://github.com/mdgriffith/elm-optimize-level-2.git
synced 2024-11-29 12:46:32 +03:00
create directories recursively if necessary to output the file (match elm make behavior)
This commit is contained in:
parent
3317354e26
commit
8e1d5348fc
@ -53,6 +53,13 @@ async function run(inputFilePath: string | undefined) {
|
||||
false,
|
||||
toolDefaults
|
||||
);
|
||||
|
||||
// Make sure all the folders up to the output file exist, if not create them.
|
||||
// This mirrors elm make behavior.
|
||||
const outputDirectory = path.dirname(program.output);
|
||||
if (!fs.existsSync(outputDirectory)) {
|
||||
fs.mkdirSync(outputDirectory, { recursive: true });
|
||||
}
|
||||
fs.writeFileSync(program.output, transformed);
|
||||
const fileName = path.basename(inputFilePath);
|
||||
console.log('Success!');
|
||||
|
Loading…
Reference in New Issue
Block a user