relion 0.46.1 → 0.47.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.
Files changed (3) hide show
  1. package/README.md +28 -15
  2. package/dist/cli.js +15 -8
  3. package/package.json +14 -14
package/README.md CHANGED
@@ -1,41 +1,54 @@
1
1
  <div align="center">
2
2
  <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset=".github/logo-dark.png">
4
- <img alt="logo" src=".github/logo-light.png">
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/kh4f/relion/refs/heads/assets/logo-dark.png">
4
+ <img alt="logo" src="https://raw.githubusercontent.com/kh4f/relion/refs/heads/assets/logo-light.png">
5
5
  </picture>
6
6
  <br>
7
- <a href="https://www.npmjs.com/package/relion"><img src="https://img.shields.io/npm/v/relion?label=npm&logo=npm&style=flat-square&color=BCC7EC&labelColor=303145" alt="npm version"/></a>&nbsp;
8
- <a href="https://www.npmjs.com/package/relion"><img src="https://img.badgesize.io/https:/unpkg.com/relion/dist/cli.js?label=Size&logo=hackthebox&logoColor=c97026&style=flat-square&color=BCC7EC&labelColor=303145" alt="bundle size"/></a>&nbsp;
9
- <a href="https://github.com/kh4f/relion/issues?q=is%3Aissue+is%3Aopen+label%3Abug"><img src="https://img.shields.io/github/issues/kh4f/relion/bug?label=%F0%9F%90%9B%20Bugs&style=flat-square&color=BCC7EC&labelColor=303145" alt="open bugs"></a>
7
+ <b>A zero‑config release automation tool<br></b>version bumping, tagging, committing, and AI changelog generation
10
8
  <br><br>
11
- <b>A zero‑config npm lib for automating the release workflow:<br></b> version bumping, release commit & tag creation, and AI‑assisted changelog generation
12
- <br><br>
13
- <p><b>
9
+ <p>
10
+ <a href="https://www.npmjs.com/package/relion"><img src="https://img.shields.io/npm/v/relion?label=npm&logo=npm&style=flat-square&color=C9CCCF&labelColor=2D3352" alt="npm version"/></a>&nbsp;
11
+ <a href="https://www.npmjs.com/package/relion"><img src="https://img.badgesize.io/https:/unpkg.com/relion/dist/cli.js?label=Size&logo=hackthebox&logoColor=c97026&style=flat-square&color=C9CCCF&labelColor=2D3352" alt="bundle size"/></a>&nbsp;
12
+ <a href="https://github.com/kh4f/relion/issues?q=is%3Aissue+is%3Aopen+label%3Abug"><img src="https://img.shields.io/github/issues/kh4f/relion/bug?label=%F0%9F%90%9B%20Bugs&style=flat-square&color=C9CCCF&labelColor=2D3352" alt="open bugs"></a>
13
+ </p>
14
+ <b>
14
15
  <a href="#%EF%B8%8F-usage">Usage</a>&nbsp; •&nbsp;
15
16
  <a href="#%EF%B8%8F-release-workflow">Release Workflow</a>&nbsp; •&nbsp;
16
17
  <a href="#-changelog-generation">Changelog Generation</a>
17
- </b></p>
18
+ </b>
18
19
  </div>
19
20
 
21
+
20
22
  ## 🕹️ Usage
21
23
 
22
24
  ```bash
23
25
  $ bunx relion -h
24
26
 
25
- Options:
26
- -b <files> Files to bump the version in ['package.json']
27
+ Usage: relion [steps] [options]
28
+
29
+ Steps (e.g. 'bm' = bump + commit; omit to run all):
30
+ c Generate release context
31
+ b Bump version in files
32
+ m Create commit
33
+ t Create tag
34
+
35
+ Options (with defaults):
27
36
  -v <version> Release version [calculated from commits]
37
+ -b <files> Files to bump the version in [package.json]
28
38
  -t <prefix> Tag prefix [v]
29
39
  -d Dry run [false]
30
40
  -y Skip prompts [false]
31
41
 
32
42
  Examples:
33
- bunx relion -b src/manifest.json Bump a custom file
34
- bunx relion -d -v 1.2.3 Dry run with a custom version
43
+ bunx relion bm -v 1.2.3 Bump and commit with custom version
44
+ bunx relion ct -t relion@ Generate context and create tag with custom prefix
45
+ bunx relion -b src/manifest.json Bump version in custom file
46
+ bunx relion -d Dry run of all steps
35
47
  ```
