Skip to content

Commit 9b8480a

Browse files
nicholasriceawentzel
authored andcommitted
fix: updates documentation site with latest master (#1818)
* update docusaurus * fixing link syntax * point typedoc at the correct tsconfig * fixing ts error in background * update website files
1 parent 9ee5b41 commit 9b8480a

File tree

6 files changed

+452
-89
lines changed

6 files changed

+452
-89
lines changed

build/documentation/generate-typedocs.js

Lines changed: 73 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
/**
22
* Utility for generating TypeDoc API documentation and placing it in the docs/en/packages folder so it can be hosted by
3-
* Github pages and viewed through Docusaurus.
4-
* Contains a dry run command to investigate how the script will operate without actually writing to anything.
3+
* Github pages and viewed through Docusaurus.
4+
* Contains a dry run command to investigate how the script will operate without actually writing to anything.
55
* Contains a verbose option to print detailed build output generated by the typedoc processes that create the
66
* api documentation.
7-
*
7+
*
88
* Usage :run node build/documentation/generate-typedocs.js OR
99
* Usage (dry-run): run node build/documentation/generate-typedocs.js --dry-run
10-
* Usage (verbose): run node build/documentation/generate-typedocs.js --verbose
10+
* Usage (verbose): run node build/documentation/generate-typedocs.js --verbose
1111
*/
1212

1313
const path = require("path");
1414
const fs = require("fs");
1515
const glob = require("glob");
16-
const os = require('os');
17-
const chalk = require('chalk');
18-
const yargs = require('yargs');
16+
const os = require("os");
17+
const chalk = require("chalk");
18+
const yargs = require("yargs");
1919

20-
const { exec } = require('child_process');
20+
const { exec } = require("child_process");
2121
const { spawn } = require("child_process");
2222

2323
const rootDir = path.resolve(process.cwd());
2424
const srcDir = "packages/*";
2525
const destDir = path.join("docs", "en", "packages");
2626

27-
var copyReadmeScript = 'copy-package-readme.js';
28-
var copyReadmeScriptPath = path.join('build', 'documentation', copyReadmeScript);
27+
var copyReadmeScript = "copy-package-readme.js";
28+
var copyReadmeScriptPath = path.join("build", "documentation", copyReadmeScript);
2929
var dryRun = false;
3030
var verbose = false;
3131

3232
const excludedPackages = [
3333
"fast-browser-extensions",
34+
"fast-color-explorer",
3435
"fast-development-site-react",
3536
"fast-permutator",
36-
"fast-tslint-rules"
37+
"fast-tslint-rules",
3738
];
3839

3940
/**
@@ -46,22 +47,24 @@ verbose = argv.verbose;
4647

4748
/**
4849
* Run the copy readme script, then this one if successful
49-
* To prevent new links constantly being appended to the readme every
50-
* time the script is run, the copy readme script is run to regenerate
50+
* To prevent new links constantly being appended to the readme every
51+
* time the script is run, the copy readme script is run to regenerate
5152
* files to their original form with the needed header
5253
*/
5354

54-
var proc = dryRun ? exec(`node ${copyReadmeScriptPath} --dry-run`) : exec(`node ${copyReadmeScriptPath}`);
55+
var proc = dryRun
56+
? exec(`node ${copyReadmeScriptPath} --dry-run`)
57+
: exec(`node ${copyReadmeScriptPath}`);
5558

56-
proc.stdout.on('data', function(data) {
59+
proc.stdout.on("data", function(data) {
5760
process.stdout.write(data);
5861
});
5962

60-
proc.on('error', (err) => {
63+
proc.on("error", err => {
6164
console.log(chalk.red(err));
6265
});
6366

64-
proc.on('close', function(code) {
67+
proc.on("close", function(code) {
6568
console.log(chalk.green(`${copyReadmeScript} ran successfully.`));
6669
execute();
6770
});
@@ -70,7 +73,6 @@ proc.on('close', function(code) {
7073
* Generate TypeDocs for each package
7174
*/
7275
function execute() {
73-
7476
if (dryRun) {
7577
console.log(`In ${destDir}, this script would...`);
7678
} else {
@@ -79,58 +81,70 @@ function execute() {
7981

8082
const packages = path.resolve(rootDir, srcDir);
8183

82-
glob(packages, {realpath:true}, function(error, srcFiles) {
83-
84-
srcFiles.forEach((srcPath) => {
85-
84+
glob(packages, { realpath: true }, function(error, srcFiles) {
85+
srcFiles.forEach(srcPath => {
8686
var valid = true;
8787

88-
var packageName = srcPath
89-
.split(path.sep)
90-
.pop();
88+
var packageName = srcPath.split(path.sep).pop();
9189

92-
excludedPackages.forEach((excludedPackageName) => {
90+
excludedPackages.forEach(excludedPackageName => {
9391
if (packageName === excludedPackageName) {
94-
console.log(chalk.yellow(`...skip generating TypeDoc API files for ${packageName}`));
92+
console.log(
93+
chalk.yellow(
94+
`...skip generating TypeDoc API files for ${packageName}`
95+
)
96+
);
9597
valid = false;
9698
}
9799
});
98100

99-
if(valid) {
100-
dryRun ? console.log(`...generate TypeDoc API files for ${packageName}`) : createAPIFiles(packageName, srcPath);
101+
if (valid) {
102+
dryRun
103+
? console.log(`...generate TypeDoc API files for ${packageName}`)
104+
: createAPIFiles(packageName, srcPath);
101105
}
102-
103106
});
104-
105107
});
106108
}
107109

108110
/**
109111
* Uses TypeDoc process to generate API docs for a given package
110-
* Stores them in the docs/en/packages folder
112+
* Stores them in the docs/en/packages folder
111113
*/
112114
function createAPIFiles(packageName, srcPath) {
113-
114-
var config = path.join(srcPath, '/tsconfig.json');
115-
var output = path.join(destDir, packageName, 'api');
116-
var file = (packageName === "fast-animation") ? path.join(srcPath, '/lib/index.ts') : path.join(srcPath, '/src/index.ts');
117-
118-
var typedocCmd = os.platform() == 'win32' ? 'typedoc.cmd' : 'typedoc';
119-
var typedocPath = path.join('node_modules', '.bin', typedocCmd);
120-
121-
const typedoc = spawn(typedocPath, // the local TypeDoc installation is needed for the markdown theme to work
115+
var config = path.join(srcPath, "/build.tsconfig.json");
116+
var output = path.join(destDir, packageName, "api");
117+
var file =
118+
packageName === "fast-animation"
119+
? path.join(srcPath, "/lib/index.ts")
120+
: path.join(srcPath, "/src/index.ts");
121+
122+
var typedocCmd = os.platform() == "win32" ? "typedoc.cmd" : "typedoc";
123+
var typedocPath = path.join("node_modules", ".bin", typedocCmd);
124+
125+
const typedoc = spawn(
126+
typedocPath, // the local TypeDoc installation is needed for the markdown theme to work
122127
[
123-
'--tsconfig', config,
124-
'--excludeNotExported',
125-
'--out', output, file,
126-
'--theme', "markdown"
127-
]);
128-
129-
typedoc.on('close', code => {
128+
"--tsconfig",
129+
config,
130+
"--excludeNotExported",
131+
"--out",
132+
output,
133+
file,
134+
"--theme",
135+
"markdown",
136+
]
137+
);
138+
139+
typedoc.on("close", code => {
130140
if (code) {
131-
console.log(chalk.red(`${packageName} - TypeDoc API docs not generated, error code: ${code}`));
141+
console.log(
142+
chalk.red(
143+
`${packageName} - TypeDoc API docs not generated, error code: ${code}`
144+
)
145+
);
132146
} else {
133-
console.log(`${packageName} - TypeDoc API docs generated`)
147+
console.log(`${packageName} - TypeDoc API docs generated`);
134148
addHeaderToReadme(packageName);
135149
addAPILinkToReadme(packageName);
136150
}
@@ -139,58 +153,47 @@ function createAPIFiles(packageName, srcPath) {
139153
// if set to true, will print detailed build output for typedoc process
140154
// useful for debugging
141155
if (verbose) {
142-
typedoc.stdout.on('data', (data) => {
156+
typedoc.stdout.on("data", data => {
143157
console.log(`${data}`);
144158
});
145159
}
146160

147-
typedoc.on('error', (err) => {
161+
typedoc.on("error", err => {
148162
console.log(chalk.red(err));
149163
});
150-
151164
}
152165

153166
/**
154167
* If the TypeDoc readme doesn't have this header
155168
* It won't be accessible in docusaurus
156169
*/
157170
function addHeaderToReadme(packageName) {
158-
159-
const readmePath = path.join(destDir, packageName, 'api', 'README.md');
171+
const readmePath = path.join(destDir, packageName, "api", "README.md");
160172
const readmeText = fs.readFileSync(readmePath).toString();
161173

162-
var docusaurusHeader =
163-
`---\n` +
164-
`id: index\n` +
165-
`---\n\n`;
174+
var docusaurusHeader = `---\n` + `id: index\n` + `---\n\n`;
166175

167176
try {
168177
fs.writeFileSync(readmePath, docusaurusHeader);
169178
fs.appendFileSync(readmePath, readmeText);
170179
} catch (err) {
171180
console.log(chalk.red(err));
172181
}
173-
174182
}
175183

176184
/**
177185
* Creates link in package readme.md docs used by Docusaurus
178186
* Said link routes to the TypeDoc API docs generated by this script
179187
*/
180188
function addAPILinkToReadme(packageName) {
181-
182-
var readmePath = path.join(destDir, packageName, 'README.md');
189+
var readmePath = path.join(destDir, packageName, "README.md");
183190
var apiLink = "api";
184191

185-
var usageText =
186-
"\n" +
187-
`[API Reference](${apiLink})`;
192+
var usageText = "\n" + `[API Reference](${apiLink})`;
188193

189-
fs.appendFile(readmePath, usageText, function (err) {
194+
fs.appendFile(readmePath, usageText, function(err) {
190195
if (err) {
191196
console.log(chalk.red(err));
192-
}
193-
})
194-
197+
}
198+
});
195199
}
196-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"babel-jest": "^24.5.0",
8888
"babel-preset-env": "^1.6.1",
8989
"chalk": "^2.4.2",
90-
"docusaurus-init": "^1.0.2",
90+
"docusaurus-init": "^1.11.0",
9191
"dotenv": "^6.0.0",
9292
"eyes.selenium": "3.6.2",
9393
"glob": "^7.1.2",

packages/fast-components-react-msft/src/background/background.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,16 @@ export default class Background extends Foundation<
7272

7373
return (
7474
<DesignSystemProvider designSystem={this.getDesignSystemOverrides(color)}>
75-
<this.props.tag {...this.unhandledProps()} style={style}>
75+
<this.tag {...this.unhandledProps()} style={style}>
7676
{this.props.children}
77-
</this.props.tag>
77+
</this.tag>
7878
</DesignSystemProvider>
7979
);
8080
};
81+
82+
private get tag(): any {
83+
return this.props.tag;
84+
}
8185
}
8286

8387
export * from "./background.props";

packages/fast-jss-manager-react/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Button extends React.Component {
2929

3030
### Create a JSS stylesheet
3131

32-
You should also create a JSS stylesheet - for detailed information please reference [https://github.com/cssinjs/jss]. The JSS instance used by the manager uses (jss-preset-default)[https://github.com/cssinjs/jss-preset-default] so feel free to use any syntaxes supported by those plugins.
32+
You should also create a JSS stylesheet - for detailed information please reference [https://github.com/cssinjs/jss](https://github.com/cssinjs/jss). The JSS instance used by the manager uses [jss-preset-default](https://github.com/cssinjs/jss-preset-default) so feel free to use any syntaxes supported by those plugins.
3333

3434
```js
3535
// buttonSyles.js

0 commit comments

Comments
 (0)