relizy 1.9.0 → 1.10.0

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 CHANGED
@@ -58,6 +58,7 @@ Imagine you have multiple packages in your project (like a box with several toys
58
58
  - ⚙️ Multiple configuration files support for different release workflows
59
59
  - 🔧 Support for npm, yarn, pnpm, and bun (auto-detected)
60
60
  - 📱 Social media integration (Twitter & Slack) for release announcements
61
+ - 🧹 Built-in commit linting with your Relizy config, a commitlint replacement (`relizy commitlint`)
61
62
 
62
63
  ## 📚 Documentation
63
64
 
@@ -136,6 +137,15 @@ Automatically post release announcements to Twitter and Slack when you ship new
136
137
  relizy release --minor # Automatically posts to configured social channels
137
138
  ```
138
139
 
140
+ ### Commit Linting
141
+
142
+ Lint your commit messages with your Relizy config: the same parser, types and packages as your releases, and commit bodies checked as they will appear in your changelogs. No commitlint config to keep in sync.
143
+
144
+ ```bash
145
+ relizy commitlint --install # Writes the commit-msg hook
146
+ relizy commitlint # Lints the commits of the pull request in CI
147
+ ```
148
+
139
149
  ## 📖 Learn More
140
150
 
141
151
  This README covers the basics to get you started quickly. For detailed documentation, configuration options, and advanced features, visit our full documentation:
@@ -148,6 +158,7 @@ Topics covered in the documentation:
148
158
  - Monorepo versioning strategies (unified, selective, independent)
149
159
  - CI/CD integration (GitHub Actions, GitLab CI)
150
160
  - Social media integration (Twitter & Slack)
161
+ - [Commit linting](https://relizy.dev/commitlint/)
151
162
  - Custom registries and private packages
152
163
  - Multiple configuration files
153
164
  - And much more...
package/dist/cli.mjs CHANGED
@@ -5,32 +5,34 @@ import process from 'node:process';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { printBanner, logger } from '@maz-ui/node';
7
7
  import { Command, Option } from 'commander';
8
- import { aJ as isInCI, a0 as getCIName, m as bump, o as changelog, b1 as publish, a$ as providerRelease, bn as social, a_ as prComment, ba as release } from './shared/relizy.CN-7XcP7.mjs';
8
+ import { b6 as isInCI, ad as getCIName, o as bump, q as changelog, bs as publish, bq as providerRelease, bS as social, u as commitlint, bp as prComment, bC as release } from './shared/relizy.BY0-QHlV.mjs';
9
9
  import 'node:child_process';
10
+ import 'node:module';
11
+ import 'mdast-util-from-markdown';
12
+ import 'mdast-util-gfm';
13
+ import 'micromark-extension-gfm';
14
+ import 'fast-glob';
15
+ import 'changelogen';
10
16
  import '@maz-ui/utils/helpers/formatJson';
11
17
  import 'c12';
12
- import 'changelogen';
13
18
  import 'defu';
14
19
  import '@inquirer/prompts';
15
20
  import 'micromatch';
16
21
  import 'semver';
17
22
  import '@maz-ui/utils/helpers/getErrorMessage';
18
- import 'fast-glob';
19
23
  import '@maz-ui/utils/helpers/upperFirst';
20
24
  import 'convert-gitmoji';
21
25
  import 'node-fetch-native';
22
- import 'mdast-util-from-markdown';
23
- import 'mdast-util-gfm';
24
- import 'micromark-extension-gfm';
25
26
 
26
27
  const hasSilentFlag = process.argv.includes("--log-level") && process.argv.includes("silent");
28
+ const isCommitlint = process.argv[2] === "commitlint";
27
29
  const __filename$1 = fileURLToPath(import.meta.url);
28
30
  const __dirname$1 = dirname(__filename$1);
29
31
  const packageJson = JSON.parse(
30
32
  readFileSync(join(__dirname$1, "../package.json"), "utf-8")
31
33
  );
32
34
  const version = packageJson.version;
33
- if (!hasSilentFlag) {
35
+ if (!hasSilentFlag && !isCommitlint) {
34
36
  printBanner({
35
37
  name: "Relizy",
36
38
  version: `v${version}`,
@@ -44,7 +46,7 @@ if (!hasSilentFlag) {
44
46
  }
45
47
  });
46
48
  }
47
- if (isInCI()) {
49
+ if (isInCI() && !isCommitlint) {
48
50
  logger.log(`Running in CI: ${getCIName()}`);
49
51
  } else {
50
52
  logger.debug("Running locally");
@@ -168,6 +170,36 @@ program.command("social").description("Post release announcements to social medi
168
170
  process.exit(1);
169
171
  }
170
172
  });
173
+ program.command("commitlint").description("Lint commit messages with the relizy config (types, scopes, changelog rendering)").option("--edit [file]", "Lint the message of the commit being created (the file given to the commit-msg hook, .git/COMMIT_EDITMSG by default)").option("--message <message>", "Lint this message").option("--from <ref>", "Lint the commits after this ref (default: merge-base of the pull/merge request in CI, otherwise the last tag)").option("--to <ref>", "Last commit of the range (default: HEAD)").option("--title", "Also lint the title of the pull/merge request in CI (default: commitlint.title)").option("--no-title", "Do not lint the title of the pull/merge request in CI").option("--preview", "Print the changelog entry of each commit").option("--quiet", "Only print the commits with problems, and the summary").addOption(new Option("--format <format>", "Output format: text for people, json for programs and AI agents").choices(["text", "json"]).default("text")).option("--install", "Write the commit-msg hook running relizy commitlint (in .husky/ when husky is set up)").option("--force", "Replace an existing commit-msg hook with --install").action(async (options) => {
174
+ try {
175
+ const { errorCount } = await commitlint({
176
+ edit: options.edit,
177
+ message: options.message,
178
+ from: options.from,
179
+ to: options.to,
180
+ title: options.title,
181
+ preview: options.preview,
182
+ format: options.format,
183
+ quiet: options.quiet,
184
+ install: options.install,
185
+ force: options.force,
186
+ configName: program.opts().config,
187
+ logLevel: program.opts().logLevel
188
+ });
189
+ if (errorCount > 0) {
190
+ process.exit(1);
191
+ }
192
+ } catch (error) {
193
+ const message = error instanceof Error ? error.message : String(error);
194
+ if (options.format === "json") {
195
+ process.stdout.write(`${JSON.stringify({ valid: false, error: message }, null, 2)}
196
+ `);
197
+ } else {
198
+ logger.error("Failed to lint the commits -", message);
199
+ }
200
+ process.exit(1);
201
+ }
202
+ });
171
203
  program.command("pr-comment").description("Post or re-post a PR comment with release information").action(async () => {
172
204
  try {
173
205
  await prComment({