Skip to content

Commit

Permalink
deploy script to gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainpolletvillard committed Aug 1, 2019
1 parent 5dbbe81 commit dd002a9
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
28 changes: 28 additions & 0 deletions build/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const { which, cd, exec, echo, exit } = require('shelljs')

if (!which('git')) {
echo('Sorry, this script requires git')
exit(1)
}

// build docs
exec('npm run build')

// navigate into the build output directory
cd('dist')

// if you are deploying to a custom domain
echo("pwa-cookbook.js.org").to("CNAME")

exec("git init")
exec("git add -A")

if (exec('git commit -m "deploy"').code !== 0) {
echo('Error: Git commit failed')
exit(1)
}

// if you are deploying to https://<USERNAME>.github.io/<REPO>
exec('git push -f https://github.com/sylvainpolletvillard/pwa-cookbook.git master:gh-pages')

cd("-")
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'"
"deploy": "node ./build/deploy.js"
},
"dependencies": {
"core-js": "^2.6.5",
Expand All @@ -29,6 +29,7 @@
"postcss-import": "^12.0.1",
"postcss-nested": "^4.1.2",
"postcss-simple-vars": "^5.0.2",
"shelljs": "^0.8.3",
"vue-cli-plugin-i18n": "^0.6.0",
"vue-template-compiler": "^2.6.10"
},
Expand Down Expand Up @@ -60,4 +61,4 @@
"> 1%",
"last 2 versions"
]
}
}

0 comments on commit dd002a9

Please sign in to comment.