Improve website docs (#920)

This commit is contained in:
Alexandre Lotte 2020-02-07 22:48:41 -05:00 committed by GitHub
parent 6f5cbfddfa
commit a31ac357c8
3 changed files with 53 additions and 9 deletions

View File

@ -3,6 +3,7 @@ module.exports = {
extends: ['standard'],
plugins: ['import', 'react'],
rules: {
'quotes': 'double',
'no-unused-vars': [2, { varsIgnorePattern: 'h' }],
'react/jsx-uses-vars': 2,
'no-undef': 0,

View File

@ -1,6 +1,48 @@
# Hyperapp official website developer guide
100% open to feedback on any aspect of the site! (Architecture, CSS practices, ESLint configs, you name it!)
[Live website](https://hyperapp.dev/)
## 🚀 Quick start:
Run these commands to get a local copy running:
```console
# Clone hyperapp repo
git clone https://github.com/jorgebucaran/hyperapp.git
# Go to in the docs directory
cd docs
npm i # Install dependencies
npm start # Dev server + live reload
```
npm run build
```console
npm run build # Build site
```
You can also run `npm run build-site` from the the root of the hyperapp repo to build the site.
## Project files
A quick look at the project's folders and files
.
├── src/ # Site source code
│ ├── assets/ # Shared assets that will bundled by parcel
│ ├── components/ # Hyperapp components (global to the site)
│ ├── lib/ # External libs
│ ├── pages/ # Page components
│ ├── styleguide/ # Copy of the hyperapp styleguide
│ ├── actions.js # Global actions
│ ├── effects.js # Global effects
│ ├── global.css # Global CSS
│ ├── index.html # HTML skeletton
│ ├── index.js # App initialization
│ ├── manifest.webmanifest # Site manifest (fancy metadata)
│ ├── subscriptions.js # Global subscriptions
│ └── utils.js # Misc utils
├── static/ # Static files to be copied "as is" in the builds

View File

@ -1,15 +1,16 @@
const path = require('path')
const glob = require('glob')
const fs = require('fs')
const path = require("path")
const glob = require("glob")
const fs = require("fs")
glob('src/pages/**/*.md', {}, (err, files) => {
// Generate a big JSON file of all the text of all pages, used for search
glob("src/pages/**/*.md", {}, (err, files) => {
const data = files.reduce((data, filePath) => {
const content = fs.readFileSync(path.join(__dirname, filePath), 'utf8')
const pageName = path.basename(filePath, '.md')
const content = fs.readFileSync(path.join(__dirname, filePath), "utf8")
const pageName = path.basename(filePath, ".md")
return {
...data,
[pageName]: content
}
}, {})
fs.writeFileSync('static/pages-data.json', JSON.stringify(data))
fs.writeFileSync("static/pages-data.json", JSON.stringify(data))
})