@jeromefitz/release-notes-generator 3.1.12 → 3.1.14-canary.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/LICENSE +1 -1
- package/chunk-pm2C21R4.mjs +1 -0
- package/{index.d.ts → index.d.mts} +3 -1
- package/index.d.mts.map +1 -0
- package/index.mjs +16 -0
- package/index.mjs.map +1 -0
- package/package.json +20 -18
- package/index.js +0 -22
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2021-
|
|
3
|
+
Copyright (c) 2021-2026 Nice Group of People, LLC
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"node:module";Object.create,Object.defineProperty,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.prototype.hasOwnProperty;export{};
|
package/index.d.mts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";iBAgCe,aAAA,CAAc,YAAA,OAAc,OAAA,QAAO,OAAA"}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import"./chunk-pm2C21R4.mjs";import{URL as e,fileURLToPath as t,format as n}from"node:url";import{filterRevertedCommitsSync as r}from"conventional-commits-filter";import{CommitParser as i}from"conventional-commits-parser";import a from"lodash/merge.js";import{readPackageUp as o}from"read-package-up";import s from"lodash/clone.js";import c from"lodash/forEach.js";import l from"lodash/map.js";import{patch as u,valid as d}from"semver";import f from"lodash/groupBy.js";import p from"lodash/orderBy.js";import{dirname as m}from"node:path";import{promisify as h}from"node:util";import g from"import-from-esm";import _ from"lodash/isPlainObject.js";import v from"lodash/size.js";import{Octokit as y}from"@octokit/rest";import b from"lodash/findIndex.js";import x from"lodash/sample.js";import S from"lodash/uniqBy.js";import{format as C}from"date-fns";import w from"lodash/cloneDeep.js";import T from"lodash/get.js";import E from"lodash/isFunction.js";import D from"lodash/set.js";function O(e,t,n,r){let i=[];return c(f(t,t=>t[e]||``),(e,t)=>{t===``&&(t=!1);let n=e;r&&(n=p(n,r));let a=n[0].typeSpec.semver,o=99;[`fix`,`patch`].includes(a)&&(o=20),[`feature`,`minor`].includes(a)&&(o=10),[`breaking`,`major`].includes(a)&&(o=0),i.push({commits:n,order:o,title:t})}),n&&(i=p(i,n)),i}function k(e,t,n){let r=[];return c(e,e=>{let t=e.title,n=!1;c(r,r=>{if(r.title===t)return n=!0,r.notes.push(e),!1}),n||r.push({notes:[e],title:t})}),r}function A(e,t,n){let r={};return r.commitGroups=O(n.groupBy,e,n.commitGroupsSort,n.commitsSort),r.noteGroups=k(t,n.noteGroupsSort,n.notesSort),r}function j(e,t,n,i){let o=[],f;if(e.ignoreReverted)for(let e of r(t))f.push(e);else f=s(t);return c(f,e=>{l(e.notes,t=>(t.commit=e,t)),o=o.concat(e.notes)}),n=a({},n,i,A(f,o,e)),i?.committerDate&&(n.date=i.committerDate),n.version&&d(n.version)&&(n.isPatch=n.isPatch||u(n.version)!==0),n={commits:t,context:n,filteredCommits:f,keyCommit:i,options:e},n}const M=m(t(import.meta.url)),N=async(e,t)=>{let{config:n,parserOpts:r,preset:i,presetConfig:a,writerOpts:o}=e,{cwd:s}=t,c;if(i){let e=`conventional-changelog-${i.toLowerCase()}`;c=await(await g.silent(M,e)||await g(s,e))(a)}else c=n?await(await g.silent(M,n)||await g(s,n))():{};return c=await(typeof c==`function`?_(a)?c(a):h(c)():c),{parserOpts:{...c.parserOpts,...r},writerOpts:{...c.writerOpts,...o}}},P=(e,t,n)=>{let{commit:r,commitGroups:i,linkReferences:a}=e,{repositoryUrl:o}=n,s=``,c=e=>e?a?` [ \`${e}\` ](${` ${o}/${r}/${e}`})`:` ${e}`:``,l=e=>{if(!e||v(e)===0)return``;let t=`, closes `,n=[];return e.map(e=>{e.issue&&n.push(`[ #${e.issue} ]`)}),t+=n.join(` `),t};return i.map(e=>{let n=e?.commits[0]?.typeSpec?.type;s+=`#### ${e?.commits[0]?.type}\n`,t.map(e=>{let{hash:t,header:r,references:i,scope:a,subject:o}=e;if(n===e.typeSpec.type){let e=`- {scope}{subject}{hash}{references}
|
|
2
|
+
`.replace(/\{scope\}/g,a?`**${a}**: `:``).replace(/\{subject\}/g,o||r).replace(/\{hash\}/g,c(t)).replace(/\{references\}/g,l(i));s+=e}}),s+=`
|
|
3
|
+
`}),s},F=new y({auth:process.env.GH_TOKEN}),I={email:[`noreply@github.com`,`users.noreply.github.com`,`semantic-release-bot@martynus.net`],login:[`dependabot`,`dependabot[bot]`,`kodiakhq`,`kodiakhq[bot]`,`renovate`,`renovate[bot]`,`semantic-release-bot`]},L=[`Props to`,`Kudos to`,`Thanks to`,`Brought to you by`],R=async(e,t,n)=>{let r=S(t.map(e=>({email:e.author.email,name:e.author.name})),`name`),{options:{contributorsProhibitList:i}}=e;await Promise.all(r.map((e,t)=>F.request(`GET /search/users`,{q:e.email}).then(({data:e})=>{let n=e.items[0]?.login;return n?(r[t].login=n,n):``}))),[...I.login,...i.login].map(e=>{let t=b(r,[`login`,e]);t!==-1&&r.splice(t)}),[...I.email,...i.email].map(e=>{let t=b(r,t=>t.email.includes(e));t!==-1&&r.splice(t)});let a=``;if(r.length>0){a+=`#### 🥳️ Contributors
|
|
4
|
+
`;let e=r.map(e=>`@${e.login}`).join(`, `);a+=`- ${x(L)} ${e}\n`,a+=`
|
|
5
|
+
`}return a},z=(e,t,n)=>{let{noteGroups:r}=e,i=``;return r.map(e=>{let{notes:t}=e,n=t[0].title;i+=`#### ${n}\n`,t.map(e=>{let{scope:t,text:n}=e,r=`- {scope}{text}
|
|
6
|
+
`.replace(/\{scope\}/g,t?`**${t}**: `:``).replace(/\{text\}/g,n||``);i+=r}),i+=`
|
|
7
|
+
`}),i},B=(e,t,n)=>{let{currentTag:r,date:i,linkCompare:a,previousTag:o,title:s}=e,{repositoryUrl:c}=n,l=`
|
|
8
|
+
| 🔖️ | Release Information |
|
|
9
|
+
| ----------- | --------------- |
|
|
10
|
+
| Current | **\`${r}\`** |\n`;if(a){let e=c+`/compare/`+o+`...`+r;l+=`| Previous | **[\`${o}\`](${e})** |\n`}return s&&(l+=`| Title | **\`${s}\`** |\n`),i&&(l+=`| Date | **\`${C(i,`yyyy-MM-dd`)}\`** |\n`),l+=`
|
|
11
|
+
`,l},V=async(e,t)=>{let{commitGroups:n,currentTag:r,date:i,host:a,issue:o,lastRelease:s,linkCompare:c,linkReferences:l,mentions:u,nextRelease:d,noteGroups:f,notes:p,options:m,owner:h,previousTag:g,references:_,repository:v,repoUrl:y,revert:b,version:x}=e,S={commitGroups:n,currentTag:r,date:i,host:a,issue:o,lastRelease:s,linkCompare:c,linkReferences:l,mentions:u,nextRelease:d,noteGroups:f,notes:p,options:m,owner:h,previousTag:g,references:_,repository:v,repoUrl:y,revert:b,version:x},C={repositoryUrl:v?a+`/`+h+`/`+v:y},w=``;return w+=B(S,t,C),w+=`
|
|
12
|
+
`,w+=P(S,t,C),w+=`
|
|
13
|
+
`,w+=await R(S,t,C),w+=`
|
|
14
|
+
`,w+=z(S,t,C),w+=`
|
|
15
|
+
`,w};function H(e,t,n){let r;try{e=JSON.parse(e)}catch{}return r=w(e),E(t)?(r=t(r,n),r&&(r.raw=e),r):(c(t,(e,t)=>{let n=T(r,t);n=E(e)?e(n,t):e,D(r,t,n)}),r.raw=e,r)}const U={commit:`commit`,hostname:`github.com`,issue:`issues`,issuePrefixes:[`#`,`gh-`],referenceActions:[`close`,`closes`,`closed`,`fix`,`fixes`,`fixed`,`resolve`,`resolves`,`resolved`]};async function W(t,s){let{parserOpts:c,writerOpts:l}=await N(t,s),{commits:u,cwd:d,lastRelease:f,nextRelease:p,options:m}=s,{commit:h,issue:g,issuePrefixes:_,referenceActions:v}=U,y=f.gitTag||f.gitHead,b=p.gitTag||p.gitHead,{commit:x,host:S,issue:C,linkCompare:w,linkReferences:T}=t,E=m.repositoryUrl.replace(/\.git$/i,``),[D,O,k,A]=/^(?!.+:\/\/)(?:(?<auth>.*)@)?(?<host>.*?):(?<path>.*)$/.exec(E)||[],{hostname:M,pathname:P,port:F,protocol:I}=new e(D?`ssh://${O?`${O}@`:``}${k}/${A}`:E);F=I.includes(`ssh`)?``:F,I=I&&/http[^s]/.test(I)?`http`:`https`;let[,L,R]=/^\/(?<owner>[^/]+)?\/?(?<repository>.+)?$/.exec(P)??[],z=a({commit:h,currentTag:b,host:n({hostname:M,port:F,protocol:I}),issue:g,linkCompare:b&&y,owner:L,packageData:(await o({cwd:d,normalize:!1}))?.packageJson,previousTag:y,repository:R,version:p.version},{commit:x,host:S,issue:C,linkCompare:w,linkReferences:T}),B=[],W=new i({issuePrefixes:_,referenceActions:v,...c});for(let e of r(u)){let t=e;if(!t?.message.trim())return!1;let n={...t,...W.parse(t?.message)};B.push(n)}let G=[];await B.map(async e=>{let t=await H(e,l.transform,s);G.push(t)}),G=await G.filter(e=>e!==void 0);let K=a({},z,m,l),q=G[0],J=H(q,l.transform,s)||q,{context:Y}=await j(K,G,s,J);return V(a({},z,Y),G)}export{W as generateNotes};
|
|
16
|
+
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["semverValid","semverPatch","_format"],"sources":["../src/utils/getCommitGroups.ts","../src/utils/getNoteGroups.ts","../src/utils/getExtraContent.ts","../src/utils/generate.ts","../src/utils/getChangelogConfig.ts","../src/templates/commit.ts","../src/templates/contributor.ts","../src/templates/footer.ts","../src/templates/header.ts","../src/utils/getMarkdown.ts","../src/utils/processCommit.ts","../src/index.ts"],"sourcesContent":["import _forEach from 'lodash/forEach.js'\nimport _groupBy from 'lodash/groupBy.js'\nimport _orderBy from 'lodash/orderBy.js'\n\nfunction getCommitGroups(groupBy, commits, commitGroupsSort, commitsSort) {\n let commitGroups: any = []\n\n const commitGroupsObj = _groupBy(commits, (commit) => commit[groupBy] || '')\n\n _forEach(commitGroupsObj, (commits, title: boolean | string) => {\n if (title === '') {\n title = false\n }\n\n let commitsSorted: any = commits\n\n if (commitsSort) {\n commitsSorted = _orderBy(commitsSorted, commitsSort)\n }\n\n const semver = commitsSorted[0].typeSpec.semver\n\n let order = 99\n if (['fix', 'patch'].includes(semver)) {\n order = 20\n }\n if (['feature', 'minor'].includes(semver)) {\n order = 10\n }\n if (['breaking', 'major'].includes(semver)) {\n order = 0\n }\n\n commitGroups.push({\n commits: commitsSorted,\n order,\n title: title,\n })\n })\n\n if (commitGroupsSort) {\n commitGroups = _orderBy(commitGroups, commitGroupsSort)\n // // @todo(#744) analytics -vs- deps-dev\n // console.dir(`>> commitGroupsSort`)\n // console.dir(commitGroups)\n }\n\n return commitGroups\n}\n\nexport default getCommitGroups\n","import _forEach from 'lodash/forEach.js'\n\nfunction getNoteGroups(notes, _noteGroupsSort, _notesSort) {\n const noteGroups: any = []\n\n // console.dir(`> getNoteGroups`)\n // console.dir(notes)\n _forEach(notes, (note) => {\n // console.dir(`> _forEach`)\n // console.dir(note)\n const title = note.title\n let titleExists = false\n\n _forEach(noteGroups, (group) => {\n if (group.title === title) {\n titleExists = true\n group.notes.push(note)\n return false\n }\n return\n })\n\n if (!titleExists) {\n noteGroups.push({\n notes: [note],\n title: title,\n })\n }\n })\n\n return noteGroups\n}\n\nexport default getNoteGroups\n","import getCommitGroups from './getCommitGroups'\nimport getNoteGroups from './getNoteGroups'\n\nfunction getExtraContext(commits, notes, options) {\n const context: any = {}\n\n context.commitGroups = getCommitGroups(\n options.groupBy,\n commits,\n options.commitGroupsSort,\n options.commitsSort,\n )\n\n context.noteGroups = getNoteGroups(\n notes,\n options.noteGroupsSort,\n options.notesSort,\n )\n\n return context\n}\n\nexport default getExtraContext\n","import { filterRevertedCommitsSync } from 'conventional-commits-filter'\nimport _clone from 'lodash/clone.js'\nimport _forEach from 'lodash/forEach.js'\nimport _map from 'lodash/map.js'\nimport _merge from 'lodash/merge.js'\nimport { patch as semverPatch, valid as semverValid } from 'semver'\n\nimport getExtraContext from './getExtraContent'\n\nfunction generate(options, commits, context, keyCommit) {\n let notes = []\n let filteredCommits: any\n\n if (options.ignoreReverted) {\n for (const commit of filterRevertedCommitsSync(commits)) {\n filteredCommits.push(commit)\n }\n } else {\n filteredCommits = _clone(commits)\n }\n\n _forEach(filteredCommits, (commit) => {\n _map(commit.notes, (note) => {\n note.commit = commit\n\n return note\n })\n\n notes = notes.concat(commit.notes)\n })\n // console.dir(`notes:`)\n // console.dir(notes)\n\n context = _merge(\n {},\n context,\n keyCommit,\n getExtraContext(filteredCommits, notes, options),\n )\n\n if (keyCommit?.committerDate) {\n context.date = keyCommit.committerDate\n }\n\n if (context.version && semverValid(context.version)) {\n context.isPatch = context.isPatch || semverPatch(context.version) !== 0\n }\n\n // @note this is/was a pass-through function, okay with \"skipping\"\n // context = options.finalizeContext(\n // context,\n // options,\n // filteredCommits,\n // keyCommit,\n // commits\n // )\n\n // @question should this be merge/extend? i.e, `...context` specifically?\n context = {\n commits,\n context,\n filteredCommits,\n keyCommit,\n options,\n }\n\n return context\n}\n\nexport default generate\n","/**\n * @copyright https://github.com/semantic-release/release-notes-generator\n */\nimport { dirname } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { promisify } from 'node:util'\n\n// import conventionalChangelogAngular from 'conventional-changelog-angular'\nimport importFrom from 'import-from-esm'\nimport _isPlainObject from 'lodash/isPlainObject.js'\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\n\nconst getChangelogConfig = async (pluginConfig, context) => {\n const { config, parserOpts, preset, presetConfig, writerOpts } = pluginConfig\n const { cwd } = context\n\n let loadedConfig: any\n\n if (preset) {\n const presetPackage = `conventional-changelog-${preset.toLowerCase()}`\n /**\n * @todo(semantic)\n * UNKNOWN\n * https://github.com/semantic-release/commit-analyzer/commit/f3b88d3e7409b0bac38cb58bd04f19506f2f6159\n */\n // @ts-ignore\n loadedConfig = await (\n (await importFrom.silent(__dirname, presetPackage)) ||\n (await importFrom(cwd, presetPackage))\n )(presetConfig)\n } else if (config) {\n // @ts-ignore\n loadedConfig = await (\n (await importFrom.silent(__dirname, config)) || (await importFrom(cwd, config))\n )()\n } else {\n // loadedConfig = conventionalChangelogAngular\n loadedConfig = {}\n }\n\n loadedConfig = await (typeof loadedConfig === 'function'\n ? _isPlainObject(presetConfig)\n ? loadedConfig(presetConfig)\n : promisify(loadedConfig)()\n : loadedConfig)\n\n const changelogConfig = {\n parserOpts: { ...loadedConfig.parserOpts, ...parserOpts },\n writerOpts: { ...loadedConfig.writerOpts, ...writerOpts },\n }\n\n return changelogConfig\n}\n\nexport { getChangelogConfig }\n","import _size from 'lodash/size.js'\n\nconst commit = (context, commits, meta) => {\n const { commit, commitGroups, linkReferences } = context\n const { repositoryUrl } = meta\n\n // @todo(release-notes) make variable\n const commitFormat = `- {scope}{subject}{hash}{references}\\n`\n\n let markdown = ``\n\n const getHash = (hash) => {\n if (!hash) return ''\n if (linkReferences) {\n const url = ` ${repositoryUrl}/${commit}/${hash}`\n return ` [ \\`${hash}\\` ](${url})`\n }\n return ` ${hash}`\n }\n\n const getReferences = (references) => {\n if (!references || _size(references) === 0) return ''\n let markdownReference = `, closes `\n const markdownReferenceArray: any = []\n references.map((reference: any) => {\n // markdownReferenceArray.push(\n // `[ ${reference.issue} ](${repositoryUrl}/${reference.issue})`\n // )\n\n // biome-ignore lint/complexity/noExtraBooleanCast: migrate\n if (!!reference.issue) {\n markdownReferenceArray.push(`[ #${reference.issue} ]`)\n }\n })\n markdownReference += markdownReferenceArray.join(' ')\n return markdownReference\n }\n\n commitGroups.map((commitGroup) => {\n const type = commitGroup?.commits[0]?.typeSpec?.type\n\n markdown += `#### ${commitGroup?.commits[0]?.type}\\n`\n // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: 11\n commits.map((commit) => {\n const { hash, header, references, scope, subject } = commit\n if (type === commit.typeSpec.type) {\n const commitMarkdown = commitFormat\n .replace(/\\{scope\\}/g, scope ? `**${scope}**: ` : '')\n .replace(/\\{subject\\}/g, subject ? subject : header)\n .replace(/\\{hash\\}/g, getHash(hash))\n .replace(/\\{references\\}/g, getReferences(references))\n\n markdown += commitMarkdown\n }\n })\n markdown += `\\n`\n })\n\n return markdown\n}\n\nexport { commit }\n","import { Octokit } from '@octokit/rest'\nimport _findIndex from 'lodash/findIndex.js'\nimport _sample from 'lodash/sample.js'\nimport _uniqBy from 'lodash/uniqBy.js'\n\nconst gh = new Octokit({ auth: process.env.GH_TOKEN })\n\ninterface IAuthor {\n email: string\n login?: string\n name: string\n}\n\n/**\n * @hack\n * remove these logins from contributors\n *\n * reason JeromeFitz is here is because most of the time\n * they are the only one making them in this repo ,haha\n *\n * maybe these should be a configuration setting?\n *\n */\nconst contributorsProhibitListDefault = {\n email: [\n 'noreply@github.com',\n 'users.noreply.github.com',\n 'semantic-release-bot@martynus.net',\n ],\n login: [\n 'dependabot',\n 'dependabot[bot]',\n 'kodiakhq',\n 'kodiakhq[bot]',\n 'renovate',\n 'renovate[bot]',\n 'semantic-release-bot',\n ],\n}\n\nconst contributorsSubtitle = [\n 'Props to',\n 'Kudos to',\n 'Thanks to',\n 'Brought to you by',\n]\n\nconst contributor = async (context, commits, _meta) => {\n const authors = _uniqBy(\n commits.map(\n (commit): IAuthor => ({\n email: commit.author.email,\n name: commit.author.name,\n }),\n ),\n 'name',\n )\n\n const {\n options: { contributorsProhibitList },\n } = context\n\n // console.dir(`> context`)\n // console.dir(context)\n\n await Promise.all(\n authors.map((author: any, authorIdx) =>\n gh\n .request('GET /search/users', {\n q: author.email,\n })\n .then(({ data }) => {\n const login = data.items[0]?.login\n // biome-ignore lint/complexity/noExtraBooleanCast: migrate\n if (!!login) {\n // biome-ignore lint/complexity/useLiteralKeys: migrate\n authors[authorIdx]['login'] = login\n return login\n }\n return ''\n }),\n ),\n )\n\n // @note could we lift this better somehow and reduce API calls?\n const contributorsProhibitListLogin = [\n ...contributorsProhibitListDefault.login,\n ...contributorsProhibitList.login,\n ]\n contributorsProhibitListLogin.map((eject) => {\n const ejectIndex = _findIndex(authors, ['login', eject])\n if (ejectIndex !== -1) authors.splice(ejectIndex)\n })\n const contributorsProhibitListEmail = [\n ...contributorsProhibitListDefault.email,\n ...contributorsProhibitList.email,\n ]\n contributorsProhibitListEmail.map((eject) => {\n const ejectIndex = _findIndex(authors, (author: any) =>\n author.email.includes(eject),\n )\n if (ejectIndex !== -1) authors.splice(ejectIndex)\n })\n\n let markdown = ``\n if (authors.length > 0) {\n // @todo(release-notes) pass title as configuration option\n markdown += `#### 🥳️ Contributors\\n`\n const authorsString = authors.map((author: any) => `@${author.login}`).join(', ')\n markdown += `- ${_sample(contributorsSubtitle)} ${authorsString}\\n`\n // markdown += `\\n---\\n`\n // markdown += _sample(contributorKudos)!(\n // authors.map((author: any) => author.login).join(',')\n // )\n markdown += `\\n`\n }\n\n return markdown\n}\n\nexport { contributor }\n","const footer = (context, _commits, _meta) => {\n const { noteGroups } = context\n\n // @todo(release-notes) make variable\n const noteFormat = `- {scope}{text}\\n`\n\n let markdown = ``\n\n noteGroups.map((noteGroup) => {\n const { notes } = noteGroup\n const title = notes[0].title\n markdown += `#### ${title}\\n`\n notes.map((note) => {\n const { scope, text } = note\n const noteMarkdown = noteFormat\n .replace(/\\{scope\\}/g, scope ? `**${scope}**: ` : '')\n .replace(/\\{text\\}/g, text ? text : '')\n\n markdown += noteMarkdown\n })\n markdown += `\\n`\n })\n\n return markdown\n}\n\nexport { footer }\n","import { format as _format } from 'date-fns'\n\nconst header = (context, _commits, meta) => {\n // @todo(release-notes) pass as option\n const { currentTag, date, linkCompare, previousTag, title } = context\n const { repositoryUrl } = meta\n\n let markdown = `\n| 🔖️ | Release Information |\n| ----------- | --------------- |\n| Current | **\\`${currentTag}\\`** |\\n`\n\n if (linkCompare) {\n const linkCompareUrl =\n // biome-ignore lint/style/useTemplate: migrate\n repositoryUrl + '/compare/' + previousTag + '...' + currentTag\n markdown += `| Previous | **[\\`${previousTag}\\`](${linkCompareUrl})** |\\n`\n }\n if (title) {\n markdown += `| Title | **\\`${title}\\`** |\\n`\n }\n if (date) {\n markdown += `| Date | **\\`${_format(date, 'yyyy-MM-dd')}\\`** |\\n`\n }\n\n markdown += `\\n`\n return markdown\n}\n\nexport { header }\n","import { commit, contributor, footer, header } from '../templates/index'\n\nconst getMarkdown = async (context, commits) => {\n const {\n commitGroups,\n currentTag,\n date,\n host,\n issue,\n lastRelease,\n linkCompare,\n linkReferences,\n mentions,\n nextRelease,\n noteGroups,\n notes,\n options,\n owner,\n previousTag,\n references,\n repository,\n repoUrl,\n revert,\n version,\n } = context\n\n const markdownContext = {\n commitGroups, // // [{title|commits}]\n currentTag,\n date, // isoString\n host,\n issue, // string\n lastRelease, // version|gitTag|channels|gitHead|name\n linkCompare,\n linkReferences,\n mentions, // []\n nextRelease, // type|channel|gitHead|version|gitTag|name|notes\n noteGroups, // []\n notes,\n options, // from `release.config`\n owner,\n previousTag,\n references, // []\n repository,\n repoUrl,\n revert, // boolean\n version,\n }\n\n // Object.keys(markdownContext).map((key) => {\n // console.dir(`>> ${key}:`)\n // console.dir(markdownContext[key])\n // })\n\n // biome-ignore lint/style/useTemplate: migrate\n const repositoryUrl = repository ? host + '/' + owner + '/' + repository : repoUrl\n\n const meta = {\n repositoryUrl,\n }\n // const meta = {}\n\n let markdown = ``\n // TEMPLATE\n // HEADER\n markdown += header(markdownContext, commits, meta)\n markdown += `\\n`\n // COMMITS\n markdown += commit(markdownContext, commits, meta)\n markdown += `\\n`\n // CONTRIBUTORS\n markdown += await contributor(markdownContext, commits, meta)\n markdown += `\\n`\n // FOOTER (NOTES)\n markdown += footer(markdownContext, commits, meta)\n markdown += `\\n`\n\n return markdown\n}\n\nexport { getMarkdown }\n","import _cloneDeep from 'lodash/cloneDeep.js'\nimport _forEach from 'lodash/forEach.js'\nimport _get from 'lodash/get.js'\nimport _isFunction from 'lodash/isFunction.js'\nimport _set from 'lodash/set.js'\n\n/**\n * @ref lifted from release-notes-generator\n */\nfunction processCommit(chunk, transform, context) {\n let commit: any\n\n try {\n chunk = JSON.parse(chunk)\n // biome-ignore lint/suspicious/noEmptyBlockStatements: migrate\n } catch (_error) {}\n\n commit = _cloneDeep(chunk)\n\n if (_isFunction(transform)) {\n commit = transform(commit, context)\n\n if (commit) {\n commit.raw = chunk\n }\n\n return commit\n }\n\n _forEach(transform, (el, path) => {\n let value = _get(commit, path)\n\n if (_isFunction(el)) {\n value = el(value, path)\n } else {\n value = el\n }\n\n _set(commit, path, value)\n })\n\n commit.raw = chunk\n\n return commit\n}\n\nexport { processCommit }\n","import { format, URL } from 'node:url'\n\nimport { filterRevertedCommitsSync } from 'conventional-commits-filter'\nimport { CommitParser } from 'conventional-commits-parser'\nimport _merge from 'lodash/merge.js'\nimport { readPackageUp } from 'read-package-up'\n\nimport generate from './utils/generate'\nimport { getChangelogConfig } from './utils/getChangelogConfig'\nimport { getMarkdown } from './utils/getMarkdown'\nimport { processCommit } from './utils/processCommit'\n\nconst configGithub = {\n commit: 'commit',\n hostname: 'github.com',\n issue: 'issues',\n issuePrefixes: ['#', 'gh-'],\n referenceActions: [\n 'close',\n 'closes',\n 'closed',\n 'fix',\n 'fixes',\n 'fixed',\n 'resolve',\n 'resolves',\n 'resolved',\n ],\n}\n\n// @todo(complexity) 17\n// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: migrate\nasync function generateNotes(pluginConfig, context) {\n const { parserOpts, writerOpts } = await getChangelogConfig(pluginConfig, context)\n const { commits: commitsPassed, cwd, lastRelease, nextRelease, options } = context\n\n const { commit, issue, issuePrefixes, referenceActions } = configGithub\n\n const previousTag = lastRelease.gitTag || lastRelease.gitHead\n const currentTag = nextRelease.gitTag || nextRelease.gitHead\n const {\n commit: commitConfig,\n host: hostConfig,\n issue: issueConfig,\n linkCompare,\n linkReferences,\n } = pluginConfig\n\n const repositoryUrl = options.repositoryUrl.replace(/\\.git$/i, '')\n const [match, auth, host, path] =\n /^(?!.+:\\/\\/)(?:(?<auth>.*)@)?(?<host>.*?):(?<path>.*)$/.exec(repositoryUrl) ||\n []\n let { hostname, pathname, port, protocol } = new URL(\n match ? `ssh://${auth ? `${auth}@` : ''}${host}/${path}` : repositoryUrl,\n )\n port = protocol.includes('ssh') ? '' : port\n protocol = protocol && /http[^s]/.test(protocol) ? 'http' : 'https'\n\n const [, owner, repository] =\n /^\\/(?<owner>[^/]+)?\\/?(?<repository>.+)?$/.exec(pathname) ?? []\n\n const changelogContext = _merge(\n {\n commit,\n currentTag,\n host: format({ hostname, port, protocol }),\n issue,\n linkCompare: currentTag && previousTag,\n owner,\n packageData: (await readPackageUp({ cwd, normalize: false }))?.packageJson,\n previousTag,\n repository,\n version: nextRelease.version,\n },\n {\n commit: commitConfig,\n host: hostConfig,\n issue: issueConfig,\n linkCompare,\n linkReferences,\n },\n )\n\n const commitsParsed: any = []\n const parser = new CommitParser({\n issuePrefixes,\n referenceActions,\n ...parserOpts,\n })\n\n for (const _commit of filterRevertedCommitsSync(commitsPassed)) {\n const commit: any = _commit\n if (!commit?.message.trim()) {\n return false\n }\n const commitPassed = {\n ...commit,\n ...parser.parse(commit?.message),\n }\n commitsParsed.push(commitPassed)\n }\n let commits: any = []\n await commitsParsed.map(async (commitParsed) => {\n const commitProcessed: any = await processCommit(\n commitParsed,\n writerOpts.transform,\n context,\n )\n commits.push(commitProcessed)\n })\n\n /**\n * @hack why is something being brought back as undefined?\n */\n commits = await commits.filter((commit) => commit !== undefined)\n\n const _options = _merge({}, changelogContext, options, writerOpts)\n\n /**\n * @note(release-notes-generator) oddly, `date` is pulled from here\n * could we do this differently? what other fields\n * are pulled for info purposes?\n */\n const _chunk = commits[0]\n const keyCommit = processCommit(_chunk, writerOpts.transform, context) || _chunk\n const { context: _context } = await generate(_options, commits, context, keyCommit)\n\n const markdownContext = _merge({}, changelogContext, _context)\n\n return getMarkdown(markdownContext, commits)\n}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ACH,GAAG,EAAO,MAAM,GAAQ,QAAQ,CACjC,CACD,EAAc,KAAK,EAAa,CAElC,IAAI,EAAe,EAAE,CACrB,MAAM,EAAc,IAAI,KAAO,IAAiB,CAC9C,IAAM,EAAuB,MAAM,EACjC,EACA,EAAW,UACX,EACD,CACD,EAAQ,KAAK,EAAgB,EAC7B,CAKF,EAAU,MAAM,EAAQ,OAAQ,GAAW,IAAW,OAAU,CAEhE,IAAM,EAAW,EAAO,EAAE,CAAE,EAAkB,EAAS,EAAW,CAO5D,EAAS,EAAQ,GACjB,EAAY,EAAc,EAAQ,EAAW,UAAW,EAAQ,EAAI,EACpE,CAAE,QAAS,GAAa,MAAM,EAAS,EAAU,EAAS,EAAS,EAAU,CAInF,OAAO,EAFiB,EAAO,EAAE,CAAE,EAAkB,EAAS,CAE1B,EAAQ"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeromefitz/release-notes-generator",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.14-canary.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Custom Release Note Generator for Semantic Release.",
|
|
6
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/JeromeFitz/packages"
|
|
9
|
+
},
|
|
7
10
|
"author": {
|
|
8
11
|
"name": "Jerome Fitzgerald",
|
|
9
12
|
"email": "j@jeromefitzgerald.com",
|
|
@@ -12,22 +15,20 @@
|
|
|
12
15
|
"license": "MIT",
|
|
13
16
|
"private": false,
|
|
14
17
|
"engines": {
|
|
15
|
-
"node": ">=
|
|
18
|
+
"node": ">=24"
|
|
16
19
|
},
|
|
17
20
|
"exports": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
21
|
+
".": "./index.mjs",
|
|
22
|
+
"./package.json": "./package.json"
|
|
20
23
|
},
|
|
21
24
|
"scripts": {
|
|
22
|
-
"build": "
|
|
25
|
+
"build": "tsdown",
|
|
23
26
|
"clean": "rm -rf .turbo && rm -rf dist",
|
|
24
27
|
"clean:install": "pnpm run clean && rm -rf node_modules",
|
|
25
28
|
"copy": "mkdir -p ./dist && ./scripts/copy.sh",
|
|
26
|
-
"dev": "
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"lint": "pnpm run format:prettier --check && pnpm run lint:eslint",
|
|
30
|
-
"lint:eslint": "eslint ./src --max-warnings=0",
|
|
29
|
+
"dev": "tsdown --watch",
|
|
30
|
+
"lint": "pnpm run lint:typescript",
|
|
31
|
+
"lint:typescript": "tsc --noEmit --declaration",
|
|
31
32
|
"semantic-release": "semantic-release",
|
|
32
33
|
"semantic-release:dry": "semantic-release --dry-run"
|
|
33
34
|
},
|
|
@@ -35,20 +36,21 @@
|
|
|
35
36
|
"lodash": "^4.17.21"
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"@octokit/rest": "22.0.
|
|
39
|
+
"@octokit/rest": "22.0.1",
|
|
39
40
|
"conventional-commits-filter": "5.0.0",
|
|
40
|
-
"conventional-commits-parser": "6.
|
|
41
|
+
"conventional-commits-parser": "6.3.0",
|
|
41
42
|
"date-fns": "4.1.0",
|
|
42
43
|
"import-from-esm": "2.0.0",
|
|
43
|
-
"read-package-up": "
|
|
44
|
-
"semver": "7.7.
|
|
44
|
+
"read-package-up": "12.0.0",
|
|
45
|
+
"semver": "7.7.4"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@types/lodash": "4.17.
|
|
48
|
-
"lodash": "4.17.
|
|
48
|
+
"@types/lodash": "4.17.24",
|
|
49
|
+
"lodash": "4.17.23"
|
|
49
50
|
},
|
|
50
51
|
"publishConfig": {
|
|
51
|
-
"registry": "https://registry.npmjs.org/"
|
|
52
|
+
"registry": "https://registry.npmjs.org/",
|
|
53
|
+
"provenance": true
|
|
52
54
|
},
|
|
53
55
|
"sideEffects": false
|
|
54
56
|
}
|
package/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{format as Bt,URL as Dt}from"url";import{filterRevertedCommitsSync as It}from"conventional-commits-filter";import{CommitParser as Mt}from"conventional-commits-parser";import B from"lodash/merge.js";import{readPackageUp as qt}from"read-package-up";import{filterRevertedCommitsSync as ut}from"conventional-commits-filter";import gt from"lodash/clone.js";import dt from"lodash/forEach.js";import ht from"lodash/map.js";import yt from"lodash/merge.js";import{patch as wt,valid as bt}from"semver";import mt from"lodash/forEach.js";import ct from"lodash/groupBy.js";import A from"lodash/orderBy.js";function pt(a,m,e,t){let r=[],n=ct(m,function(s){return s[a]||""});return mt(n,function(s,i){i===""&&(i=!1);let o=s;t&&(o=A(o,t));let c=o[0].typeSpec.semver,p=99;["fix","patch"].includes(c)&&(p=20),["feature","minor"].includes(c)&&(p=10),["breaking","major"].includes(c)&&(p=0),r.push({commits:o,order:p,title:i})}),e&&(r=A(r,e)),r}var N=pt;import F from"lodash/forEach.js";function ft(a,m,e){let t=[];return F(a,function(r){let n=r.title,s=!1;F(t,function(i){if(i.title===n)return s=!0,i.notes.push(r),!1}),s||t.push({notes:[r],title:n})}),t}var H=ft;function lt(a,m,e){let t={};return t.commitGroups=N(e.groupBy,a,e.commitGroupsSort,e.commitsSort),t.noteGroups=H(m,e.noteGroupsSort,e.notesSort),t}var z=lt;function xt(a,m,e,t){let r=[],n;if(a.ignoreReverted)for(let s of ut(m))n.push(s);else n=gt(m);return dt(n,function(s){ht(s.notes,function(i){return i.commit=s,i}),r=r.concat(s.notes)}),e=yt({},e,t,z(n,r,a)),t&&t.committerDate&&(e.date=t.committerDate),e.version&&bt(e.version)&&(e.isPatch=e.isPatch||wt(e.version)!==0),e={commits:m,context:e,filteredCommits:n,keyCommit:t,options:a},e}var J=xt;import{dirname as Ct}from"path";import{fileURLToPath as _t}from"url";import{promisify as vt}from"util";import R from"import-from-esm";import $t from"lodash/isPlainObject.js";var K=Ct(_t(import.meta.url)),V=async(a,m)=>{let{config:e,parserOpts:t,preset:r,presetConfig:n,writerOpts:s}=a,{cwd:i}=m,o;if(r){let p=`conventional-changelog-${r.toLowerCase()}`;o=await(await R.silent(K,p)||await R(i,p))(n)}else e?o=await(await R.silent(K,e)||await R(i,e))():o={};return o=await(typeof o=="function"?$t(n)?o(n):vt(o)():o),{parserOpts:{...o.parserOpts,...t},writerOpts:{...o.writerOpts,...s}}};import kt from"lodash/size.js";var E=(a,m,e)=>{let{commit:t,commitGroups:r,linkReferences:n}=a,{repositoryUrl:s}=e,i=`- {scope}{subject}{hash}{references}
|
|
2
|
-
`,o="",c=f=>{if(!f)return"";if(n){let l=` ${s}/${t}/${f}`;return` [ \`${f}\` ](${l})`}return` ${f}`},p=f=>{if(!f||kt(f)===0)return"";let l=", closes ",g=[];return f.map(d=>{d.issue&&g.push(`[ #${d.issue} ]`)}),l+=g.join(" "),l};return r.map(f=>{let{commits:l}=f,g=l[0]?.type;o+=`#### ${g}
|
|
3
|
-
`,l.map(d=>{let{hash:b,header:v,references:$,scope:h,subject:y}=d,x=i.replace(/\{scope\}/g,h?`**${h}**: `:"").replace(/\{subject\}/g,y||v).replace(/\{hash\}/g,c(b)).replace(/\{references\}/g,p($));o+=x}),o+=`
|
|
4
|
-
`}),o};import{Octokit as Pt}from"@octokit/rest";import Q from"lodash/findIndex.js";import Gt from"lodash/sample.js";import Rt from"lodash/uniqBy.js";var Ot=new Pt({auth:process.env.GH_TOKEN}),W={email:["noreply@github.com","users.noreply.github.com","semantic-release-bot@martynus.net"],login:["dependabot","dependabot[bot]","kodiakhq","kodiakhq[bot]","renovate","renovate[bot]","semantic-release-bot"]},Tt=["Props to","Kudos to","Thanks to","Brought to you by"],L=async(a,m,e)=>{let t=Rt(m.map(o=>({email:o.author.email,name:o.author.name})),"name"),{options:{contributorsProhibitList:r}}=a;await Promise.all(t.map((o,c)=>Ot.request("GET /search/users",{q:o.email}).then(({data:p})=>{let f=p.items[0]?.login;return f?(t[c].login=f,f):""}))),[...W.login,...r.login].map(o=>{let c=Q(t,["login",o]);c!==-1&&t.splice(c)}),[...W.email,...r.email].map(o=>{let c=Q(t,p=>p.email.includes(o));c!==-1&&t.splice(c)});let i="";if(t.length>0){i+=`#### \u{1F973}\uFE0F Contributors
|
|
5
|
-
`;let o=t.map(c=>`@${c.login}`).join(", ");i+=`- ${Gt(Tt)} ${o}
|
|
6
|
-
`,i+=`
|
|
7
|
-
`}return i};var S=(a,m,e)=>{let{noteGroups:t}=a,r=`- {scope}{text}
|
|
8
|
-
`,n="";return t.map(s=>{let{notes:i}=s,o=i[0].title;n+=`#### ${o}
|
|
9
|
-
`,i.map(c=>{let{scope:p,text:f}=c,l=r.replace(/\{scope\}/g,p?`**${p}**: `:"").replace(/\{text\}/g,f||"");n+=l}),n+=`
|
|
10
|
-
`}),n};import{format as Et}from"date-fns";var U=(a,m,e)=>{let{currentTag:t,date:r,linkCompare:n,previousTag:s,title:i}=a,{repositoryUrl:o}=e,c=`
|
|
11
|
-
| \u{1F516}\uFE0F | Release Information |
|
|
12
|
-
| ----------- | --------------- |
|
|
13
|
-
| Current | **\`${t}\`** |
|
|
14
|
-
`;if(n){let p=o+"/compare/"+s+"..."+t;c+=`| Previous | **[\`${s}\`](${p})** |
|
|
15
|
-
`}return i&&(c+=`| Title | **\`${i}\`** |
|
|
16
|
-
`),r&&(c+=`| Date | **\`${Et(r,"yyyy-MM-dd")}\`** |
|
|
17
|
-
`),c+=`
|
|
18
|
-
`,c};var X=async(a,m)=>{let{commitGroups:e,currentTag:t,date:r,host:n,issue:s,lastRelease:i,linkCompare:o,linkReferences:c,mentions:p,nextRelease:f,noteGroups:l,notes:g,options:d,owner:b,previousTag:v,references:$,repository:h,repoUrl:y,revert:x,version:O}=a,w={commitGroups:e,currentTag:t,date:r,host:n,issue:s,lastRelease:i,linkCompare:o,linkReferences:c,mentions:p,nextRelease:f,noteGroups:l,notes:g,options:d,owner:b,previousTag:v,references:$,repository:h,repoUrl:y,revert:x,version:O},C={repositoryUrl:h?n+"/"+b+"/"+h:y},u="";return u+=U(w,m,C),u+=`
|
|
19
|
-
`,u+=E(w,m,C),u+=`
|
|
20
|
-
`,u+=await L(w,m,C),u+=`
|
|
21
|
-
`,u+=S(w,m,C),u+=`
|
|
22
|
-
`,u};import Lt from"lodash/cloneDeep.js";import St from"lodash/forEach.js";import Ut from"lodash/get.js";import Y from"lodash/isFunction.js";import jt from"lodash/set.js";function j(a,m,e){let t;try{a=JSON.parse(a)}catch{}return t=Lt(a),Y(m)?(t=m(t,e),t&&(t.raw=a),t):(St(m,function(r,n){let s=Ut(t,n);Y(r)?s=r(s,n):s=r,jt(t,n,s)}),t.raw=a,t)}var At={commit:"commit",hostname:"github.com",issue:"issues",issuePrefixes:["#","gh-"],referenceActions:["close","closes","closed","fix","fixes","fixed","resolve","resolves","resolved"]};async function Ho(a,m){let{parserOpts:e,writerOpts:t}=await V(a,m),{commits:r,cwd:n,lastRelease:s,nextRelease:i,options:o}=m,{commit:c,issue:p,issuePrefixes:f,referenceActions:l}=At,g=s.gitTag||s.gitHead,d=i.gitTag||i.gitHead,{commit:b,host:v,issue:$,linkCompare:h,linkReferences:y}=a,x=o.repositoryUrl.replace(/\.git$/i,""),[O,w,D,C]=/^(?!.+:\/\/)(?:(?<auth>.*)@)?(?<host>.*?):(?<path>.*)$/.exec(x)||[],{hostname:u,pathname:Z,port:T,protocol:k}=new Dt(O?`ssh://${w?`${w}@`:""}${D}/${C}`:x);T=k.includes("ssh")?"":T,k=k&&/http[^s]/.test(k)?"http":"https";let[,tt,ot]=/^\/(?<owner>[^/]+)?\/?(?<repository>.+)?$/.exec(Z)??[],I=B({commit:c,currentTag:d,host:Bt({hostname:u,port:T,protocol:k}),issue:p,linkCompare:d&&g,owner:tt,packageData:(await qt({cwd:n,normalize:!1})||{}).packageJson,previousTag:g,repository:ot,version:i.version},{commit:b,host:v,issue:$,linkCompare:h,linkReferences:y}),M=[],et=new Mt({issuePrefixes:f,referenceActions:l,...e});for(let P of It(r)){let G=P;if(!G?.message.trim())return!1;let at={...G,...et.parse(G?.message)};M.push(at)}let _=[];await M.map(async P=>{let G=await j(P,t.transform,m);_.push(G)}),_=await _.filter(P=>P!==void 0);let rt=B({},I,o,t),q=_[0],nt=j(q,t.transform,m)||q,{context:st}=await J(rt,_,m,nt),it=B({},I,st);return X(it,_)}export{Ho as generateNotes};
|