mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(bazel): update api-extractor bazel tool to only accept a single input (#43431)
Updates the API extractor tool used by the `ng_module` rule to only accept a single entry-point file. This change is made in preparation for APF v13 where this logic is no longer needed. The logic previously only existed to also bundle the `r3_symbols` file. This file is no longer needed in APF v13 because Angular core no longer needs to be processed with `ngcc`. This allows us to clean up this logic which helps simplifying `ng_module`. Consumers that use an older version of `@angular/core` should respectively also use a compiler-cli version matching the core version. PR Close #43431
This commit is contained in:
committed by
Dylan Hunn
parent
f87b7c1e65
commit
827a83e00f
@@ -17,7 +17,7 @@ import * as path from 'path';
|
||||
const DEBUG = false;
|
||||
|
||||
export function runMain(
|
||||
tsConfig: string, entryPoint: string, dtsBundleOut?: string, apiReviewFolder?: string,
|
||||
tsConfig: string, entryPointExecPath: string, dtsBundleOut: string, apiReviewFolder?: string,
|
||||
acceptApiUpdates = false): 1|0 {
|
||||
const [parsedConfig, errors] = parseTsconfig(tsConfig);
|
||||
if (errors && errors.length) {
|
||||
@@ -26,7 +26,7 @@ export function runMain(
|
||||
return 1;
|
||||
}
|
||||
|
||||
const pkgJson = path.resolve(path.dirname(entryPoint), 'package.json');
|
||||
const pkgJson = path.resolve(path.dirname(entryPointExecPath), 'package.json');
|
||||
if (!fs.existsSync(pkgJson)) {
|
||||
fs.writeFileSync(pkgJson, JSON.stringify({
|
||||
'name': 'GENERATED-BY-BAZEL',
|
||||
@@ -64,7 +64,7 @@ export function runMain(
|
||||
overrideTsconfig: parsedTsConfig,
|
||||
},
|
||||
projectFolder: path.resolve(path.dirname(tsConfig)),
|
||||
mainEntryPointFilePath: path.resolve(entryPoint),
|
||||
mainEntryPointFilePath: path.resolve(entryPointExecPath),
|
||||
apiReport: {
|
||||
enabled: !!apiReviewFolder,
|
||||
// TODO(alan-agius4): remove this folder name when the below issue is solved upstream
|
||||
@@ -75,8 +75,8 @@ export function runMain(
|
||||
enabled: false,
|
||||
},
|
||||
dtsRollup: {
|
||||
enabled: !!dtsBundleOut,
|
||||
untrimmedFilePath: dtsBundleOut && path.resolve(dtsBundleOut),
|
||||
enabled: true,
|
||||
untrimmedFilePath: path.resolve(dtsBundleOut),
|
||||
},
|
||||
tsdocMetadata: {
|
||||
enabled: false,
|
||||
@@ -108,20 +108,6 @@ api-extractor: running with
|
||||
`);
|
||||
}
|
||||
|
||||
const [tsConfig, entryPoint, dtsBundleOut] = process.argv.slice(2);
|
||||
const entryPoints = entryPoint.split(',');
|
||||
const dtsBundleOuts = dtsBundleOut.split(',');
|
||||
|
||||
if (entryPoints.length !== entryPoints.length) {
|
||||
throw new Error(`Entry points count (${entryPoints.length}) does not match Bundle out count (${
|
||||
dtsBundleOuts.length})`);
|
||||
}
|
||||
|
||||
for (let i = 0; i < entryPoints.length; i++) {
|
||||
process.exitCode = runMain(tsConfig, entryPoints[i], dtsBundleOuts[i]);
|
||||
|
||||
if (process.exitCode !== 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
const [tsConfig, entryPointExecPath, outputExecPath] = process.argv.slice(2);
|
||||
process.exitCode = runMain(tsConfig, entryPointExecPath, outputExecPath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user