@oorabona/release-it-preset 0.3.0 → 0.4.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
@@ -2,6 +2,13 @@
2
2
 
3
3
  Shared [release-it](https://github.com/release-it/release-it) configuration and scripts for automated versioning, changelog generation, and package publishing.
4
4
 
5
+ [![codecov](https://codecov.io/github/oorabona/release-it-preset/graph/badge.svg?token=6RMN34Z7TX)](https://codecov.io/github/oorabona/release-it-preset)
6
+ [![CI](https://github.com/oorabona/release-it-preset/actions/workflows/ci.yml/badge.svg)](https://github.com/oorabona/release-it-preset/actions/workflows/ci.yml)
7
+ [![NPM Version](https://img.shields.io/npm/v/release-it-preset.svg)](https://npmjs.org/package/@oorabona/release-it-preset)
8
+ [![NPM Downloads](https://img.shields.io/npm/dm/release-it-preset.svg)](https://npmjs.org/package/@oorabona/release-it-preset)
9
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.3+-blue.svg)](https://www.typescriptlang.org/)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
+
5
12
  ## Features
6
13
 
7
14
  - 📦 Multiple release configurations for different scenarios
@@ -469,6 +476,7 @@ Customize behavior with environment variables:
469
476
  - `GIT_REQUIRE_UPSTREAM` - Require upstream tracking (default: `false`)
470
477
  - `GIT_REQUIRE_CLEAN` - Require clean working directory (default: `false`)
471
478
  - `GIT_REMOTE` - Git remote name (default: `origin`)
479
+ - `GIT_CHANGELOG_COMMAND` - Override the git log command used for previews (default filters out release/hotfix/ci commits)
472
480
 
473
481
  ### GitHub
474
482
  - `GITHUB_RELEASE` - Enable GitHub releases (default: `false`)
@@ -608,7 +616,7 @@ jobs:
608
616
  - name: Update GitHub release and publish to npm
609
617
  run: pnpm release-it-preset retry-publish --ci
610
618
  env:
611
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
619
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
612
620
  NPM_PUBLISH: 'true'
613
621
  GITHUB_RELEASE: 'true'
614
622
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -619,7 +627,7 @@ jobs:
619
627
  - `GITHUB_TOKEN` is provided automatically by GitHub Actions (no manual secret needed)
620
628
 
621
629
  **Required Permissions (locally):**
622
- - Set `GITHUB_RELEASE=true` and/or `NPM_PUBLISH=true` only when you explicitly want to perform those actions from your machine. Provide `GITHUB_TOKEN`/`NODE_AUTH_TOKEN` as needed.
630
+ - Set `GITHUB_RELEASE=true` and/or `NPM_PUBLISH=true` only when you explicitly want to perform those actions from your machine. Provide `GITHUB_TOKEN`/`NPM_TOKEN` as needed.
623
631
 
624
632
  ### Alternative: Full CI Release
625
633
 
@@ -648,7 +656,7 @@ jobs:
648
656
  - run: pnpm release-it-preset default --ci --increment ${{ inputs.version }}
649
657
  env:
650
658
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
651
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
659
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
652
660
  GITHUB_RELEASE: 'true'
653
661
  NPM_PUBLISH: 'true'
654
662
  ```
package/config/default.js CHANGED
@@ -17,10 +17,11 @@
17
17
  * ```
18
18
  */
19
19
 
20
- import { createReleaseNotesGenerator, runScriptCommand } from './helpers.js';
20
+ import { createReleaseNotesGenerator, getGitChangelogCommand, runScriptCommand } from './helpers.js';
21
21
 
22
22
  const config = {
23
23
  git: {
24
+ changelog: getGitChangelogCommand(),
24
25
  commitMessage: process.env.GIT_COMMIT_MESSAGE || 'release: bump v${version}',
25
26
  tagName: process.env.GIT_TAG_NAME || 'v${version}',
26
27
  requireBranch: process.env.GIT_REQUIRE_BRANCH || 'main',
package/config/helpers.js CHANGED
@@ -5,6 +5,20 @@ import { fileURLToPath } from 'node:url';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = dirname(__filename);
7
7
  const RUN_SCRIPT_PATH = join(__dirname, '..', 'bin', 'run-script.js');
8
+ const DEFAULT_CHANGELOG_COMMAND = [
9
+ 'git log',
10
+ '--pretty=format:"* %s (%h)"',
11
+ '${from}..${to}',
12
+ '--grep="^release"',
13
+ '--grep="^Release"',
14
+ '--grep="^release-"',
15
+ '--grep="^Release-"',
16
+ '--grep="^hotfix"',
17
+ '--grep="^Hotfix"',
18
+ '--grep="^ci"',
19
+ '--grep="^CI"',
20
+ '--invert-grep',
21
+ ].join(' ');
8
22
 
9
23
  const DOUBLE_QUOTE = /["\\]/g;
10
24
 
@@ -50,3 +64,7 @@ export function createReleaseNotesGenerator() {
50
64
  return output ? `${output}\n` : fallbackReleaseNotes(version);
51
65
  };
52
66
  }
67
+
68
+ export function getGitChangelogCommand() {
69
+ return process.env.GIT_CHANGELOG_COMMAND || DEFAULT_CHANGELOG_COMMAND;
70
+ }
package/config/hotfix.js CHANGED
@@ -14,12 +14,12 @@
14
14
  * ```
15
15
  */
16
16
 
17
- import { createReleaseNotesGenerator, runScriptCommand } from './helpers.js';
17
+ import { createReleaseNotesGenerator, getGitChangelogCommand, runScriptCommand } from './helpers.js';
18
18
 
19
19
  const config = {
20
20
  increment: process.env.HOTFIX_INCREMENT || 'patch',
21
21
  git: {
22
- changelog: 'git log --pretty=format:"- %s" ${latestTag}..HEAD',
22
+ changelog: getGitChangelogCommand(),
23
23
  commitMessage: process.env.GIT_COMMIT_MESSAGE || 'hotfix: bump v${version}',
24
24
  tagName: process.env.GIT_TAG_NAME || 'v${version}',
25
25
  requireBranch: process.env.GIT_REQUIRE_BRANCH || 'main',
@@ -29,10 +29,11 @@
29
29
  * ```
30
30
  */
31
31
 
32
- import { createReleaseNotesGenerator, runScriptCommand } from './helpers.js';
32
+ import { createReleaseNotesGenerator, getGitChangelogCommand, runScriptCommand } from './helpers.js';
33
33
 
34
34
  const config = {
35
35
  git: {
36
+ changelog: getGitChangelogCommand(),
36
37
  commitMessage: process.env.GIT_COMMIT_MESSAGE || 'release: bump v${version}',
37
38
  tagName: process.env.GIT_TAG_NAME || 'v${version}',
38
39
  requireBranch: process.env.GIT_REQUIRE_BRANCH || 'main',
@@ -18,11 +18,12 @@
18
18
  * ```
19
19
  */
20
20
 
21
- import { createReleaseNotesGenerator, runScriptCommand } from './helpers.js';
21
+ import { createReleaseNotesGenerator, getGitChangelogCommand, runScriptCommand } from './helpers.js';
22
22
 
23
23
  const config = {
24
24
  increment: false,
25
25
  git: {
26
+ changelog: getGitChangelogCommand(),
26
27
  commitMessage: process.env.GIT_COMMIT_MESSAGE || 'chore: republish v${version}',
27
28
  tagName: process.env.GIT_TAG_NAME || 'v${version}',
28
29
  tagAnnotation: 'Release ${version} (republished)',
@@ -97,6 +97,12 @@ export function parseCommitsWithMultiplePrefixes(gitOutput, repoUrl) {
97
97
  if (parts.length === 0) {
98
98
  const firstLine = body.split('\n')[0].trim();
99
99
  if (firstLine) {
100
+ const lowerFirstLine = firstLine.toLowerCase();
101
+ const ignoredPatterns = [/^release\b/, /^hotfix\b/, /^ci\b/];
102
+ const shouldSkip = ignoredPatterns.some((pattern) => pattern.test(lowerFirstLine));
103
+ if (shouldSkip) {
104
+ continue;
105
+ }
100
106
  allParts.push({
101
107
  type: 'misc',
102
108
  description: firstLine,
@@ -157,7 +157,7 @@ export function validateNpmAuth(deps) {
157
157
  };
158
158
  }
159
159
  catch (error) {
160
- const tokenEnvVars = ['NPM_TOKEN', 'NODE_AUTH_TOKEN', 'NPM_CONFIG__AUTH', 'NPM_CONFIG_TOKEN'];
160
+ const tokenEnvVars = ['NPM_TOKEN', 'NPM_TOKEN', 'NPM_CONFIG__AUTH', 'NPM_CONFIG_TOKEN'];
161
161
  const hasAutomationToken = tokenEnvVars.some((name) => {
162
162
  const value = deps.getEnv(name);
163
163
  return typeof value === 'string' && value.trim().length > 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oorabona/release-it-preset",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Shared release-it configuration and scripts for the organisation",
5
5
  "type": "module",
6
6
  "keywords": [