Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 8dd967c

Browse files
committed
migrate mochajs.github.io into mocha; closes mochajs#2987 [ci skip]
- some jekyll tweaks were needed; we can no longer consume the `github-pages` gem apparently since they added support for themes - added `markdown-toc` dev dep to build the toc - added `buildDocs` and `serveDocs` scripts - miraculously avoided monkeying with the content itself Signed-off-by: Christopher Hiller <[email protected]>
1 parent e514e33 commit 8dd967c

File tree

6 files changed

+92
-1
lines changed

6 files changed

+92
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ coverage/
1515
yarn.lock
1616
package-lock.json
1717
mocha.js
18+
docs/_site

Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
# Added at 2017-12-05 23:01:55 -0800 by boneskull:
3+
gem "jekyll", "~> 3.6"

Gemfile.lock

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
GEM
2+
specs:
3+
addressable (2.5.2)
4+
public_suffix (>= 2.0.2, < 4.0)
5+
colorator (1.1.0)
6+
ffi (1.9.18)
7+
forwardable-extended (2.6.0)
8+
jekyll (3.6.2)
9+
addressable (~> 2.4)
10+
colorator (~> 1.0)
11+
jekyll-sass-converter (~> 1.0)
12+
jekyll-watch (~> 1.1)
13+
kramdown (~> 1.14)
14+
liquid (~> 4.0)
15+
mercenary (~> 0.3.3)
16+
pathutil (~> 0.9)
17+
rouge (>= 1.7, < 3)
18+
safe_yaml (~> 1.0)
19+
jekyll-sass-converter (1.5.0)
20+
sass (~> 3.4)
21+
jekyll-watch (1.5.1)
22+
listen (~> 3.0)
23+
kramdown (1.14.0)
24+
liquid (4.0.0)
25+
listen (3.0.8)
26+
rb-fsevent (~> 0.9, >= 0.9.4)
27+
rb-inotify (~> 0.9, >= 0.9.7)
28+
mercenary (0.3.6)
29+
pathutil (0.16.0)
30+
forwardable-extended (~> 2.6)
31+
public_suffix (3.0.0)
32+
rb-fsevent (0.10.2)
33+
rb-inotify (0.9.10)
34+
ffi (>= 0.5.0, < 2)
35+
rouge (2.2.1)
36+
safe_yaml (1.0.4)
37+
sass (3.5.3)
38+
sass-listen (~> 4.0.0)
39+
sass-listen (4.0.0)
40+
rb-fsevent (~> 0.9, >= 0.9.4)
41+
rb-inotify (~> 0.9, >= 0.9.7)
42+
43+
PLATFORMS
44+
ruby
45+
46+
DEPENDENCIES
47+
jekyll (~> 3.6)
48+
49+
BUNDLED WITH
50+
1.16.0

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,10 @@
303303
"lint": "eslint . bin/*",
304304
"test": "make clean && make test",
305305
"prepublishOnly": "npm test && make clean && make mocha.js",
306-
"coveralls": "nyc report --reporter=text-lcov | coveralls"
306+
"coveralls": "nyc report --reporter=text-lcov | coveralls",
307+
"prebuildDocs": "node scripts/pre-build-docs.js",
308+
"buildDocs": "bundle exec jekyll build --source docs --destination docs/_site --layouts docs/_layouts --safe --drafts",
309+
"serveDocs": "bundle exec jekyll serve --config docs/_config.yml --safe --drafts --watch"
307310
},
308311
"dependencies": {
309312
"browser-stdout": "1.3.0",
@@ -340,6 +343,7 @@
340343
"karma-mocha-reporter": "^2.2.4",
341344
"karma-phantomjs-launcher": "^1.0.4",
342345
"karma-sauce-launcher": "^1.2.0",
346+
"markdown-toc": "^1.2.0",
343347
"nyc": "^11.2.1",
344348
"rimraf": "^2.5.2",
345349
"through2": "^2.0.1",

scripts/.eslintrc.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
parserOptions:
2+
ecmaVersion: 2017

scripts/pre-build-docs.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* The CLI included with markdown-toc doesn't support `bullets`
5+
* and `maxdepth` options, so that's why this exists.
6+
*/
7+
8+
'use strict';
9+
10+
const toc = require('markdown-toc');
11+
const utils = require('markdown-toc/lib/utils');
12+
const fs = require('fs');
13+
const path = require('path');
14+
15+
const docsFilepath = path.join(__dirname, '..', 'docs', 'index.md');
16+
17+
console.log('Updating TOC...');
18+
19+
fs.createReadStream(docsFilepath)
20+
.on('error', err => {
21+
console.log(err);
22+
process.exit(1);
23+
})
24+
.on('close', () => {
25+
console.log('Done.');
26+
})
27+
.pipe(utils.concat(
28+
input => fs.writeFileSync(docsFilepath, toc.insert(String(input), {
29+
bullets: '-',
30+
maxdepth: 2
31+
}))));

0 commit comments

Comments
 (0)