Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
desc: 'Public base URL of of Magento 2.3 instance.',
example: 'https://magento2.vagrant65'
});
const { readFileSync } = require('fs');
const path = require('path');
const chalk = require('chalk');
const dotenv = require('dotenv');
let parsedEnv;
const envPath = path.join(__dirname, '.env');
try {
parsedEnv = dotenv.parse(readFileSync(envPath));
// don't use console.log, which writes to stdout. writing to stdout
// interferes with webpack json output
console.warn(
chalk.green(
`Using environment variables from ${chalk.greenBright(
'.env'
)}`
)
);
if (env.DEBUG || env.NODE_DEBUG) {
console.warn(
'\n ' +
require('util')
.inspect(parsedEnv, {
colors: true,
compact: false
})
.replace(/\s*[\{\}]\s*/gm, '')
.replace(/,\n\s+/gm, '\n ') +
'\n'
);
public async getLockFile(): Promise {
const lockFilePath = path.resolve(this.projectDir, 'migrations', 'lift.lock')
if (await exists(lockFilePath)) {
const file = await readFile(lockFilePath, 'utf-8')
const lockFile = deserializeLockFile(file)
if (lockFile.remoteBranch) {
// TODO: Implement handling the conflict
throw new Error(
`There's a merge conflict in the ${chalk.bold(
'migrations/lift.lock',
)} file. Please execute ${chalk.greenBright('prisma lift fix')} to solve it`,
)
}
return lockFile
}
return initLockFile()
}
const printMods = root => f => {
// TODO: Add logic for modifications, new, deleting, etc.
const type = chalk.greenBright("modified");
const file = `${root}/${removeDotFromFilepath(f)}`;
shell.echo(` ${type} ${file}`);
return f;
};
function onFinish(stats) {
setConfig = noop
if (Object.keys(stats.fail).length === 0) {
console.log(
label(chalk.bgGreen, 'DONE'),
label(chalk.bgWhite, 'build complete'),
chalk.greenBright('all tasks finished successfully'),
)
return
}
console.log(
label(chalk.bgKeyword('orange'), 'WARN'),
chalk.bold.keyword('orange')('some tasks failed'),
)
for (const name in stats.fail) {
console.log(chalk.keyword('orange')(` - ${name}`))
}
process.exit(1)
}
if (program.args.length) {
console.error(chalk.red('Unrecognized commands:'));
program.args.forEach(function (arg) {
console.log(chalk.red(arg));
});
console.error(chalk.red('List does not require any options. '));
process.exit(1);
}
console.log();
console.log('Logged in Captain Machines:');
console.log();
let machines = configs.get('captainMachines');
for (let i = 0; i < machines.length; i++) {
console.log('>> ' + chalk.greenBright(machines[i].name) + ' at ' + chalk.cyan(machines[i].baseUrl));
}
console.log();
function handleEnd () {
spinner.stop()
console.log()
console.info(chalk.greenBright('Load successful, enjoy it!'))
console.log()
console.log(chalk.gray('# Inter your blog'))
console.log(`$ cd ${program.init}`)
console.log(chalk.gray('# Install package'))
console.log('$ npm install')
}
async function DownloadTemplate(template: Template, copyNode: boolean, fileFactory: IFileFactory, dep: Dependency): Promise {
const writer: FileWriter = new FileWriter(dep.util);
const installer: Installer = new Installer(dep.core, fileFactory, dep.util, writer);
const string = await installer.Install(template.Link, copyNode);
if (string !== "Installation Completed") return string;
template.CreateGroupEntry();
if (template.Exist()) {
const data = template.TemplateData;
const verify = data.key === template.key && template.name == data.name && template.link === data.repo;
if (verify)
return chalk.greenBright("Template ") +
chalk.blueBright(template.name) +
chalk.greenBright(" has been installed in Group ") +
chalk.blueBright(template.group);
}
template.DeleteGroupEntry();
rimraf.sync(template.Target);
return chalk.redBright("Template ") +
chalk.blueBright(template.name) +
chalk.redBright(" failed to installed in Group ") +
chalk.blueBright(template.group) +
chalk.redBright(`, possibly due to the following reason:
\t- The target folder does not exist
\t- The target git repository does not exist
\t- The target folder or repository does not contain [cyan.config.js] in the root folder
\t- The target folder or repository does not contain [cyan.json] in the root folder
\t- The data in the target repository's [cyan.json] does not match with server's
`);
}
export const initialization = async (logger: ProcessLogger): Promise => {
logger.stdout.write(chalk.greenBright("👋"));
logger.stdout.write(chalk.green(" Welcome to TypeStat! "));
logger.stdout.write(chalk.greenBright("👋"));
logger.stdout.write(chalk.reset(EOL));
logger.stdout.write(chalk.reset(`This will create a new `));
logger.stdout.write(chalk.yellowBright(fileName));
logger.stdout.write(chalk.reset(` for you.${EOL}`));
logger.stdout.write(`If you don't know how to answer, that's ok - just select the default answer.${EOL}`);
logger.stdout.write(chalk.reset(EOL));
try {
await runPrompts();
} catch (error) {
logger.stderr.write(getQuickErrorSummary(error));
return ResultStatus.ConfigurationError;
}
private handleList() {
const versions = getSolidityVersions().map(([alias, full]) => ({
alias,
full,
}))
this.log(chalk.greenBright('Available Solidity Versions'))
ux.table(versions, {
alias: {},
full: {},
})
this.log('')
}