Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to add package documentation #1313

Merged
merged 8 commits into from Jan 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
62 changes: 62 additions & 0 deletions build/documentation/copy-package-readme.js
@@ -0,0 +1,62 @@
/**
* Utility for copying readme to .docs/en/packages/[package-name]/readme.md.
* Usage: node build/documentation/copy-package-readme.js
*/
const path = require("path");
const fs = require("fs");
const glob = require("glob");

const rootDir = path.resolve(process.cwd());
const srcReadmePaths = "packages/*/README.md";
const destDir = "docs\\en\\packages";
var dryRun = false;

/**
* Determine if a dry run will be executed based off --dry-run argument being present
* if an invalid third parameter is entered, the application will exit
*/
process.argv.forEach(function (val, index) {

var validArg = true;

if (index == 2) {
val === "--dry-run" ? dryRun = true : validArg = false;
}

if (!validArg) {
console.log('Invalid argument used. To perform a dry-run use --dry-run');
process.exit(1);
}
});

/**
* Function to copy readme files to the docs/en/packages folder
*/
function copyReadmeFiles() {

const resolvedSrcReadmePaths = path.resolve(rootDir, srcReadmePaths);

glob(resolvedSrcReadmePaths, {realpath:true}, function(error, files) {

files.forEach((filePath) => {
const destReadmePath = filePath.replace(/(\bpackages\b)(?!.*\1)/, destDir);
const dirPath = destReadmePath.replace(/(\b\\README.md\b)(?!.*\1)/, '');
if (!fs.existsSync(dirPath)) {
dryRun ? console.log("----> Would create folder " + dirPath) : fs.mkdirSync(dirPath);
}
if (!fs.existsSync(destReadmePath)) {
dryRun ? console.log(" --> Would create file README.md in " + dirPath) : fs.copyFileSync(filePath, destReadmePath);
} else {
dryRun ? console.log(" --> Would replace README.md in " + dirPath) : fs.copyFileSync(filePath, destReadmePath);
}

});

});

}

/**
* Copy all files
*/
copyReadmeFiles();
@@ -1,7 +1,7 @@
---
id: fast-animation
id: index
title: FAST Animation
sidebar_label: Fast Animation
sidebar_label: Animation
---

# FAST Animation
Expand All @@ -18,6 +18,8 @@ Fast Animation is a library for simplifying the creation of animations and inter

## Usage

[API Reference](https://microsoft.github.io/fast-dna/docs/en/contributing/packages/fast-animation/api/index.html)

### Installation

```bash
Expand Down
7 changes: 5 additions & 2 deletions website/core/Footer.js
Expand Up @@ -34,10 +34,13 @@ class Footer extends React.Component {
)}
</a> */}
<div>
<h5>Documentation</h5>
<a href={this.docUrl('contributing/install', this.props.language)}>
<h5>Guides</h5>
<a href={this.docUrl('en/contributing/install', this.props.language)}>
Install
</a>
<a href={this.docUrl('en/packages/fast-animation', this.props.language)}>
Packages
</a>
</div>
<div>
<h5>Community</h5>
Expand Down
10 changes: 7 additions & 3 deletions website/i18n/en.json
Expand Up @@ -33,17 +33,21 @@
"title": "Writing style guide",
"sidebar_label": "Writing style guide"
},
"en/packages/fast-animation": {
"en/packages/fast-animation/index": {
"title": "FAST Animation",
"sidebar_label": "Fast Animation"
"sidebar_label": "Animation"
},
"en/packages/fast-application-utilities/index": {
"title": "FAST Application Utilities",
"sidebar_label": "Application Utilities"
},
"readme": {
"title": "FAST-DNA",
"sidebar_label": "What is FAST-DNA"
}
},
"links": {
"Documentation": "Documentation",
"Guide": "Guide",
"GitHub": "GitHub",
"Components": "Components"
},
Expand Down
2 changes: 1 addition & 1 deletion website/pages/en/index.js
Expand Up @@ -85,9 +85,9 @@ class HomeSplash extends React.Component {
<div className="inner">
<ProjectTitle />
<PromoSection>
<Button href={docUrl('en/contributing/install', language)}>Guide</Button>
<Button target="_blank" href="https://github.com/microsoft/fast-dna">GitHub</Button>
<Button target="_blank" href="https://msft-docs.fast-dna.net">Components</Button>
<Button href={docUrl('en/contributing/install', language)}>Documentation</Button>
</PromoSection>
</div>
</SplashContainer>
Expand Down
29 changes: 27 additions & 2 deletions website/sidebars.json
Expand Up @@ -10,7 +10,32 @@
"en/contributing/policies"
],
"Packages": [
"en/packages/fast-animation"
]
"en/packages/fast-animation/index",
"en/packages/fast-breakpoint-tracker-react/index",
"en/packages/fast-browser-extensions/index",
"en/packages/fast-colors/index",
"en/packages/fast-components-class-name-contracts-base/index",
"en/packages/fast-components-class-name-contracts-msft/index",
"en/packages/fast-components-foundation-react/index",
"en/packages/fast-components-react-base/index",
"en/packages/fast-components-react-msft/index",
"en/packages/fast-components-styles-msft/index",
"en/packages/fast-css-editor-react/index",
"en/packages/fast-data-utilities-react/index",
"en/packages/fast-development-site-react/index",
"en/packages/fast-form-generator-react/index",
"en/packages/fast-glyphs-msft/index",
"en/packages/fast-jest-snapshots-react/index",
"en/packages/fast-jss-manager/index",
"en/packages/fast-jss-manager-angular/index",
"en/packages/fast-jss-manager-react/index",
"en/packages/fast-jss-utilities/index",
"en/packages/fast-layouts-react/index",
"en/packages/fast-markdown-msft-react/index",
"en/packages/fast-permutator/index",
"en/packages/fast-sketch-library/index",
"en/packages/fast-tslint-rules/index",
"en/packages/fast-viewer-react/index",
"en/packages/fast-web-utilities/index" ]
}
}
2 changes: 1 addition & 1 deletion website/siteConfig.js
Expand Up @@ -39,7 +39,7 @@ const siteConfig = {

// For no header links in the top nav bar -> headerLinks: [],
headerLinks: [
{doc: 'en/contributing/install', label: 'Documentation'},
{doc: 'en/contributing/install', label: 'Guide'},
{href: "https://github.com/microsoft/fast-dna", label: "GitHub"},
{href: "https://msft-docs.fast-dna.net", label: "Components"}
// {doc: 'doc4', label: 'API'},
Expand Down