@itwin/build-tools 4.0.0-dev.96 → 4.0.0-dev.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/betools.js +14 -2
- package/package.json +1 -1
- package/scripts/extract-api.js +15 -6
package/bin/betools.js
CHANGED
@@ -71,7 +71,7 @@ yargs.strict(true)
|
|
71
71
|
})
|
72
72
|
},
|
73
73
|
(argv) => { extractCommand(argv) })
|
74
|
-
.command("extract-api", "Extracts the API of the Typescript library starting from an entry file with a default presets.
|
74
|
+
.command("extract-api", "Extracts the API of the Typescript library starting from an entry file with a default presets. Powered by @microsoft/api-extractor (https://api-extractor.com)",
|
75
75
|
function (yargs) {
|
76
76
|
return yargs.options({
|
77
77
|
"entry": {
|
@@ -79,6 +79,15 @@ yargs.strict(true)
|
|
79
79
|
},
|
80
80
|
"ignoreMissingTags": {
|
81
81
|
describe: "Turns off the 'ae-missing-release-tag' option which returns an error when a missing release tag is detected"
|
82
|
+
},
|
83
|
+
"apiReportFolder": {
|
84
|
+
describe: "Directory for the API report. Defaults to `<Rush repository root>/common/api`."
|
85
|
+
},
|
86
|
+
"apiReportTempFolder": {
|
87
|
+
describe: "Directory for the API report. Defaults to `<Rush repository root>/temp/api`."
|
88
|
+
},
|
89
|
+
"apiSummaryFolder": {
|
90
|
+
describe: "Directory for the API summary. Defaults to `<Rush repository root>/common/api/summary`."
|
82
91
|
}
|
83
92
|
})
|
84
93
|
},
|
@@ -149,7 +158,10 @@ function extractCommand(options) {
|
|
149
158
|
function extractApiCommand(options) {
|
150
159
|
const entryOpt = options.entry ? ["--entry", options.entry] : [];
|
151
160
|
const ignoreTagsOpt = options.ignoreMissingTags ? ["--ignoreMissingTags"] : [];
|
152
|
-
|
161
|
+
const apiReportFolderOpt = options.apiReportFolder ? ["--apiReportFolder", options.apiReportFolder] : [];
|
162
|
+
const apiReportTempFolderOpt = options.apiReportTempFolder ? ["--apiReportTempFolder", options.apiReportTempFolder] : [];
|
163
|
+
const apiSummaryFolderOpt = options.apiSummaryFolder ? ["--apiSummaryFolder", options.apiSummaryFolder] : [];
|
164
|
+
exec(["node", getScriptPath("extract-api.js"), ...entryOpt, ...ignoreTagsOpt, ...apiReportFolderOpt, ...apiReportTempFolderOpt, ...apiSummaryFolderOpt]);
|
153
165
|
}
|
154
166
|
|
155
167
|
function pseudolocalizeCommand(options) {
|
package/package.json
CHANGED
package/scripts/extract-api.js
CHANGED
@@ -31,7 +31,16 @@ const resolveRoot = relativePath => {
|
|
31
31
|
}
|
32
32
|
process.stderr.write("Root of the Rush repository not found. Missing a rush.json file?");
|
33
33
|
};
|
34
|
-
const rushCommon =
|
34
|
+
const rushCommon = () => {
|
35
|
+
let resolved;
|
36
|
+
if (!resolved)
|
37
|
+
resolved = resolveRoot("common");
|
38
|
+
return resolved;
|
39
|
+
};
|
40
|
+
|
41
|
+
const apiReportFolder = argv.apiReportFolder ?? path.join(rushCommon(), "/api");
|
42
|
+
const apiReportTempFolder = argv.apiReportTempFolder ?? path.join(rushCommon(), "/temp/api");
|
43
|
+
const apiSummaryFolder = argv.apiSummaryFolder ?? path.join(rushCommon(), "/api/summary");
|
35
44
|
|
36
45
|
const config = {
|
37
46
|
$schema: "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
@@ -42,8 +51,8 @@ const config = {
|
|
42
51
|
mainEntryPointFilePath: `${entryPointFileName}.d.ts`,
|
43
52
|
apiReport: {
|
44
53
|
enabled: true,
|
45
|
-
reportFolder: path.resolve(
|
46
|
-
reportTempFolder: path.resolve(
|
54
|
+
reportFolder: path.resolve(apiReportFolder),
|
55
|
+
reportTempFolder: path.resolve(apiReportTempFolder),
|
47
56
|
},
|
48
57
|
docModel: {
|
49
58
|
enabled: false
|
@@ -94,7 +103,7 @@ const config = {
|
|
94
103
|
};
|
95
104
|
|
96
105
|
if (!fs.existsSync("lib")) {
|
97
|
-
process.stderr.write("lib folder not found.
|
106
|
+
process.stderr.write("`lib` folder not found. Build the package(s) before running `extract-api`");
|
98
107
|
process.exit(1);
|
99
108
|
}
|
100
109
|
|
@@ -118,8 +127,8 @@ spawn(require.resolve(".bin/api-extractor"), args).then((code) => {
|
|
118
127
|
|
119
128
|
const extractSummaryArgs = [
|
120
129
|
path.resolve(__dirname, "extract-api-summary.js"),
|
121
|
-
"--apiSignature", path.resolve(path.join(
|
122
|
-
"--outDir", path.resolve(
|
130
|
+
"--apiSignature", path.resolve(path.join(apiReportFolder, `${entryPointFileName}.api.md`)),
|
131
|
+
"--outDir", path.resolve(apiSummaryFolder),
|
123
132
|
];
|
124
133
|
|
125
134
|
spawn("node", extractSummaryArgs).then((code) => {
|