Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function checkProjectName(name, dependencies) {
// Validate project name against NPM naming restriction
// https://github.com/npm/cli/blob/latest/doc/files/package.json.md#name
const validationResult = validateProjectName(name);
if (!validationResult.validForNewPackages) {
console.error(`Could not create a project called ${colors.red(`"${name}"`)} because of npm naming restrictions:`);
printValidationResults(validationResult.errors);
printValidationResults(validationResult.warnings);
process.exit(1);
}
// Check if project name conflicts with existing NPM packages
if (dependencies.indexOf(name) >= 0) {
console.error(
colors.red(`We cannot create a project called `) +
colors.green(name) +
colors.red(
` because a dependency with the same name exists.\n` +
`Due to the way npm works, the following names are not allowed:\n\n`
) +
colors.cyan(dependencies.map(depName => ` ${depName}`).join('\n')) +
colors.red('\n\nPlease choose a different project name.')
);
process.exit(1);
}
}
requiredConfigUpdates.map( (requiredConfigField) => {
// Error if config that must be set is still the default value.
if ( nameFieldDefaults[requiredConfigField] === config.theme[requiredConfigField] ){
log(colors.red(`${colors.bold('Error:')} the theme ${requiredConfigField} must be different than the default value ${nameFieldDefaults[requiredConfigField]}.`));
process.exit(1);
}
});
.catch(e => {
fancyLog(acolors.red('ng-compilation failed. See below for errors.\n'));
fancyLog(acolors.red(e));
process.exit(1);
});
});
fs.readFile('dev/index.html', 'utf8', function(err, theFileContents) {
if (err) {
log(c.red('*** metadata ad.size validation error encountered ***'));
log(c.red(err));
}
var adSizeMetaData;
var parser = new htmlparser.Parser({
onopentag: function(name, attribs) {
//log('opentag');
if (name === "meta" && attribs.name === 'ad.size') {
log(c.yellow('* Found ad.size metadata: ') + c.green(attribs.content));
adSizeMetaData = attribs.content
//log(attribs.content);
}
},
ontext: function(text) {
//console.log("-->", text);
},
}, { decodeEntities: true, recognizeSelfClosing: true });
function message(title, alternative, description) {
console.log(colors.red('gulp-typescript').toString() +
colors.gray(': ') +
title +
colors.gray(' - ') +
alternative);
if (description)
console.log(' ' + colors.gray(description.replace(/\n/g, '\n ')));
}
exports.message = message;
'use strict';
const colors = require('ansi-colors');
const { MultiSelect } = require('enquirer');
const prompt = new MultiSelect({
name: 'food',
message: 'What are your favorite foods?',
choices: [
'Lasagna',
'Pizza',
{
name: 'Funnel Cakes',
disabled: colors.red('Not today!'),
indicator: '-'
},
'Chicken Curry',
'Tacos'
]
});
prompt.run()
.then(console.log)
.catch(console.log);
function run(tasks) {
process.emit('senseGo_onRunStart');
try {
gulp.series(tasks, function (done) {
process.emit('senseGo_onRunFinished');
process.emit('senseGo_onEnd');
done();
})();
} catch (ex) {
if (ex) {
log(colors.red(ex.name), ex.message);
}
}
}
const render = async() => {
this.clear();
this.cursorHide();
let waiting = red('Please wait until all choices are loaded');
let value = this.selected ? cyan(this.selected.value) : '';
let hint = !this.queue.length ? this.renderHelp(help) : waiting;
this.write(this.renderHeader());
this.write(this.renderMessage(value, help));
this.write(await this.renderChoices());
this.write(this.renderFooter());
if (this.queue.length) {
this.online = this.offline();
let choice = await this.toChoice(this.queue.shift());
this.choices.push(choice);
this.str += '\n';
return render();
}
};
if (state.answered) {
let result = format(state.values[key], choice, state);
state.output += colors.unstyle(result);
continue;
}
if (val !== value) {
state.values[key] = val;
value = colors.dim(val);
} else {
state.values[key] = '';
val = `<${token.inner}>`;
if (state.missing.has(key) || state.invalid.has(key)) {
value = colors.red(val);
} else {
value = colors.cyan(val);
}
}
if (index === state.index) {
value = colors.underline(value);
}
index++;
}
if (value) {
state.output += value;
}
}