Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function describeStability(thing: Documentable, options: TypeSystemTreeOptions) {
if (!options.stabilities) { return ''; }
switch (thing.docs.stability) {
case Stability.Stable: return ` (${colors.green('stable')})`;
case Stability.Experimental: return ` (${colors.yellow('experimental')})`;
case Stability.Deprecated: return ` (${colors.red('deprecated')})`;
}
return '';
}
public customTag(tag: string): string | undefined {
return this.docs.custom?.[tag];
}
public get summary(): string {
return this.docs.summary ?? '';
}
public get remarks(): string {
return this.docs.remarks ?? '';
}
}
const stabilityPrecedence = {
[Stability.Deprecated]: 0,
[Stability.Experimental]: 1,
[Stability.External]: 2,
[Stability.Stable]: 3,
};
function lowestStability(a?: Stability, b?: Stability): Stability | undefined {
if (a === undefined) { return b; }
if (b === undefined) { return a; }
return stabilityPrecedence[a] < stabilityPrecedence[b] ? a : b;
}
if (isValid) {
return true;
}
return 'Please enter a value';
}
/*
* Schema that questions are built from.
*
* Name values for questions are built from parent keys.
*/
const schema: ConfigPromptsSchema = {
stability: {
type: 'list',
message: 'Jsii Stability - stability of compiled module apis',
default: Stability.Experimental,
choices: Object.values(Stability)
},
types: {
type: 'input',
message: 'Jsii Type Definitions - compiled typescript definitions file for module (e.g. "index.d.ts")',
validate: hasLength
},
jsii: {
outdir: {
type: 'input',
message: 'Output Directory - Location for typescript compiler output (e.g. "dist")',
default: 'dist',
validate: hasLength
},
versionFormat: {
type: 'list',