feat(bazel): update to the latest `@microsoft/api-extractor` (#32185)

PR Close #32185
This commit is contained in:
Alan Agius 2019-08-19 11:55:34 +02:00 committed by Matias Niemelä
parent 8c388e3730
commit 350ea47def
4 changed files with 62 additions and 59 deletions

View File

@ -43,7 +43,7 @@
"@bazel/karma": "0.34.0", "@bazel/karma": "0.34.0",
"@bazel/protractor": "0.34.0", "@bazel/protractor": "0.34.0",
"@bazel/typescript": "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", "@schematics/angular": "^8.0.0-beta.15",
"@types/angular": "^1.6.47", "@types/angular": "^1.6.47",
"@types/base64-js": "1.2.5", "@types/base64-js": "1.2.5",

View File

@ -29,7 +29,7 @@
"@angular-devkit/architect": "^0.800.0-beta.15", "@angular-devkit/architect": "^0.800.0-beta.15",
"@angular-devkit/core": "^8.0.0-beta.15", "@angular-devkit/core": "^8.0.0-beta.15",
"@angular-devkit/schematics": "^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", "@schematics/angular": "^8.0.0-beta.15",
"@types/node": "6.0.84", "@types/node": "6.0.84",
"semver": "^5.6.0", "semver": "^5.6.0",

View File

@ -10,7 +10,7 @@
/// <reference lib="es2017"/> /// <reference lib="es2017"/>
import {format, parseTsconfig} from '@bazel/typescript'; 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 fs from 'fs';
import * as path from 'path'; import * as path from 'path';
@ -55,51 +55,46 @@ export function runMain(
}); });
} }
const extractorOptions: IExtractorOptions = { const extractorOptions: IExtractorInvokeOptions = {
localBuild: acceptApiUpdates, localBuild: acceptApiUpdates,
customLogger: DEBUG ? undefined : {
// don't log verbose messages when not in debug mode
logVerbose: _message => {}
}
}; };
const extractorConfig: IExtractorConfig = { const configObject: IConfigFile = {
compiler: { compiler: {
configType: 'tsconfig',
overrideTsconfig: parsedTsConfig, overrideTsconfig: parsedTsConfig,
rootFolder: path.resolve(path.dirname(tsConfig))
}, },
project: { projectFolder: path.resolve(path.dirname(tsConfig)),
entryPointSourceFile: path.resolve(entryPoint), mainEntryPointFilePath: path.resolve(entryPoint),
}, apiReport: {
apiReviewFile: {
enabled: !!apiReviewFolder, 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, enabled: false,
}, },
policies: {
namespaceSupport: 'permissive',
},
validationRules: {
missingReleaseTags: ExtractorValidationRulePolicy.allow,
},
dtsRollup: { dtsRollup: {
enabled: !!dtsBundleOut, enabled: !!dtsBundleOut,
publishFolder: dtsBundleOut && path.resolve(path.dirname(dtsBundleOut)), untrimmedFilePath: dtsBundleOut && path.resolve(dtsBundleOut),
mainDtsRollupPath: dtsBundleOut && path.basename(dtsBundleOut),
}, },
tsdocMetadata: { tsdocMetadata: {
enabled: false, enabled: false,
} }
}; };
const extractor = new Extractor(extractorConfig, extractorOptions); const options: IExtractorConfigPrepareOptions = {
const isSuccessful = extractor.processProject(); 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. // API extractor errors are emitted by it's logger.
return isSuccessful ? 0 : 1; return succeeded ? 0 : 1;
} }
// Entry point // Entry point

View File

