@vida-global/core 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/release/README.md +66 -0
- package/package.json +1 -1
- package/scripts/release.js +18 -5
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
Add the following scripts to your package.json
|
|
3
|
+
```
|
|
4
|
+
"release": "node node_modules/@vida-global/core/scripts/release.js",
|
|
5
|
+
"develop": "node node_modules/@vida-global/core/scripts/release.js develop"
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Release Management
|
|
10
|
+
The release script provides serves two purposes, version management and production release management.
|
|
11
|
+
|
|
12
|
+
## Version Management
|
|
13
|
+
```
|
|
14
|
+
npm run release increment <major,minor,point>
|
|
15
|
+
```
|
|
16
|
+
Running this command will find the current `main` or `master` branch on your remote repo,
|
|
17
|
+
search for the highest remote version, create a new release branch with the incremented version,
|
|
18
|
+
and update the version in `package.json`
|
|
19
|
+
|
|
20
|
+
## Production Release Management
|
|
21
|
+
```
|
|
22
|
+
npm run release production [version]
|
|
23
|
+
```
|
|
24
|
+
Running this command will find the current highest version on the remote repo, or the one specified
|
|
25
|
+
by the version option, and replace `release/production` with that branch.
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
Given a current highest version of `release/1.5.3`
|
|
29
|
+
|
|
30
|
+
#### Increment point version
|
|
31
|
+
```
|
|
32
|
+
npm run release increment point
|
|
33
|
+
```
|
|
34
|
+
This will create a new branch of `origin/master` named `release/1.6.0` and will update `package.json`
|
|
35
|
+
to use `1.6.0` as the "version."
|
|
36
|
+
|
|
37
|
+
#### Release
|
|
38
|
+
```
|
|
39
|
+
npm run release production
|
|
40
|
+
```
|
|
41
|
+
This will replace `release/production` with a branch of `release/1.6.0`
|
|
42
|
+
|
|
43
|
+
#### Rollback a release
|
|
44
|
+
```
|
|
45
|
+
npm run release production
|
|
46
|
+
```
|
|
47
|
+
This will replace `release/production` with a branch of `release/1.6.0`
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# Development
|
|
51
|
+
```
|
|
52
|
+
npm run develop -- this is my new branch -i123
|
|
53
|
+
```
|
|
54
|
+
This will offer to create a new branch `feature/123/<YOUR_INITIALS>/this-is-my-new-branch`
|
|
55
|
+
|
|
56
|
+
## Options
|
|
57
|
+
#### -i --issue (required)
|
|
58
|
+
Provide the issue number this branch is associated with
|
|
59
|
+
|
|
60
|
+
#### -t --type (optional)
|
|
61
|
+
By default, the script creates a branch of type `feature`. Using the `-t` option, you can create a
|
|
62
|
+
branch of type `bugfix`, `chore`, `feature`, `hotfix`, or `refactor`
|
|
63
|
+
|
|
64
|
+
#### -s --source (optional)
|
|
65
|
+
By default, this script creates a branch of `origin/master`. By specifying the `-s` option and
|
|
66
|
+
providing a branch name, you will create a branch from the provided source.
|
package/package.json
CHANGED
package/scripts/release.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const commander = require('commander');
|
|
2
|
+
const { logger } = require('../lib/logger');
|
|
3
|
+
const Release = require('../lib/release');
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
function validateIssueNumber(val) {
|
|
@@ -39,14 +40,22 @@ program.name('Vida Release')
|
|
|
39
40
|
program.command('increment')
|
|
40
41
|
.argument('<type>', 'version number to increment', validateVersionType)
|
|
41
42
|
.action(async (type) => {
|
|
42
|
-
|
|
43
|
+
try {
|
|
44
|
+
await Release.increment(type);
|
|
45
|
+
} catch(err) {
|
|
46
|
+
logger.error(err.message);
|
|
47
|
+
}
|
|
43
48
|
});
|
|
44
49
|
|
|
45
50
|
|
|
46
51
|
program.command('production')
|
|
47
52
|
.argument('[version]', 'optional version release')
|
|
48
53
|
.action(async (version) => {
|
|
49
|
-
|
|
54
|
+
try {
|
|
55
|
+
await Release.release('staging', version);
|
|
56
|
+
} catch(err) {
|
|
57
|
+
logger.error(err.message);
|
|
58
|
+
}
|
|
50
59
|
});
|
|
51
60
|
|
|
52
61
|
|
|
@@ -56,7 +65,11 @@ program.command('develop')
|
|
|
56
65
|
.option('-s, --source [sourceBranch]', 'Branch to copy')
|
|
57
66
|
.argument('<description...>', 'a description of your project')
|
|
58
67
|
.action(async (description, { issue, type, source }) => {
|
|
59
|
-
|
|
68
|
+
try {
|
|
69
|
+
await Release.develop(type, issue, description.join(' '), source);
|
|
70
|
+
} catch(err) {
|
|
71
|
+
logger.error(err.message);
|
|
72
|
+
}
|
|
60
73
|
});
|
|
61
74
|
|
|
62
75
|
program.parse();
|