-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.js
31 lines (27 loc) · 974 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
/* eslint-disable import/no-extraneous-dependencies */
const inquirer = require('inquirer');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const versions = {
major: 'major',
minor: 'minor',
patch: 'patch',
};
const incrementVersion = ({ versionType, message }) => exec(`npm version ${versionType} -m "Upgrade to %s. ${message}"`);
const pushTagsToGit = () => exec('git push --follow-tags');
inquirer
.prompt([{
name: 'versionType',
type: 'list',
message: 'What type of versioning do you want to do (vX.Y.Z - major bumps X, minor bumps Y, patch bumps Z)',
choices: Object.keys(versions),
default: versions.patch,
}, {
name: 'message',
type: 'input',
message: 'Enter a message for the tag',
validate: input => (input.length > 0 ? true : 'Must leave a message - think of your future self!!'),
}])
.then(incrementVersion)
.then(pushTagsToGit)
.catch(err => console.log(err));