@ -301,26 +301,34 @@
through2 "^2.0.0" through2 "^2.0.0"
xdg-basedir "^3.0.0" xdg-basedir "^3.0.0"
"@microsoft/api-extractor@7.0.21": "@microsoft/api-extractor-model@7.3.2":
version "7.0.21" version "7.3.2"
resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.0.21.tgz#d5ff9bba4ff7283503aac83ad489b16cad293fc7" resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.3.2.tgz#71229ba80f8aafc56afe4d3ee83f19b1ce72eb24"
integrity sha512-7lFcHNykVz0tvgOz9juXqP+a1j0EmnJ9J080CBE/171IxL4fBrpslPhqN86dNuavuPragRpBLc8Okv/bV7FJPQ== integrity sha512-2yNbQsQl5PI36l5WzHQshwjBHPe5IeIcmidWad0E+wjyaAxGMLx5pBp5AgXY2JG9S9VQjFmmGmqJJBXn8tzu+w==
dependencies: dependencies:
"@microsoft/node-core-library" "3.12.0" "@microsoft/node-core-library" "3.14.0"
"@microsoft/ts-command-line" "4.2.3" "@microsoft/tsdoc" "0.12.12"
"@microsoft/tsdoc" "0.12.5"
"@types/node" "8.5.8" "@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": "@microsoft/api-extractor@^7.3.9":
version "3.12.0" version "7.3.9"
resolved "https://registry.yarnpkg.com/@microsoft/node-core-library/-/node-core-library-3.12.0.tgz#f9c27b8bb6b55d60b91d4e1962f42b03b9f8f47f" resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.3.9.tgz#c035748e9e8745eb9df43351f76ace1f529d17dc"
integrity sha512-9T2dEXmmxZqnqcpHuIB8mTAOM/DNSi/QcAwKYDjvZvkd+PGT5lCUXjM9GL7SaR2NPa3UrWDGgFhNoqLqLfEPbw== 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: dependencies:
"@types/fs-extra" "5.0.4" "@types/fs-extra" "5.0.4"
"@types/jju" "~1.4.0" "@types/jju" "~1.4.0"
@ -331,20 +339,20 @@
jju "~1.4.0" jju "~1.4.0"
z-schema "~3.18.3" z-schema "~3.18.3"
"@microsoft/ts-command-line@4.2.3": "@microsoft/ts-command-line@4.2.7":
version "4.2.3" version "4.2.7"
resolved "https://registry.yarnpkg.com/@microsoft/ts-command-line/-/ts-command-line-4.2.3.tgz#20d6a1684148b9fc0df25ee7335c3bb227d47d4f" resolved "https://registry.yarnpkg.com/@microsoft/ts-command-line/-/ts-command-line-4.2.7.tgz#01e963c683ae782e57225c5c424aa65702a9732c"
integrity sha512-SIs4q7RcG7efBbh5Ffrf6V4jVLxWihD4NDRY3+gPiOG8CYawBzE22tTEloZ1yj/FBvBZQkQ0GYwXoPhn6ElYXA== integrity sha512-PwUMIIDl8oWyl64Y5DW5FAuoRk4KWTBZdk4FEh366KEm5xYFBQhCeatHGURIj8nEYm0Xb2coCrXF77dGDlp/Qw==
dependencies: dependencies:
"@types/argparse" "1.0.33" "@types/argparse" "1.0.33"
"@types/node" "8.5.8" "@types/node" "8.5.8"
argparse "~1.0.9" argparse "~1.0.9"
colors "~1.2.1" colors "~1.2.1"
"@microsoft/tsdoc@0.12.5": "@microsoft/tsdoc@0.12.12":
version "0.12.5" version "0.12.12"
resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.5.tgz#c448a38902ccb5601c1b2ef3b1a105012ef7712c" resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.12.tgz#6692f1cbca664f68abbc62f9a26459fba8b9ff28"
integrity sha512-xEAyvLXo4Cter/b0EMCWUZTgXOfLOPJ/Xr52WdjVclPx9eDmNTGFtZl8Pn/nqSnZsQBNcHL0eHk/YyRyyXXpiQ== integrity sha512-5EzH1gHIonvvgA/xWRmVAJmRkTQj/yayUXyr66hFwNZiFE4j7lP8is9YQeXhwxGZEjO1PVMblAmFF0CyjNtPGw==
"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": "@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2":
version "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" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
integrity sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg== 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" version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== 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" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.12.0.tgz#2bd6dc46a040f59e686c972ed21d93dc59053258"
integrity sha1-K9bcRqBA9Z5obJcu0h2T3FkFMlg= 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: log-driver@1.2.7:
version "1.2.7" version "1.2.7"
resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" 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" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.3.tgz#0eb320e4ace9b10eadf5bc6103286b0f8b7c224f"
integrity sha512-FFgHdPt4T/duxx6Ndf7hwgMZZjZpB+U0nMNGVCYPq0rEzWKjEDobm4J6yb3CS7naZ0yURFqdw9Gwc7UOh/P9oQ== 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: typescript@~3.5.3:
version "3.5.3" version "3.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977"