Skip to content

Commit

Permalink
move site to site folder
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidWells committed Aug 31, 2018
1 parent 79edb6e commit 57b474f
Show file tree
Hide file tree
Showing 8 changed files with 10,274 additions and 0 deletions.
11 changes: 11 additions & 0 deletions site/config.js
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')
}
}
9,513 changes: 9,513 additions & 0 deletions site/package-lock.json

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions site/package.json
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"
}
}
84 changes: 84 additions & 0 deletions site/src/_app.js
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>
)
}
}

0 comments on commit 57b474f

Please sign in to comment.