@cmflow/cli 2.0.0-alpha.10 → 2.0.0-alpha.12

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.
Binary file
package/README.md CHANGED
@@ -47,34 +47,34 @@ Then create `release.config.js` with this configuration:
47
47
  import { defineConfig } from '@cmflow/cli'
48
48
 
49
49
  export default defineConfig({
50
- verifyConditions: ['@cmflow/cli/semantic/verify-conditions'],
51
- analyzeCommits: ['@cmflow/cli/semantic/analyze-commits'],
52
- verifyRelease: ['@cmflow/cli/semantic/verify-release'],
50
+ verifyConditions: ['@cmflow/cli/semantic/core/verify-conditions'],
51
+ analyzeCommits: ['@cmflow/cli/semantic/core/analyze-commits'],
52
+ verifyRelease: ['@cmflow/cli/semantic/core/verify-release'],
53
53
  generateNotes: [
54
54
  [
55
55
  "@cmflow/cli/semantic/conditional", // add this task to trigger build npm task
56
56
  {
57
57
  // when: (context) => context.branch.type === "release" // default condition to run the task
58
- run: ["@semantic-release/release-notes-generator"]
58
+ run: ["@semantic-release/core/release-notes-generator"]
59
59
  }
60
60
  ]
61
61
  ],
62
62
  prepare: [
63
- '@cmflow/cli/semantic/prepare/bump-version',
63
+ '@cmflow/cli/semantic/core/prepare/bump-version',
64
64
  [
65
- '@cmflow/cli/semantic/prepare/run', // add this task to trigger build npm task
65
+ '@cmflow/cli/semantic/core/prepare/run', // add this task to trigger build npm task
66
66
  {
67
67
  command: 'build'
68
68
  }
69
69
  ],
70
70
  [
71
- '@cmflow/cli/semantic/prepare/run', // add this task to trigger build npm task
71
+ '@cmflow/cli/semantic/core/prepare/run', // add this task to trigger build npm task
72
72
  {
73
73
  command: 'test_e2e'
74
74
  }
75
75
  ],
76
76
  [
77
- '@cmflow/cli/semantic/conditional', // add this task to trigger build npm task
77
+ '@cmflow/cli/semantic/core/conditional', // add this task to trigger build npm task
78
78
  {
79
79
  // when: (context) => context.branch.type === "release" // default condition to run the task
80
80
  run: [
@@ -85,26 +85,26 @@ export default defineConfig({
85
85
  ],
86
86
  publish: [
87
87
  [
88
- '@cmflow/cli/semantic/conditional',
88
+ '@cmflow/cli/semantic/core/conditional',
89
89
  {
90
90
  // when: (context) => context.branch.type === "release" // default condition to run the task
91
91
  run: [
92
- '@cmflow/cli/semantic/publish/sync-repository',
92
+ '@cmflow/cli/semantic/core/publish/sync-repository',
93
93
  '@semantic-release/github'
94
94
  ] // only run if the conditional rule is true
95
95
  }
96
96
  ],
97
97
  [
98
- '@cmflow/cli/semantic/conditional', // run process.exit(0) if the branch is not a release branch - legacy: maybe not necessary now all task are conditional
98
+ '@cmflow/cli/semantic/core/conditional', // run process.exit(0) if the branch is not a release branch - legacy: maybe not necessary now all task are conditional
99
99
  {
100
100
  when: (context) => context.branch.type !== 'release',
101
- run: '@cmflow/cli/semantic/publish/exit.js'
101
+ run: '@cmflow/cli/semantic/core/publish/exit'
102
102
  }
103
103
  ]
104
104
  ],
105
105
  success: [
106
106
  [
107
- '@cmflow/cli/semantic/conditional',
107
+ '@cmflow/cli/semantic/core/conditional',
108
108
  {
109
109
  // when: (context) => context.branch.type === "release" // default condition to run the task
110
110
  run: '@semantic-release/github' // only run if the conditional rule is true
@@ -113,7 +113,7 @@ export default defineConfig({
113
113
  ],
114
114
  fail: [
115
115
  [
116
- "@cmflow/cli/semantic/conditional",
116
+ "@cmflow/cli/semantic/core/conditional",
117
117
  {
118
118
  // when: (context) => context.branch.type === "release" // default condition to run the task
119
119
  run: '@semantic-release/github' // only run if the conditional rule is true
@@ -139,7 +139,7 @@ Now, CmFlow and semantic release are correctly installed on your project.
139
139
 
140
140
  ### Condition step (publish, success, fail)
141
141
 
142
- CMFlow provide a `@cmflow/cli/semantic/conditional` task to run one task or many task only if a condition is true. The condition is a
142
+ CMFlow provide a `@cmflow/cli/semantic/core/conditional` task to run one task or many task only if a condition is true. The condition is a
143
143
  function that takes the semantic context as parameter and return a boolean.
144
144
 
145
145
  You can customize the condition to run the task by adding a `when` property to the configuration object.
@@ -147,7 +147,7 @@ You can customize the condition to run the task by adding a `when` property to t
147
147
  ```javascript
148
148
  export default defineConfig({
149
149
  publish: [
150
- '@cmflow/cli/semantic/conditional',
150
+ '@cmflow/cli/semantic/core/conditional',
151
151
  {
152
152
  when: (context) => context.branch.type === 'release', // default condition to run the task
153
153
  run: ['@semantic-release/github', '@semantic-release/github'] // only run if the conditional rule is true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmflow/cli",
3
- "version": "2.0.0-alpha.10",
3
+ "version": "2.0.0-alpha.12",
4
4
  "description": "An awesome Git Flow",
5
5
  "author": "camfou",
6
6
  "license": "MIT",
@@ -3,7 +3,7 @@ import { git } from "./cli/git.js";
3
3
  export function configureGitWorkspace(context) {
4
4
  const {
5
5
  logger,
6
- config: { SCM_TOKEN, REPOSITORY_URL, ORIGIN, GIT_USER_NAME, GIT_USER_EMAIL }
6
+ config: { SCM_TOKEN, REPOSITORY_URL, ORIGIN, GIT_USER_NAME, GIT_USER_EMAIL, GIT_DISABLE_SSL }
7
7
  } = context;
8
8
 
9
9
  if (GIT_USER_NAME && GIT_USER_EMAIL) {
@@ -11,6 +11,11 @@ export function configureGitWorkspace(context) {
11
11
  git.config("--global", "user.email", `"${GIT_USER_EMAIL}"`);
12
12
  }
13
13
 
14
+ if (GIT_DISABLE_SSL) {
15
+ logger.info("Disable SSL verification");
16
+ git.config("--global", "http.sslVerify", "false");
17
+ }
18
+
14
19
  if (SCM_TOKEN) {
15
20
  const repository = REPOSITORY_URL.replace("https://", "");
16
21
 
@@ -74,8 +74,20 @@ export function getCI() {
74
74
  export function getConfig() {
75
75
  const pkg = getPackageJson();
76
76
  const [owner, projectName] = pkg.name.replace(/^@/, "").split("/");
77
- const { PROJECT_NAME, DOCKER_HUB_ID, DOCKER_HUB_PWD, REF_COMMIT, GH_TOKEN, SCM_TOKEN, REPOSITORY_URL, GIT_USER_NAME, GIT_USER_EMAIL } =
78
- process.env;
77
+ const {
78
+ PROJECT_NAME,
79
+ DOCKER_HUB_ID,
80
+ DOCKER_HUB_PWD,
81
+ REF_COMMIT,
82
+ GH_TOKEN,
83
+ SCM_TOKEN,
84
+ REPOSITORY_URL,
85
+ GIT_DISABLE_SSL,
86
+ GIT_USER_NAME,
87
+ GIT_USER_EMAIL,
88
+ GITLAB_USER_EMAIL,
89
+ GITLAB_USER_NAME
90
+ } = process.env;
79
91
 
80
92
  const HAS_YARN = hasYarn();
81
93
  const IS_YARN_BERRY = HAS_YARN ? fs.existsSync(join(process.cwd(), ".yamlrc.yml")) : false;
@@ -113,8 +125,9 @@ export function getConfig() {
113
125
  GH_TOKEN,
114
126
  SCM_TOKEN: GH_TOKEN || SCM_TOKEN,
115
127
  REPOSITORY_URL: get(pkg, "repository.url", get(pkg, "repository", REPOSITORY_URL)),
116
- GIT_USER_NAME,
117
- GIT_USER_EMAIL,
128
+ GIT_USER_NAME: GIT_USER_NAME || GITLAB_USER_NAME,
129
+ GIT_USER_EMAIL: GIT_USER_EMAIL || GITLAB_USER_EMAIL,
130
+ GIT_DISABLE_SSL,
118
131
  BUMP_METHOD,
119
132
  WORKSPACES: pkg.workspaces || [],
120
133
  ...getCI()
@@ -23,7 +23,7 @@ export function fail(pluginConfig, context) {
23
23
  async function runAll(step, pluginConfig, context, defaultCondition) {
24
24
  context.config = getConfig();
25
25
 
26
- const condition = pluginConfig.when !== undefined ? pluginConfig.if(context) : defaultCondition;
26
+ const condition = pluginConfig.when !== undefined ? pluginConfig.when(context) : defaultCondition;
27
27
 
28
28
  if (condition && pluginConfig.run) {
29
29
  const tasks = [].concat(pluginConfig.run);