Skip to content

Commit ee99c1d

Browse files
committed
Use commit hash in message, remove old methods
1 parent 7d099bb commit ee99c1d

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,19 @@
22
"name": "whatwebcando",
33
"description": "Can I rely on the Web Platform features to build my app? An overview of the device integration HTML5 APIs",
44
"private": true,
5-
"type": "module",
65
"scripts": {
76
"preinstall": "npx npm-force-resolutions",
87
"dev": "sapper dev",
98
"build": "sapper build --legacy",
10-
"export": "mv dist/.git __sapper__/_tmp_dist_git && (sapper export dist --legacy || true) && mv __sapper__/_tmp_dist_git dist/.git",
9+
"export": "sapper export --legacy",
1110
"export-aliases": "node deploy/aliases.mjs",
1211
"start": "node __sapper__/build",
1312
"cy:run": "cypress run",
1413
"cy:open": "cypress open",
1514
"test": "run-p --race dev cy:run",
16-
"deploy": "(cd dist && git add --ignore-removal . && git commit -m \"Update to $(cd .. && git rev-parse HEAD)\" && git push && git reseth)",
15+
"deploy": "npm run clean && npm run export && node ./scripts/deploy.js",
1716
"deploy-staging": "surge ./dist https://wwcd-beta.surge.sh",
18-
"clean": "rm -rf ./__sapper__",
19-
"export-legacy": "sapper export --legacy",
20-
"deploy-gh-pages": "npm run clean && npm run export-legacy && node ./scripts/deploy.js"
17+
"clean": "rm -rf ./__sapper__"
2118
},
2219
"dependencies": {
2320
"chartist": "^0.11.4",

scripts/deploy.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
const ghpages = require('gh-pages');
2+
const { exec } = require("child_process");
23

3-
ghpages.publish(
4+
exec("git rev-parse HEAD", (error, revHash) => {
5+
if (error) {
6+
console.error(error)
7+
return
8+
}
9+
10+
ghpages.publish(
411
'__sapper__/export',
512
{
6-
branch: 'gh-pages',
7-
remote: 'origin',
8-
message: 'Deploy on GitHub Pages via gh-pages script',
13+
branch: 'gh-pages',
14+
remote: 'origin',
15+
message: `Update to ${revHash.trim()}`,
16+
add: true,
917
},
1018
() => {
11-
console.log('Deploy on GitHub Pages Complete!')
19+
console.log('Deploy on GitHub Pages Complete!')
1220
}
13-
)
21+
)
22+
})

0 commit comments

Comments
 (0)