diff --git a/public/docs/docsGenOutput/docsGenOutput.d.ts b/public/docs/docsGenOutput/docsGenOutput.d.ts index 6301b32c71..0a16ce03ea 100644 --- a/public/docs/docsGenOutput/docsGenOutput.d.ts +++ b/public/docs/docsGenOutput/docsGenOutput.d.ts @@ -94,6 +94,7 @@ type Autogenerated_TDocsGenExportedTypeRef = '@epam/uui-core:AcceptDropParams' | '@epam/uui-core:IContextProviderSsrProps' | '@epam/uui-core:IDataSource' | '@epam/uui-core:IDataSourceView' | +'@epam/uui-core:IDataSourceViewConfig' | '@epam/uui-core:IDisableable' | '@epam/uui-core:IDndActor' | '@epam/uui-core:IDndContext' | diff --git a/public/docs/docsGenOutput/docsGenOutput.json b/public/docs/docsGenOutput/docsGenOutput.json index 8ca8050a6f..8837054f71 100644 --- a/public/docs/docsGenOutput/docsGenOutput.json +++ b/public/docs/docsGenOutput/docsGenOutput.json @@ -1,5 +1,5 @@ { - "timestamp": "2023-12-06", + "timestamp": "2023-12-08", "docsGenTypes": { "@epam/uui-core:AcceptDropParams": { "summary": { @@ -15115,6 +15115,7 @@ "print": [ "// eslint-disable-next-line @typescript-eslint/no-unused-vars", "type IDataSourceView = {", + " getConfig(): IDataSourceViewConfig;", " getById(id: TId, index: number): DataRowProps;", " getListProps(): DataSourceListProps;", " getVisibleRows(): DataRowProps[];", @@ -15123,6 +15124,7 @@ " reload(): void;", " destroy(): void;", " loadData(): void;", + " clearAllChecked(): void;", " _forceUpdate(): void;", " selectAll?: ICheckable;", "};" @@ -15131,6 +15133,17 @@ "props": [ { "uid": 1, + "name": "getConfig", + "typeValue": { + "raw": "() => IDataSourceViewConfig" + }, + "editor": { + "type": "func" + }, + "required": true + }, + { + "uid": 2, "name": "getById", "typeValue": { "raw": "(id: TId, index: number) => DataRowProps" @@ -15141,7 +15154,7 @@ "required": true }, { - "uid": 2, + "uid": 3, "name": "getListProps", "typeValue": { "raw": "() => DataSourceListProps" @@ -15152,7 +15165,7 @@ "required": true }, { - "uid": 3, + "uid": 4, "name": "getVisibleRows", "typeValue": { "raw": "() => DataRowProps[]" @@ -15163,7 +15176,7 @@ "required": true }, { - "uid": 4, + "uid": 5, "name": "getSelectedRows", "typeValue": { "raw": "(range?: VirtualListRange | undefined) => DataRowProps[]" @@ -15174,7 +15187,7 @@ "required": true }, { - "uid": 5, + "uid": 6, "name": "getSelectedRowsCount", "typeValue": { "raw": "() => number" @@ -15185,7 +15198,7 @@ "required": true }, { - "uid": 6, + "uid": 7, "name": "reload", "typeValue": { "raw": "() => void" @@ -15196,7 +15209,7 @@ "required": true }, { - "uid": 7, + "uid": 8, "name": "destroy", "typeValue": { "raw": "() => void" @@ -15207,7 +15220,7 @@ "required": true }, { - "uid": 8, + "uid": 9, "name": "loadData", "typeValue": { "raw": "() => void" @@ -15218,7 +15231,18 @@ "required": true }, { - "uid": 9, + "uid": 10, + "name": "clearAllChecked", + "typeValue": { + "raw": "() => void" + }, + "editor": { + "type": "func" + }, + "required": true + }, + { + "uid": 11, "name": "_forceUpdate", "typeValue": { "raw": "() => void" @@ -15229,7 +15253,7 @@ "required": true }, { - "uid": 10, + "uid": 12, "name": "selectAll", "typeValue": { "raw": "ICheckable" @@ -15240,6 +15264,96 @@ "propsFromUnion": false } }, + "@epam/uui-core:IDataSourceViewConfig": { + "summary": { + "module": "@epam/uui-core", + "typeName": { + "name": "IDataSourceViewConfig", + "nameFull": "IDataSourceViewConfig" + }, + "src": "uui-core/src/types/dataSources.ts", + "exported": true + }, + "details": { + "kind": 264, + "typeValue": { + "raw": "IDataSourceViewConfig", + "print": [ + "type IDataSourceViewConfig = {", + " complexIds?: boolean;", + " cascadeSelection?: CascadeSelection;", + " selectAll?: true | false;", + " backgroundReload?: boolean;", + " flattenSearchResults?: boolean;", + "};" + ] + }, + "props": [ + { + "uid": 1, + "name": "complexIds", + "typeValue": { + "raw": "boolean" + }, + "editor": { + "type": "bool" + }, + "required": false + }, + { + "uid": 2, + "name": "cascadeSelection", + "typeValue": { + "raw": "boolean | 'implicit' | 'explicit'" + }, + "editor": { + "type": "oneOf", + "options": [ + false, + true, + "implicit", + "explicit" + ] + }, + "required": false + }, + { + "uid": 3, + "name": "selectAll", + "typeValue": { + "raw": "boolean" + }, + "editor": { + "type": "bool" + }, + "required": false + }, + { + "uid": 4, + "name": "backgroundReload", + "typeValue": { + "raw": "boolean" + }, + "editor": { + "type": "bool" + }, + "required": false + }, + { + "uid": 5, + "name": "flattenSearchResults", + "typeValue": { + "raw": "boolean" + }, + "editor": { + "type": "bool" + }, + "required": false + } + ], + "propsFromUnion": false + } + }, "@epam/uui-core:IDisableable": { "summary": { "module": "@epam/uui-core", @@ -39760,8 +39874,8 @@ "interface DropdownContainerProps extends IHasCX, IHasChildren, IHasStyleAttrs, IHasRawProps>, IHasForwardedRef, IDropdownBodyProps {", " /** Defines width in 'px' or 'auto'. If 'auto' provided, will be used width of the content. */", " width?: number | 'auto';", - " /** Defines maximum width in 'px'. */", - " maxWidth?: number;", + " /** Defines maximum width in 'px'. If 'auto' provided, will be used width of the content. */", + " maxWidth?: number | 'auto';", " /** Defines height in 'px'. */", " height?: number;", " /** If true, arrow tip will be shown", @@ -39829,14 +39943,11 @@ "name": "maxWidth", "comment": { "raw": [ - "Defines maximum width in 'px'." + "Defines maximum width in 'px'. If 'auto' provided, will be used width of the content." ] }, "typeValue": { - "raw": "number" - }, - "editor": { - "type": "number" + "raw": "number | 'auto'" }, "required": false }, @@ -47061,7 +47172,7 @@ "typeValue": { "raw": "PaginatorParams", "print": [ - "interface PaginatorParams extends IHasRawProps> {", + "interface PaginatorParams extends IHasRawProps> {", " size: '24' | '30';", " pages: PaginatorItem[];", " goToNext(): void;", @@ -47148,7 +47259,7 @@ ] }, "typeValue": { - "raw": "React.ReactHTMLElement & Record<`data-${string}`, string>" + "raw": "React.HTMLAttributes & Record<`data-${string}`, string>" }, "from": "@epam/uui-core:IHasRawProps", "required": false @@ -47172,7 +47283,7 @@ "typeValue": { "raw": "PaginatorProps", "print": [ - "interface PaginatorProps extends IEditable, IAnalyticableOnChange, IHasRawProps> {", + "interface PaginatorProps extends IEditable, IAnalyticableOnChange, IHasRawProps> {", " /** Component size */", " size: '24' | '30';", " /** Total number of pages */", @@ -47393,7 +47504,7 @@ ] }, "typeValue": { - "raw": "React.ReactHTMLElement & Record<`data-${string}`, string>" + "raw": "React.HTMLAttributes & Record<`data-${string}`, string>" }, "from": "@epam/uui-core:IHasRawProps", "required": false @@ -69969,6 +70080,7 @@ " editMode?: 'dropdown' | 'modal';", " searchSize?: ControlSize;", " selectionMode?: 'single' | 'multi';", + " maxWidth?: number;", "}" ] }, @@ -70035,6 +70147,17 @@ }, { "uid": 5, + "name": "maxWidth", + "typeValue": { + "raw": "number" + }, + "editor": { + "type": "number" + }, + "required": false + }, + { + "uid": 6, "name": "onKeyDown", "typeValue": { "raw": "(e: React.KeyboardEvent) => void" @@ -70046,7 +70169,7 @@ "required": false }, { - "uid": 6, + "uid": 7, "name": "renderNotFound", "typeValue": { "raw": "() => React.ReactNode" @@ -70058,7 +70181,7 @@ "required": false }, { - "uid": 7, + "uid": 8, "name": "rows", "typeValue": { "raw": "React.ReactNode[]" @@ -70067,7 +70190,7 @@ "required": true }, { - "uid": 8, + "uid": 9, "name": "scheduleUpdate", "typeValue": { "raw": "() => void" @@ -70079,7 +70202,7 @@ "required": false }, { - "uid": 9, + "uid": 10, "name": "search", "typeValue": { "raw": "IEditable" @@ -70088,7 +70211,7 @@ "required": true }, { - "uid": 10, + "uid": 11, "name": "showSearch", "typeValue": { "raw": "boolean | 'auto'" @@ -70105,7 +70228,7 @@ "required": false }, { - "uid": 11, + "uid": 12, "name": "fixedBodyPosition", "typeValue": { "raw": "boolean" @@ -70117,7 +70240,7 @@ "required": false }, { - "uid": 12, + "uid": 13, "name": "searchDebounceDelay", "typeValue": { "raw": "number" @@ -70129,7 +70252,7 @@ "required": false }, { - "uid": 13, + "uid": 14, "name": "selectAll", "comment": { "raw": [ @@ -70144,7 +70267,7 @@ "required": false }, { - "uid": 14, + "uid": 15, "name": "isReloading", "comment": { "raw": [ @@ -70161,7 +70284,7 @@ "required": false }, { - "uid": 15, + "uid": 16, "name": "rowsCount", "comment": { "raw": [ @@ -70179,7 +70302,7 @@ "required": false }, { - "uid": 16, + "uid": 17, "name": "exactRowsCount", "comment": { "raw": [ @@ -70196,7 +70319,7 @@ "required": false }, { - "uid": 17, + "uid": 18, "name": "knownRowsCount", "comment": { "raw": [ @@ -70215,7 +70338,7 @@ "required": false }, { - "uid": 18, + "uid": 19, "name": "totalCount", "comment": { "raw": [ @@ -70232,7 +70355,7 @@ "required": false }, { - "uid": 19, + "uid": 20, "name": "value", "comment": { "raw": [ @@ -70246,7 +70369,7 @@ "required": true }, { - "uid": 20, + "uid": 21, "name": "onValueChange", "comment": { "raw": [ @@ -70263,7 +70386,7 @@ "required": true }, { - "uid": 21, + "uid": 22, "name": "isInvalid", "comment": { "raw": [ @@ -70280,7 +70403,7 @@ "required": false }, { - "uid": 22, + "uid": 23, "name": "validationMessage", "comment": { "raw": [ @@ -70295,7 +70418,7 @@ "required": false }, { - "uid": 23, + "uid": 24, "name": "validationProps", "comment": { "raw": [ @@ -70309,7 +70432,7 @@ "required": false }, { - "uid": 24, + "uid": 25, "name": "isDisabled", "comment": { "raw": [ @@ -70326,7 +70449,7 @@ "required": false }, { - "uid": 25, + "uid": 26, "name": "isReadonly", "comment": { "raw": [ @@ -70343,7 +70466,7 @@ "required": false }, { - "uid": 26, + "uid": 27, "name": "isRequired", "comment": { "raw": [ @@ -70360,7 +70483,7 @@ "required": false }, { - "uid": 27, + "uid": 28, "name": "rawProps", "comment": { "raw": [ @@ -73013,14 +73136,11 @@ "name": "maxWidth", "comment": { "raw": [ - "Defines maximum width in 'px'." + "Defines maximum width in 'px'. If 'auto' provided, will be used width of the content." ] }, "typeValue": { - "raw": "number" - }, - "editor": { - "type": "number" + "raw": "number | 'auto'" }, "from": "@epam/uui-components:DropdownContainerProps", "required": false @@ -96633,14 +96753,11 @@ "name": "maxWidth", "comment": { "raw": [ - "Defines maximum width in 'px'." + "Defines maximum width in 'px'. If 'auto' provided, will be used width of the content." ] }, "typeValue": { - "raw": "number" - }, - "editor": { - "type": "number" + "raw": "number | 'auto'" }, "from": "@epam/uui-components:DropdownContainerProps", "required": false @@ -105451,7 +105568,10 @@ "comment": { "raw": [ "@default \"sky\"" - ] + ], + "tags": { + "@default": "sky" + } }, "typeValue": { "raw": "'sky' | 'grass' | 'sun' | 'fire' | 'white' | 'night600' | 'night500' | 'gray'" @@ -105998,7 +106118,10 @@ "comment": { "raw": [ "@default \"sky\"" - ] + ], + "tags": { + "@default": "sky" + } }, "typeValue": { "raw": "'sky' | 'grass' | 'sun' | 'fire' | 'white' | 'night600' | 'night500' | 'gray'" @@ -106437,14 +106560,11 @@ "name": "maxWidth", "comment": { "raw": [ - "Defines maximum width in 'px'." + "Defines maximum width in 'px'. If 'auto' provided, will be used width of the content." ] }, "typeValue": { - "raw": "number" - }, - "editor": { - "type": "number" + "raw": "number | 'auto'" }, "from": "@epam/uui-components:DropdownContainerProps", "required": false diff --git a/public/docs/docsGenOutput/docsGenStats.json b/public/docs/docsGenOutput/docsGenStats.json index b592fbe038..9febf58b3a 100644 --- a/public/docs/docsGenOutput/docsGenStats.json +++ b/public/docs/docsGenOutput/docsGenStats.json @@ -1,8 +1,8 @@ { "missingPropComment": { "totals": { - "amountProps": 615, - "amountTypes": 210 + "amountProps": 623, + "amountTypes": 211 }, "value": [ { @@ -174,8 +174,10 @@ "typeRef": "@epam/uui-core:IDataSourceView", "value": [ "_forceUpdate", + "clearAllChecked", "destroy", "getById", + "getConfig", "getListProps", "getSelectedRows", "getSelectedRowsCount", @@ -185,6 +187,16 @@ "selectAll" ] }, + { + "typeRef": "@epam/uui-core:IDataSourceViewConfig", + "value": [ + "backgroundReload", + "cascadeSelection", + "complexIds", + "flattenSearchResults", + "selectAll" + ] + }, { "typeRef": "@epam/uui-core:IDndContext", "value": [ @@ -910,6 +922,7 @@ "value": [ "editMode", "maxHeight", + "maxWidth", "searchSize", "selectionMode" ] @@ -1674,7 +1687,7 @@ }, "missingTypeComment": { "totals": { - "amountTypes": 484 + "amountTypes": 485 }, "value": [ "@epam/uui-core:AcceptDropParams", @@ -1746,6 +1759,7 @@ "@epam/uui-core:IContextProviderSsrProps", "@epam/uui-core:IDataSource", "@epam/uui-core:IDataSourceView", + "@epam/uui-core:IDataSourceViewConfig", "@epam/uui-core:IDndContext", "@epam/uui-core:IErrorContext", "@epam/uui-core:IFilterConfig", @@ -3053,9 +3067,9 @@ }, "includedExports": { "totals": { - "allExports": 566, + "allExports": 567, "byModule": { - "@epam/uui-core": 201, + "@epam/uui-core": 202, "@epam/uui-components": 88, "@epam/uui": 138, "@epam/promo": 55, @@ -3240,6 +3254,7 @@ "IColumnConfig", "Icon", "IDataSourceView", + "IDataSourceViewConfig", "IFilterConfig", "IFilterItemBodyProps", "IFilterPredicate", diff --git a/uui-build/docsGen/compareStatsUtils/statsComparatorUtils.ts b/uui-build/docsGen/compareStatsUtils/statsComparatorUtils.ts new file mode 100644 index 0000000000..cb72f7040d --- /dev/null +++ b/uui-build/docsGen/compareStatsUtils/statsComparatorUtils.ts @@ -0,0 +1,84 @@ +import { TDocGenStatsResult } from '../types/types'; +import { formatResultsToMd } from './statsMdFormatterUtils'; +import { getPrevStatsFromCliArg, getStatsFromFile, removeComparisonReportMd, saveComparisonReportMd } from './statsLoaderUtils'; +import { TCompareStatsResult } from './types'; + +export function compareToPrevStats(nextStats: TDocGenStatsResult) { + removeComparisonReportMd(); + const relPath = getPrevStatsFromCliArg(); + if (relPath) { + const prevStats = getStatsFromFile(relPath); + const comparisonResult = compareStats({ prevStats, nextStats }); + const mdReport = formatResultsToMd(comparisonResult); + saveComparisonReportMd(mdReport); + } +} + +function compareStats(params: { prevStats: TDocGenStatsResult | undefined, nextStats: TDocGenStatsResult }): TCompareStatsResult { + const { prevStats, nextStats } = params; + + const propsNoComment = { + prev: prevStats ? prevStats.missingPropComment.totals.amountProps : undefined, + next: nextStats.missingPropComment.totals.amountProps, + }; + const typesNoComment = { + prev: prevStats ? prevStats.missingTypeComment.totals.amountTypes : undefined, + next: nextStats.missingTypeComment.totals.amountTypes, + }; + return { + propsNoComment: { + ...propsNoComment, + isIncreased: isIncreased(propsNoComment.prev, propsNoComment.next), + newWithNoComment: getNewPropsWithNoComments(params), + }, + typesNoComment: { + ...typesNoComment, + isIncreased: isIncreased(typesNoComment.prev, typesNoComment.next), + newWithNoComment: getNewTypesWithNoComments(params), + }, + }; + + function isIncreased(prevAmount: number | undefined, nextAmount: number) { + if (prevAmount === undefined) { + return false; + } + return nextAmount > prevAmount; + } +} + +function getNewTypesWithNoComments(params: { prevStats: TDocGenStatsResult | undefined, nextStats: TDocGenStatsResult }): string[] { + const res: string[] = []; + const { prevStats, nextStats } = params; + const prevSet = new Set(prevStats?.missingTypeComment.value || []); + nextStats.missingTypeComment.value.forEach((typeRef) => { + if (!prevSet.has(typeRef)) { + res.push(typeRef); + } + }); + return res; +} + +function getNewPropsWithNoComments(params: { prevStats: TDocGenStatsResult | undefined, nextStats: TDocGenStatsResult }): string[] { + const res: string[] = []; + const { prevStats, nextStats } = params; + const prevSet = new Set(normMissingPropComments(prevStats)); + const nextArr = normMissingPropComments(nextStats); + nextArr.forEach((typeRef) => { + if (!prevSet.has(typeRef)) { + res.push(typeRef); + } + }); + return res; + + function normMissingPropComments(stats: TDocGenStatsResult | undefined) { + if (!stats) { + return []; + } + return stats.missingPropComment.value.reduce((acc, { typeRef, value }) => { + value.forEach((propName) => { + acc.push(`${typeRef}/${propName}`); + }); + return acc; + }, []); + } +} diff --git a/uui-build/docsGen/compareStatsUtils/statsLoaderUtils.ts b/uui-build/docsGen/compareStatsUtils/statsLoaderUtils.ts new file mode 100644 index 0000000000..4d9fc42f8e --- /dev/null +++ b/uui-build/docsGen/compareStatsUtils/statsLoaderUtils.ts @@ -0,0 +1,38 @@ +import path from 'path'; +import fs from 'fs'; + +import { TDocGenStatsResult } from '../types/types'; +import { uuiRoot } from '../constants'; +import { saveContentToFile } from '../utils/fileUtils'; + +const OUTPUT_FILE_COMPARISON_REPORT_MD = path.resolve(uuiRoot, './.reports/generateComponentsApiStats.md'); + +export function getPrevStatsFromCliArg(): string | undefined { + const arg = process.argv[2]; + if (arg) { + const [name, relPath] = arg.split('='); + if (name === '--prev-stats') { + return relPath; + } + throw new Error(`Unknown argument: ${arg}`); + } +} + +export function getStatsFromFile(relPath: string): TDocGenStatsResult | undefined { + const fullPath = path.resolve(uuiRoot, relPath); + if (fs.existsSync(fullPath)) { + return JSON.parse(fs.readFileSync(fullPath).toString()); + } else { + console.warn(`Stats not found. This file doesn't exist: ${fullPath}`); + return; + } +} + +export function saveComparisonReportMd(reportMd: string) { + saveContentToFile(OUTPUT_FILE_COMPARISON_REPORT_MD, reportMd); +} +export function removeComparisonReportMd() { + if (fs.existsSync(OUTPUT_FILE_COMPARISON_REPORT_MD)) { + fs.rmSync(OUTPUT_FILE_COMPARISON_REPORT_MD, { force: true }); + } +} diff --git a/uui-build/docsGen/compareStatsUtils/statsMdFormatterUtils.ts b/uui-build/docsGen/compareStatsUtils/statsMdFormatterUtils.ts new file mode 100644 index 0000000000..6670d5970b --- /dev/null +++ b/uui-build/docsGen/compareStatsUtils/statsMdFormatterUtils.ts @@ -0,0 +1,62 @@ +import { TCompareStatsResult } from './types'; + +export function formatResultsToMd(result: TCompareStatsResult) { + const isErr = result.typesNoComment.isIncreased || result.propsNoComment.isIncreased; + const typesAmount = formatAmountWithDiff(result.typesNoComment.prev, result.typesNoComment.next); + const propsAmount = formatAmountWithDiff(result.propsNoComment.prev, result.propsNoComment.next); + const mdGeneratedBy = 'Generated by: generate-components-api'; + const ciStatus = `CI Status: ${isErr ? 'error' : 'ok'} \n`; + const SUMMARY_TITLE = 'New missing comments'; + const SUMMARY_DESC = 'NOTE: Comments in the entities below are missed in the report generated from merge commit, but they aren\'t missed in the target branch report.'; + let detailsMd = ''; + if (isErr) { + detailsMd = [ + '
', + `${SUMMARY_TITLE}`, + '
', + SUMMARY_DESC, + '', + '```', + newWithNoCommentsToMdList('Types', result.typesNoComment.newWithNoComment), + newWithNoCommentsToMdList('Props', result.propsNoComment.newWithNoComment), + '```', + '
', + ].join('\n'); + } + return [ + mdGeneratedBy, + '
', + ciStatus, + '**Types/Props without comments**
', + '', + '| Entity | Amount |', + '|:-------:|:-------------------------:|', + `| Types | ${typesAmount} |`, + `| Props | ${propsAmount} |`, + detailsMd, + ].join('\n'); + + function newWithNoCommentsToMdList(label: string, items: string[]) { + if (items.length > 0) { + const mdList = items.map((line) => `- ${line}`).join('\n'); + return `${label}:\n${mdList}`; + } + return ''; + } + function formatAmountWithDiff(prev: number | undefined, next: number) { + let mdTypesAmountChange = '(no baseline :warning:)'; + if (prev !== undefined) { + const typesAmountDiff = next - prev; + let typesAmountSign = ''; + let emodji = ':ok:'; + if (typesAmountDiff < 0) { + typesAmountSign = '-'; + } else if (typesAmountDiff > 0) { + typesAmountSign = '+'; + emodji = ':no_entry:'; + } + mdTypesAmountChange = `(${typesAmountSign}${typesAmountDiff}) ${emodji}`; + } + return `${next} ${mdTypesAmountChange}`; + } +} diff --git a/uui-build/docsGen/compareStatsUtils/types.ts b/uui-build/docsGen/compareStatsUtils/types.ts new file mode 100644 index 0000000000..f04fdab185 --- /dev/null +++ b/uui-build/docsGen/compareStatsUtils/types.ts @@ -0,0 +1,10 @@ +type TCompareStatsEntry = { + prev: number | undefined, + next: number, + isIncreased: boolean, + newWithNoComment: string[], +}; +export type TCompareStatsResult = { + propsNoComment: TCompareStatsEntry + typesNoComment: TCompareStatsEntry +}; diff --git a/uui-build/docsGen/main.ts b/uui-build/docsGen/main.ts index e8027037e2..7a1181da74 100644 --- a/uui-build/docsGen/main.ts +++ b/uui-build/docsGen/main.ts @@ -8,6 +8,7 @@ import { } from './constants'; import { generateDTS } from './dts'; import { ConverterContext } from './converterContext/converterContext'; +import { compareToPrevStats } from './compareStatsUtils/statsComparatorUtils'; main(); @@ -18,5 +19,9 @@ function main() { const dts = generateDTS(formatted); saveContentToFile(OUTPUT_FILE_FULL_PATH, formatted); saveContentToFile(OUTPUT_DTS_FILE_FULL_PATH, dts); - saveContentToFile(OUTPUT_STATS_FILE_FULL_PATH, context.stats.getResults()); + const nextStats = context.stats.getResults(); + saveContentToFile(OUTPUT_STATS_FILE_FULL_PATH, nextStats); + + // Prev stats is optional and can be passed via CLI: generate-components-api --prev-stats=../docsGenStats.json + compareToPrevStats(nextStats); } diff --git a/uui-build/docsGen/tsdoc/__tests__/tsDocUtils.test.ts b/uui-build/docsGen/tsdoc/__tests__/tsDocUtils.test.ts index 3047f127e4..d63f7c64e0 100644 --- a/uui-build/docsGen/tsdoc/__tests__/tsDocUtils.test.ts +++ b/uui-build/docsGen/tsdoc/__tests__/tsDocUtils.test.ts @@ -15,6 +15,16 @@ describe('TsDocUtils', () => { TsDocUtils.isCommentEmpty(TsDocUtils.parseComment(ONLY_TAGS_2)), ).toBeTruthy(); }); + it('Should resolve @default tag with string value in double/single quotes', () => { + const ONLY_TAGS_1 = '/** @default "hi" */'; + const ONLY_TAGS_2 = '/** @default \'hi\' */'; + expect( + TsDocUtils.parseComment(ONLY_TAGS_1).tags['@default'] === 'hi', + ).toBeTruthy(); + expect( + TsDocUtils.parseComment(ONLY_TAGS_2).tags['@default'] === 'hi', + ).toBeTruthy(); + }); it('Should treat comment as non-empty if there is some text not related to tags.', () => { const NON_EMPTY_1 = '/** Hello, World! */'.trim(); const NON_EMPTY_2 = ` diff --git a/uui-build/docsGen/tsdoc/tsDocUtils.ts b/uui-build/docsGen/tsdoc/tsDocUtils.ts index d012df3d98..895fe675bf 100644 --- a/uui-build/docsGen/tsdoc/tsDocUtils.ts +++ b/uui-build/docsGen/tsdoc/tsDocUtils.ts @@ -80,6 +80,7 @@ const CUSTOM_TAGS = { const valueParts = db.getChildNodes()[1]; // DocSection const firstValuePart = valueParts.getChildNodes()[0]; // DocParagraph const txt = firstValuePart.getChildNodes()[0]; // DocPlainText + const isInQuotes = (t: string) => ["'", '"'].indexOf(t[0]) !== -1 && ["'", '"'].indexOf(t[t.length - 1]) !== -1; if (txt instanceof DocPlainText) { const txtValue = txt?.text?.trim(); if (typeof txtValue !== 'undefined') { @@ -98,7 +99,7 @@ const CUSTOM_TAGS = { default: { if (!isNaN(+txtValue)) { value = +txtValue; - } else if (txtValue[0] === '\'' && txtValue[txtValue.length - 1] === '\'') { + } else if (isInQuotes(txtValue)) { value = txtValue.substring(1, txtValue.length - 1); } else { return; diff --git a/uui-build/utils/trackBundleSize/trackBundleSizeMdFormatter.js b/uui-build/utils/trackBundleSize/trackBundleSizeMdFormatter.js index 1b1f906429..e04f673e77 100644 --- a/uui-build/utils/trackBundleSize/trackBundleSizeMdFormatter.js +++ b/uui-build/utils/trackBundleSize/trackBundleSizeMdFormatter.js @@ -38,8 +38,14 @@ function comparisonResultToMd({ comparisonResult, currentBaseLine, newBaseLine } * So, if you want to change it, then please make sure that "trackBundleSize.yml" is updated as well. */ const generatedBy = `Generated by: track-bundle-size. Exceeds Limits: ${isExceedsLimits ? 'yes' : 'no'}`; + const ciStatus = `CI Status: ${isExceedsLimits ? 'error' : 'ok'} \n`; const descriptionMd = [ - 'Bundle size diff (in kBytes). Not gzipped. Both CSS & JS included.', `Baseline: v${currentBaseLine.version} (${currentBaseLine.timestamp})`, generatedBy, `Generated at: ${new Date().toUTCString()}`, '\n', + 'Bundle size diff (in kBytes). Not gzipped. Both CSS & JS included.', + `Baseline: v${currentBaseLine.version} (${currentBaseLine.timestamp})`, + generatedBy, + `Generated at: ${new Date().toUTCString()}`, + ciStatus, + '\n', ].join('
'); const newBaseLineMd = formatNewBaseLine(newBaseLine);