@cmflow/cli 0.65.1
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/README.md +106 -0
- package/bin/checkfeatures.sh +5 -0
- package/bin/cm-changelog.js +17 -0
- package/bin/cm-clean.js +10 -0
- package/bin/cm-config.js +14 -0
- package/bin/cm-deploy.js +11 -0
- package/bin/cm-fetch.js +11 -0
- package/bin/cm-finish.js +13 -0
- package/bin/cm-publish-pages.js +11 -0
- package/bin/cm-publish.js +14 -0
- package/bin/cm-push.js +14 -0
- package/bin/cm-rebase.js +14 -0
- package/bin/cm-republish.js +11 -0
- package/bin/cm-start.js +20 -0
- package/bin/cm.js +20 -0
- package/bin/cmexpedit.sh +9 -0
- package/bin/cmpull.sh +7 -0
- package/bin/cmrelease.js +3 -0
- package/package.json +88 -0
- package/release.config.js +19 -0
- package/semantic.js +1 -0
- package/src/commands/changelog.js +47 -0
- package/src/commands/clean.js +30 -0
- package/src/commands/config.js +23 -0
- package/src/commands/deploy.js +39 -0
- package/src/commands/fetch.js +21 -0
- package/src/commands/finish.js +44 -0
- package/src/commands/index.js +10 -0
- package/src/commands/prompts/branches.js +38 -0
- package/src/commands/publish-pages.js +29 -0
- package/src/commands/push.js +26 -0
- package/src/commands/rebase.js +38 -0
- package/src/commands/release.js +36 -0
- package/src/commands/republish.js +24 -0
- package/src/commands/start.js +82 -0
- package/src/commands/tasks/push-branch.js +16 -0
- package/src/commands/tasks/rebase-all-branches.js +34 -0
- package/src/commands/tasks/refresh-repository.js +33 -0
- package/src/commands/tasks/run-test.js +23 -0
- package/src/commands/tasks/update-branch.js +40 -0
- package/src/commands/tasks/update-dependencies.js +37 -0
- package/src/commands/utils/check-install.js +31 -0
- package/src/common/cli/cli.js +107 -0
- package/src/common/cli/docker.js +63 -0
- package/src/common/cli/docker.test.js +128 -0
- package/src/common/cli/git.js +130 -0
- package/src/common/cli/git.test.js +205 -0
- package/src/common/cli/heroku.js +21 -0
- package/src/common/cli/heroku.test.js +56 -0
- package/src/common/cli/lerna.js +25 -0
- package/src/common/cli/lerna.test.js +48 -0
- package/src/common/cli/npm.js +33 -0
- package/src/common/cli/npm.test.js +47 -0
- package/src/common/cli/yarn.js +33 -0
- package/src/common/cli/yarn.test.js +48 -0
- package/src/common/configure-git-workspace.js +27 -0
- package/src/common/get-config.js +135 -0
- package/src/common/get-package-json.js +7 -0
- package/src/common/get-release-config.js +7 -0
- package/src/common/index.js +10 -0
- package/src/common/run-command.js +61 -0
- package/src/common/run-command.test.js +63 -0
- package/src/index.js +1 -0
- package/src/main.js +10 -0
- package/src/semantic-release/actions/analyze-commits.js +9 -0
- package/src/semantic-release/actions/fail.js +16 -0
- package/src/semantic-release/actions/generate-notes.js +11 -0
- package/src/semantic-release/actions/index.js +8 -0
- package/src/semantic-release/actions/prepare.js +101 -0
- package/src/semantic-release/actions/publish.js +17 -0
- package/src/semantic-release/actions/success.js +30 -0
- package/src/semantic-release/actions/verify-conditions.js +30 -0
- package/src/semantic-release/actions/verify-release.js +7 -0
- package/src/semantic-release/get-semantic-config.js +115 -0
- package/src/semantic-release/utils/calculate-snapshot-version.js +9 -0
- package/src/semantic-release/utils/calculate-snapshot-version.test.js +57 -0
- package/src/semantic-release/utils/display-package-info.js +11 -0
- package/src/semantic-release/utils/display-release-info.js +12 -0
- package/src/semantic-release/utils/docker-clean-tags.js +45 -0
- package/src/semantic-release/utils/docker-clean-tags.test.js +54 -0
- package/src/semantic-release/utils/docker-publish.js +36 -0
- package/src/semantic-release/utils/docker-publish.test.js +43 -0
- package/src/semantic-release/utils/ghpages-publish.js +16 -0
- package/src/semantic-release/utils/log-section.js +5 -0
- package/src/workflow/index.js +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<h1 style="text-align: center" align="center">CMFLOW</h1>
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
<hr />
|
|
6
|
+
|
|
7
|
+
[](https://badge.fury.io/js/%40cmflow%2Fcli)
|
|
8
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
9
|
+
[](https://github.com/prettier/prettier)
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<hr />
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
npm i -g @cmflow/cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## CmFlow release
|
|
20
|
+
### Installation
|
|
21
|
+
|
|
22
|
+
CmFlow is compatible with [semantic-release](https://github.com/semantic-release/semantic-release) 📦🚀. You can use
|
|
23
|
+
CmFlow release to deploy your projects based on CmFlow convention.
|
|
24
|
+
|
|
25
|
+
Add the cmflow to your project:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
npm i --save-dev @cmflow/cli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Then create `release.config.js` with this configuration:
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
const { getSemanticConfig } = require('@cmflow/cli')
|
|
35
|
+
|
|
36
|
+
module.exports = {
|
|
37
|
+
...getSemanticConfig(),
|
|
38
|
+
// Additional semantic configuration props
|
|
39
|
+
npmPublish: false
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then edit your `package.json` add the following tasks on script property:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"script": {
|
|
48
|
+
"release": "cmrelease",
|
|
49
|
+
"release_dry_run": "cmrelease --dry-run"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Now, CmFlow and semantic release are correctly installed on your project.
|
|
55
|
+
|
|
56
|
+
### Build and E2E Test
|
|
57
|
+
|
|
58
|
+
CmFlow release are able to run `build` and `test_e2e` task during the deploy process. It's useful when you want to
|
|
59
|
+
deploy a docker image on docker hub with the right revision number in the `package.json`. The only requirement, is to
|
|
60
|
+
have a `build` and `test_e2e` tasks in you npm scripts.
|
|
61
|
+
|
|
62
|
+
Example:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "docker-compose build",
|
|
68
|
+
"test_e2e": "docker-compose up -d && sleep 10 && npm run test_cucumber && docker-compose stop"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Generate changelog
|
|
74
|
+
|
|
75
|
+
CmFlow release call also a npm task `build_changelog` to let you generate the changelog file with your preferred tool.
|
|
76
|
+
|
|
77
|
+
Example:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"scripts": {
|
|
82
|
+
"build_changelog": "conventional-changelog --preset angular --release-count 0 --outfile ./CHANGELOG.md",
|
|
83
|
+
"build_changelog": "cmchangelog"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Configure CI
|
|
89
|
+
|
|
90
|
+
CmFlow release can be used with Travis CI, Circle CI and GitLab. You have to create these environments variables to
|
|
91
|
+
allow git release note deployment, commit push and docker image deployment.
|
|
92
|
+
|
|
93
|
+
| Variable | Description |
|
|
94
|
+
|---------------------|---------------------------------------------------------------------------------------------------------------------------|
|
|
95
|
+
| PROJECT_NAME | The project to publish artifact on docker |
|
|
96
|
+
| GH_TOKEN | A GitHub [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line). |
|
|
97
|
+
| GIT_USER_EMAIL | User mail to sign the commit produced by CmFlow release |
|
|
98
|
+
| GIT_USER_NAME | User name to sign the commit produced by CmFlow release |
|
|
99
|
+
| DEPLOY_ON_DOCKER | Set 1 to deploy on docker |
|
|
100
|
+
| DOCKER_HUB_ID | The docker hub id |
|
|
101
|
+
| DOCKER_HUB_PWD | The docker password account |
|
|
102
|
+
| HEROKU_APP | Enable deployment on heroku. Note: You have to configure HEROKU_API_KEY token on your CI |
|
|
103
|
+
| SKIP_DEPLOY | Skip all deployment task (docker, heroku). |
|
|
104
|
+
| SKIP_GITHUB_PUBLISH | Skip tag and release note publication on Github. |
|
|
105
|
+
| GITHUB_PAGES_PATH | Path to the front-end artifact. Enable github pages deployment. |
|
|
106
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const commander = require('commander')
|
|
4
|
+
const { commands, runCommand } = require('../src')
|
|
5
|
+
|
|
6
|
+
commander
|
|
7
|
+
.usage('cmchangelog [options]')
|
|
8
|
+
.alias('cm changelog')
|
|
9
|
+
.option('-p, --preset <preset>', 'Name of the preset you want to use. Must be one of the following:\n' +
|
|
10
|
+
'angular, atom, codemirror, ember, eslint, express, jquery, jscs or jshint', 'angular')
|
|
11
|
+
.option('-r, --release-count <count>', 'How many releases to be generated from the latest\n' +
|
|
12
|
+
'If 0, the whole changelog will be regenerated and the outfile will be overwritten\n' +
|
|
13
|
+
'Default: 0', 0)
|
|
14
|
+
.option('-t, --tag-prefix <prefix>', 'Tag prefix to consider when reading the tags')
|
|
15
|
+
.parse(process.argv)
|
|
16
|
+
|
|
17
|
+
runCommand(commands.Changelog, commander)
|
package/bin/cm-clean.js
ADDED
package/bin/cm-config.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const commander = require('commander')
|
|
3
|
+
const { commands, runCommand } = require('../src')
|
|
4
|
+
|
|
5
|
+
commander
|
|
6
|
+
.usage('cmconfig')
|
|
7
|
+
.alias('cm config')
|
|
8
|
+
.option('-v, --verbose', 'Enable verbose log', (v, t) => t + 1, 0)
|
|
9
|
+
.parse(process.argv)
|
|
10
|
+
|
|
11
|
+
runCommand(commands.Config, {
|
|
12
|
+
verbose: commander.verbose
|
|
13
|
+
})
|
|
14
|
+
require('../src').release()
|
package/bin/cm-deploy.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const commander = require('commander')
|
|
3
|
+
const { commands, runCommand } = require('../src')
|
|
4
|
+
|
|
5
|
+
commander
|
|
6
|
+
.usage('cmdeploy [options]')
|
|
7
|
+
.alias('cm deploy')
|
|
8
|
+
.option('-t, --target <target>', 'Deploy on docker hub/Heroku (docker, heroku)')
|
|
9
|
+
.parse(process.argv)
|
|
10
|
+
|
|
11
|
+
runCommand(commands.Deploy, commander)
|
package/bin/cm-fetch.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const commander = require('commander')
|
|
3
|
+
const { commands, runCommand } = require('../src')
|
|
4
|
+
|
|
5
|
+
commander
|
|
6
|
+
.usage('cmfetch [options]')
|
|
7
|
+
.alias('cm fetch')
|
|
8
|
+
.option('-v, --verbose', 'Enable verbose log', (v, t) => t + 1, 0)
|
|
9
|
+
.parse(process.argv)
|
|
10
|
+
|
|
11
|
+
runCommand(commands.Fetch, commander)
|
package/bin/cm-finish.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const commander = require('commander')
|
|
3
|
+
const { commands, runCommand } = require('../src')
|
|
4
|
+
|
|
5
|
+
commander
|
|
6
|
+
.usage('cmfinish [options]')
|
|
7
|
+
.alias('cm finish')
|
|
8
|
+
.option('-t, --unit-test', 'Run unit test', (v, t) => t + 1, 0)
|
|
9
|
+
.option('-c, --cucumber', 'Run cucumber', (v, t) => t + 1, 0)
|
|
10
|
+
.option('-v, --verbose', 'Enable verbose log', (v, t) => t + 1, 0)
|
|
11
|
+
.parse(process.argv)
|
|
12
|
+
|
|
13
|
+
runCommand(commands.Finish, commander)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const commander = require('commander')
|
|
3
|
+
const { commands, runCommand } = require('../src')
|
|
4
|
+
|
|
5
|
+
commander
|
|
6
|
+
.usage('cmpublishpages [options]')
|
|
7
|
+
.alias('cm publish-pages')
|
|
8
|
+
.option('-s, --source <source>', 'Publish given directory on the github pages')
|
|
9
|
+
.parse(process.argv)
|
|
10
|
+
|
|
11
|
+
runCommand(commands.PublishPages, commander)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const commander = require('commander')
|
|
3
|
+
const { commands, runCommand } = require('../src')
|
|
4
|
+
|
|
5
|
+
commander
|
|
6
|
+
.usage('cmpublish [options]')
|
|
7
|
+
.alias('cm publish')
|
|
8
|
+
.option('-t, --unit-test', 'Run unit test', (v, t) => t + 1, 0)
|
|
9
|
+
.option('-c, --cucumber', 'Run cucumber', (v, t) => t + 1, 0)
|
|
10
|
+
.option('-f, --force', 'Force push', (v, t) => t + 1, 0)
|
|
11
|
+
.option('-v, --verbose', 'Enable verbose log', (v, t) => t + 1, 0)
|
|
12
|
+
.parse(process.argv)
|
|
13
|
+
|
|
14
|
+
runCommand(commands.Push, commander)
|
package/bin/cm-push.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const commander = require('commander')
|
|
3
|
+
const { commands, runCommand } = require('../src')
|
|
4
|
+
|
|
5
|
+
commander
|
|
6
|
+
.usage('cmpush [options]')
|
|
7
|
+
.alias('cm push')
|
|
8
|
+
.option('-t, --unit-test', 'Run unit test', (v, t) => t + 1, 0)
|
|
9
|
+
.option('-c, --cucumber', 'Run cucumber', (v, t) => t + 1, 0)
|
|
10
|
+
.option('-f, --force', 'Force push', (v, t) => t + 1, 0)
|
|
11
|
+
.option('-v, --verbose', 'Enable verbose log', (v, t) => t + 1, 0)
|
|
12
|
+
.parse(process.argv)
|
|
13
|
+
|
|
14
|
+
runCommand(commands.Push, commander)
|
package/bin/cm-rebase.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const commander = require('commander')
|
|
3
|
+
const { commands, runCommand } = require('../src')
|
|
4
|
+
|
|
5
|
+
commander
|
|
6
|
+
.usage('cmrebase [options]')
|
|
7
|
+
.alias('cm rebase')
|
|
8
|
+
.option('-t, --unit-test', 'Run unit test', (v, t) => t + 1, 0)
|
|
9
|
+
.option('-c, --cucumber', 'Run cucumber', (v, t) => t + 1, 0)
|
|
10
|
+
.option('-f, --force', 'Force push', (v, t) => t + 1, 0)
|
|
11
|
+
.option('-v, --verbose', 'Enable verbose log', (v, t) => t + 1, 0)
|
|
12
|
+
.parse(process.argv)
|
|
13
|
+
|
|
14
|
+
runCommand(commands.Rebase, commander)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const commander = require('commander')
|
|
3
|
+
const { commands, runCommand } = require('../src')
|
|
4
|
+
|
|
5
|
+
commander
|
|
6
|
+
.usage('cmrepublish [options]')
|
|
7
|
+
.alias('cm republish')
|
|
8
|
+
.option('-v, --verbose', 'Enable verbose log', (v, t) => t + 1, 0)
|
|
9
|
+
.parse(process.argv)
|
|
10
|
+
|
|
11
|
+
runCommand(commands.Republish, commander)
|
package/bin/cm-start.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const commander = require('commander')
|
|
3
|
+
const { commands, runCommand } = require('../src')
|
|
4
|
+
|
|
5
|
+
const options = {}
|
|
6
|
+
|
|
7
|
+
commander
|
|
8
|
+
.usage('cmstart [branchName]')
|
|
9
|
+
.arguments('[branchName]')
|
|
10
|
+
.alias('cm start')
|
|
11
|
+
.option('-v, --verbose', 'Enable verbose log', (v, t) => t + 1, 0)
|
|
12
|
+
.action((branchName) => {
|
|
13
|
+
options.branchName = branchName
|
|
14
|
+
})
|
|
15
|
+
.parse(process.argv)
|
|
16
|
+
|
|
17
|
+
runCommand(commands.Start, {
|
|
18
|
+
...options,
|
|
19
|
+
verbose: commander.verbose
|
|
20
|
+
})
|
package/bin/cm.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const commander = require('commander')
|
|
4
|
+
const cliPkg = require('../package.json')
|
|
5
|
+
|
|
6
|
+
commander
|
|
7
|
+
.version(cliPkg.version)
|
|
8
|
+
.command('finish', 'Rebase the branch, add [MEP] tag on latest commit and push it')
|
|
9
|
+
.command('changelog', 'Update changelog file for the project')
|
|
10
|
+
.command('start', 'Create a new branch from the latest commit of production branch')
|
|
11
|
+
.command('push', 'Rebase the current branch from production and push all commit')
|
|
12
|
+
.command('publish', 'Rebase the current branch from production and push all commit (alias of cm push)')
|
|
13
|
+
.command('republish', 'Rebase all branches from production')
|
|
14
|
+
.command('publish-pages', 'Publish github pages')
|
|
15
|
+
.command('deploy', 'Deploy app on docker hub/Heroku')
|
|
16
|
+
.command('rebase', 'Rebase the current branch from production')
|
|
17
|
+
.command('fetch', 'Download objects and refs from repository (--all and --prune)')
|
|
18
|
+
.command('clean', 'Clean deployed docker image on Docker hub')
|
|
19
|
+
.command('config', 'Configure git workspace with expected information')
|
|
20
|
+
.parse(process.argv)
|
package/bin/cmexpedit.sh
ADDED
package/bin/cmpull.sh
ADDED
package/bin/cmrelease.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cmflow/cli",
|
|
3
|
+
"version": "0.65.1",
|
|
4
|
+
"description": "An awesome Git Flow",
|
|
5
|
+
"author": "camfou",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"email": "camfou@gmail.com",
|
|
8
|
+
"main": "./src/index.js",
|
|
9
|
+
"module": "./src/main.js",
|
|
10
|
+
"private": false,
|
|
11
|
+
"bin": {
|
|
12
|
+
"cm": "./bin/cm.js",
|
|
13
|
+
"cmfetch": "bin/cm-fetch.js",
|
|
14
|
+
"cmrebase": "bin/cm-rebase.js",
|
|
15
|
+
"cmfinish": "bin/cm-finish.js",
|
|
16
|
+
"cmexpedit": "./bin/cmexpedit.sh",
|
|
17
|
+
"cmpublish": "bin/cm-publish.js",
|
|
18
|
+
"cmrepublish": "bin/cm-republish.js",
|
|
19
|
+
"cmpush": "bin/cm-push.js",
|
|
20
|
+
"cmpull": "./bin/cmpull.sh",
|
|
21
|
+
"cmstart": "bin/cm-start.js",
|
|
22
|
+
"checkfeatures": "./bin/checkfeatures.sh",
|
|
23
|
+
"cmrelease": "./bin/cmrelease.js",
|
|
24
|
+
"cmchangelog": "bin/cm-changelog.js",
|
|
25
|
+
"cmconfig": "bin/cm-config.js"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@samverschueren/stream-to-observable": "0.3.1",
|
|
29
|
+
"axios": "^0.21.0",
|
|
30
|
+
"chalk": "^4.1.0",
|
|
31
|
+
"commander": "5.1.0",
|
|
32
|
+
"conventional-changelog": "3.1.24",
|
|
33
|
+
"conventional-changelog-cli": "2.1.1",
|
|
34
|
+
"esm": "3.2.25",
|
|
35
|
+
"execa": "^4.0.2",
|
|
36
|
+
"figures": "3.2.0",
|
|
37
|
+
"has-yarn": "^2.1.0",
|
|
38
|
+
"inquirer": "7.3.3",
|
|
39
|
+
"listr": "0.14.3",
|
|
40
|
+
"lodash": "4.17.20",
|
|
41
|
+
"rxjs": "6.6.3",
|
|
42
|
+
"semantic-release": "17.3.0",
|
|
43
|
+
"semver": "7.3.4",
|
|
44
|
+
"split": "1.0.1"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@babel/core": "7.12.10",
|
|
48
|
+
"@babel/preset-env": "7.12.11",
|
|
49
|
+
"babel-jest": "26.6.3",
|
|
50
|
+
"eslint": "7.15.0",
|
|
51
|
+
"eslint-config-standard": "16.0.2",
|
|
52
|
+
"eslint-plugin-import": "2.22.1",
|
|
53
|
+
"eslint-plugin-node": "11.1.0",
|
|
54
|
+
"eslint-plugin-promise": "4.2.1",
|
|
55
|
+
"eslint-plugin-standard": "4.0.2",
|
|
56
|
+
"husky": "4.3.6",
|
|
57
|
+
"jest": "^24.9.0",
|
|
58
|
+
"jest-junit": "^11.0.1",
|
|
59
|
+
"lint-staged": "10.5.3"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"@semantic-release/commit-analyzer": "8.0.1",
|
|
63
|
+
"@semantic-release/github": "7.0.7",
|
|
64
|
+
"@semantic-release/release-notes-generator": "9.0.1"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"test": "yarn lint && yarn test_unit",
|
|
68
|
+
"test_unit": "jest",
|
|
69
|
+
"lint": "eslint -c .eslintrc src/**",
|
|
70
|
+
"lint_ci": "eslint -c .eslintrc src/** --format junit --output-file ./reports/eslint.xml",
|
|
71
|
+
"lint_fix": "eslint -c .eslintrc src/** --fix",
|
|
72
|
+
"release": "node bin/cmrelease.js",
|
|
73
|
+
"release_dry_run": "node bin/cmrelease.js --dry-run",
|
|
74
|
+
"build_changelog": "node bin/cm-changelog.js"
|
|
75
|
+
},
|
|
76
|
+
"husky": {
|
|
77
|
+
"hooks": {
|
|
78
|
+
"pre-commit": "lint-staged",
|
|
79
|
+
"post-commit": "git update-index --again"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"lint-staged": {
|
|
83
|
+
"*.js": [
|
|
84
|
+
"eslint -c .eslintrc --fix",
|
|
85
|
+
"git add"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
process.env.PRODUCTION_BRANCH = 'master'
|
|
2
|
+
process.env.DEVELOP_BRANCH = 'master'
|
|
3
|
+
process.env.DEPLOY_ON_DOCKER = 'false'
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
branch: 'master',
|
|
7
|
+
plugins: [
|
|
8
|
+
'./semantic'
|
|
9
|
+
],
|
|
10
|
+
verifyConditions: ['./semantic'],
|
|
11
|
+
analyzeCommits: ['./semantic'],
|
|
12
|
+
verifyRelease: ['./semantic'],
|
|
13
|
+
generateNotes: ['./semantic'],
|
|
14
|
+
prepare: ['./semantic'],
|
|
15
|
+
publish: ['./semantic'],
|
|
16
|
+
success: ['./semantic'],
|
|
17
|
+
fail: ['./semantic'],
|
|
18
|
+
npmPublish: false
|
|
19
|
+
}
|
package/semantic.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./src/semantic-release/actions')
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import conventionalChangelog from 'conventional-changelog'
|
|
2
|
+
import { Observable } from 'rxjs'
|
|
3
|
+
import { createWriteStream } from 'fs'
|
|
4
|
+
|
|
5
|
+
export class Changelog {
|
|
6
|
+
mapContext (commander, config) {
|
|
7
|
+
return {
|
|
8
|
+
preset: commander.preset || 'angular',
|
|
9
|
+
releaseCount: commander.releaseCount || 0,
|
|
10
|
+
outfile: `${process.cwd()}/CHANGELOG.md`,
|
|
11
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
12
|
+
tagPrefix: (config.tagFormat || commander.tagPrefix || '').replace('${version}', '')
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exec ({ preset, releaseCount, outfile, tagPrefix }) {
|
|
17
|
+
const writableStream = createWriteStream(outfile, { encoding: 'utf8' })
|
|
18
|
+
|
|
19
|
+
return new Observable(observer => {
|
|
20
|
+
const stream = conventionalChangelog({
|
|
21
|
+
preset,
|
|
22
|
+
releaseCount,
|
|
23
|
+
path: `${process.cwd()}/package.json`,
|
|
24
|
+
tagPrefix
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
stream.pipe(writableStream)
|
|
28
|
+
|
|
29
|
+
stream.on('error', (err) => {
|
|
30
|
+
observer.error(err)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
stream.on('end', () => {
|
|
34
|
+
observer.complete()
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getTasks (ctx) {
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
title: 'Generate changelog',
|
|
43
|
+
task: () => this.exec(ctx)
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
import chalk from 'chalk'
|
|
3
|
+
import figures from 'figures'
|
|
4
|
+
import { dockerCleanTags } from '../semantic-release/utils/docker-clean-tags'
|
|
5
|
+
|
|
6
|
+
export class Clean {
|
|
7
|
+
mapContext (commander, context) {
|
|
8
|
+
return {
|
|
9
|
+
...context
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
prompt (context) {
|
|
14
|
+
return []
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getTasks (context) {
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
title: 'Clean docker tags',
|
|
21
|
+
task: () => dockerCleanTags(context)
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
success (context) {
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.log(chalk.green(figures.tick), 'Docker tags cleaned')
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { configureGitWorkspace, getConfig } from '../common'
|
|
2
|
+
|
|
3
|
+
export class Config {
|
|
4
|
+
mapContext (commander, context) {
|
|
5
|
+
return {
|
|
6
|
+
...context,
|
|
7
|
+
config: getConfig()
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
prompt () {
|
|
12
|
+
return []
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getTasks (context) {
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
title: 'Configure workspace',
|
|
19
|
+
task: () => configureGitWorkspace(context)
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
import figures from 'figures'
|
|
3
|
+
import { deployOnDockerHub, deployOnHeroku } from '../semantic-release/utils/docker-publish'
|
|
4
|
+
import { getConfig } from '../common'
|
|
5
|
+
|
|
6
|
+
export class Deploy {
|
|
7
|
+
mapContext (commander, context) {
|
|
8
|
+
return {
|
|
9
|
+
...context,
|
|
10
|
+
target: commander.target,
|
|
11
|
+
config: getConfig()
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
prompt (context) {
|
|
16
|
+
return []
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getTasks (context) {
|
|
20
|
+
return [
|
|
21
|
+
{
|
|
22
|
+
title: `Deploy on ${context.target}`,
|
|
23
|
+
task: () => {
|
|
24
|
+
switch (context.target) {
|
|
25
|
+
case 'docker':
|
|
26
|
+
return deployOnDockerHub(context)
|
|
27
|
+
case 'heroku':
|
|
28
|
+
return deployOnHeroku(context)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
success (context) {
|
|
36
|
+
// eslint-disable-next-line no-console
|
|
37
|
+
console.log(chalk.green(figures.tick), 'Github pages deployed')
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { refreshRepository } from './tasks/refresh-repository'
|
|
2
|
+
|
|
3
|
+
export class Fetch {
|
|
4
|
+
mapContext (commander, context) {
|
|
5
|
+
return {
|
|
6
|
+
...context,
|
|
7
|
+
output: []
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getTasks (context) {
|
|
12
|
+
return [
|
|
13
|
+
refreshRepository(context)
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
success (context) {
|
|
18
|
+
// eslint-disable-next-line no-console
|
|
19
|
+
console.log(context.output.filter(l => !l.match('Fetching')).join('\n'))
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
import figures from 'figures'
|
|
3
|
+
import { Rebase } from './rebase'
|
|
4
|
+
import { git } from '../common/cli/git'
|
|
5
|
+
import { pushBranch } from './tasks/push-branch'
|
|
6
|
+
|
|
7
|
+
export class Finish extends Rebase {
|
|
8
|
+
mapContext (commander, context) {
|
|
9
|
+
return {
|
|
10
|
+
...super.mapContext(commander, context),
|
|
11
|
+
checkStatus: true,
|
|
12
|
+
force: true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
verifyConditions (context) {
|
|
17
|
+
// Can't finish a production branch
|
|
18
|
+
if (context.featureBranch === context.fromBranch) {
|
|
19
|
+
// eslint-disable-next-line no-console
|
|
20
|
+
console.error(chalk.red(`${figures.cross} ${context.fromBranch} cannot be finished`))
|
|
21
|
+
process.exit(1)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
getTasks (context) {
|
|
26
|
+
return [
|
|
27
|
+
...super.getTasks(context),
|
|
28
|
+
{
|
|
29
|
+
title: `Add ${context.RELEASE_CANDIDATE_TAG} on last commit`,
|
|
30
|
+
task () {
|
|
31
|
+
const message = `${git.getLastCommitMsg()} ${context.RELEASE_CANDIDATE_TAG}`
|
|
32
|
+
|
|
33
|
+
return git.commit('--amend', '-m', message).toObservable()
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
pushBranch(context)
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
success (context) {
|
|
41
|
+
// eslint-disable-next-line no-console
|
|
42
|
+
console.log(chalk.green(figures.tick), 'Branch', chalk.green(context.featureBranch), 'is finished')
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './changelog'
|
|
2
|
+
export * from './finish'
|
|
3
|
+
export * from './fetch'
|
|
4
|
+
export * from './push'
|
|
5
|
+
export * from './start'
|
|
6
|
+
export * from './republish'
|
|
7
|
+
export * from './rebase'
|
|
8
|
+
export * from './publish-pages'
|
|
9
|
+
export * from './clean'
|
|
10
|
+
export * from './deploy'
|