Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// should we show the version number & jet?
// const hasNoArguments = isEmpty(commandLine._)
// const hasVersionOption = commandLine.version || commandLine.v
// if (hasNoArguments && hasVersionOption) {
// await runtime.run({ rawCommand: 'version' })
// return
// }
// wtf mode shows problems with plugins, commands, and extensions
if (commandLine.wtf) {
printWtf(runtime);
return;
}
if (commandLine.verbose && !commandLine.debug) {
print.error('Use --debug instead of --verbose.');
return;
}
// run the command
let context;
try {
context = await runtime.run();
} catch (e) {
console.log(pe.render(e));
throw e; // rethrow
}
if (
commandLine.help ||
commandLine.h ||
isNil(context.plugin) ||
run: async function run(argv) {
// create a runtime
let runtime
try {
runtime = buildIgnite()
} catch (e) {
console.log(pe.render(e))
throw e // rethrow
}
// parse the command line
const commandLine = minimist(argv.slice(2))
if (commandLine.verbose && !commandLine.debug) {
print.error('Use --debug instead of --verbose.')
return
}
// run the command
let toolbox
try {
toolbox = await runtime.run()
} catch (e) {
console.log(pe.render(e))
throw e // rethrow
}
if (toolbox.error) {
print.debug(toolbox.error)
}
if (!nameProject) throw 'Please fill your name app. For ex: zkrn init myApp'
print.info('FILE BIN ' + __dirname)
print.info('DEFAULT FOLDER ' + process.cwd())
print.info(`Creating new react-native called ${nameProject}... Will take 5 minutes`)
await installReactNative(nameProject)
print.info('Creating react-native successfully')
print.info('Now install dependence package')
await installPackageDependence(nameProject)
print.info('Copying base component')
await copyBaseToProject(nameProject)
// Link package
print.info('Linking package...')
await linkingPackage(nameProject)
print.info('Done!. Run IOS now')
} catch(err) {
print.error(err)
}
}
function exit(name: string, status: number, msg: string = "Success!") {
if (status) {
print.error(`${name} exited with status ${status}\n`);
process.exit(status);
} else {
print.success(msg);
}
return status;
}
async function help() {
print.error('Try this: zkrn init ')
}
async function init(nameProject) {
async function remove(nameProject) {
if(!nameProject) {
print.error('Try this zkrn remove ')
}
print.info(`Removing ${nameProject}... Will take 5 minutes`)
if (nameProject) {
const { stdout, stderr } = await exec(`rm -rf ${process.cwd()}/${nameProject}`);
print.info('Remove successfully!')
}
}
const helpModule = () => {
function invalidArgument(message?: string) {
print.error(`Invalid argument provided. ${message}`);
print.info("Run --help for more details");
}
export default () => {
print.error("Invalid argument provided");
print.info("Run --help for more details");
};