mirror of
https://github.com/mdgriffith/elm-optimize-level-2.git
synced 2024-11-25 13:45:08 +03:00
Return the outputFilePath and require it in the lib
This commit is contained in:
parent
908cec2fee
commit
ac3d1349af
@ -2,7 +2,7 @@ import * as Run from './run';
|
||||
|
||||
export async function run(options: {
|
||||
inputFilePath: string | undefined,
|
||||
outputFilePath: string | null,
|
||||
outputFilePath: string,
|
||||
optimizeSpeed: boolean,
|
||||
processOpts: {
|
||||
stdio: [string, string, string],
|
||||
|
@ -12,7 +12,7 @@ import * as fs from 'fs';
|
||||
export async function run(
|
||||
options: {
|
||||
inputFilePath: string | undefined,
|
||||
outputFilePath: string | null,
|
||||
outputFilePath: string,
|
||||
optimizeSpeed: boolean,
|
||||
verbose: boolean,
|
||||
processOpts: { stdio: [string, string, string] },
|
||||
@ -94,15 +94,16 @@ 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(program.output);
|
||||
const outputDirectory = path.dirname(options.outputFilePath);
|
||||
if (!fs.existsSync(outputDirectory)) {
|
||||
fs.mkdirSync(outputDirectory, { recursive: true });
|
||||
}
|
||||
fs.writeFileSync(program.output, transformed);
|
||||
fs.writeFileSync(options.outputFilePath, transformed);
|
||||
const fileName = path.basename(inputFilePath);
|
||||
log('Success!');
|
||||
log('');
|
||||
log(` ${fileName} ───> ${program.output}`);
|
||||
log(` ${fileName} ───> ${options.outputFilePath}`);
|
||||
log('');
|
||||
return options.outputFilePath;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user