Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const npmBin = execSync('npm bin', {encoding: 'utf8'}).trimRight();
logger.info('TestRunnerCli.Run', `(3/5) Retrieving npm bin folder... DONE, folder: ${npmBin}`);
if (args.env === 'node') {
// STEP 4. use tsc to build ONNX.js
logger.info('TestRunnerCli.Run', '(4/5) Running tsc...');
const tscCommand = path.join(npmBin, 'tsc');
const tsc = spawnSync(tscCommand, {shell: true, stdio: 'inherit'});
if (tsc.status !== 0) {
console.error(tsc.error);
process.exit(tsc.status);
}
logger.info('TestRunnerCli.Run', '(4/5) Running tsc... DONE');
// STEP 5. run mocha
logger.info('TestRunnerCli.Run', '(5/5) Running mocha...');
const mochaCommand = path.join(npmBin, 'mocha');
const mochaArgs = [path.join(TEST_ROOT, 'test-main'), '--timeout 60000'];
logger.info('TestRunnerCli.Run', `CMD: ${mochaCommand} ${mochaArgs.join(' ')}`);
const mocha = spawnSync(mochaCommand, mochaArgs, {shell: true, stdio: 'inherit'});
if (mocha.status !== 0) {
console.error(mocha.error);
process.exit(mocha.status);
}
logger.info('TestRunnerCli.Run', '(5/5) Running mocha... DONE');
} else {
// STEP 4. use webpack to generate ONNX.js
logger.info('TestRunnerCli.Run', '(4/5) Running webpack to generate ONNX.js...');
const webpackCommand = path.join(npmBin, 'webpack');
const webpackArgs = [`--bundle-mode=${args.bundleMode}`];
logger.info('TestRunnerCli.Run', `CMD: ${webpackCommand} ${webpackArgs.join(' ')}`);
} else if (parsed.type === "git" && parsed.hosted && parsed.hosted.default === "shortcut") {
// probably a shorthand subpath, e.g. "foo/bar"
parsed.name = parsed.raw;
}
// Maybe it doesn't need an implicit 'conventional-changelog-' prefix?
try {
config = resolveConfigPromise(presetPackageName);
cfgCache.set(changelogPreset, config);
// early exit, yay
return Promise.resolve(config);
} catch (err) {
log.verbose("getChangelogConfig", err.message);
log.info("getChangelogConfig", "Auto-prefixing conventional-changelog preset %j", changelogPreset);
// probably a deep shorthand subpath :P
parsed.name = parsed.raw;
}
if (parsed.name.indexOf("conventional-changelog-") < 0) {
// implicit 'conventional-changelog-' prefix
const parts = parsed.name.split("/");
const start = parsed.scope ? 1 : 0;
// foo => conventional-changelog-foo
// @scope/foo => @scope/conventional-changelog-foo
parts.splice(start, 1, `conventional-changelog-${parts[start]}`);
// _technically_ supports 'foo/lib/bar.js', but that's gross
presetPackageName = parts.join("/");
autoBuildFile.modules.forEach(({ opencvModule, libPath }) => {
if (!libPath) {
log.info('install', '%s: %s', opencvModule, 'ignored')
return
}
const foundLib = installedLibs.find(lib => lib.opencvModule === opencvModule)
hasLibs = hasLibs && !!foundLib
log.info('install', '%s: %s', opencvModule, foundLib ? foundLib.libPath : 'not found')
})
this.isBootstrapCompleted = function() {
var pass = true
for(i=0;i
type: 'password',
name: 'password',
message: 'What is your GitHub password?',
validate: _.ary(_.bind(validator.isLength, validator, _, 1), 1),
},
]);
info.github = answers;
info.github.endpoint = info.ghepurl || 'https://api.github.com';
const token = await createAuthorization(info);
if (!token) throw new Error('Could not login to GitHub.');
info.github.token = token;
log.info('Successfully created GitHub token.');
};
spawned.stdout.on('data', function(data) {
var msg = util.format('%s', data.toString());
if (msg.length === 0) return;
log.info(command, msg);
infos.push(msg);
});
spawned.stderr.on('data', function(data) {
function ongyps(binding_gyp, node_gyp) {
var res;
try {
res = adaptNodeGyp(projectDir, nodeDir, binding_gyp, node_gyp);
} catch(err) {
return cb(err);
}
var json = JSON.stringify(res.node_gyp, null, 2);
log.info('nad', 'Writing adapted node.gyp');
fs.writeFile(node_gyp_file, json, function (err) {
if (err) return cb(err);
cb(null, res)
})
}
}
vars.builtinPlugins.forEach(plugin => {
log.info('install', plugin)
sh.cp('-r', path.join('..', plugin), '.')
sh.rm('-rf', path.join(plugin, 'node_modules'))
sh.cd(plugin)
sh.exec(`npm install --only=prod`)
log.info('rebuild', 'native')
if (fs.existsSync('node_modules')) {
rebuild(path.resolve('.'), vars.electronVersion, process.arch, [], true)
}
sh.cd('..')
})
fs.unlinkSync(path.join(target, 'package.json'), '{}')
targets.filter(function (t) { return t }).forEach(function (t) {
log.info("install", "%s into %s", t._id, where)
})
asyncMap(targets, function (target, cb) {