Skip to content

Commit be295cd

Browse files
committed
Merge from master.
2 parents 4f8d93c + 138e943 commit be295cd

100 files changed

Lines changed: 1378 additions & 288 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/api-documenter/CHANGELOG.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,50 @@
11
{
22
"name": "@microsoft/api-documenter",
33
"entries": [
4+
{
5+
"version": "1.5.58",
6+
"tag": "@microsoft/api-documenter_v1.5.58",
7+
"date": "Wed, 28 Nov 2018 19:29:53 GMT",
8+
"comments": {
9+
"dependency": [
10+
{
11+
"comment": "Updating dependency \"@microsoft/api-extractor\" from `6.2.0` to `6.3.0`"
12+
},
13+
{
14+
"comment": "Updating dependency \"@microsoft/rush-stack-compiler\" from `0.5.5` to `0.5.6`"
15+
},
16+
{
17+
"comment": "Updating dependency \"@microsoft/node-library-build\" from `6.0.13` to `6.0.14`"
18+
}
19+
]
20+
}
21+
},
22+
{
23+
"version": "1.5.57",
24+
"tag": "@microsoft/api-documenter_v1.5.57",
25+
"date": "Wed, 28 Nov 2018 02:17:11 GMT",
26+
"comments": {
27+
"patch": [
28+
{
29+
"comment": "add uid to implements and extends blocks, fix uid references"
30+
}
31+
],
32+
"dependency": [
33+
{
34+
"comment": "Updating dependency \"@microsoft/api-extractor\" from `6.1.6` to `6.2.0`"
35+
},
36+
{
37+
"comment": "Updating dependency \"@microsoft/node-core-library\" from `3.6.0` to `3.7.0`"
38+
},
39+
{
40+
"comment": "Updating dependency \"@microsoft/rush-stack-compiler\" from `0.5.4` to `0.5.5`"
41+
},
42+
{
43+
"comment": "Updating dependency \"@microsoft/node-library-build\" from `6.0.12` to `6.0.13`"
44+
}
45+
]
46+
}
47+
},
448
{
549
"version": "1.5.56",
650
"tag": "@microsoft/api-documenter_v1.5.56",

apps/api-documenter/CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
# Change Log - @microsoft/api-documenter
22

3-
This log was last generated on Fri, 16 Nov 2018 21:37:10 GMT and should not be manually modified.
3+
This log was last generated on Wed, 28 Nov 2018 19:29:53 GMT and should not be manually modified.
4+
5+
## 1.5.58
6+
Wed, 28 Nov 2018 19:29:53 GMT
7+
8+
*Version update only*
9+
10+
## 1.5.57
11+
Wed, 28 Nov 2018 02:17:11 GMT
12+
13+
### Patches
14+
15+
- add uid to implements and extends blocks, fix uid references
416

517
## 1.5.56
618
Fri, 16 Nov 2018 21:37:10 GMT

apps/api-documenter/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/api-documenter",
3-
"version": "1.5.56",
3+
"version": "1.5.58",
44
"description": "Read JSON files from api-extractor, generate documentation pages",
55
"repository": {
66
"type": "git",
@@ -15,15 +15,15 @@
1515
"api-documenter": "./bin/api-documenter"
1616
},
1717
"dependencies": {
18-
"@microsoft/api-extractor": "6.1.6",
19-
"@microsoft/node-core-library": "3.6.0",
18+
"@microsoft/api-extractor": "6.3.0",
19+
"@microsoft/node-core-library": "3.7.0",
2020
"@microsoft/ts-command-line": "4.2.2",
2121
"colors": "~1.2.1",
2222
"js-yaml": "~3.9.1"
2323
},
2424
"devDependencies": {
2525
"@microsoft/rush-stack-compiler-3.0": "0.0.0",
26-
"@microsoft/node-library-build": "6.0.12",
26+
"@microsoft/node-library-build": "6.0.14",
2727
"@types/js-yaml": "3.9.1",
2828
"@types/node": "8.5.8",
2929
"gulp": "~3.9.1",

apps/api-extractor/CHANGELOG.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
11
{
22
"name": "@microsoft/api-extractor",
33
"entries": [
4+
{
5+
"version": "6.3.0",
6+
"tag": "@microsoft/api-extractor_v6.3.0",
7+
"date": "Wed, 28 Nov 2018 19:29:53 GMT",
8+
"comments": {
9+
"minor": [
10+
{
11+
"comment": "Support \"extends\" field in api-extractor.json config files for easier management of monorepos with many projects"
12+
}
13+
]
14+
}
15+
},
16+
{
17+
"version": "6.2.0",
18+
"tag": "@microsoft/api-extractor_v6.2.0",
19+
"date": "Wed, 28 Nov 2018 02:17:11 GMT",
20+
"comments": {
21+
"minor": [
22+
{
23+
"comment": "Introduce a new build output \"dist/tsdoc-metdata.json\", which completely replaces the old \"tsdocFlavor\" field in package.json"
24+
}
25+
],
26+
"dependency": [
27+
{
28+
"comment": "Updating dependency \"@microsoft/node-core-library\" from `3.6.0` to `3.7.0`"
29+
}
30+
]
31+
}
32+
},
433
{
534
"version": "6.1.6",
635
"tag": "@microsoft/api-extractor_v6.1.6",

apps/api-extractor/CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
# Change Log - @microsoft/api-extractor
22

3-
This log was last generated on Fri, 16 Nov 2018 21:37:10 GMT and should not be manually modified.
3+
This log was last generated on Wed, 28 Nov 2018 19:29:53 GMT and should not be manually modified.
4+
5+
## 6.3.0
6+
Wed, 28 Nov 2018 19:29:53 GMT
7+
8+
### Minor changes
9+
10+
- Support "extends" field in api-extractor.json config files for easier management of monorepos with many projects
11+
12+
## 6.2.0
13+
Wed, 28 Nov 2018 02:17:11 GMT
14+
15+
### Minor changes
16+
17+
- Introduce a new build output "dist/tsdoc-metdata.json", which completely replaces the old "tsdocFlavor" field in package.json
418

519
## 6.1.6
620
Fri, 16 Nov 2018 21:37:10 GMT

apps/api-extractor/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/api-extractor",
3-
"version": "6.1.6",
3+
"version": "6.3.0",
44
"description": "Validate, document, and review the exported API for a TypeScript library",
55
"keywords": [
66
"typescript",
@@ -31,7 +31,7 @@
3131
"build": "gulp test --clean"
3232
},
3333
"dependencies": {
34-
"@microsoft/node-core-library": "3.6.0",
34+
"@microsoft/node-core-library": "3.7.0",
3535
"@microsoft/ts-command-line": "4.2.2",
3636
"@microsoft/tsdoc": "0.12.2",
3737
"@types/node": "8.5.8",
@@ -40,14 +40,15 @@
4040
"jju": "~1.3.0",
4141
"lodash": "~4.17.5",
4242
"typescript": "~3.1.6",
43-
"z-schema": "~3.18.3"
43+
"z-schema": "~3.18.3",
44+
"resolve": "1.8.1"
4445
},
4546
"devDependencies": {
46-
"@microsoft/rush-stack-compiler": "0.5.4",
47+
"@microsoft/rush-stack-compiler": "0.5.6",
4748
"tslint-microsoft-contrib": "~5.2.1",
4849
"@types/lodash": "4.14.116",
4950
"gulp": "~3.9.1",
50-
"@microsoft/node-library-build": "6.0.12",
51+
"@microsoft/node-library-build": "6.0.14",
5152
"@types/jest": "21.1.10"
5253
}
5354
}

apps/api-extractor/src/cli/RunAction.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as colors from 'colors';
55
import * as os from 'os';
66
import * as path from 'path';
77
import {
8-
JsonFile,
98
PackageJsonLookup,
109
FileSystem,
1110
IPackageJson
@@ -134,7 +133,7 @@ export class RunAction extends CommandLineAction {
134133
console.log(`Using configuration from ${configFilename}` + os.EOL + os.EOL);
135134
}
136135

137-
const config: IExtractorConfig = JsonFile.loadAndValidate(configFilename, Extractor.jsonSchema);
136+
const config: IExtractorConfig = Extractor.loadConfigObject(configFilename);
138137
const extractor: Extractor = new Extractor(
139138
config,
140139
{

apps/api-extractor/src/extractor/Extractor.ts

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import * as path from 'path';
55
import * as ts from 'typescript';
6+
import * as resolve from 'resolve';
67
import lodash = require('lodash');
78
import colors = require('colors');
89

@@ -173,11 +174,62 @@ export class Extractor {
173174
* @param options - IExtractor options.
174175
*/
175176
public static processProjectFromConfigFile(jsonConfigFile: string, options?: IExtractorOptions): void {
176-
const configObject: IExtractorConfig = JsonFile.loadAndValidate(jsonConfigFile, Extractor.jsonSchema);
177+
const configObject: IExtractorConfig = this.loadConfigObject(jsonConfigFile);
177178
const extractor: Extractor = new Extractor(configObject, options);
178179
extractor.processProject();
179180
}
180181

182+
/**
183+
* Loads the api extractor config file in Extractor Config object.
184+
* The jsonConfigFile path specified is relative to project directory path.
185+
* @param jsonConfigFile - Path to api extractor json config file.
186+
*/
187+
public static loadConfigObject(jsonConfigFile: string): IExtractorConfig {
188+
// Set to keep track of config files which have been processed.
189+
const pathSet: Set<string> = new Set<string>();
190+
// Get absolute path of config file.
191+
let currentConfigFilePath: string = path.resolve(process.cwd(), jsonConfigFile);
192+
pathSet.add(currentConfigFilePath);
193+
194+
const originalConfigFileFolder: string = path.dirname(currentConfigFilePath);
195+
196+
let extractorConfig: IExtractorConfig = JsonFile.load(jsonConfigFile);
197+
198+
while (extractorConfig.extends) {
199+
if (extractorConfig.extends.match(/^\./)) {
200+
// If extends has relative path.
201+
// Populate the api extractor config path defined in extends relative to current config path.
202+
currentConfigFilePath = path.resolve(originalConfigFileFolder, extractorConfig.extends);
203+
} else {
204+
// If extends has package path.
205+
currentConfigFilePath = resolve.sync(
206+
extractorConfig.extends,
207+
{
208+
basedir: originalConfigFileFolder
209+
}
210+
);
211+
}
212+
// Check if this file was already processed.
213+
if (pathSet.has(currentConfigFilePath)) {
214+
throw new Error(`The API Extractor config files contain a cycle. "${currentConfigFilePath}"`
215+
+ ` is included twice. Please check the "extends" values in config files.`);
216+
}
217+
pathSet.add(currentConfigFilePath);
218+
219+
// Remove extends property from config for current config.
220+
delete extractorConfig.extends;
221+
222+
// Load the extractor config defined in extends property.
223+
const baseConfig: IExtractorConfig = JsonFile.load(currentConfigFilePath);
224+
lodash.merge(baseConfig, extractorConfig);
225+
extractorConfig = baseConfig;
226+
}
227+
228+
// Validate if the extractor config generated adheres to schema.
229+
Extractor.jsonSchema.validateObject(extractorConfig, jsonConfigFile);
230+
return extractorConfig;
231+
}
232+
181233
private static _applyConfigDefaults(config: IExtractorConfig): IExtractorConfig {
182234
// Use the provided config to override the defaults
183235
const normalized: IExtractorConfig = lodash.merge(

apps/api-extractor/src/extractor/IExtractorConfig.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@ export interface IExtractorDtsRollupConfig {
261261
* @public
262262
*/
263263
export interface IExtractorConfig {
264+
/**
265+
* Path to json config file from which config should extend.
266+
* The path specified in this field is relative to current config file path.
267+
*/
268+
extends?: string;
269+
264270
/**
265271
* Determines how the TypeScript compiler will be invoked.
266272
* The compiler.configType selects the type of configuration;

apps/api-extractor/src/extractor/api-extractor.schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
"type": "string"
99
},
1010

11+
"extends": {
12+
"description": "Optional field. Path to json config file from which config should extend",
13+
"type": "string"
14+
},
15+
1116
"compiler": {
1217
"description": "Determines how the TypeScript compiler will be invoked. The compiler.configType selects the type of configuration. Different options are available according to the configuration type.",
1318
"type": "object",

0 commit comments

Comments
 (0)