Skip to content

Infra/unify docs #1036

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

Merged
merged 15 commits into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions uilib-docs/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
.npmignore

.cache
public
16 changes: 9 additions & 7 deletions uilib-docs/configurations/pageCreators/createMarkdownPages.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = async ({graphql, boundActionCreators}) => {
const {createPage} = boundActionCreators;
const result = await graphql(`
{
allFile(filter: {sourceInstanceName: {eq: "markdown-pages"}}) {
allFile(filter: {sourceInstanceName: {eq: "markdown-pages"}, childMarkdownRemark: {frontmatter: {path: {ne: null}}}}) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure... :)
I guess we'll talk about it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand the comment..

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've said we'll discuss these PRs, so let's do that when you can.

edges {
node {
id
Expand All @@ -24,11 +24,13 @@ module.exports = async ({graphql, boundActionCreators}) => {
`);

result.data.allFile.edges.forEach(({node}) => {
createPage({
name: node.name,
path: node.childMarkdownRemark.frontmatter.path,
component: path.resolve(`src/templates/markdownTemplate.js`),
context: {} // additional data can be passed via context
});
if (node.childMarkdownRemark.frontmatter.path) {
createPage({
name: node.name,
path: node.childMarkdownRemark.frontmatter.path,
component: path.resolve(`src/templates/markdownTemplate.js`),
context: {} // additional data can be passed via context
});
}
});
};
8 changes: 5 additions & 3 deletions uilib-docs/configurations/plugins.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('path');

const manifestPlugin = [
{
resolve: `gatsby-plugin-manifest`,
Expand All @@ -13,12 +15,12 @@ const manifestPlugin = [
}
];

const markdownPagesPlugin = [
const markdownPagesPlugin = (path = `${__dirname}/../../markdowns/`) => [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `markdown-pages`,
path: `${__dirname}/../../markdowns/`
path
}
},
`gatsby-transformer-remark`
Expand Down Expand Up @@ -73,7 +75,7 @@ const layoutPlugin = [
{
resolve: `gatsby-plugin-layout`,
options: {
component: require.resolve(`${__dirname}/../src/components/layout.js`)
component: require.resolve(`${path.resolve('./')}/src/components/layout.js`)
}
}
];
Expand Down
2 changes: 1 addition & 1 deletion uilib-docs/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
plugins: [
`gatsby-plugin-react-helmet`,
`gatsby-plugin-sass`,
...markdownPagesPlugin,
...markdownPagesPlugin(),
...componentsDocgenPlugin,
...incubatorComponentsDocgenPlugin,
...nativeComponentsDocgenPlugin,
Expand Down
7 changes: 7 additions & 0 deletions uilib-docs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const PageCreators = require('./configurations/pageCreators');
const Plugins = require('./configurations/plugins');

module.exports = {
PageCreators,
Plugins
};
10 changes: 5 additions & 5 deletions uilib-docs/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "gatsby-starter-default",
"private": true,
"description": "A simple starter to get up and developing quickly with Gatsby",
"version": "0.1.0",
"author": "Kyle Mathews <[email protected]>",
"name": "uilib-docs",
"description": "uilib docs template",
"version": "1.0.4",
"author": "Ethan Sharabi <[email protected]>",
"main": "index.js",
"dependencies": {
"classnames": "^2.2.6",
"gatsby": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion uilib-docs/src/components/navbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class Navbar extends Component {
}
}
}
allFile(filter: {sourceInstanceName: {eq: "markdown-pages"}}) {
allFile(filter: {sourceInstanceName: {eq: "markdown-pages"}, childMarkdownRemark: {frontmatter: {path: {ne: null}}}}) {
edges {
node {
childMarkdownRemark {
Expand Down