Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.validate = function (logger, config, cli) {
ti.validateProjectDir(logger, cli, cli.argv, 'project-dir');
// Validate the key, if it exists
if (cli.argv._.length > 0) {
const key = cli.argv._[0];
if (!/^([A-Za-z_]{1}[A-Za-z0-9-_]*(\.[A-Za-z-_]{1}[A-Za-z0-9-_]*)*)$/.test(key)) {
logger.error(__('Invalid key "%s"', key) + '\n');
process.exit(1);
}
}
return function (finished) {
ti.loadPlugins(null, config, cli, cli.argv['project-dir'], finished, cli.argv.output !== 'report' || cli.argv._.length, false);
};
};
if (platforms.bad.length) {
logger.error(__n('Invalid platform: %%s', 'Invalid platforms: %%s', platforms.bad.length, platforms.bad.join(', ')) + '\n');
logger.log(__('Available platforms for SDK version %s:', ti.manifest.sdkVersion) + '\n');
ti.targetPlatforms.forEach(function (p) {
logger.log(' ' + p.cyan);
});
logger.log();
process.exit(1);
}
cli.argv.platforms = platforms.scrubbed;
} else {
cli.argv.platforms = null;
}
ti.validateProjectDir(logger, cli, cli.argv, 'project-dir');
return function (finished) {
ti.loadPlugins(logger, config, cli, cli.argv['project-dir'], function () {
finished();
});
};
}
};