@oorabona/release-it-preset 0.3.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/LICENSE +21 -0
- package/README.md +833 -0
- package/bin/cli.js +180 -0
- package/bin/run-script.js +72 -0
- package/config/changelog-only.js +41 -0
- package/config/default.js +54 -0
- package/config/helpers.js +52 -0
- package/config/hotfix.js +51 -0
- package/config/manual-changelog.js +64 -0
- package/config/no-changelog.js +40 -0
- package/config/republish.js +60 -0
- package/config/retry-publish.js +40 -0
- package/dist/scripts/check-config.js +285 -0
- package/dist/scripts/check-pr-status.js +164 -0
- package/dist/scripts/extract-changelog.js +66 -0
- package/dist/scripts/init-project.js +191 -0
- package/dist/scripts/lib/commit-parser.js +67 -0
- package/dist/scripts/lib/git-utils.js +33 -0
- package/dist/scripts/lib/semver-utils.js +26 -0
- package/dist/scripts/lib/string-utils.js +12 -0
- package/dist/scripts/populate-unreleased-changelog.js +236 -0
- package/dist/scripts/republish-changelog.js +187 -0
- package/dist/scripts/retry-publish.js +98 -0
- package/dist/scripts/validate-release.js +288 -0
- package/dist/types/check-config.d.ts +65 -0
- package/dist/types/check-pr-status.d.ts +51 -0
- package/dist/types/extract-changelog.d.ts +23 -0
- package/dist/types/init-project.d.ts +37 -0
- package/dist/types/lib/commit-parser.d.ts +44 -0
- package/dist/types/lib/git-utils.d.ts +20 -0
- package/dist/types/lib/semver-utils.d.ts +18 -0
- package/dist/types/lib/string-utils.d.ts +10 -0
- package/dist/types/populate-unreleased-changelog.d.ts +56 -0
- package/dist/types/republish-changelog.d.ts +39 -0
- package/dist/types/retry-publish.d.ts +33 -0
- package/dist/types/validate-release.d.ts +43 -0
- package/package.json +93 -0
package/bin/cli.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* CLI wrapper for release-it-preset
|
|
4
|
+
*
|
|
5
|
+
* Provides two types of commands:
|
|
6
|
+
* 1. Release commands - Run release-it with specific configurations
|
|
7
|
+
* 2. Utility commands - Helper commands for project setup and validation
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* release-it-preset <command> [...args]
|
|
11
|
+
*
|
|
12
|
+
* Release commands:
|
|
13
|
+
* release-it-preset default
|
|
14
|
+
* release-it-preset hotfix
|
|
15
|
+
* release-it-preset changelog-only
|
|
16
|
+
*
|
|
17
|
+
* Utility commands:
|
|
18
|
+
* release-it-preset init [--yes]
|
|
19
|
+
* release-it-preset update
|
|
20
|
+
* release-it-preset validate [--allow-dirty]
|
|
21
|
+
* release-it-preset check
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { spawn } from 'node:child_process';
|
|
25
|
+
import { fileURLToPath } from 'node:url';
|
|
26
|
+
import { dirname, join } from 'node:path';
|
|
27
|
+
|
|
28
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
29
|
+
const __dirname = dirname(__filename);
|
|
30
|
+
|
|
31
|
+
const RELEASE_CONFIGS = {
|
|
32
|
+
default: 'config/default.js',
|
|
33
|
+
hotfix: 'config/hotfix.js',
|
|
34
|
+
'changelog-only': 'config/changelog-only.js',
|
|
35
|
+
'manual-changelog': 'config/manual-changelog.js',
|
|
36
|
+
'no-changelog': 'config/no-changelog.js',
|
|
37
|
+
republish: 'config/republish.js',
|
|
38
|
+
'retry-publish': 'config/retry-publish.js',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Map base names (without extension) for utility scripts
|
|
42
|
+
const UTILITY_COMMANDS = {
|
|
43
|
+
init: 'init-project',
|
|
44
|
+
update: 'populate-unreleased-changelog',
|
|
45
|
+
validate: 'validate-release',
|
|
46
|
+
check: 'check-config',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function showHelp() {
|
|
50
|
+
console.log(`
|
|
51
|
+
Usage: release-it-preset <command> [...args]
|
|
52
|
+
|
|
53
|
+
Release Commands:
|
|
54
|
+
default Full release with changelog, git, GitHub, and npm
|
|
55
|
+
hotfix Emergency hotfix with auto-changelog from commits
|
|
56
|
+
changelog-only Update changelog only, no release
|
|
57
|
+
manual-changelog Release with manually edited changelog (skip auto-generation)
|
|
58
|
+
no-changelog Release without changelog updates
|
|
59
|
+
republish Republish existing version (moves git tag)
|
|
60
|
+
retry-publish Retry failed npm/GitHub publish
|
|
61
|
+
|
|
62
|
+
Utility Commands:
|
|
63
|
+
init [--yes] Initialize project (create CHANGELOG.md, .release-it.json, etc.)
|
|
64
|
+
update Update [Unreleased] section from commits
|
|
65
|
+
validate [--allow-dirty] Validate project is ready for release
|
|
66
|
+
check Display configuration and project status
|
|
67
|
+
|
|
68
|
+
Examples:
|
|
69
|
+
# Release commands
|
|
70
|
+
release-it-preset default --dry-run
|
|
71
|
+
release-it-preset hotfix --verbose
|
|
72
|
+
release-it-preset changelog-only --ci
|
|
73
|
+
|
|
74
|
+
# Utility commands
|
|
75
|
+
release-it-preset init
|
|
76
|
+
release-it-preset update
|
|
77
|
+
release-it-preset validate
|
|
78
|
+
release-it-preset check
|
|
79
|
+
|
|
80
|
+
For release-it options, see: https://github.com/release-it/release-it
|
|
81
|
+
For environment variables, see: https://github.com/oorabona/release-it-preset#environment-variables
|
|
82
|
+
`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function handleReleaseCommand(configName, args) {
|
|
86
|
+
const configPath = join(__dirname, '..', RELEASE_CONFIGS[configName]);
|
|
87
|
+
|
|
88
|
+
console.log(`🚀 Running release-it with config: ${configName}`);
|
|
89
|
+
console.log(`📝 Config file: ${configPath}`);
|
|
90
|
+
|
|
91
|
+
const releaseItCommand = 'release-it';
|
|
92
|
+
const fullArgs = ['--config', configPath, ...args];
|
|
93
|
+
|
|
94
|
+
console.log(`💡 Command: ${releaseItCommand} ${fullArgs.join(' ')}\n`);
|
|
95
|
+
|
|
96
|
+
const child = spawn(releaseItCommand, fullArgs, {
|
|
97
|
+
stdio: 'inherit',
|
|
98
|
+
shell: true,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
child.on('error', (error) => {
|
|
102
|
+
console.error(`❌ Failed to start release-it: ${error.message}`);
|
|
103
|
+
console.error(`\nMake sure release-it is installed:`);
|
|
104
|
+
console.error(` pnpm add -D release-it`);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
child.on('close', (code) => {
|
|
109
|
+
process.exit(code ?? 0);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function handleUtilityCommand(commandName, args) {
|
|
114
|
+
const base = UTILITY_COMMANDS[commandName];
|
|
115
|
+
const compiledPath = join(__dirname, '..', 'dist', 'scripts', `${base}.js`);
|
|
116
|
+
const sourcePath = join(__dirname, '..', 'scripts', `${base}.ts`);
|
|
117
|
+
|
|
118
|
+
console.log(`🔧 Running utility command: ${commandName}\n`);
|
|
119
|
+
|
|
120
|
+
// Prefer compiled script; fallback to tsx source if not built yet (developer convenience)
|
|
121
|
+
import('node:fs').then(fs => {
|
|
122
|
+
const useCompiled = fs.existsSync(compiledPath);
|
|
123
|
+
const runner = useCompiled ? 'node' : 'tsx';
|
|
124
|
+
const target = useCompiled ? compiledPath : sourcePath;
|
|
125
|
+
if (!useCompiled) {
|
|
126
|
+
console.log('ℹ️ Compiled script not found, falling back to tsx source execution (dev mode).');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const child = spawn(runner, [target, ...args], {
|
|
130
|
+
stdio: 'inherit',
|
|
131
|
+
shell: true,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
child.on('error', (error) => {
|
|
135
|
+
console.error(`❌ Failed to run command: ${error.message}`);
|
|
136
|
+
if (!useCompiled) {
|
|
137
|
+
console.error(`\nMake sure tsx is installed for source execution:`);
|
|
138
|
+
console.error(` pnpm add -D tsx`);
|
|
139
|
+
}
|
|
140
|
+
process.exit(1);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
child.on('close', (code) => {
|
|
144
|
+
process.exit(code ?? 0);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function main() {
|
|
150
|
+
const args = process.argv.slice(2);
|
|
151
|
+
|
|
152
|
+
if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
|
|
153
|
+
showHelp();
|
|
154
|
+
process.exit(0);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const command = args[0];
|
|
158
|
+
const commandArgs = args.slice(1);
|
|
159
|
+
|
|
160
|
+
// Check if it's a release config
|
|
161
|
+
if (RELEASE_CONFIGS[command]) {
|
|
162
|
+
handleReleaseCommand(command, commandArgs);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Check if it's a utility command
|
|
167
|
+
if (UTILITY_COMMANDS[command]) {
|
|
168
|
+
handleUtilityCommand(command, commandArgs);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Unknown command
|
|
173
|
+
console.error(`❌ Unknown command: ${command}`);
|
|
174
|
+
console.error(`\nAvailable release configs: ${Object.keys(RELEASE_CONFIGS).join(', ')}`);
|
|
175
|
+
console.error(`Available utility commands: ${Object.keys(UTILITY_COMMANDS).join(', ')}`);
|
|
176
|
+
console.error(`\nRun 'release-it-preset --help' for more information.`);
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
main();
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* c8 ignore file */
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
|
|
11
|
+
function quote(value) {
|
|
12
|
+
return `"${value.replace(/["\\]/g, '\\$&')}"`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function resolveTsxCommand() {
|
|
16
|
+
const localTsx = join(__dirname, '..', 'node_modules', '.bin', 'tsx');
|
|
17
|
+
if (existsSync(localTsx)) {
|
|
18
|
+
return localTsx;
|
|
19
|
+
}
|
|
20
|
+
return 'tsx';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function runWithNode(target, args) {
|
|
24
|
+
const result = spawnSync(process.execPath, [target, ...args], { stdio: 'inherit' });
|
|
25
|
+
if (result.error) {
|
|
26
|
+
console.error(`❌ Failed to execute ${target}: ${result.error.message}`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
process.exit(result.status ?? 0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function runWithTsx(tsxCommand, sourcePath, args) {
|
|
33
|
+
const command = [`${quote(tsxCommand)} ${quote(sourcePath)}`]
|
|
34
|
+
.concat(args.map(arg => quote(arg)))
|
|
35
|
+
.join(' ');
|
|
36
|
+
|
|
37
|
+
const result = spawnSync(command, { stdio: 'inherit', shell: true });
|
|
38
|
+
if (result.error) {
|
|
39
|
+
console.error(`❌ Failed to execute tsx: ${result.error.message}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
process.exit(result.status ?? 0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const [scriptName, ...scriptArgs] = process.argv.slice(2);
|
|
46
|
+
|
|
47
|
+
if (!scriptName) {
|
|
48
|
+
console.error('❌ Missing script name. Usage: node run-script.js <script-name> [...args]');
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const compiledPath = join(__dirname, '..', 'dist', 'scripts', `${scriptName}.js`);
|
|
53
|
+
const sourcePath = join(__dirname, '..', 'scripts', `${scriptName}.ts`);
|
|
54
|
+
|
|
55
|
+
if (existsSync(compiledPath)) {
|
|
56
|
+
runWithNode(compiledPath, scriptArgs);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
console.log('ℹ️ Compiled script not found, falling back to tsx execution.');
|
|
60
|
+
const tsxCommand = resolveTsxCommand();
|
|
61
|
+
|
|
62
|
+
if (!tsxCommand) {
|
|
63
|
+
console.error('❌ Could not locate tsx. Run "pnpm install" or "pnpm build" and retry.');
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!existsSync(sourcePath)) {
|
|
68
|
+
console.error(`❌ Source script not found: ${sourcePath}`);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
runWithTsx(tsxCommand, sourcePath, scriptArgs);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Changelog-only release-it configuration
|
|
3
|
+
*
|
|
4
|
+
* This configuration only generates/updates the changelog without:
|
|
5
|
+
* - Version increment
|
|
6
|
+
* - Git operations
|
|
7
|
+
* - npm publishing
|
|
8
|
+
* - GitHub releases
|
|
9
|
+
*
|
|
10
|
+
* Useful for preparing changelogs in CI or before actual release.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* ```bash
|
|
14
|
+
* pnpm release-it --config node_modules/@oorabona/release-it-preset/config/changelog-only.js --ci
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { runScriptCommand } from './helpers.js';
|
|
19
|
+
|
|
20
|
+
const config = {
|
|
21
|
+
increment: false,
|
|
22
|
+
git: {
|
|
23
|
+
changelog: false,
|
|
24
|
+
commit: false,
|
|
25
|
+
tag: false,
|
|
26
|
+
push: false,
|
|
27
|
+
},
|
|
28
|
+
hooks: {
|
|
29
|
+
'before:init': [
|
|
30
|
+
runScriptCommand('populate-unreleased-changelog'),
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
npm: {
|
|
34
|
+
publish: false,
|
|
35
|
+
},
|
|
36
|
+
github: {
|
|
37
|
+
release: false,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default config;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default release-it configuration
|
|
3
|
+
*
|
|
4
|
+
* This configuration provides a complete release workflow with:
|
|
5
|
+
* - Keep a Changelog format
|
|
6
|
+
* - Git commit, tag, and push
|
|
7
|
+
* - Optional GitHub releases (set GITHUB_RELEASE=true)
|
|
8
|
+
* - Optional npm publishing with provenance (set NPM_PUBLISH=true)
|
|
9
|
+
*
|
|
10
|
+
* Usage in client project:
|
|
11
|
+
* ```json
|
|
12
|
+
* {
|
|
13
|
+
* "release-it": {
|
|
14
|
+
* "extends": "@oorabona/release-it-preset/config/default"
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { createReleaseNotesGenerator, runScriptCommand } from './helpers.js';
|
|
21
|
+
|
|
22
|
+
const config = {
|
|
23
|
+
git: {
|
|
24
|
+
commitMessage: process.env.GIT_COMMIT_MESSAGE || 'release: bump v${version}',
|
|
25
|
+
tagName: process.env.GIT_TAG_NAME || 'v${version}',
|
|
26
|
+
requireBranch: process.env.GIT_REQUIRE_BRANCH || 'main',
|
|
27
|
+
requireUpstream: process.env.GIT_REQUIRE_UPSTREAM === 'true',
|
|
28
|
+
requireCleanWorkingDir: process.env.GIT_REQUIRE_CLEAN === 'true',
|
|
29
|
+
},
|
|
30
|
+
hooks: {
|
|
31
|
+
'before:bump': [
|
|
32
|
+
runScriptCommand('populate-unreleased-changelog'),
|
|
33
|
+
],
|
|
34
|
+
'after:bump': [
|
|
35
|
+
runScriptCommand('republish-changelog'),
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
github: {
|
|
39
|
+
release: process.env.GITHUB_RELEASE === 'true',
|
|
40
|
+
releaseNotes: createReleaseNotesGenerator(),
|
|
41
|
+
},
|
|
42
|
+
npm: {
|
|
43
|
+
skipChecks: process.env.NPM_SKIP_CHECKS === 'true',
|
|
44
|
+
publish: process.env.NPM_PUBLISH === 'true',
|
|
45
|
+
versionArgs: ['--allow-same-version'],
|
|
46
|
+
publishArgs: [
|
|
47
|
+
'--provenance',
|
|
48
|
+
'--access',
|
|
49
|
+
process.env.NPM_ACCESS || 'public',
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default config;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = dirname(__filename);
|
|
7
|
+
const RUN_SCRIPT_PATH = join(__dirname, '..', 'bin', 'run-script.js');
|
|
8
|
+
|
|
9
|
+
const DOUBLE_QUOTE = /["\\]/g;
|
|
10
|
+
|
|
11
|
+
function quote(value) {
|
|
12
|
+
return `"${value.replace(DOUBLE_QUOTE, '\\$&')}"`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function fallbackReleaseNotes(version) {
|
|
16
|
+
return `# Release v${version}\n\nNo changelog entry available.\n`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function runScriptCommand(scriptName, extraArgs = []) {
|
|
20
|
+
const args = [scriptName, ...extraArgs].map(quote).join(' ');
|
|
21
|
+
return `node ${quote(RUN_SCRIPT_PATH)} ${args}`.trim();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function createReleaseNotesGenerator() {
|
|
25
|
+
return ({ version }) => {
|
|
26
|
+
const result = spawnSync(
|
|
27
|
+
process.execPath,
|
|
28
|
+
[RUN_SCRIPT_PATH, 'extract-changelog', version],
|
|
29
|
+
{
|
|
30
|
+
encoding: 'utf8',
|
|
31
|
+
stdio: ['ignore', 'pipe', 'inherit'],
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (result.error) {
|
|
36
|
+
console.warn(`⚠️ Failed to run extract-changelog script: ${result.error.message}`);
|
|
37
|
+
return fallbackReleaseNotes(version);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (result.status !== 0) {
|
|
41
|
+
console.warn(
|
|
42
|
+
`⚠️ extract-changelog exited with code ${
|
|
43
|
+
typeof result.status === 'number' ? result.status : 'unknown'
|
|
44
|
+
}`,
|
|
45
|
+
);
|
|
46
|
+
return fallbackReleaseNotes(version);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const output = result.stdout?.trim();
|
|
50
|
+
return output ? `${output}\n` : fallbackReleaseNotes(version);
|
|
51
|
+
};
|
|
52
|
+
}
|
package/config/hotfix.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hotfix release-it configuration
|
|
3
|
+
*
|
|
4
|
+
* This configuration is for emergency hotfix releases:
|
|
5
|
+
* - Forces patch version increment
|
|
6
|
+
* - Generates changelog from git log
|
|
7
|
+
* - Populates unreleased section before bump
|
|
8
|
+
* - Optionally creates GitHub release with extracted notes (set GITHUB_RELEASE=true)
|
|
9
|
+
* - Optionally publishes to npm with provenance (set NPM_PUBLISH=true)
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```bash
|
|
13
|
+
* pnpm release-it --config node_modules/@oorabona/release-it-preset/config/hotfix.js
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { createReleaseNotesGenerator, runScriptCommand } from './helpers.js';
|
|
18
|
+
|
|
19
|
+
const config = {
|
|
20
|
+
increment: process.env.HOTFIX_INCREMENT || 'patch',
|
|
21
|
+
git: {
|
|
22
|
+
changelog: 'git log --pretty=format:"- %s" ${latestTag}..HEAD',
|
|
23
|
+
commitMessage: process.env.GIT_COMMIT_MESSAGE || 'hotfix: bump v${version}',
|
|
24
|
+
tagName: process.env.GIT_TAG_NAME || 'v${version}',
|
|
25
|
+
requireBranch: process.env.GIT_REQUIRE_BRANCH || 'main',
|
|
26
|
+
requireUpstream: process.env.GIT_REQUIRE_UPSTREAM === 'true',
|
|
27
|
+
requireCleanWorkingDir: process.env.GIT_REQUIRE_CLEAN === 'true',
|
|
28
|
+
},
|
|
29
|
+
hooks: {
|
|
30
|
+
'before:bump': [
|
|
31
|
+
'echo "Creating hotfix release..."',
|
|
32
|
+
runScriptCommand('populate-unreleased-changelog'),
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
github: {
|
|
36
|
+
release: process.env.GITHUB_RELEASE === 'true',
|
|
37
|
+
releaseNotes: createReleaseNotesGenerator(),
|
|
38
|
+
},
|
|
39
|
+
npm: {
|
|
40
|
+
skipChecks: process.env.NPM_SKIP_CHECKS === 'true',
|
|
41
|
+
publish: process.env.NPM_PUBLISH === 'true',
|
|
42
|
+
versionArgs: ['--allow-same-version'],
|
|
43
|
+
publishArgs: [
|
|
44
|
+
'--provenance',
|
|
45
|
+
'--access',
|
|
46
|
+
process.env.NPM_ACCESS || 'public',
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default config;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manual changelog release-it configuration
|
|
3
|
+
*
|
|
4
|
+
* This configuration is for releases where you have manually edited
|
|
5
|
+
* the [Unreleased] section in CHANGELOG.md:
|
|
6
|
+
* - Skips automatic changelog population (no before:bump hook)
|
|
7
|
+
* - Moves your manual [Unreleased] content to the version section (after:bump)
|
|
8
|
+
* - Creates git commit, tag, and push
|
|
9
|
+
* - Optionally creates GitHub release with your manual changelog (set GITHUB_RELEASE=true)
|
|
10
|
+
* - Optionally publishes to npm with provenance (set NPM_PUBLISH=true)
|
|
11
|
+
*
|
|
12
|
+
* Typical workflow:
|
|
13
|
+
* 1. Run `pnpm release-it-preset update` to generate initial changelog
|
|
14
|
+
* 2. Manually edit CHANGELOG.md [Unreleased] section
|
|
15
|
+
* 3. Run `pnpm release-it-preset manual-changelog` to release
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```bash
|
|
19
|
+
* pnpm release-it-preset manual-changelog
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Or via extends in client project:
|
|
23
|
+
* ```json
|
|
24
|
+
* {
|
|
25
|
+
* "release-it": {
|
|
26
|
+
* "extends": "@oorabona/release-it-preset/config/manual-changelog"
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import { createReleaseNotesGenerator, runScriptCommand } from './helpers.js';
|
|
33
|
+
|
|
34
|
+
const config = {
|
|
35
|
+
git: {
|
|
36
|
+
commitMessage: process.env.GIT_COMMIT_MESSAGE || 'release: bump v${version}',
|
|
37
|
+
tagName: process.env.GIT_TAG_NAME || 'v${version}',
|
|
38
|
+
requireBranch: process.env.GIT_REQUIRE_BRANCH || 'main',
|
|
39
|
+
requireUpstream: process.env.GIT_REQUIRE_UPSTREAM === 'true',
|
|
40
|
+
requireCleanWorkingDir: process.env.GIT_REQUIRE_CLEAN === 'true',
|
|
41
|
+
},
|
|
42
|
+
hooks: {
|
|
43
|
+
// No before:bump - preserve manual changelog edits
|
|
44
|
+
'after:bump': [
|
|
45
|
+
runScriptCommand('republish-changelog'),
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
github: {
|
|
49
|
+
release: process.env.GITHUB_RELEASE === 'true',
|
|
50
|
+
releaseNotes: createReleaseNotesGenerator(),
|
|
51
|
+
},
|
|
52
|
+
npm: {
|
|
53
|
+
skipChecks: process.env.NPM_SKIP_CHECKS === 'true',
|
|
54
|
+
publish: process.env.NPM_PUBLISH === 'true',
|
|
55
|
+
versionArgs: ['--allow-same-version'],
|
|
56
|
+
publishArgs: [
|
|
57
|
+
'--provenance',
|
|
58
|
+
'--access',
|
|
59
|
+
process.env.NPM_ACCESS || 'public',
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default config;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No-changelog release-it configuration
|
|
3
|
+
*
|
|
4
|
+
* This configuration disables changelog generation for quick releases:
|
|
5
|
+
* - Skips changelog updates
|
|
6
|
+
* - Still performs git operations
|
|
7
|
+
* - Optionally publishes to npm (set NPM_PUBLISH=true)
|
|
8
|
+
* - Optionally creates GitHub releases (set GITHUB_RELEASE=true)
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* ```bash
|
|
12
|
+
* pnpm release-it --config node_modules/@oorabona/release-it-preset/config/no-changelog.js
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const config = {
|
|
17
|
+
git: {
|
|
18
|
+
changelog: false,
|
|
19
|
+
commitMessage: process.env.GIT_COMMIT_MESSAGE || 'release: bump v${version}',
|
|
20
|
+
tagName: process.env.GIT_TAG_NAME || 'v${version}',
|
|
21
|
+
requireBranch: process.env.GIT_REQUIRE_BRANCH || 'main',
|
|
22
|
+
requireUpstream: process.env.GIT_REQUIRE_UPSTREAM === 'true',
|
|
23
|
+
requireCleanWorkingDir: process.env.GIT_REQUIRE_CLEAN === 'true',
|
|
24
|
+
},
|
|
25
|
+
github: {
|
|
26
|
+
release: process.env.GITHUB_RELEASE === 'true',
|
|
27
|
+
},
|
|
28
|
+
npm: {
|
|
29
|
+
skipChecks: process.env.NPM_SKIP_CHECKS === 'true',
|
|
30
|
+
publish: process.env.NPM_PUBLISH === 'true',
|
|
31
|
+
versionArgs: ['--allow-same-version'],
|
|
32
|
+
publishArgs: [
|
|
33
|
+
'--provenance',
|
|
34
|
+
'--access',
|
|
35
|
+
process.env.NPM_ACCESS || 'public',
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default config;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Republish release-it configuration
|
|
3
|
+
*
|
|
4
|
+
* DANGER: This configuration republishes the current version without incrementing.
|
|
5
|
+
* It moves the existing git tag, which breaks semantic versioning immutability.
|
|
6
|
+
*
|
|
7
|
+
* Only use this in exceptional cases when you need to:
|
|
8
|
+
* - Fix a broken release
|
|
9
|
+
* - Republish with corrected artifacts
|
|
10
|
+
*
|
|
11
|
+
* Publishing steps remain opt-in:
|
|
12
|
+
* - Set GITHUB_RELEASE=true to update the GitHub release
|
|
13
|
+
* - Set NPM_PUBLISH=true to republish to npm with provenance
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* ```bash
|
|
17
|
+
* pnpm release-it --config node_modules/@oorabona/release-it-preset/config/republish.js
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { createReleaseNotesGenerator, runScriptCommand } from './helpers.js';
|
|
22
|
+
|
|
23
|
+
const config = {
|
|
24
|
+
increment: false,
|
|
25
|
+
git: {
|
|
26
|
+
commitMessage: process.env.GIT_COMMIT_MESSAGE || 'chore: republish v${version}',
|
|
27
|
+
tagName: process.env.GIT_TAG_NAME || 'v${version}',
|
|
28
|
+
tagAnnotation: 'Release ${version} (republished)',
|
|
29
|
+
requireBranch: process.env.GIT_REQUIRE_BRANCH || 'main',
|
|
30
|
+
requireUpstream: process.env.GIT_REQUIRE_UPSTREAM === 'true',
|
|
31
|
+
requireCleanWorkingDir: process.env.GIT_REQUIRE_CLEAN === 'true',
|
|
32
|
+
},
|
|
33
|
+
hooks: {
|
|
34
|
+
'before:init': [
|
|
35
|
+
'echo "⚠️ WARNING: You are about to MOVE an existing tag!"',
|
|
36
|
+
'echo "⚠️ This breaks semantic versioning immutability!"',
|
|
37
|
+
'echo "⚠️ Only proceed if you understand the consequences."',
|
|
38
|
+
],
|
|
39
|
+
'before:bump': [
|
|
40
|
+
runScriptCommand('republish-changelog'),
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
npm: {
|
|
44
|
+
skipChecks: process.env.NPM_SKIP_CHECKS === 'true',
|
|
45
|
+
publish: process.env.NPM_PUBLISH === 'true',
|
|
46
|
+
versionArgs: ['--allow-same-version'],
|
|
47
|
+
publishArgs: [
|
|
48
|
+
'--provenance',
|
|
49
|
+
'--access',
|
|
50
|
+
process.env.NPM_ACCESS || 'public',
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
github: {
|
|
54
|
+
release: process.env.GITHUB_RELEASE === 'true',
|
|
55
|
+
update: true,
|
|
56
|
+
releaseNotes: createReleaseNotesGenerator(),
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default config;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry publish release-it configuration
|
|
3
|
+
*
|
|
4
|
+
* This configuration retries publishing an existing version that failed:
|
|
5
|
+
* - No version increment
|
|
6
|
+
* - No git operations
|
|
7
|
+
* - Optionally runs npm publish with provenance (set NPM_PUBLISH=true)
|
|
8
|
+
* - Optionally updates GitHub release (set GITHUB_RELEASE=true)
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* First run the retry script to checkout the tag:
|
|
12
|
+
* ```bash
|
|
13
|
+
* node node_modules/@oorabona/release-it-preset/dist/scripts/retry-publish.js
|
|
14
|
+
* pnpm release-it --config node_modules/@oorabona/release-it-preset/config/retry-publish.js
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { createReleaseNotesGenerator } from './helpers.js';
|
|
19
|
+
|
|
20
|
+
const config = {
|
|
21
|
+
increment: false,
|
|
22
|
+
git: false,
|
|
23
|
+
npm: {
|
|
24
|
+
skipChecks: process.env.NPM_SKIP_CHECKS === 'true',
|
|
25
|
+
publish: process.env.NPM_PUBLISH === 'true',
|
|
26
|
+
versionArgs: ['--allow-same-version'],
|
|
27
|
+
publishArgs: [
|
|
28
|
+
'--provenance',
|
|
29
|
+
'--access',
|
|
30
|
+
process.env.NPM_ACCESS || 'public',
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
github: {
|
|
34
|
+
release: process.env.GITHUB_RELEASE === 'true',
|
|
35
|
+
update: true,
|
|
36
|
+
releaseNotes: createReleaseNotesGenerator(),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default config;
|