diff --git a/src/index.ts b/src/index.ts index 45b4c98..fd190a9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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], diff --git a/src/run.ts b/src/run.ts index 71a38b6..42b5281 100644 --- a/src/run.ts +++ b/src/run.ts @@ -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; } }