From 350ea47def0b62eeda25f319b7919e56b4f6c098 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Mon, 19 Aug 2019 11:55:34 +0200 Subject: [PATCH] feat(bazel): update to the latest `@microsoft/api-extractor` (#32185) PR Close #32185 --- package.json | 2 +- packages/bazel/package.json | 2 +- packages/bazel/src/api-extractor/index.ts | 47 +++++++-------- yarn.lock | 70 +++++++++++++---------- 4 files changed, 62 insertions(+), 59 deletions(-) diff --git a/package.json b/package.json index db62e8261a..d79205cb8f 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@bazel/karma": "0.34.0", "@bazel/protractor": "0.34.0", "@bazel/typescript": "0.34.0", - "@microsoft/api-extractor": "7.0.21", + "@microsoft/api-extractor": "^7.3.9", "@schematics/angular": "^8.0.0-beta.15", "@types/angular": "^1.6.47", "@types/base64-js": "1.2.5", diff --git a/packages/bazel/package.json b/packages/bazel/package.json index 818e3d4b69..52ed44d3ae 100644 --- a/packages/bazel/package.json +++ b/packages/bazel/package.json @@ -29,7 +29,7 @@ "@angular-devkit/architect": "^0.800.0-beta.15", "@angular-devkit/core": "^8.0.0-beta.15", "@angular-devkit/schematics": "^8.0.0-beta.15", - "@microsoft/api-extractor": "7.0.21", + "@microsoft/api-extractor": "^7.3.9", "@schematics/angular": "^8.0.0-beta.15", "@types/node": "6.0.84", "semver": "^5.6.0", diff --git a/packages/bazel/src/api-extractor/index.ts b/packages/bazel/src/api-extractor/index.ts index 2d327e4970..71e46ca72c 100644 --- a/packages/bazel/src/api-extractor/index.ts +++ b/packages/bazel/src/api-extractor/index.ts @@ -10,7 +10,7 @@ /// import {format, parseTsconfig} from '@bazel/typescript'; -import {Extractor, ExtractorValidationRulePolicy, IExtractorConfig, IExtractorOptions} from '@microsoft/api-extractor'; +import {Extractor, ExtractorConfig, IConfigFile, IExtractorConfigPrepareOptions, IExtractorInvokeOptions} from '@microsoft/api-extractor'; import * as fs from 'fs'; import * as path from 'path'; @@ -55,51 +55,46 @@ export function runMain( }); } - const extractorOptions: IExtractorOptions = { + const extractorOptions: IExtractorInvokeOptions = { localBuild: acceptApiUpdates, - customLogger: DEBUG ? undefined : { - // don't log verbose messages when not in debug mode - logVerbose: _message => {} - } }; - const extractorConfig: IExtractorConfig = { + const configObject: IConfigFile = { compiler: { - configType: 'tsconfig', overrideTsconfig: parsedTsConfig, - rootFolder: path.resolve(path.dirname(tsConfig)) }, - project: { - entryPointSourceFile: path.resolve(entryPoint), - }, - apiReviewFile: { + projectFolder: path.resolve(path.dirname(tsConfig)), + mainEntryPointFilePath: path.resolve(entryPoint), + apiReport: { enabled: !!apiReviewFolder, - apiReviewFolder: apiReviewFolder && path.resolve(apiReviewFolder), + // TODO(alan-agius4): remove this folder name when the below issue is solved upstream + // See: https://github.com/microsoft/web-build-tools/issues/1470 + reportFileName: apiReviewFolder && path.resolve(apiReviewFolder) || 'invalid', }, - apiJsonFile: { + docModel: { enabled: false, }, - policies: { - namespaceSupport: 'permissive', - }, - validationRules: { - missingReleaseTags: ExtractorValidationRulePolicy.allow, - }, dtsRollup: { enabled: !!dtsBundleOut, - publishFolder: dtsBundleOut && path.resolve(path.dirname(dtsBundleOut)), - mainDtsRollupPath: dtsBundleOut && path.basename(dtsBundleOut), + untrimmedFilePath: dtsBundleOut && path.resolve(dtsBundleOut), }, tsdocMetadata: { enabled: false, } }; - const extractor = new Extractor(extractorConfig, extractorOptions); - const isSuccessful = extractor.processProject(); + const options: IExtractorConfigPrepareOptions = { + configObject, + packageJson: undefined, + packageJsonFullPath: pkgJson, + configObjectFullPath: undefined, + }; + + const extractorConfig = ExtractorConfig.prepare(options); + const {succeeded} = Extractor.invoke(extractorConfig, extractorOptions); // API extractor errors are emitted by it's logger. - return isSuccessful ? 0 : 1; + return succeeded ? 0 : 1; } // Entry point diff --git a/yarn.lock b/yarn.lock index 9b5cbb679e..fcaffc8016 100644 --- a/yarn.lock +++ b/yarn.lock @@ -301,26 +301,34 @@ through2 "^2.0.0" xdg-basedir "^3.0.0" -"@microsoft/api-extractor@7.0.21": - version "7.0.21" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.0.21.tgz#d5ff9bba4ff7283503aac83ad489b16cad293fc7" - integrity sha512-7lFcHNykVz0tvgOz9juXqP+a1j0EmnJ9J080CBE/171IxL4fBrpslPhqN86dNuavuPragRpBLc8Okv/bV7FJPQ== +"@microsoft/api-extractor-model@7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.3.2.tgz#71229ba80f8aafc56afe4d3ee83f19b1ce72eb24" + integrity sha512-2yNbQsQl5PI36l5WzHQshwjBHPe5IeIcmidWad0E+wjyaAxGMLx5pBp5AgXY2JG9S9VQjFmmGmqJJBXn8tzu+w== dependencies: - "@microsoft/node-core-library" "3.12.0" - "@microsoft/ts-command-line" "4.2.3" - "@microsoft/tsdoc" "0.12.5" + "@microsoft/node-core-library" "3.14.0" + "@microsoft/tsdoc" "0.12.12" "@types/node" "8.5.8" - "@types/z-schema" "3.16.31" - colors "~1.2.1" - lodash "~4.17.5" - resolve "1.8.1" - typescript "~3.1.6" - z-schema "~3.18.3" -"@microsoft/node-core-library@3.12.0": - version "3.12.0" - resolved "https://registry.yarnpkg.com/@microsoft/node-core-library/-/node-core-library-3.12.0.tgz#f9c27b8bb6b55d60b91d4e1962f42b03b9f8f47f" - integrity sha512-9T2dEXmmxZqnqcpHuIB8mTAOM/DNSi/QcAwKYDjvZvkd+PGT5lCUXjM9GL7SaR2NPa3UrWDGgFhNoqLqLfEPbw== +"@microsoft/api-extractor@^7.3.9": + version "7.3.9" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.3.9.tgz#c035748e9e8745eb9df43351f76ace1f529d17dc" + integrity sha512-8qj+N/3CgJaHFZj/YlXqtyPAK8vQ2e4oFzKrzbQNw5mtlVnyLlayTkNfVIq93Q0xRMwAhPJjlmxmAuu1ZI88oQ== + dependencies: + "@microsoft/api-extractor-model" "7.3.2" + "@microsoft/node-core-library" "3.14.0" + "@microsoft/ts-command-line" "4.2.7" + "@microsoft/tsdoc" "0.12.12" + colors "~1.2.1" + lodash "~4.17.15" + resolve "1.8.1" + source-map "~0.6.1" + typescript "~3.5.3" + +"@microsoft/node-core-library@3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@microsoft/node-core-library/-/node-core-library-3.14.0.tgz#c7014328c67c4a4110e2ed2a9bd11cfd0ad3318d" + integrity sha512-+gbTXTRfvR40hTH+C3Vno/RJ51sU/RZAyHb2bo9af8GCdOgxCxCs+qp2KCXklbpuolmIPFfbCmdTwv90yH5tJw== dependencies: "@types/fs-extra" "5.0.4" "@types/jju" "~1.4.0" @@ -331,20 +339,20 @@ jju "~1.4.0" z-schema "~3.18.3" -"@microsoft/ts-command-line@4.2.3": - version "4.2.3" - resolved "https://registry.yarnpkg.com/@microsoft/ts-command-line/-/ts-command-line-4.2.3.tgz#20d6a1684148b9fc0df25ee7335c3bb227d47d4f" - integrity sha512-SIs4q7RcG7efBbh5Ffrf6V4jVLxWihD4NDRY3+gPiOG8CYawBzE22tTEloZ1yj/FBvBZQkQ0GYwXoPhn6ElYXA== +"@microsoft/ts-command-line@4.2.7": + version "4.2.7" + resolved "https://registry.yarnpkg.com/@microsoft/ts-command-line/-/ts-command-line-4.2.7.tgz#01e963c683ae782e57225c5c424aa65702a9732c" + integrity sha512-PwUMIIDl8oWyl64Y5DW5FAuoRk4KWTBZdk4FEh366KEm5xYFBQhCeatHGURIj8nEYm0Xb2coCrXF77dGDlp/Qw== dependencies: "@types/argparse" "1.0.33" "@types/node" "8.5.8" argparse "~1.0.9" colors "~1.2.1" -"@microsoft/tsdoc@0.12.5": - version "0.12.5" - resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.5.tgz#c448a38902ccb5601c1b2ef3b1a105012ef7712c" - integrity sha512-xEAyvLXo4Cter/b0EMCWUZTgXOfLOPJ/Xr52WdjVclPx9eDmNTGFtZl8Pn/nqSnZsQBNcHL0eHk/YyRyyXXpiQ== +"@microsoft/tsdoc@0.12.12": + version "0.12.12" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.12.tgz#6692f1cbca664f68abbc62f9a26459fba8b9ff28" + integrity sha512-5EzH1gHIonvvgA/xWRmVAJmRkTQj/yayUXyr66hFwNZiFE4j7lP8is9YQeXhwxGZEjO1PVMblAmFF0CyjNtPGw== "@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": version "1.1.2" @@ -6994,7 +7002,7 @@ lodash@^4.0.0, lodash@^4.14.0, lodash@^4.16.6, lodash@^4.2.1, lodash@^4.5.0, lod resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" integrity sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg== -lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0, lodash@~4.17.5: +lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== @@ -7009,6 +7017,11 @@ lodash@~4.12.0: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.12.0.tgz#2bd6dc46a040f59e686c972ed21d93dc59053258" integrity sha1-K9bcRqBA9Z5obJcu0h2T3FkFMlg= +lodash@~4.17.15: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + log-driver@1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" @@ -11117,11 +11130,6 @@ typescript@3.4.3: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.3.tgz#0eb320e4ace9b10eadf5bc6103286b0f8b7c224f" integrity sha512-FFgHdPt4T/duxx6Ndf7hwgMZZjZpB+U0nMNGVCYPq0rEzWKjEDobm4J6yb3CS7naZ0yURFqdw9Gwc7UOh/P9oQ== -typescript@~3.1.6: - version "3.1.6" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.6.tgz#b6543a83cfc8c2befb3f4c8fba6896f5b0c9be68" - integrity sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA== - typescript@~3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977"