-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathgit-deploy.js
More file actions
29 lines (23 loc) · 824 Bytes
/
git-deploy.js
File metadata and controls
29 lines (23 loc) · 824 Bytes
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
const git = require('simple-git')()
const msg = process.argv[2]
if (process.argv.length !== 3) throw Error(`
You passed the wrong number of arguments.
Try a command like this: 'yarn deploy "Commit msg here"'
`)
if (typeof msg !== 'string') throw Error(`You didn't provide a valid msg`)
const deploy = () => {
console.log(`Trying to commit to your github repository...`)
git
.add('./*')
.commit(msg)
.push(
['-u', 'origin', 'master'],
() => {
console.log(`Your commits have been successfully pushed to your github repository`)
console.log(`-----------------------------------------------------------`)
console.log(`-----------------------------------------------------------`)
console.log(`Run 'lerna publish' to publish on npm`)
}
)
}
deploy()