docs: remove github stars counter and bypass xhr request, do some clean

This commit is contained in:
bordun 2020-04-25 16:02:06 +02:00
parent fb1212d7e2
commit 8804868b4f
16 changed files with 39 additions and 58 deletions

2
.gitignore vendored
View file

@ -7,6 +7,8 @@ app/assets/*.png
app/client/*.js*
app/launcher/*.js*
app/server/*
app/docs/*
!app/docs/.htaccess
!app/server/.keep
app/package.json
package-lock.json

View file

@ -96,7 +96,7 @@
"watch-css": "nodemon --watch src/scss -e scss -x \"npm run build-css -- --reload\"",
"watch-server": "nodemon --watch src/server/ -e js -x \"npm run build-server-js\"",
"watch-launcher": "nodemon --watch src/launcher/ -e js -x \"npm run build-launcher-js\"",
"build-docs": "node scripts/build-widgets-reference.js > resources/docs/docs/widgets/properties-reference.md && cd resources && npm run build",
"build-docs": "node scripts/build-widgets-reference.js > resources/docs/docs/widgets/properties-reference.md && cd resources && mkdocs build",
"test": "eslint src && npm run build && node tests/test.js"
},
"engines": {

View file

@ -1,2 +0,0 @@
site/*
!site/.htaccess

View file

@ -1,9 +1,9 @@
# How to build the docs
```bash
$ sudo apt-get install python python-pip # python package manager
$ sudo pip install mkdocs # docs site builder
$ sudo pip install mkdocs-material # theme
# https://squidfunk.github.io/mkdocs-material/getting-started/
$ python3 -m pip install mkdocs-material
$ mkdocs serve # make docs available on http://127.0.0.1:8000
# or

View file

@ -37,6 +37,17 @@ npm start [ -- options]
!!! info ""
A double hyphen (`--`) is used here to tell npm that the options are to be passed to the app.
## Build documentation
In order to make the local documentation available through the server's `--docs` option and the launcher's `Documentation` menu action, an extra step is needed.
```bash
# install docs website theme
python3 -m pip install mkdocs-material
# build docs website
npm run build-docs
```
## Package from sources

View file

@ -138,6 +138,10 @@ The **server** can be configured with many options, either from a terminal or wi
Show help.
=== "docs"
Serve documentation website locally and open it with the system\'s default browser
=== "version"

View file

@ -16,6 +16,10 @@ html {
padding-left: 0!important
}
.md-source__facts {
display: none;
}
td:first-child {
white-space: pre!important;
vertical-align: top;

View file

@ -1 +0,0 @@
../../images/icons-bolt.svg

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve">
<style type="text/css">
.st0{fill:#4F5D73;}
.st1{opacity:0.2;fill:#231F20;}
.st2{fill:#F5CF87;}
</style>
<circle class="st0" cx="32" cy="32" r="32"/>
<path class="st1" d="M46.9,17.5C46.7,17.2,46.4,17,46,17H29c-0.4,0-0.7,0.2-0.9,0.6l-8,16c-0.2,0.3-0.1,0.7,0,1
c0.2,0.3,0.5,0.5,0.9,0.5h5.5l-8.4,18.6c-0.2,0.4-0.1,0.9,0.3,1.2c0.2,0.1,0.4,0.2,0.6,0.2c0.2,0,0.5-0.1,0.6-0.2l24-20
c0.3-0.3,0.4-0.7,0.3-1.1C43.8,33.3,43.4,33,43,33h-6.1l9.9-14.4C47,18.3,47.1,17.9,46.9,17.5z"/>
<path class="st2" d="M46.9,15.5C46.7,15.2,46.4,15,46,15H29c-0.4,0-0.7,0.2-0.9,0.6l-8,16c-0.2,0.3-0.1,0.7,0,1
c0.2,0.3,0.5,0.5,0.9,0.5h5.5l-8.4,18.6c-0.2,0.4-0.1,0.9,0.3,1.2c0.2,0.1,0.4,0.2,0.6,0.2c0.2,0,0.5-0.1,0.6-0.2l24-20
c0.3-0.3,0.4-0.7,0.3-1.1C43.8,31.3,43.4,31,43,31h-6.1l9.9-14.4C47,16.3,47.1,15.9,46.9,15.5z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -4,6 +4,7 @@ repo_url: https://github.com/jean-emmanuel/open-stage-control
edit_uri: tree/master/resources/docs/
copyright: "Copyleft © Jean-Emmanuel Doucet @ <a href='http://ammd.net'>AMMD</a> (<a href='https://github.com/jean-emmanuel/open-stage-control/blob/master/LICENSE'>GNU/GPLv3</a>)"
site_description: "Libre and modular OSC / MIDI controller"
site_dir: '../app/docs/'
theme:
name: 'material'

View file

@ -5,4 +5,8 @@
<link rel="stylesheet" href="/fonts/fa-solid.css">
<link rel="stylesheet" href="/fonts/roboto.css">
<style>body,input{font-family:"Roboto",-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono",SFMono-Regular,Consolas,Menlo,monospace}</style>
<script>
// hack mkdocs-material to bypass github stars/forks fetching
sessionStorage.setItem('-655102438', '[]')
</script>
{% endblock %}

View file

@ -1,14 +0,0 @@
{
"name": "open-stage-control-docs",
"version": "1.0.0",
"description": "```bash $ sudo apt-get install python python-pip # python package manager $ sudo pip install mkdocs # docs site builder $ sudo pip install mkdocs-material # theme",
"main": "index.js",
"directories": {
"doc": "docs"
},
"scripts": {
"build": "mkdocs build"
},
"author": "Jean-Emmanuel Doucet",
"license": "GPLv3"
}

View file

@ -1,12 +0,0 @@
var sass = require('node-sass'),
path = require('path'),
fs = require('fs')
var result = sass.renderSync({
file: path.resolve(__dirname + '/../src/scss/styles.scss'),
outFile: path.resolve(__dirname + '/../theme/styles.css'),
outputStyle: 'compressed',
sourceMap: false
})
fs.writeFileSync(path.resolve(__dirname + '/../theme/styles.css'), result.css)

View file

@ -1 +0,0 @@
ErrorDocument 404 /404.html

View file

@ -18,7 +18,7 @@ packager({
overwrite: true,
out: path.resolve(__dirname + '/../dist'),
icon: path.resolve(__dirname + '/../resources/images/logo'),
ignore: /node_modules\/(serialport|uws)/,
ignore: /(node_modules\/(serialport|uws)|docs\/fonts)/,
afterExtract: [safeFFMPEG],
prune: false
}).then((appPaths)=>{

View file

@ -12,15 +12,14 @@ class DocsServer extends EventEmitter {
super(...arguments)
this.baseUrl = path.resolve(__dirname + '/../../resources/site')
this.baseUrl = path.resolve(__dirname + '/../docs')
this.home = '/docs/getting-started/introduction/'
this.server = null
this.started = false
this.port = 0
this.available = true
if (!fs.existsSync(this.baseUrl)) {
if (!fs.existsSync(path.join(this.baseUrl, 'index.html'))) {
console.error(`(ERROR, DOCS) Documentation assets not found in the app\'s directory.`)
this.available = false
}
@ -68,9 +67,12 @@ class DocsServer extends EventEmitter {
if (url[url.length-1] === '/') url += 'index.html'
var fpath = path.join(this.baseUrl, url)
if (url.indexOf('/fonts') === 0) url = '../assets' + url
if (!fs.existsSync(fpath)) {
url = path.join(this.baseUrl, url)
if (!fs.existsSync(url)) {
if (url.indexOf('index.html') !== -1) {
return send(req, path.join(this.baseUrl, '/404.html')).pipe(res)
} else {
@ -78,7 +80,7 @@ class DocsServer extends EventEmitter {
res.end()
}
} else {
return send(req, fpath).pipe(res)
return send(req, url).pipe(res)
}
}