From 3cfdc17488f4e4752a0e1ae643703c721e1c5ce0 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Mon, 6 Mar 2023 14:48:26 +0100 Subject: [PATCH] chore(scripts-tasks): remove not needed api-extractor task logs --- scripts/tasks/src/api-extractor.ts | 68 +----------------------------- 1 file changed, 1 insertion(+), 67 deletions(-) diff --git a/scripts/tasks/src/api-extractor.ts b/scripts/tasks/src/api-extractor.ts index 30c450e281369c..336ad6667301c4 100644 --- a/scripts/tasks/src/api-extractor.ts +++ b/scripts/tasks/src/api-extractor.ts @@ -51,11 +51,10 @@ interface ApiExtractorCliRunCommandArgs { export function apiExtractor(): TaskFunction { const { configs, configsToExecute } = getConfig(); - const messages = { + const messages: Record = { TS7016: [] as string[], TS2305: [] as string[], }; - let configDebug: Parameters>[0] | null = null; const args: ReturnType & Partial = getJustArgv(); const { isUsingTsSolutionConfigs, packageJson, tsConfig } = getTsPathAliasesConfig(); @@ -70,8 +69,6 @@ export function apiExtractor(): TaskFunction { */ const isLocalBuild = args.local ?? !(process.env.TF_BUILD || isCI); - console.log({ isLocalBuild }); - const tasks = configsToExecute.map(([configPath, configName]) => { const taskName = `api-extractor:${configName}`; @@ -120,8 +117,6 @@ export function apiExtractor(): TaskFunction { // NOTE: internally just-tasks calls `options.onConfigLoaded?.(rawConfig);` so we need to mutate object properties (js passes objects by reference) config.compiler = compilerConfig; - - configDebug = config; } function messageCallback(message: Parameters>[0]) { @@ -150,25 +145,6 @@ export function apiExtractor(): TaskFunction { return; } - // Log on CI processed configs for better troubleshooting for https://github.com/microsoft/fluentui/issues/25766 - // if (process.env.TF_BUILD) { - logger.info('❌ api-extractor FAIL debug:', { - configsToExecute, - extractorOptions: JSON.stringify(configDebug, null, 2), - }); - // } - - if (messages.TS2305.length) { - const errTitle = [ - chalk.bgRed.white.bold(`api-extractor | API VIOLATION:`), - chalk.red(` Your package public API uses \`@internal\` marked API's from following packages:`), - '\n', - ].join(''); - const logErr = formatApiViolationMessage(messages.TS2305); - - logger.error(errTitle, logErr, '\n'); - } - if (messages.TS7016.length) { const errTitle = [ chalk.bgRed.white.bold(`api-extractor | MISSING DEPENDENCY TYPE DECLARATIONS:`), @@ -208,48 +184,6 @@ function getConfig() { return { configsToExecute, configs }; } -/** - * - * @example - * - * ``` - (TS2305) Module '"@fluentui/react-shared-contexts"' has no exported member 'ThemeContextValue_unstable'. - (TS2305) Module '"@fluentui/react-shared-contexts"' has no exported member 'TooltipVisibilityContextValue_unstable'. - - ↓ ↓ ↓ - - @fluentui/react-shared-contexts: - - TooltipVisibilityContextValue_unstable - - ThemeContextValue_unstable - ``` - */ -function formatApiViolationMessage(messages: string[]) { - const regexPkg = /'"(@fluentui\/[a-z-]+)"'/i; - const exportedTokenRegex = /'([a-z-_]+)'/i; - - const byPackage = messages.reduce((acc, curr) => { - const [, packageName] = regexPkg.exec(curr) ?? []; - const [, exportedToken] = exportedTokenRegex.exec(curr) ?? []; - if (acc[packageName]) { - acc[packageName].add(exportedToken); - return acc; - } - acc[packageName] = new Set([exportedToken]); - return acc; - }, {} as Record>); - - return Object.entries(byPackage) - .map(([packageName, tokens]) => { - return [ - chalk.red.underline(packageName) + ':', - Array.from(tokens) - .map(token => chalk.italic.red(' - ' + token)) - .join('\n'), - ].join('\n'); - }) - .join('\n'); -} - /** * * @example