From a79b378a1f336f7c328bade18d9c8124911ee498 Mon Sep 17 00:00:00 2001 From: rxliuli Date: Fri, 19 Apr 2019 00:27:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20github=20pages=20=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CNAME | 1 + gh-pages-pub.js | 22 ++++++++++++++++++++++ package.json | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 CNAME create mode 100644 gh-pages-pub.js diff --git a/CNAME b/CNAME new file mode 100644 index 00000000..68d67aa1 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +rx-util.rxliuli.com \ No newline at end of file diff --git a/gh-pages-pub.js b/gh-pages-pub.js new file mode 100644 index 00000000..a2093079 --- /dev/null +++ b/gh-pages-pub.js @@ -0,0 +1,22 @@ +// 发布文档到 git-pages +const exec = require('child_process').execSync +console.log('Start Deploy github pages...') + +const cmds = [ + 'yarn docs', + 'yarn coverage', + 'cp CNAME docs/', + 'git subtree push --prefix=docs origin gh-pages', + 'rm -rf docs/' +] + +cmds.forEach(cmd => { + try { + const stdout = exec(cmd) + console.log(stdout.toString()) + } catch (err) { + console.error(err) + console.error('Deploy github pages failed') + throw err + } +}) diff --git a/package.json b/package.json index 79782899..bce82225 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "docs": "esdoc", "test": "jest --watch", "coverage": "jest --coverage", - "pub": "npm run build && npm run docs && npm run coverage", + "pages": "node gh-pages-pub.js", "server": "npm run docs && npm run coverage && live-server docs/ --port=4000" }, "repository": {