Skip to content

Commit 71ba6de

Browse files
committed
Deploy fast
1 parent 6f565e1 commit 71ba6de

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.DS_Store
22
node_modules
3-
/dist
3+
# /dist
44

55
# local env files
66
.env.local
@@ -19,3 +19,5 @@ yarn-error.log*
1919
*.njsproj
2020
*.sln
2121
*.sw?
22+
23+
vue.config.js

deployGhPages.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const exec = require('child_process').exec;
2+
3+
const commitMessage = process.argv[2];
4+
5+
function execute (command) {
6+
return new Promise((resolve, reject) => {
7+
exec(command,
8+
function (error, stdout, stderr) {
9+
if (error) {
10+
console.log("error1", error)
11+
console.log("stderr", stderr)
12+
reject(stderr)
13+
}
14+
15+
resolve(stdout)
16+
}
17+
)
18+
})
19+
}
20+
21+
async function start () {
22+
// console.log('commitMessage', commitMessage)
23+
// return
24+
25+
try {
26+
console.log('Building...')
27+
await execute('npm run build')
28+
29+
console.log('Adding the dist...')
30+
await execute(`git add dist`)
31+
32+
console.log('Commiting')
33+
await execute(`git commit -m "${commitMessage}"`)
34+
35+
console.log('Pushing to gh')
36+
await execute('git subtree push --prefix dist origin gh-pages')
37+
38+
console.log('The project was deployed on Gh-pages! Good work!')
39+
} catch (error) {
40+
console.log('error', error)
41+
}
42+
}
43+
44+
start()

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"scripts": {
66
"serve": "vue-cli-service serve",
77
"build": "vue-cli-service build",
8-
"lint": "vue-cli-service lint",
8+
"lint": "vue-cli-service lint",
9+
"deploy:gh-pages": "node deployGhPages.js",
910
"docs:generate": "vuedoc.md.cmd ./src/components/player.vue --output PLAYER.md",
1011
"test:unit": "vue-cli-service test:unit"
1112
},

0 commit comments

Comments
 (0)