@cmflow/cli
v3.4.0
Published
An awesome Git Flow
Readme
Club Med Flow command-line tooling for Git Flow, Semantic Release and publishing Yarn workspace packages.
Installation
Install globally for the Git Flow commands:
npm install --global @cmflow/cli
cm --helpInstall it as a development dependency when a project uses its release plugins or package-artifact commands:
npm install --save-dev @cmflow/cliGit Flow commands
cm provides commands for starting, finishing, pushing, pulling, merging, rebasing and deploying branches, plus release and Jira helpers.
cm --help
cm start --help
cm finish --help
cm deploy --helpJira releases
jira-releases lists release versions for a Jira project and component, generates delivery notes, and can mark versions as released.
cm jira-releases --project-id <PROJECT_KEY> --component <COMPONENT> --tag <VERSION> [--update] [--verbose]It requires JIRA_API, JIRA_EMAIL and JIRA_TOKEN. Directus workflow support is optional and uses DIRECTUS_URL, DIRECTUS_FLOW_ID and DIRECTUS_ACCESS_TOKEN. Run without --update first to review the selected versions.
Monorepo package artifacts
cm packages build creates the npm-ready artifacts of a Yarn-workspace monorepo. It performs the following steps:
- Cleans the configured output directory.
- Runs the configured build script.
- Copies non-private workspace packages into
dist/<package-name>. - Writes package manifests with the release version and rewritten internal dependencies.
cm packages build
cm packages build --version 3.4.0-alpha.3The default output is dist. Private workspaces are never included in the artifacts or published. If --version is omitted, the current root package.json version is retained.
cm packages build is invoked by the Semantic Release prepare step for the cmflow bump method. Do not add it to the release command: Semantic Release owns the artifact lifecycle.
Use a dedicated script only to verify artifact generation locally or in a pre-release CI check:
{
"scripts": {
"artifacts:prepare": "yarn build && cm packages build"
}
}flow configuration
Configure package build and publication defaults in the root package.json:
{
"workspaces": ["packages/*"],
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"flow": {
"outputDir": "dist",
"buildCmd": "build",
"npmAccess": "public",
"npmDistTag": "next",
"npmFallbackDistTag": "latest",
"registries": [],
"skipNpmPublish": false,
"trustedPublishing": true
}
}| Option | Default | Purpose |
| -------------------- | ------------------- | ---------------------------------------------------------------------- |
| outputDir | dist | Destination directory for generated package artifacts. |
| buildCmd | build | Root package script run by cm packages build. |
| npmAccess | public | npm access passed to npm publish. |
| npmDistTag | publishConfig.tag | Dist-tag written in generated package manifests. |
| npmFallbackDistTag | latest | Tag used when npm rejects an implicit latest tag. |
| registries | [] | Additional registries to publish to. |
| skipNpmPublish | false | Builds release artifacts but skips npm publication. |
| trustedPublishing | false | Enables npm trusted publishing; no npmjs token is written to .npmrc. |
A workspace package may set its own flow.registries array to replace the root registries for that package.
Semantic Release
Use cmrelease to run Semantic Release:
{
"scripts": {
"release": "cmrelease",
"release:dry_run": "cmrelease --dry-run"
}
}For a workspace release, the publish sequence must push the release branch and tag before npm publication:
import { defineConfig } from "@cmflow/cli";
export default defineConfig({
prepare: ["@cmflow/cli/semantic/core/prepare/bump-version", "@cmflow/cli/semantic/core/prepare/commit"],
publish: [
"@cmflow/cli/semantic/core/push-release",
"@cmflow/cli/semantic/core/publish-packages",
"@cmflow/cli/semantic/core/sync-repository"
],
npmPublish: false
});push-release pushes the branch and release tag first. publish-packages publishes only non-private generated artifacts. It supports npmjs, GitHub Packages and additional registries; trustedPublishing uses npm’s OIDC-based trusted publishing flow. During a dry run, packages are packed but never published.
For CircleCI, export the OIDC token in each job that runs a real release:
- run:
name: Cm Release
command: |
export NPM_ID_TOKEN=$(circleci run oidc get --claims '{"aud":"npm:registry.npmjs.org"}')
yarn releaseEach npm package must also be configured with a CircleCI trusted publisher and allow the npm publish action. The Organization ID, Project ID, Pipeline definition ID and VCS origin configured on npm must match the CircleCI project exactly. npm’s CircleCI trusted publishing guide details the required values.
Atlas
API-to-backend catalogue tooling is published separately as @cmflow/atlas. Its project configuration is atlas.config.ts; it does not belong in this repository or in this CLI package.
Development
From the monorepo root:
yarn workspace @cmflow/cli build
yarn workspace @cmflow/cli test
yarn checkLicense
The MIT License (MIT) Copyright (c) 2016 - Today ClubMed
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
