@keymanapp/kmc
Version:
Keyman Developer compiler command line tools
35 lines (33 loc) • 1.37 kB
JavaScript
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b226b27f-9397-52b2-a96d-f34ef3f0c0f1")}catch(e){}}();
import * as fs from 'fs';
import * as path from 'path';
import { InfrastructureMessages } from '../../messages/infrastructureMessages.js';
export class BuildActivity {
async runCompiler(compiler, infile, outfile, callbacks, options) {
if (!await compiler.init(callbacks, options)) {
return false;
}
const result = await compiler.run(infile, outfile);
if (!result) {
return false;
}
if (!this.createOutputFolder(outfile ?? infile, callbacks)) {
return false;
}
return await compiler.write(result.artifacts);
}
createOutputFolder(targetFilename, callbacks) {
const targetFolder = path.dirname(targetFilename);
try {
fs.mkdirSync(targetFolder, { recursive: true });
}
catch (e) {
callbacks.reportMessage(InfrastructureMessages.Error_CannotCreateFolder({ folderName: targetFolder, e }));
return false;
}
return true;
}
}
;
//# sourceMappingURL=BuildActivity.js.map
//# debugId=b226b27f-9397-52b2-a96d-f34ef3f0c0f1