Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 1x 1x 1x 1x 21x 21x 21x 4x 4x 4x 4x 12x 12x 12x 12x 8x 8x 8x 8x 5x 5x 5x 5x 1x 11x 1x | import * as path from 'path'; import {JSONFile, JSONObject} from './json_file'; import * as babelParser from '@babel/parser'; export interface CerbaConfigType extends JSONObject { initialVersion?: string; babelPlugins?: string[]; packagesDir?: string; packages?: { name: string; description?: string; main?: string; bin?: string; }[]; } export type CerbaConfigPkg = NonNullable<CerbaConfigType['packages']>[number]; const defaults = {basename: 'cerba.json', defaultContent: '{}', readonly: true}; export class CerbaConfig extends JSONFile<CerbaConfigType> { constructor(public Iprops: ConstructorParameters<typeof JSONFile>[0] & {scope?: string} = defaults) { super({...props, ...defaults}); this.props = {...props, ...defaults}; } get initialVersion(): Promise<string> { return (async () => { const content = await this.parsedContent; return content.initialVersion || '1.0.0'; })(); } get packagesDir(): Promise<string> { return (async () => { const content = await this.parsedContent; return path.join(this.cwd, content.packagesDir || 'packages'); })(); } get babelPlugins(): Promise<babelParser.ParserPlugin[]> { return (async () => { const content = await this.parsedContent; return (content.babelPlugins || []) as babelParser.ParserPlugin[]; })(); } get packages(): Promise<CerbaConfigPkg[]> { return (async () => { const content = await this.parsedContent; return content.packages || []; })(); } get scope(): string | undefined { return this.props.scope; } } |