Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ls.on('close', (code) => {
// 成功安装依赖
if (code === 0) {
clearConsole('cyan', `X-BUILD v${require('../package').version}`);
console.log('> Get started with the following commands:');
console.log('');
console.log(chalk.gray(' $ ') + chalk.blueBright(`cd ${store.dirname}`));
console.log(chalk.gray(' $ ') + chalk.blueBright(`${packageManagement() === 'npm' ? 'npm run' : 'yarn'} serve`));
}
});
}
outputs = [...outputs]
] = loadFiles(root, config)
if (inputs.length < 1) {
console.log(chalk.yellowBright('cannot find any file ') +
'by' +
config.input.toString())
}
if (outputs.length < 1) {
console.log(chalk.yellowBright('cannot find any file ') +
'by' +
config.output.toString())
}
debug(chalk.blueBright('inputs: ') + inputs)
debug(chalk.blueBright('outputs: ') + outputs)
// todo: need @rrreol/core to finish further
const { Judge } = rrreol
const judge = new Judge()
for (let i = 1; i <= inputs.length; i++) {
await judge.in(i).readPath(inputs[i])
await judge.out(i).readPath(outputs[i])
}
await judge.exec()
}
async function installAllComponents(): Promise {
if (!fs.existsSync('direflow-components')) {
console.log(chalk.white('No direflow components found. Nothing to install...'));
return;
}
console.log('');
console.log(chalk.blueBright('Please be patient'));
console.log(chalk.blueBright('Installing all Direflow Components...'));
console.log('');
const componentsDirectory = fs.readdirSync('direflow-components');
for (const directory of componentsDirectory) {
if (fs.statSync(`direflow-components/${directory}`).isDirectory()) {
try {
const result = await triggerCommand(directory);
console.log(chalk.greenBright(result));
} catch (err) {
console.log(chalk.red(err));
process.exit(1);
}
}
}
}
export async function Try(dep: Dependency, from: string, to: string, git: boolean, copyNode: boolean): Promise {
let f: string = path.resolve(process.cwd(), from);
if (git) {
let gitSimulate: GitSimulator = new GitSimulator(dep.core);
f = await gitSimulate.SimulateGit(process.cwd(), from);
console.log(chalk.blueBright(f));
}
let ret = "";
try {
let cyanSafe = await Interrogate(dep, dep.autoInquirer, f, to);
let logger = console.log;
console.log = function (...args) {
logger.apply(console, args);
};
ret = await GenerateTemplate(dep, f, to, cyanSafe, copyNode);
} catch (e) {
ret = chalk.redBright(e);
}
if (git) {
if (newHash.requirements != oldHash.requirements) {
console.log(chalk.green("(m) requirements"))
installResult = await installUtil.install(appDir, buildDir, functionName)
installUtil.copyRequirementsToFunction(buildDir, functionName)
newHash = await hashUtil.calculateHashForDirectoy(functionBuildFolder)
}
if (installResult) {
await zipFolder(functionBuildFolder, `${functionBuildFolder}.zip`, [])
await hashUtil.putHashesForFunction(buildDir, functionName, newHash)
}
}
else {
console.log(chalk.blueBright("(#) no changes detected"));
}
}
Git.Clone("https://github.com/leinov/wnow", dist).then(()=>{
fs.removeSync(path.resolve(dist,"bin"));
fs.removeSync(path.resolve(dist,".git"));
fs.removeSync(path.resolve(dist,"LICENSE"));
fs.removeSync(path.resolve(dist,".gitignore"));
console.log(chalk.blueBright(`${dist} created success !`));
});
}
notice(message: string): void {
return console.log(chalk.blueBright(`🌟 [Notice] ${message}`));
}
};
export function printInfo(text) {
console.log(`${chalk.blueBright("[INFO]")} ${text}`);
}
notice(message: string) {
return console.log(chalk.blueBright(`🌟 [Notice] ${message}`));
}
};
export const sourceReference = (text: string) => chalk.blueBright(text)
export const success = (text: string) => chalk.greenBright(text)