-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79edb6e
commit 57b474f
Showing
8 changed files
with
10,274 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const path = require('path') | ||
|
||
const rootDir = path.join(__dirname, '..') | ||
|
||
module.exports = { | ||
rootDir: rootDir, | ||
docs: { | ||
srcPath: path.join(rootDir, 'docs'), | ||
outputPath: path.join(rootDir, 'site/src') | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "cli-docs-site", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "npm run clean && run-s build:*", | ||
"build:docs": "DOCS_GEN=TRUE node ./scripts/docs.js", | ||
"build:site": "x0 build src", | ||
"build:deptree": "depcruise --exclude '^node_modules' --output-type dot src | dot -T svg > dist/dependencygraph.svg", | ||
"start:docs": "node ./watch.js", | ||
"start:site": "x0 src", | ||
"start": "run-p start:*" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@compositor/x0": "^6.0.5", | ||
"@rebass/mdx": "^1.0.0-1", | ||
"react-helmet": "^5.2.0", | ||
"react-instantsearch-dom": "^5.2.3", | ||
"styled-components": "^3.3.3" | ||
}, | ||
"devDependencies": { | ||
"fs-extra": "^7.0.0", | ||
"sane": "^3.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React from 'react' | ||
import RebassMDX from '@rebass/mdx' | ||
import createScope from '@rebass/markdown' | ||
import * as Rebass from 'rebass' | ||
import sortBy from 'lodash.sortby' | ||
import { ScopeProvider } from '@compositor/x0/components' | ||
import Layout from './_layout' | ||
import { LiveEditor } from './_ui' | ||
|
||
const scope = { | ||
...createScope(), | ||
...Rebass, | ||
code: LiveEditor, | ||
pre: ({ children }) => children, | ||
a: ({ children, href }) => { | ||
console.log('href', href) | ||
// TODO single page routing Link here | ||
return <Rebass.Link color="#00ad9f" href={href}>{children}</Rebass.Link> | ||
} | ||
} | ||
|
||
const navOrder = [ | ||
'index', | ||
'getting-started', | ||
'commands', | ||
'login', | ||
'logout', | ||
'init', | ||
'link', | ||
'unlink', | ||
'deploy', | ||
'sites', | ||
'open', | ||
'status', | ||
'contributing', | ||
] | ||
|
||
const pageNames = { | ||
index: 'Introduction', | ||
'getting-started': 'Getting Started', | ||
} | ||
|
||
const sortRoutes = routes => [ | ||
...sortBy([...routes], a => { | ||
const i = navOrder.indexOf(a.name) | ||
return i < 0 ? Infinity : i | ||
}) | ||
].map(route => { | ||
if (!pageNames[route.name]) { | ||
return route | ||
} | ||
return { | ||
...route, | ||
name: pageNames[route.name], | ||
props: { | ||
hidePagination: true | ||
} | ||
} | ||
}) | ||
|
||
export default class App extends React.Component { | ||
|
||
static defaultProps = { | ||
title: 'Netlify CLI' | ||
} | ||
|
||
render () { | ||
const { routes } = this.props | ||
|
||
const nav = sortRoutes(routes) | ||
// console.log('nav', nav) | ||
// console.log('scope', scope) | ||
// console.log('this.props', this.props) | ||
return ( | ||
<RebassMDX> | ||
<ScopeProvider scope={scope}> | ||
<Layout {...this.props} routes={nav}> | ||
{this.props.children} | ||
</Layout> | ||
</ScopeProvider> | ||
</RebassMDX> | ||
) | ||
} | ||
} |
Oops, something went wrong.