forked from zorrock/handsfreeJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.js
34 lines (26 loc) · 964 Bytes
/
deploy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* Helper script for building and deploying
* Deploys out of /dist/
*/
// 👉🏻 CONFIG
// Set this to the repo to deploy to
const gitRepo = 'https://github.com/handsfreejs/docs'
// Adds a CNAME record with this value if present, or ignores it
const domainName = 'handsfree.js.org'
// build
const pckg = require('./package.json')
const shell = require('shelljs')
shell.exec('npm run build')
// navigate into the build output directory
shell.cd('dist')
// if you are deploying to a custom domain
shell.exec(`echo ${domainName} > CNAME`)
shell.exec('git init')
shell.exec('git add -A')
shell.exec(`git commit -m "deploy docs for ${pckg.version}"`)
// if you are deploying to https://<USERNAME>.github.io
// git push -f [email protected]:<USERNAME>/<USERNAME>.github.io.git master
// if you are deploying to https://<USERNAME>.github.io/<REPO>
shell.exec(`git remote add origin ${gitRepo}`)
shell.exec('git push origin master:gh-pages -f')
shell.cd('-')