@cmflow/cli 2.1.1 → 2.2.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/.yarn/install-state.gz +0 -0
- package/README.md +34 -0
- package/package.json +1 -1
- package/src/semantic/core/sync-repository.js +10 -2
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -155,6 +155,40 @@ export default defineConfig({
|
|
|
155
155
|
})
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
+
### Sync repository plugin (@cmflow/cli/semantic/core/sync-repository)
|
|
159
|
+
|
|
160
|
+
This plugin synchronizes your remote repository after publishing:
|
|
161
|
+
- It pushes the current branch to the remote (with --set-upstream) if it is part of the candidate branches.
|
|
162
|
+
- It then synchronizes the development branch with the production branch if they are different.
|
|
163
|
+
|
|
164
|
+
Options:
|
|
165
|
+
- pluginOptions.branches: Allows you to explicitly define the list of branches that must be pushed to synchronize the remote. Example:
|
|
166
|
+
|
|
167
|
+
```javascript
|
|
168
|
+
export default defineConfig({
|
|
169
|
+
publish: [
|
|
170
|
+
[
|
|
171
|
+
'@cmflow/cli/semantic/core/conditional',
|
|
172
|
+
{
|
|
173
|
+
run: [
|
|
174
|
+
[
|
|
175
|
+
'@cmflow/cli/semantic/core/sync-repository',
|
|
176
|
+
{ branches: ['main', 'develop', 'release'] }
|
|
177
|
+
],
|
|
178
|
+
'@semantic-release/github'
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
]
|
|
183
|
+
})
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Default behavior:
|
|
187
|
+
- If pluginOptions.branches is not provided, the plugin falls back to semantic-release's branches configuration (options.branches). Values can be strings or branch objects; in the latter case, only the branch name is used.
|
|
188
|
+
|
|
189
|
+
Notes:
|
|
190
|
+
- PRODUCTION_BRANCH and DEVELOP_BRANCH are defined via the CmFlow configuration (flow.branch.production and flow.branch.develop) and are used for the synchronization between production and develop.
|
|
191
|
+
|
|
158
192
|
### Build and E2E Test
|
|
159
193
|
|
|
160
194
|
CmFlow release are able to run `build` and `test_e2e` task during the prepare step. It's useful when you want to
|
package/package.json
CHANGED
|
@@ -20,8 +20,16 @@ export default async function syncRepository(pluginConfig, context) {
|
|
|
20
20
|
|
|
21
21
|
await asyncCatchError(() => git.fetch());
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const candidateBranches =
|
|
24
|
+
pluginConfig.branches ||
|
|
25
|
+
context.options.branches?.map((branch) => {
|
|
26
|
+
return branch.name || branch;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
logger.info(`Candidate branches to sync: ${candidateBranches.join(", ")}`);
|
|
30
|
+
|
|
31
|
+
if (candidateBranches.includes(context.branch.name)) {
|
|
32
|
+
logger.info(`Push ${context.branch.name}`);
|
|
25
33
|
|
|
26
34
|
await asyncCatchError(() => {
|
|
27
35
|
logger.info(`git push --quiet --set-upstream ${ORIGIN} ${context.branch.name}`);
|