Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function renderHeader(statuses) {
var txt = '';
// Build Header
for (var k in statuses) {
var status = statuses[k];
// Create header
var col = centerText(k, width);
// Set header status color
if (status === false) {
col = chalk.dim(col);
} else {
col = chalk.white(col);
}
txt += col;
}
return txt;
}
.then(function() {
// Status
JawsCli.log(chalk.white('-------------------------------------------'));
JawsCli.log(chalk.white(' Dashboard: Deploying Lambdas...'));
JawsCli.log(chalk.white('-------------------------------------------'));
if (!_this._allTagged && !_this._report.selectedLambdas) {
return JawsCli.log(chalk.white('No selected Lambdas to deploy.'));
}
return CMDdeployLambda.run(
_this._JAWS,
_this._stage,
(_this._regions.length > 1 ? null : _this._regions[0]),
true);
})
.then(function() {
const boxen = require('boxen')
const fs = require('fs')
const path = require('path')
// Define options for Boxen
const options = {
padding: 1,
margin: 1,
borderStyle: 'round'
}
// Text + chalk definitions
const data = {
name: chalk.white(' Tierney Cyren'),
handle: chalk.white('bitandbang'),
work: chalk.white('Senior Cloud Developer Advocate at Microsoft'),
opensource: chalk.white('Node.js Community Committee ') + chalk.green('⬢'),
twitter: chalk.gray('https://twitter.com/') + chalk.cyan('bitandbang'),
npm: chalk.gray('https://npmjs.com/') + chalk.red('~bnb'),
github: chalk.gray('https://github.com/') + chalk.green('bnb'),
linkedin: chalk.gray('https://linkedin.com/in/') + chalk.blue('bitandbang'),
web: chalk.cyan('https://bnb.im'),
npx: chalk.red('npx') + ' ' + chalk.white('@bnb/card (via GitHub Package Registry)'),
labelWork: chalk.white.bold(' Work:'),
labelOpenSource: chalk.white.bold('Open Source:'),
labelTwitter: chalk.white.bold(' Twitter:'),
labelnpm: chalk.white.bold(' npm:'),
labelGitHub: chalk.white.bold(' GitHub:'),
labelLinkedIn: chalk.white.bold(' LinkedIn:'),
labelWeb: chalk.white.bold(' Web:'),
labelCard: chalk.white.bold(' Card:')
}
test('specificHelpScript: help: formats a nice message', () => {
const config = {
scripts: {
foo: {
bar: {
description: 'the foo script',
script: 'echo "foo"',
},
},
},
}
const actual = specificHelpScript(config, 'f.b')
const name = chalk.green('foo.bar')
const description = chalk.white('the foo script')
const script = chalk.gray('echo "foo"')
const expected = `${name} - ${description} - ${script}`
expect(actual).toBe(expected)
})
_help(details) {
console.log(asciiLogo(pkg.version, 'APP SUPPORT SCRIPTS'));
this._exit(
help +
(details
? detailedHelp
: `Use ${chalk.white('--help')} for more info.\n`)
);
}
.on('--help', function () {
console.log();
console.log(' Examples:');
console.log(' ' + chalk.blueBright(`npf search , ${chalk.white("fuzzy search for npm modules with preview")}`));
console.log(' ' + chalk.blueBright(`npf search --no-preview, ${chalk.white("fuzzy search for npm modules without preview")}`));
console.log(' ' + chalk.blueBright(`npf search --no-fuzzy, ${chalk.white("plain search for npm modules")}`));
console.log();
})
.action(function (module) {
getNewArtifactPath: function(type, template, name, destination) {
var cwd = process.cwd();
//path names should all be kebab-cased
name = Case.kebab(name);
var projectRoot = this.cli.reflect.projectRoot();
if (!projectRoot) {
console.log(chalk.white('Make sure you are inside a project before creating a new ' + type + '!'));
console.log('');
return;
}
if( cwd === path.resolve(projectRoot + '/shared_modules') ) {
console.log(chalk.white('You cannot create an artifact directly in the shared modules folder.'));
console.log('');
return;
}
//determine the destination
if (!destination) {
if (projectRoot !== cwd && (cwd.indexOf(path.resolve(projectRoot + '/components')) !== -1 || cwd.indexOf(path.resolve(projectRoot + '/shared_modules')) !== -1) ) {
if (path.basename(cwd) !== type+'s') {
destination = path.resolve(cwd + '/' + type + 's/' + name);
} else {
.then(({ stdout, stderr }) => {
const successMessage = `\nsuccessfully ran ${packageManager} install at ${cwd} ${argsString}`;
const peerWarnings = stripNonPeerDependenciesWarnings(stderr, packageManager);
stdout = verbose ? stdout + successMessage : chalk.white(peerWarnings) + successMessage;
stderr = verbose ? stderr : '';
return { stdout, stderr };
})
.catch((err) => {
addRoutes(modelClass, relation, type, routesSettings, indent) {
const handlers = restHandlers[type]
const getSettings = settingsHandlers[type]
const target = relation || modelClass
for (const [verb, handler] of Object.entries(getSettings ? handlers : {})) {
const settings = getSettings(verb, handlers, routesSettings)
if (!settings || !settings.access) {
continue
}
const path = this.getRoutePath(type, modelClass, relation)
this.adapter.addRoute(
{ modelClass, relation, type, verb, path, settings },
ctx => handler(target, ctx)
)
this.log(`${chalk.magenta(verb.toUpperCase())} ${chalk.white(path)}`,
indent)
}
}
const SCHEMA_SELECT = ({ action, opt, props }) => {
const { prompt } = props;
const zones = ZONE_LIST();
return {
properties: {
id: {
description: `${chalk.white('Zone:')}\n\t ${zones.join(
'\n\t ',
)}\n ${chalk.white('Select:')}`,
type: 'string',
required: true,
message: ' select a zone',
ask: () => {
return !op.has(prompt, 'override.id');
},
before: val => {
val = val.replace(/[^\w-_]/g, '');
return !isNaN(val) && val > zones.length
? null
: GET_ZONE(val) || val;
},
},
},
};
};