Skip to content

Commit e4163f4

Browse files
authored
Merge branch 'master' into pgonzal/ae-events
2 parents 741e0e8 + f680dd0 commit e4163f4

File tree

145 files changed

+2034
-607
lines changed

Some content is hidden

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

145 files changed

+2034
-607
lines changed

.pullapprove.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ groups:
2020
- pgonzal
2121
- qz2017
2222
- patmill
23+
- aditima
2324

2425
api-approvers:
2526
conditions:
@@ -32,6 +33,7 @@ groups:
3233
- pgonzal
3334
- qz2017
3435
- mpasarin
36+
- aditima
3537

3638
general-approvers:
3739
conditions:
@@ -51,6 +53,7 @@ groups:
5153
- nickpape-msft
5254
- pgonzal
5355
- qz2017
56+
- aditima
5457

5558
load-themed-styles-approvers:
5659
conditions:
@@ -63,3 +66,4 @@ groups:
6366
- pgonzal
6467
- qz2017
6568
- dzearing
69+
- aditima

apps/api-documenter/CHANGELOG.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,48 @@
11
{
22
"name": "@microsoft/api-documenter",
33
"entries": [
4+
{
5+
"version": "1.4.4",
6+
"tag": "@microsoft/api-documenter_v1.4.4",
7+
"date": "Fri, 13 Jul 2018 19:04:50 GMT",
8+
"comments": {
9+
"dependency": [
10+
{
11+
"comment": "Updating dependency \"@microsoft/node-library-build\" from `4.3.48` to `4.3.49`"
12+
}
13+
]
14+
}
15+
},
16+
{
17+
"version": "1.4.3",
18+
"tag": "@microsoft/api-documenter_v1.4.3",
19+
"date": "Thu, 12 Jul 2018 16:03:26 GMT",
20+
"comments": {
21+
"patch": [
22+
{
23+
"comment": "Changing Office's APIExtractor add-on to unescape characters in code blocks"
24+
}
25+
]
26+
}
27+
},
28+
{
29+
"version": "1.4.2",
30+
"tag": "@microsoft/api-documenter_v1.4.2",
31+
"date": "Tue, 03 Jul 2018 21:03:31 GMT",
32+
"comments": {
33+
"dependency": [
34+
{
35+
"comment": "Updating dependency \"@microsoft/api-extractor\" from `5.9.0` to `5.9.1`"
36+
},
37+
{
38+
"comment": "Updating dependency \"@microsoft/node-core-library\" from `1.4.1` to `1.5.0`"
39+
},
40+
{
41+
"comment": "Updating dependency \"@microsoft/node-library-build\" from `4.3.47` to `4.3.48`"
42+
}
43+
]
44+
}
45+
},
446
{
547
"version": "1.4.1",
648
"tag": "@microsoft/api-documenter_v1.4.1",

apps/api-documenter/CHANGELOG.md

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

3-
This log was last generated on Fri, 29 Jun 2018 02:56:51 GMT and should not be manually modified.
3+
This log was last generated on Fri, 13 Jul 2018 19:04:50 GMT and should not be manually modified.
4+
5+
## 1.4.4
6+
Fri, 13 Jul 2018 19:04:50 GMT
7+
8+
*Version update only*
9+
10+
## 1.4.3
11+
Thu, 12 Jul 2018 16:03:26 GMT
12+
13+
### Patches
14+
15+
- Changing Office's APIExtractor add-on to unescape characters in code blocks
16+
17+
## 1.4.2
18+
Tue, 03 Jul 2018 21:03:31 GMT
19+
20+
*Version update only*
421

522
## 1.4.1
623
Fri, 29 Jun 2018 02:56:51 GMT

apps/api-documenter/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/api-documenter",
3-
"version": "1.4.1",
3+
"version": "1.4.4",
44
"description": "Read JSON files from api-extractor, generate documentation pages",
55
"repository": {
66
"type": "git",
@@ -15,16 +15,14 @@
1515
"api-documenter": "./bin/api-documenter"
1616
},
1717
"dependencies": {
18-
"@microsoft/api-extractor": "5.9.0",
19-
"@microsoft/node-core-library": "1.4.1",
18+
"@microsoft/api-extractor": "5.9.1",
19+
"@microsoft/node-core-library": "1.5.0",
2020
"@microsoft/ts-command-line": "4.2.0",
2121
"colors": "~1.2.1",
22-
"fs-extra": "~5.0.0",
2322
"js-yaml": "~3.9.1"
2423
},
2524
"devDependencies": {
26-
"@microsoft/node-library-build": "4.3.47",
27-
"@types/fs-extra": "5.0.1",
25+
"@microsoft/node-library-build": "4.3.49",
2826
"@types/js-yaml": "3.9.1",
2927
"@types/node": "8.5.8",
3028
"gulp": "~3.9.1",

apps/api-documenter/src/cli/BaseAction.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4-
import * as fsx from 'fs-extra';
54
import * as path from 'path';
65

76
import {
87
CommandLineAction,
98
CommandLineStringParameter
109
} from '@microsoft/ts-command-line';
1110

11+
import { FileSystem } from '@microsoft/node-core-library';
12+
1213
import { DocItemSet } from '../utils/DocItemSet';
1314

1415
export abstract class BaseAction extends CommandLineAction {
@@ -41,14 +42,14 @@ export abstract class BaseAction extends CommandLineAction {
4142
const docItemSet: DocItemSet = new DocItemSet();
4243

4344
this.inputFolder = this._inputFolderParameter.value || './input';
44-
if (!fsx.existsSync(this.inputFolder)) {
45+
if (!FileSystem.exists(this.inputFolder)) {
4546
throw new Error('The input folder does not exist: ' + this.inputFolder);
4647
}
4748

4849
this.outputFolder = this._outputFolderParameter.value || `./${this.actionName}`;
49-
fsx.mkdirsSync(this.outputFolder);
50+
FileSystem.ensureFolder(this.outputFolder);
5051

51-
for (const filename of fsx.readdirSync(this.inputFolder)) {
52+
for (const filename of FileSystem.readFolder(this.inputFolder)) {
5253
if (filename.match(/\.api\.json$/i)) {
5354
console.log(`Reading ${filename}`);
5455
const filenamePath: string = path.join(this.inputFolder, filename);

apps/api-documenter/src/markdown/MarkdownDocumenter.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4-
import * as fsx from 'fs-extra';
54
import * as path from 'path';
65

7-
import { Text, PackageName } from '@microsoft/node-core-library';
6+
import {
7+
PackageName,
8+
FileSystem,
9+
NewlineKind
10+
} from '@microsoft/node-core-library';
811
import {
912
IApiClass,
1013
IApiEnum,
@@ -614,7 +617,9 @@ export class MarkdownDocumenter {
614617
}
615618
});
616619

617-
fsx.writeFileSync(filename, Text.convertToCrLf(content));
620+
FileSystem.writeFile(filename, content, {
621+
convertLineEndings: NewlineKind.CrLf
622+
});
618623
}
619624

620625
private _getFilenameForDocItem(docItem: DocItem): string {
@@ -631,6 +636,6 @@ export class MarkdownDocumenter {
631636

632637
private _deleteOldOutputFiles(): void {
633638
console.log('Deleting old output from ' + this._outputFolder);
634-
fsx.emptyDirSync(this._outputFolder);
639+
FileSystem.ensureEmptyFolder(this._outputFolder);
635640
}
636641
}

apps/api-documenter/src/utils/test/MarkdownRenderer.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4-
import * as fsx from 'fs-extra';
54
import * as path from 'path';
6-
import { FileDiffTest } from '@microsoft/node-core-library';
5+
import { FileDiffTest, FileSystem } from '@microsoft/node-core-library';
76
import { IMarkupPage, Markup } from '@microsoft/api-extractor';
87

98
import { MarkdownRenderer } from '../MarkdownRenderer';
@@ -66,7 +65,7 @@ describe('MarkdownPageRenderer', () => {
6665
]);
6766

6867
const outputFilename: string = path.join(outputFolder, 'ActualOutput.md');
69-
fsx.writeFileSync(outputFilename, MarkdownRenderer.renderElements([markupPage], { }));
68+
FileSystem.writeFile(outputFilename, MarkdownRenderer.renderElements([markupPage], { }));
7069

7170
FileDiffTest.assertEqual(outputFilename, path.join(__dirname, 'ExpectedOutput.md'));
7271

apps/api-documenter/src/yaml/OfficeYamlDocumenter.ts

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
// See LICENSE in the project root for license information.
33

44
import * as colors from 'colors';
5-
import * as fsx from 'fs-extra';
65
import * as path from 'path';
76
import yaml = require('js-yaml');
87

98
import { DocItemSet } from '../utils/DocItemSet';
109
import { IYamlTocItem } from './IYamlTocFile';
1110
import { IYamlItem } from './IYamlApiFile';
1211
import { YamlDocumenter } from './YamlDocumenter';
13-
import { Text } from '@microsoft/node-core-library';
12+
import { Text, FileSystem } from '@microsoft/node-core-library';
1413

1514
interface ISnippetsFile {
1615
/**
@@ -44,7 +43,8 @@ export class OfficeYamlDocumenter extends YamlDocumenter {
4443
const snippetsFilePath: string = path.join(inputFolder, 'snippets.yaml');
4544

4645
console.log('Loading snippets from ' + snippetsFilePath);
47-
const snippetsContent: string = fsx.readFileSync(snippetsFilePath).toString();
46+
47+
const snippetsContent: string = FileSystem.readFile(snippetsFilePath);
4848
this._snippets = yaml.load(snippetsContent, { filename: snippetsFilePath });
4949
}
5050

@@ -68,25 +68,6 @@ export class OfficeYamlDocumenter extends YamlDocumenter {
6868

6969
protected onCustomizeYamlItem(yamlItem: IYamlItem): void { // override
7070
const nameWithoutPackage: string = yamlItem.uid.replace(/^[^.]+\./, '');
71-
72-
const snippets: string[] | undefined = this._snippets[nameWithoutPackage];
73-
if (snippets) {
74-
delete this._snippets[nameWithoutPackage];
75-
76-
if (!yamlItem.remarks) {
77-
yamlItem.remarks = '';
78-
}
79-
80-
yamlItem.remarks += '\n\n#### Examples\n';
81-
for (const snippet of snippets) {
82-
if (snippet.search(/await/) === -1) {
83-
yamlItem.remarks += '\n```javascript\n' + snippet + '\n```\n';
84-
} else {
85-
yamlItem.remarks += '\n```typescript\n' + snippet + '\n```\n';
86-
}
87-
}
88-
}
89-
9071
if (yamlItem.summary) {
9172
yamlItem.summary = this._fixupApiSet(yamlItem.summary, yamlItem.uid);
9273
yamlItem.summary = this._fixBoldAndItalics(yamlItem.summary);
@@ -96,7 +77,7 @@ export class OfficeYamlDocumenter extends YamlDocumenter {
9677
yamlItem.remarks = this._fixupApiSet(yamlItem.remarks, yamlItem.uid);
9778
yamlItem.remarks = this._fixBoldAndItalics(yamlItem.remarks);
9879
yamlItem.remarks = this._fixCodeTicks(yamlItem.remarks);
99-
yamlItem.remarks = this._fixCodeArrows(yamlItem.remarks);
80+
yamlItem.remarks = this._fixEscapedCode(yamlItem.remarks);
10081
}
10182
if (yamlItem.syntax && yamlItem.syntax.parameters) {
10283
yamlItem.syntax.parameters.forEach(part => {
@@ -106,6 +87,24 @@ export class OfficeYamlDocumenter extends YamlDocumenter {
10687
}
10788
});
10889
}
90+
91+
const snippets: string[] | undefined = this._snippets[nameWithoutPackage];
92+
if (snippets) {
93+
delete this._snippets[nameWithoutPackage];
94+
95+
if (!yamlItem.remarks) {
96+
yamlItem.remarks = '';
97+
}
98+
99+
yamlItem.remarks += '\n\n#### Examples\n';
100+
for (const snippet of snippets) {
101+
if (snippet.search(/await/) === -1) {
102+
yamlItem.remarks += '\n```javascript\n' + snippet + '\n```\n';
103+
} else {
104+
yamlItem.remarks += '\n```typescript\n' + snippet + '\n```\n';
105+
}
106+
}
107+
}
109108
}
110109

111110
private _fixupApiSet(markup: string, uid: string): string {
@@ -137,7 +136,16 @@ export class OfficeYamlDocumenter extends YamlDocumenter {
137136
return Text.replaceAll(text, '\\`', '`');
138137
}
139138

140-
private _fixCodeArrows(text: string): string {
141-
return Text.replaceAll(text, '=>', '=>');
139+
private _fixEscapedCode(text: string): string {
140+
const backtickIndex: number = text.indexOf('`');
141+
if (text.indexOf('`', backtickIndex) > 0) {
142+
text = Text.replaceAll(text, '=>', '=>');
143+
let x: number = text.indexOf('\\', backtickIndex);
144+
while (x >= 0) {
145+
text = text.replace(/\\([^\\])/, '$1');
146+
x = text.indexOf('\\', x + 1);
147+
}
148+
}
149+
return text;
142150
}
143151
}

apps/api-documenter/src/yaml/YamlDocumenter.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4-
import * as fsx from 'fs-extra';
54
import * as path from 'path';
65
import * as colors from 'colors';
76

87
import yaml = require('js-yaml');
9-
import { JsonFile, JsonSchema, Text, PackageName } from '@microsoft/node-core-library';
8+
import {
9+
JsonFile,
10+
JsonSchema,
11+
PackageName,
12+
FileSystem,
13+
NewlineKind
14+
} from '@microsoft/node-core-library';
1015
import {
1116
MarkupElement,
1217
IApiMethod,
@@ -417,10 +422,10 @@ export class YamlDocumenter {
417422
stringified = `### YamlMime:${yamlMimeType}\n` + stringified;
418423
}
419424

420-
const normalized: string = Text.convertToCrLf(stringified);
421-
422-
fsx.mkdirsSync(path.dirname(filePath));
423-
fsx.writeFileSync(filePath, normalized);
425+
FileSystem.writeFile(filePath, stringified, {
426+
convertLineEndings: NewlineKind.CrLf,
427+
ensureFolderExists: true
428+
});
424429

425430
if (schema) {
426431
schema.validateObject(dataObject, filePath);
@@ -580,6 +585,6 @@ export class YamlDocumenter {
580585

581586
private _deleteOldOutputFiles(): void {
582587
console.log('Deleting old output from ' + this._outputFolder);
583-
fsx.emptyDirSync(this._outputFolder);
588+
FileSystem.ensureEmptyFolder(this._outputFolder);
584589
}
585590
}

apps/api-extractor/CHANGELOG.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
{
22
"name": "@microsoft/api-extractor",
33
"entries": [
4+
{
5+
"version": "5.9.1",
6+
"tag": "@microsoft/api-extractor_v5.9.1",
7+
"date": "Tue, 03 Jul 2018 21:03:31 GMT",
8+
"comments": {
9+
"dependency": [
10+
{
11+
"comment": "Updating dependency \"@microsoft/node-core-library\" from `1.4.1` to `1.5.0`"
12+
}
13+
]
14+
}
15+
},
416
{
517
"version": "5.9.0",
618
"tag": "@microsoft/api-extractor_v5.9.0",

0 commit comments

Comments
 (0)