Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cmd: cmd,
args: args,
options: spawnOptions
}, function(err, result, exitCode) {
// Log any stdout using grunt.log.ok and any stderr using grunt.log.error
_.each({ok: result.stdout, error: result.stderr}, function(output, logType) {
if (output && output.length > 0) {
grunt.log[logType](output);
}
});
callback(err);
})
};
return elmCompile(sources, _.defaults({spawn: spawn}, options));
}
var rendererFileContents = templates.generateRendererFile(moduleNames);
fs.writeFileSync(privateMainPath, rendererFileContents);
var nativeString = templates.generateNativeModuleString(projectName);
fs.writeFileSync(nativePath, nativeString);
if (isVerbose) console.log('wrote template files to..', renderDirName);
var options = {
yes: true,
cwd: dirPath,
output: 'elm.js'
};
var compileProcess = compile(privateMainPath, options);
compileProcess.on('exit',
function(exitCode){
if (exitCode !== 0){
console.log("Exited with the code", exitCode);
console.log('Trying to proceed anyway..');
}
var Elm = require(path.join(dirPath, 'elm.js'));
var elmApp = Elm.PrivateMain.worker();
elmApp.ports.htmlOut.subscribe(function(htmlOutput){
htmlOutput.map(function(group){
var outputFile = group[0];
var html = group[1];
await new Promise((resolve) => {
compile([mainModuleFilename], {
yes: true,
report,
pathToMake: pathToElmMake,
output: outputCompiledFilename,
processOpts: {
stdio: [0, elmCompileStdoutFd, elmCompileStderrFd]
}
}).on('close', resolve);
});
} catch (e) {
return new Promise((resolve, reject) => {
const newFile = path.join(
outDir,
path.basename(file).replace('.elm', '.js')
)
elm
.compile(path.join(cwd, file), {
output: newFile,
cwd: cwd,
yes: true,
processOpts: {
stdio: 'inherit',
},
})
.on('close', exitCode => {
if (exitCode === 0) {
resolve(newFile)
} else {
reject('node-elm-compiler Errored with exit code 1')
}
})
})