Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
glob('**/*.svelte', { cwd }).forEach(file => {
if (file[0] === '_') return;
try {
const { js } = compile(
fs.readFileSync(`${cwd}/${file}`, 'utf-8'),
Object.assign(options, {
filename: file
})
);
console.log( // eslint-disable-line no-console
`\n>> ${colors.cyan().bold(file)}\n${addLineNumbers(js.code)}\n<< ${colors.cyan().bold(file)}`
);
} catch (err) {
console.log(`failed to generate output: ${err.message}`);
}
});
}
renderOption(cursor, v, i, arrowIndicator) {
const prefix = (v.selected ? color.green(figures.radioOn) : figures.radioOff) + ' ' + arrowIndicator + ' ';
let title, desc;
if (v.disabled) {
title = cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
} else {
title = cursor === i ? color.cyan().underline(v.title) : v.title;
if (cursor === i && v.description) {
desc = ` - ${v.description}`;
if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
desc = '\n' + wrap(v.description, {
margin: prefix.length,
width: this.out.columns
});
}
}
}
return prefix + title + color.gray(desc || '');
} // shared with autocompleteMultiselect
let title, prefix, desc = '', v = this.choices[i];
// Determine whether to display "more choices" indicators
if (i === startIndex && startIndex > 0) {
prefix = figures.arrowUp;
} else if (i === endIndex - 1 && endIndex < this.choices.length) {
prefix = figures.arrowDown;
} else {
prefix = ' ';
}
if (v.disabled) {
title = this.cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
prefix = (this.cursor === i ? color.bold().gray(figures.pointer) + ' ' : ' ') + prefix;
} else {
title = this.cursor === i ? color.cyan().underline(v.title) : v.title;
prefix = (this.cursor === i ? color.cyan(figures.pointer) + ' ' : ' ') + prefix;
if (v.description && this.cursor === i) {
desc = ` - ${v.description}`;
if (prefix.length + title.length + desc.length >= this.out.columns
|| v.description.split(/\r?\n/).length > 1) {
desc = '\n' + wrap(v.description, { margin: 3, width: this.out.columns });
}
}
}
this.outputText += `${prefix} ${title}${color.gray(desc)}\n`;
}
}
this.out.write(this.outputText);
}
batchingPool.setBatchingHandler(batchingKey, async (batchingParamsList: any[]) => {
// merge common params with batching params
const mergedParams = (params || {}) as any;
for (const batchingParamName of batchingParamNames) {
mergedParams[batchingParamName] = [];
}
for (const bParams of batchingParamsList) {
for (const [k, v] of Object.entries(bParams)) {
mergedParams[k].push(v);
}
}
// log in advance
this.props.logger[this.opts.log!.call! ? "info" : "debug"](`call ${action}${kleur.cyan("@")}${node} ${kleur.cyan(batchingParamsList.length)} times in a batch from ${kleur.yellow((context.id || "unknown") + "@" + (context.ip || "unknown"))}`);
// do batching call
const response = await this.delegator.call(ctx, {action, node, params: mergedParams, disableCache});
this.registry.addActionExample({action, params: mergedParams, response});
return response;
});
}
render() {
if (this.closed) return;
if (this.firstRender) this.out.write(cursor.hide);
super.render();
this.out.write(erase.lines(this.first ? 1 : this.msg.split(/\n/g).length) + cursor.to(0) + [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.value ? this.inactive : color.cyan().underline(this.inactive), color.gray('/'), this.value ? color.cyan().underline(this.active) : this.active].join(' '));
}
function commandHelp() {
console.log(
[
kleur.underline('Usage'),
'',
' ' +
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('--port') + ' Port to run development server on',
' ' + kleur.yellow('--open') + ' Open Styleguidist in the default browser',
' ' + kleur.yellow('--verbose') + ' Print debug information',
].join('\n')
);
}
renderOption(cursor, v, i, arrowIndicator) {
const prefix = (v.selected ? color.green(figures.radioOn) : figures.radioOff) + ' ' + arrowIndicator + ' ';
let title, desc;
if (v.disabled) {
title = cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
} else {
title = cursor === i ? color.cyan().underline(v.title) : v.title;
if (cursor === i && v.description) {
desc = ` - ${v.description}`;
if (prefix.length + title.length + desc.length >= this.out.columns
|| v.description.split(/\r?\n/).length > 1) {
desc = '\n' + wrap(v.description, { margin: prefix.length, width: this.out.columns });
}
}
}
return prefix + title + color.gray(desc || '');
}
renderOption(v, hovered, isStart, isEnd) {
let desc;
let prefix = isStart ? figures.arrowUp : isEnd ? figures.arrowDown : ' ';
let title = hovered ? color.cyan().underline(v.title) : v.title;
prefix = (hovered ? color.cyan(figures.pointer) + ' ' : ' ') + prefix;
if (v.description) {
desc = ` - ${v.description}`;
if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
desc = '\n' + wrap(v.description, {
margin: 3,
width: this.out.columns
});
}
}
return prefix + ' ' + title + color.gray(desc || '');
}
))
const config = getLibConfig(response)
processPgkJson(config)
modifyContents(config)
processTemplates(config)
removeItems(config)
initGit()
initGitHooks()
log(kleur.cyan("OK, you're all set. Happy type-safe coding!! 🌊 🏄 🤙 \n"))
}
console.error(red('Unknown command, run tscov -h or tscov --help for a list of commands.'))
return false
}
const { correctCount, totalCount, anys } = await this.checkTypes.startLinter(projectInput, true, argv.debug, fileInput)
const openCount: number = totalCount - correctCount
const percentage: number = Math.round(10000 * correctCount / totalCount) / 100
const minCoverage: number | undefined = await this.minCoverage.getMinCoverage(argv)
const failed: boolean | undefined | 0 = minCoverage && percentage < minCoverage
const success: boolean | undefined | 0 = minCoverage && percentage > minCoverage
if (argv.d || argv.details || failed) {
console.log('')
console.log('------------- uncovered types ---------------')
for (const { file, line, character, text } of anys) {
console.log(`${path.resolve(process.cwd(), file)}: ` + cyan(`${line + 1}:${character + 1}`) + ` - ${text}`)
}
}
console.log('')
console.log('')
console.log('----------------- coverage ------------------')
console.log(cyan(`${totalCount}`) + ` - max reachable type coverage`)
console.log(cyan(`${correctCount}`) + ` - types covered`)
console.log(cyan(`${openCount}`) + ` - types uncovered`)
console.log('')
if (success) {
console.log(green(`${percentage.toFixed(2)}%`) + ` - coverage percentage` + white(`\nYou can run ` + cyan('"tscov --details"') + ` to show all uncovered types.`))
}
if (failed) {
console.log((red(`${percentage.toFixed(2)}%`) + white(` - the type coverage rate is lower than your target: `) + cyan(`${minCoverage}%.`)))
}