Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.action((url, args) => {
// Error Handling
if (typeof url === 'undefined') {
ui.error('\nYou have to set an URL.\n', false);
process.exit(1);
}
if (url.match(/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/) === null) {
ui.error('\nYou have to set a valid URL.', false);
ui.info(chalk.dim('e.g. https://example.com or example.com\n'));
process.exit(1);
}
if (args.parent.verbose && args.parent.mute) {
ui.error('\nYou have to choose between silent or verbose mode!\n', false);
process.exit(1);
}
if (args.parent.verbose) ui.set('verbose');
if (args.parent.mute) ui.set('silent');
// initialize the task runner
const tasks = new Tasks(url, ui);
if (args.ssl) tasks.new('ssl');
if (args.fonts) tasks.new('fonts');
if (args.prefetching) tasks.new('prefetching');
// folders in the output. E.g. instead of `foo -> bar -> baz` we get
// `foo/bar/baz` instead.
if (subtree.children && subtree.children.length === 1) {
const child = subtree.children[0];
const newName = chalk.dim(path.join(dir.toString(), child.name!));
children.push({
children: child.children,
name: newName,
});
continue;
}
children.push({
children: subtree.children,
name: chalk.dim(dir.toString()),
});
}
return { name, children };
}
if (cli.flags.json) {
console.log(JSON.stringify(stats));
return;
}
let output = `
Ping ${getSpinnerFromState('ping')}${stats.ping}
Download ${getSpinnerFromState('download')}${stats.download}
Upload ${getSpinnerFromState('upload')}${stats.upload}`;
if (cli.flags.verbose) {
output += [
'',
' Server ' + (stats.data === undefined ? '' : chalk.cyan(stats.data.server.host)),
' Location ' + (stats.data === undefined ? '' : chalk.cyan(stats.data.server.location + chalk.dim(' (' + stats.data.server.country + ')'))),
' Distance ' + (stats.data === undefined ? '' : chalk.cyan(roundTo(stats.data.server.distance, 1) + chalk.dim(' km')))
].join('\n');
}
logUpdate(output);
}
const help = () => {
console.log(`
${chalk.bold(`${logo} now remove`)} [...deploymentId|deploymentName]
${chalk.dim('Options:')}
-h, --help Output usage information
-A ${chalk.bold.underline('FILE')}, --local-config=${chalk.bold.underline(
'FILE'
)} Path to the local ${'`now.json`'} file
-Q ${chalk.bold.underline('DIR')}, --global-config=${chalk.bold.underline(
'DIR'
)} Path to the global ${'`.now`'} directory
-d, --debug Debug mode [off]
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
'TOKEN'
)} Login token
-y, --yes Skip confirmation
-s, --safe Skip deployments with an active alias
-S, --scope Set a custom scope
codeObjectsForGrade.forEach((codeObject: CodeObjectWithRolesAndEvalutation) => {
const grade = `[${codeObject.grade}]`;
const arrow = getPriorityArrow(codeObject.priority);
const filename = path.relative(baseDir, codeObject.location.filename);
const location = `(${filename}:${codeObject.location.line})`;
console.log(colorizeFun(`${EDGE} ${grade} ${chalk.dim(arrow)} ${codeObject.name}`) + chalk.dim(` ${location}`));
});
});
function splash(){
console.log(chalk.dim('ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; `ttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; ttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; tttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; ;ttttttttttt, ttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; ;tttttttttttt, ;tttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; ;tttttttttttt, ;tttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; ;ttttttttttt, ttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; tttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; ttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; ,ttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; ;ttttttttttttttttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; ;ttttttttttttttttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; ;ttttttttttttttttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; ;ttttttttttttttttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttt; ;ttttttttttttttttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttt ttttttttttt'));
console.log(chalk.dim('ttttttttttt ') + chalk.bold('------------ PHUNT ------------') + chalk.dim(' ttttttttttt'));
console.log(chalk.dim('ttttttttttt PRODUCTHUNT COMMAND LINE CLIENT ttttttttttt'));
console.log(chalk.dim('ttttttttttt ttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt'));
console.log(chalk.dim('ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt\n'));
}
module.exports = function (webpackConfig, options) {
console.log(chalk.dim('---------------------'))
process.stdout.write('\x1Bc')
if (options.dev) {
console.log(chalk.cyan('> Starting development server'))
}
const cleanDist = () => {
if (options.cleanDist && !options.format) {
rm(path.join(options.dist, '*'))
}
}
if (options.inspect) {
console.log(webpackConfig)
}
const result = {
let propName, action;
if (key.endsWith('__deleted')) {
action = 'delete';
propName = key.replace('__deleted', '')
console.log(chalk.red.bold('Delete:'));
console.log(chalk.red(prefix('- ', `${propName}: ${JSON.stringify(value)}`)));
} else if (key.endsWith('__added')) {
action = 'add';
propName = key.replace('__added', '')
console.log(chalk.green.bold('Add:'));
console.log(chalk.green(prefix('+ ', `${propName}: ${JSON.stringify(value)}`)));
} else if (value.__old && value.__new) {
action = 'update';
console.log(chalk.yellow.bold('Update:'));
console.log(chalk.dim('Old:'));
console.log(chalk.red(prefix('- ', `${key}: ${JSON.stringify(value.__old, null, 2)}`)));
console.log(chalk.dim('New:'));
console.log(chalk.green(prefix('+ ', `${key}: ${JSON.stringify(value.__new, null, 2)}`)));
}
process.stdout.write('\n');
return this._promptChangeAction()
.then(applyChange => {
if (!applyChange) return;
if (action === 'delete') delete out[propName];
else if (action === 'add') out[propName] = value;
else if (action === 'update') out[key] = value.__new;
})
})
.then(() => {
const chalk = require('chalk')
const header = chalk.dim('elm-live:')
const hotReloadOn =
`${header}
${chalk.bold('Hot Reloading is ') + chalk.bold.green('ON')}
${chalk.magenta.bold('Warning:')} Hot Reloading does not replay the messages of the app.
It just restores the previous state and can lead to bad state.
If this happen, reload the app in the browser manually to fix it.
`
const wrongLocation =
`${chalk.red(`-- Output In Wrong Location -----------------`)}
You have used the ${chalk.blue('elm make')} flag --output in the wrong location. As seen in the usage example about, all ${chalk.blue('elm make')} flags must be added to your command after the -- separator.
`
The deployment id can be used as the source:
${chalk.cyan('$ now alias set deploymentId my-alias')}
Custom domains work as alias targets:
${chalk.cyan(
`$ now alias set ${chalk.underline(
'api-ownv3nc9f8.now.sh'
)} ${chalk.underline('my-api.com')}`
)}
${chalk.dim('–')} The subcommand ${chalk.dim(
'`set`'
)} is the default and can be skipped.
${chalk.dim('–')} ${chalk.dim(
'`http(s)://`'
)} in the URLs is unneeded / ignored.
${chalk.gray('–')} Add and modify path based aliases for ${chalk.underline(
'zeit.ninja'
)}:
${chalk.cyan(
`$ now alias ${chalk.underline('zeit.ninja')} -r ${chalk.underline(
'rules.json'
)}`
)}
Export effective routing rules:
${chalk.cyan(