36
48
 
37
49
  - `package.json` is **always included** in the bump list if exists
38
50
  - to create a tag without a prefix, use `-t ''`
51
+ - type 's' at any prompt to skip that step
39
52
 
40
53
  <details><summary>Example output of running <code>bunx relion</code>:</summary>
41
54
 
@@ -47,9 +60,9 @@ Current version: 0.42.1
47
60
  Parsed commits: 26
48
61
  New version: 0.43.0
49
62
  New tag: v0.43.0
63
+ Commit message: 'chore(release): v0.43.0'
64
+ Setps: context, bump, commit, tag
50
65
  ------------------------------
51
-
52
- ('' to continue / 's' to skip)
53
66
  About to write context to 'RELEASE.md'
54
67
  About to bump version in files: package.json
55
68
  About to commit changes: 'git commit -m "chore(release): v0.43.0"'
package/dist/cli.js CHANGED
@@ -1,18 +1,25 @@
1
1
  #!/usr/bin/env node
2
- import{execSync as e,spawnSync as t}from"node:child_process";import{existsSync as n,readFileSync as r,writeFileSync as i}from"node:fs";import{createInterface as a}from"node:readline";import o from"semver";const s=()=>{let t=e(`git config --get remote.origin.url`,{encoding:`utf8`}).trim(),n=/(github\.com.*?)(\.git)?$/.exec(t)?.[1]??``,r=n.split(`/`).at(-1)??``;return{url:`https://${n}`,name:r}},c=t=>e(`git log ${t?`${t}..`:``} --format="%h %B---" .`,{encoding:`utf8`}).trim().split(`---`).filter(Boolean).map(e=>/^(.+?) (.+)/s.exec(e.trim())).map(e=>({hash:e?.[1]??``,message:e?.[2].trim()??``})),l=(e,t)=>{let n=e.some(e=>e.message.includes(`BREAKING CHANGE`))?t.startsWith(`0.`)?`minor`:`major`:e.some(e=>/feat(\(.*?\))?:/.test(e.message))?`minor`:`patch`;return o.inc(t,n)??(()=>{throw Error(`Failed to increment version '${t}' with release type '${n}'`)})()},u=async(e,t=!1)=>{if(t)return!0;let n=a({input:process.stdin,output:process.stdout});return await new Promise(t=>{n.question(e,e=>{n.close(),t(e.trim()!==`s`)})})},d={bump:[`package.json`],newVersion:``,tagPrefix:`v`,commitsExclude:[/^(ci|build|test)\(/,/^chore\(deps\)(?!!)/],dryRun:!1,yes:!1},f=[{filePattern:/\.rc$/,bump:(e,t)=>e.replace(/(\b(FileVersion|ProductVersion)\b.*?)\d[\w.+-]*/g,`$1${t}`).replace(/(\b(FILEVERSION|PRODUCTVERSION)\b.*?)\d[\w,+-]*/g,`$1${(/^\d+\.\d+\.\d+/.exec(t)?.[0]??``).replace(/\./g,`,`)+`,0`}`)},{filePattern:/.*/,bump:(e,t)=>e.replace(/(\bversion\b.*?)\d[\w.+-]*/,`$1${t}`)}],p=async(e,t,n,r,a)=>{if(e.yes||!await u(`About to write context to 'RELEASE.md'`,e.yes)||e.dryRun)return;let o=``,s=`---\ntag: ${r}\nprevTag: ${n}\ndate: ${new Date().toLocaleString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}\nrepoURL: ${a}
2
+ import{execSync as e,spawnSync as t}from"node:child_process";import{existsSync as n,readFileSync as r,writeFileSync as i}from"node:fs";import{createInterface as a}from"node:readline";import o from"semver";const s=()=>{let t=e(`git config --get remote.origin.url`,{encoding:`utf8`}).trim(),n=/(github\.com.*?)(\.git)?$/.exec(t)?.[1]??``,r=n.split(`/`).at(-1)??``;return{url:`https://${n}`,name:r}},c=t=>e(`git log ${t?`${t}..`:``} --format="%h %B---" .`,{encoding:`utf8`}).trim().split(`---`).filter(Boolean).map(e=>/^(.+?) (.+)/s.exec(e.trim())).map(e=>({hash:e?.[1]??``,message:e?.[2].trim()??``})),l=(e,t)=>{let n=e.some(e=>e.message.includes(`BREAKING CHANGE`))?t.startsWith(`0.`)?`minor`:`major`:e.some(e=>/feat(\(.*?\))?:/.test(e.message))?`minor`:`patch`;return o.inc(t,n)??(()=>{throw Error(`Failed to increment version '${t}' with release type '${n}'`)})()},u=async(e,t=!1)=>{if(t)return!0;let n=a({input:process.stdin,output:process.stdout});return await new Promise(t=>{n.question(e,e=>{n.close(),t(e.trim()!==`s`)})})},d={steps:[`context`,`bump`,`commit`,`tag`],bump:[`package.json`],newVersion:``,tagPrefix:`v`,commitsExclude:[/^(ci|build|test)\(/,/^chore\(deps\)(?!!)/],dryRun:!1,yes:!1},f=[{filePattern:/\.rc$/,bump:(e,t)=>e.replace(/(\b(FileVersion|ProductVersion)\b.*?)\d[\w.+-]*/g,`$1${t}`).replace(/(\b(FILEVERSION|PRODUCTVERSION)\b.*?)\d[\w,+-]*/g,`$1${(/^\d+\.\d+\.\d+/.exec(t)?.[0]??``).replace(/\./g,`,`)+`,0`}`)},{filePattern:/.*/,bump:(e,t)=>e.replace(/(\bversion\b.*?)\d[\w.+-]*/,`$1${t}`)}],p=async(e,t,n,r,a)=>{if(e.yes||!await u(`About to write context to 'RELEASE.md'`,e.yes)||e.dryRun)return;let o=``,s=`---\ntag: ${r}\nprevTag: ${n}\ndate: ${new Date().toLocaleString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}\nrepoURL: ${a}
3
3
  ---
4
4
  `;o+=s+`
5
- `;let c=t.map(e=>`[${e.hash}] ${e.message}`).join(`\n${`-`.repeat(30)}\n`);o+=`## Commit Log\n\n\`\`\`\n${c}\n\`\`\``,i(`RELEASE.md`,o,`utf8`)},m=async e=>{let t=e.bump.filter(n);await u(`About to bump version in files: ${t.join(`, `)}`,e.yes)&&t.forEach(t=>{let n=f.find(e=>e.filePattern.test(t));if(!n)return console.warn(`No matching bumper found for file '${t}', skipping...`);let a=r(t,`utf8`),o=n.bump(a,e.newVersion);e.dryRun||i(t,o,`utf8`)})},h=async(t,n)=>{let r=`${t.yes?`git add -A && `:``}git commit -m "${n}"`;await u(`About to commit changes: '${r}'`,t.yes)&&(t.dryRun||e(r,{stdio:`inherit`}))},g=async(t,n,r)=>{let i=`git tag ${n} -m "${r}"`;await u(`About to create a tag: '${i}'`,t.yes)&&(t.dryRun||e(i,{stdio:`inherit`}))},_=async e=>{let n=s();console.log(`Project: ${n.name}`),console.log(`Repo: ${n.url}`);let r={...d,...e,bump:[...d.bump,...e.bump??[]]},i=t(`git`,[`describe`,`--match`,`${r.tagPrefix}[0-9]*.[0-9]*.[0-9]*`,`--abbrev=0`],{encoding:`utf8`}).stdout.trim();console.log(`Current tag: ${i}`);let a=/\d+\.\d+\.\d+.*/.exec(i)?.[0]??`0.0.0`;console.log(`Current version: ${a}`);let o=c(i),u=o.filter(e=>!r.commitsExclude.some(t=>t.test(e.message)));console.log(`Parsed commits: ${u.length}`),r.newVersion||=l(o,a),console.log(`New version: ${r.newVersion}`);let f=`${r.tagPrefix}${r.newVersion}`;console.log(`New tag: ${f}`);let _=`chore(release): ${f}`;console.log(`Commit message: '${_}'`),console.log(`-`.repeat(30)),console.log(`
6
- ('' to continue / 's' to skip)`),await p(r,u,i,f,n.url),await m(r),await h(r,_),await g(r,f,_)},v=process.argv.slice(2).join(` `);v.includes(`-h`)&&(console.log(`Usage: relion [options]
5
+ `;let c=t.map(e=>`[${e.hash}] ${e.message}`).join(`\n${`-`.repeat(30)}\n`);o+=`## Commit Log\n\n${c}`,i(`RELEASE.md`,o,`utf8`)},m=async e=>{let t=e.bump.filter(n);await u(`About to bump version in files: ${t.join(`, `)}`,e.yes)&&t.forEach(t=>{let n=f.find(e=>e.filePattern.test(t));if(!n)return console.warn(`No matching bumper found for file '${t}', skipping...`);let a=r(t,`utf8`),o=n.bump(a,e.newVersion);e.dryRun||i(t,o,`utf8`)})},h=async(t,n)=>{let r=`${t.yes?`git add -A && `:``}git commit -m "${n}"`;await u(`About to commit changes: '${r}'`,t.yes)&&(t.dryRun||e(r,{stdio:`inherit`}))},g=async(t,n,r)=>{let i=`git tag ${n} -m "${r}"`;await u(`About to create a tag: '${i}'`,t.yes)&&(t.dryRun||e(i,{stdio:`inherit`}))},_=async e=>{let n=s();console.log(`Project: ${n.name}`),console.log(`Repo: ${n.url}`);let r={...d,...e,bump:[...d.bump,...e.bump??[]]},i=t(`git`,[`describe`,`--match`,`${r.tagPrefix}[0-9]*.[0-9]*.[0-9]*`,`--abbrev=0`],{encoding:`utf8`}).stdout.trim();console.log(`Current tag: ${i}`);let a=/\d+\.\d+\.\d+.*/.exec(i)?.[0]??`0.0.0`;console.log(`Current version: ${a}`);let o=c(i),u=o.filter(e=>!r.commitsExclude.some(t=>t.test(e.message)));console.log(`Parsed commits: ${u.length}`),r.newVersion||=l(o,a),console.log(`New version: ${r.newVersion}`);let f=`${r.tagPrefix}${r.newVersion}`;console.log(`New tag: ${f}`);let _=`chore(release): ${f}`;console.log(`Commit message: '${_}'`),console.log(`Steps: ${r.steps.join(`, `)}`),console.log(`-`.repeat(30)),r.steps.includes(`context`)&&await p(r,u,i,f,n.url),r.steps.includes(`bump`)&&await m(r),r.steps.includes(`commit`)&&await h(r,_),r.steps.includes(`tag`)&&await g(r,f,_)},v=[`context`,`bump`,`commit`,`tag`],y={context:`c`,bump:`b`,commit:`m`,tag:`t`},b=process.argv.slice(2),x=b[0]&&!b[0].startsWith(`-`)?b.shift():``;b.includes(`-h`)&&(console.log(`Usage: relion [steps] [options]
7
6
 
8
- Options:
9
- -b <files> Files to bump the version in ['package.json']
7
+ Steps (e.g. 'bm' = bump + commit; omit to run all):
8
+ c Generate release context
9
+ b Bump version in files
10
+ m Create commit
11
+ t Create tag
12
+
13
+ Options (with defaults):
10
14
  -v <version> Release version [calculated from commits]
15
+ -b <files> Files to bump the version in [package.json]
11
16
  -t <prefix> Tag prefix [v]
12
17
  -d Dry run [false]
13
18
  -y Skip prompts [false]
14
19
 
15
20
  Examples:
16
- bunx relion -b src/manifest.json Bump a custom file
17
- bunx relion -d -v 1.2.3 Dry run with a custom version
18
- `),process.exit(0));const y=/-b (.+?)( -|$)/.exec(v)?.[1].split(` `),b=/-v (\S+)/.exec(v)?.[1];let x=/-t (\S+)/.exec(v)?.[1];x===`''`&&(x=``);const S=/\b-d\b/.test(v),C=/\b-y\b/.test(v);_({...y&&{bump:y},...b&&{newVersion:b},...x&&{tagPrefix:x},dryRun:S,yes:C}).catch(e=>{console.error(e),process.exit(1)});export{};
21
+ bunx relion bm -v 1.2.3 Bump and commit with custom version
22
+ bunx relion ct -t relion@ Generate context and create tag with custom prefix
23
+ bunx relion -b src/manifest.json Bump version in custom file
24
+ bunx relion -d Dry run of all steps
25
+ `),process.exit(0));const S=x?v.filter(e=>x.includes(y[e])):void 0,C=b.join(` `),w=/-b (.+?)( -|$)/.exec(C)?.[1].split(` `),T=/-v (\S+)/.exec(C)?.[1],E=b.indexOf(`-t`),D=E===-1?void 0:b[E+1],O=/\b-d\b/.test(C),k=/\b-y\b/.test(C);_({...S&&{steps:S},...w&&{bump:w},...T&&{newVersion:T},...D!==void 0&&{tagPrefix:D},dryRun:O,yes:k}).catch(e=>{console.error(e),process.exit(1)});export{};
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
1
  {
2
2
  "name": "relion",
3
- "version": "0.46.1",
3
+ "version": "0.47.1",
4
4
  "description": "🏷️ Release Workflow Helper",
5
- "author": "kh4f <kh4f.dev@gmail.com>",
5
+ "author": "kh4f",
6
6
  "license": "MIT",
7
7
  "repository": "https://github.com/kh4f/relion",
8
8
  "bugs": "https://github.com/kh4f/relion/issues",
9
9
  "homepage": "https://github.com/kh4f/relion#readme",
10
- "keywords": ["relion", "release", "release-automation", "release-workflow", "release-helper", "release-workflow-helper"],
10
+ "keywords": ["relion", "release", "release-automation", "release-workflow", "release-helper"],
11
11
  "files": ["dist"],
12
12
  "type": "module",
13
13
  "bin": "dist/cli.js",
14
14
  "scripts": {
15
- "build": "tsdown",
16
- "build:watch": "tsdown --watch",
17
- "build:prod": "tsdown --prod",
18
- "lint": "eslint",
15
+ "dev": "tsdown",
16
+ "watch": "tsdown -w",
17
+ "build": "tsdown -p",
19
18
  "typecheck": "tsc",
19
+ "lint": "eslint",
20
20
  "test": "bun test",
21
21
  "release": "bun src/cli"
22
22
  },
23
23
  "dependencies": {
24
- "semver": "^7.7.4"
24
+ "semver": "^7.8.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@eslint/js": "^10.0.1",
28
28
  "@stylistic/eslint-plugin": "^5.10.0",
29
- "@types/bun": "^1.3.11",
29
+ "@types/bun": "^1.3.14",
30
30
  "@types/semver": "^7.7.1",
31
- "eslint": "^10.2.0",
32
- "jiti": "^2.6.1",
33
- "tsdown": "^0.21.7",
34
- "typescript": "^6.0.2",
35
- "typescript-eslint": "^8.58.0"
31
+ "eslint": "^10.4.0",
32
+ "jiti": "^2.7.0",
33
+ "tsdown": "^0.22.0",
34
+ "typescript": "^6.0.3",
35
+ "typescript-eslint": "^8.59.4"
36
36
  }
37
37
  }