Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/** @type {string[]} */
const rmFiles = []
const rmDirs = ['migrate']
const cpItems = cpFiles.map((file) => join(starterPathDir, file))
const rmItems = [...rmDirs, ...rmFiles].map((file) =>
join(libPackagePathDir, file)
)
sh.cp('-Rf', cpItems, `${libPackagePathDir}/`)
// 'rm' command checks the item type before attempting to remove it
sh.rm('-Rf', rmItems)
log(kleur.underline().white('==📁 scripts/ updated ✅ =='))
log(kleur.red('Removed: \n ' + rmItems.join('\n')))
log(kleur.yellow('Copied: \n ' + cpItems.join('\n')))
}
public async publishEvent(context: APIRequestContext, args: EventPublishArgs): Promise {
const ctx = this.getDelegatorContext(context);
await this.delegator.publish(ctx, args);
// add from information to original packet and store as example
const packet: EventPacket = args;
packet.from = `${context.id || "unknown"}@${context.ip || "unknown"}`;
this.registry.addEventExample(this.resolveEventName(args.event), packet);
// log
this.props.logger[this.opts.log!.event! ? "info" : "debug"](`published ${kleur.green(packet.event)} ${packet.broadcast ? "broadcast " : ""}event from ${kleur.yellow(packet.from!)}`);
}
sortAndGroupCommands(commands).forEach(({ group, commands: groupCommands }) => {
console.log('')
if (group === 'root') {
console.log(bold(yellow('Available commands')))
} else {
console.log(bold(yellow(group)))
}
groupCommands.forEach(({ commandName, description }) => {
console.log(` ${green(padRight(commandName, maxWidth, ' '))} ${dim(description)}`)
})
})
if (flagsList.length) {
console.log('')
console.log(bold(yellow('Global Flags')))
flagsList.forEach(({ displayName, displayType, description = '', width }) => {
const whiteSpace = padRight('', maxWidth - width, ' ')
console.log(` ${green(displayName)} ${dim(displayType)} ${whiteSpace} ${dim(description)}`)
})
}
}
' ' +
kleur.cyan('') +
' ' +
kleur.yellow('[]'),
'',
kleur.underline('Commands'),
'',
' ' + kleur.cyan('build') + ' Build style guide',
' ' + kleur.cyan('server') + ' Run development server',
' ' + kleur.cyan('help') + ' Display React Styleguidist help',
'',
kleur.underline('Options'),
'',
' ' + kleur.yellow('--config') + ' Config file path',
' ' + kleur.yellow('--port') + ' Port to run development server on',
' ' + kleur.yellow('--open') + ' Open Styleguidist in the default browser',
' ' + kleur.yellow('--verbose') + ' Print debug information',
].join('\n')
);
}
function updateRcFiles() {
const libPackagePath = PACKAGE_ROOT
const cpFiles = ['.travis.yml']
const cpItems = cpFiles.map((path) => join(ROOT, path))
sh.cp('-Rf', cpItems, `${libPackagePath}/`)
log(kleur.underline().white('== rc/config root files updated ✅ =='))
log(kleur.yellow('Copied: \n ' + cpItems.join('\n')))
}
renderDoneOrInstructions() {
if (this.done) {
return this.value.filter(e => e.selected).map(v => v.title).join(', ');
}
const output = [color.gray(this.hint), this.renderInstructions(), this.renderCurrentInput()];
if (this.filteredOptions.length && this.filteredOptions[this.cursor].disabled) {
output.push(color.yellow(this.warn));
}
return output.join(' ');
}
' ' +
kleur.bold('styleguidist') +
' ' +
kleur.cyan('') +
' ' +
kleur.yellow('[]'),
'',
kleur.underline('Commands'),
'',
' ' + kleur.cyan('build') + ' Build style guide',
' ' + kleur.cyan('server') + ' Run development server',
' ' + kleur.cyan('help') + ' Display React Styleguidist help',
'',
kleur.underline('Options'),
'',
' ' + kleur.yellow('--config') + ' Config file path',
' ' + kleur.yellow('--open') + ' Open Styleguidist in the default browser',
' ' + kleur.yellow('--verbose') + ' Print debug information'
].join('\n')
)
}
function getName({ name, pkgName, amdName, cwd, hasPackageJson }) {
if (!pkgName) {
pkgName = basename(cwd);
if (hasPackageJson) {
stderr(
yellow(
`${yellow().inverse(
'WARN',
)} missing package.json "name" field. Assuming "${pkgName}".`,
),
);
}
}
return { finalName: name || amdName || safeVariableName(pkgName), pkgName };
}
async function fromCmd(packageName, opts) {
const { depth: maxDepth = 4, output } = opts;
let manifest = null;
await checkHydrateDB();
const spinner = new Spinner({
text: white().bold(`Searching for '${yellow().bold(packageName)}' manifest in the npm registry!`)
}).start();
try {
manifest = await pacote.manifest(packageName, {
registry: REGISTRY_DEFAULT_ADDR,
...token
});
const elapsedTime = ms(spinner.elapsedTime.toFixed(2));
spinner.succeed(
white().bold(`Fetched ${yellow().bold(packageName)} manifest on npm in ${cyan(elapsedTime)}`)
);
}
catch (err) {
spinner.failed(err.message);
}
if (manifest !== null) {