relion 0.46.0 → 0.46.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.
- package/dist/cli.js +2 -2
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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]
|
|
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}
|
|
3
3
|
---
|
|
4
4
|
`;o+=s+`
|
|
5
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(`
|
|
@@ -15,4 +15,4 @@ Options:
|
|
|
15
15
|
Examples:
|
|
16
16
|
bunx relion -b src/manifest.json Bump a custom file
|
|
17
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
|
|
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{};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "relion",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.1",
|
|
4
4
|
"description": "🏷️ Release Workflow Helper",
|
|
5
5
|
"author": "kh4f <kh4f.dev@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
29
29
|
"@types/bun": "^1.3.11",
|
|
30
30
|
"@types/semver": "^7.7.1",
|
|
31
|
-
"eslint": "^10.
|
|
31
|
+
"eslint": "^10.2.0",
|
|
32
32
|
"jiti": "^2.6.1",
|
|
33
33
|
"tsdown": "^0.21.7",
|
|
34
34
|
"typescript": "^6.0.2",
|