mirror of
https://github.com/mdgriffith/elm-optimize-level-2.git
synced 2024-10-26 12:21:10 +03:00
Merge pull request #55 from jfmengels/no-unnecessary-mkdir
Prevent creating folder if input and output file paths are the same
This commit is contained in:
commit
8e61bed99f
@ -102,9 +102,10 @@ export async function run(
|
||||
// Make sure all the folders up to the output file exist, if not create them.
|
||||
// This mirrors elm make behavior.
|
||||
const outputDirectory = path.dirname(options.outputFilePath);
|
||||
if (!fs.existsSync(outputDirectory)) {
|
||||
if (path.dirname(inputFilePath) !== outputDirectory && !fs.existsSync(outputDirectory)) {
|
||||
fs.mkdirSync(outputDirectory, { recursive: true });
|
||||
}
|
||||
|
||||
fs.writeFileSync(options.outputFilePath, transformed);
|
||||
const fileName = path.basename(inputFilePath);
|
||||
log('Success!');
|
||||
|
Loading…
Reference in New Issue
Block a user