mirror of
https://github.com/darksaid98/auto-changelog.git
synced 2026-12-01 14:38:47 +00:00
refactor: enhance ESLint configuration and type safety
This commit replaces `.eslintrc.yml` with `eslint.config.mts`, and updates the ESLint setup with Noir and Flat Gitignore configs. Signed-off-by: Ardalan Amini <[email protected]>
This commit is contained in:
32 files changed
+1140
-752
No files matched your search
@@ -1,12 +0,0 @@
|
||||
env:
|
||||
es2022: true
|
||||
node: true
|
||||
extends:
|
||||
- noir/all
|
||||
parserOptions:
|
||||
project: ./tsconfig.json
|
||||
ecmaVersion: latest
|
||||
sourceType: module
|
||||
rules:
|
||||
import/extensions: off
|
||||
import/no-relative-parent-imports: off
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
require('./sourcemap-register.js');(()=>{var e={252:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generateChangelog=generateChangelog;const s=A(4708);const r=A(9456);const o=A(3820);async function generateChangelog(e){const{owner:t,repo:A}=(0,o.repository)();const n=new r.ChangelogNode;for await(const r of(0,o.iterateCommits)(t,A,e)){const e=r.commit.message.split("\n")[0];(0,s.debug)(`commit message -> ${e}`);let{type:t,scope:A,description:i,pr:a,flag:c,breaking:l}=(0,o.parseCommitMessage)(e);i=(0,o.trim)(i);if(!i)continue;c=(0,o.trim)(c);if(c==="ignore")continue;const g=n.addType(t);const u=g.addScope(A);const E=u.addCommit(i,l);const h=E.addAuthor(r.author?.login);h.addReference(r.sha,a)}const i=n.print();if(i)return`${i}\n`;return""}},6351:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generateFooter=generateFooter;const s=A(6087);const r=A(8642);const o=A(3820);async function generateFooter(e){const{owner:t,repo:A,url:n}=(0,o.repository)();const i=(0,r.releaseName)();const a=[];if((0,r.mentionNewContributors)()){const{rest:r}=(0,o.octokit)();const{data:n}=await r.repos.generateReleaseNotes({owner:t,repo:A,tag_name:i,previous_tag_name:e});const c=s.marked.lexer(n.body);const l=c.findIndex((e=>e.type==="heading"&&e.text==="New Contributors"));const g=c[l+1];if(g.type==="list")a.push(`## New Contributors\n${g.raw}\n`)}if((0,r.includeCompareLink)()&&e){let t=`${n}/compare/${e}...${i}`;if(!(0,r.useGitHubAutolink)()||(0,r.releaseNamePrefix)())t=`\`[${e}...${i}](${n}/compare/${e}...${i})\``;a.push(`**Full Changelog**: ${t}`)}if(a.length>0)a.unshift("");return a.join("\n\n")}},3139:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generate=generate;const s=A(252);const r=A(6351);const o=A(6027);const n=A(146);async function generate(){const{prerelease:e,releaseId:t,previous:A}=await(0,n.getTagInfo)();(0,o.setPrerelease)(e);(0,o.setReleaseId)(t);let i=await(0,s.generateChangelog)(A?.sha);i+=await(0,r.generateFooter)(A?.name);(0,o.setChangelog)(i)}},8453:function(e,t,A){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.commitTypes=commitTypes;const r=s(A(5625));const o=A(5020);function commitTypes(){return(0,o.input)("commit-types",(e=>r.default.parse(e)))}},2878:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.defaultCommitType=defaultCommitType;const s=A(5020);function defaultCommitType(){return(0,s.input)("default-commit-type")}},5595:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.gitHubToken=gitHubToken;const s=A(5020);function gitHubToken(){return(0,s.input)("github-token")}},1822:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.includeCommitLinks=includeCommitLinks;const s=A(3545);function includeCommitLinks(){return(0,s.booleanInput)("include-commit-links")}},1589:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.includeCompareLink=includeCompareLink;const s=A(3545);function includeCompareLink(){return(0,s.booleanInput)("include-compare-link")}},2065:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.includePRLinks=includePRLinks;const s=A(3545);function includePRLinks(){return(0,s.booleanInput)("include-pr-links")}},8642:function(e,t,A){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,A,s){if(s===undefined)s=A;var r=Object.getOwnPropertyDescriptor(t,A);if(!r||("get"in r?!t.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return t[A]}}}Object.defineProperty(e,s,r)}:function(e,t,A,s){if(s===undefined)s=A;e[s]=t[A]});var r=this&&this.__exportStar||function(e,t){for(var A in e)if(A!=="default"&&!Object.prototype.hasOwnProperty.call(t,A))s(t,e,A)};Object.defineProperty(t,"__esModule",{value:true});r(A(8453),t);r(A(2878),t);r(A(5595),t);r(A(1589),t);r(A(1822),t);r(A(2065),t);r(A(3317),t);r(A(9530),t);r(A(7211),t);r(A(4876),t);r(A(6340),t);r(A(4593),t)},3317:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.mentionAuthors=mentionAuthors;const s=A(3545);function mentionAuthors(){return(0,s.booleanInput)("mention-authors")}},9530:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.mentionNewContributors=mentionNewContributors;const s=A(3545);function mentionNewContributors(){return(0,s.booleanInput)("mention-new-contributors")}},4876:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.releaseNamePrefix=releaseNamePrefix;const s=A(5020);function releaseNamePrefix(){return(0,s.input)("release-name-prefix",false)}},7211:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.releaseName=releaseName;const s=A(5020);function releaseName(){return(0,s.input)("release-name")}},6340:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semver=sLine truncated
|
||||
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */;const escape=e=>e.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22");const normalizeLinefeeds=e=>e.replace(/\r?\n|\r/g,"\r\n");const s=[];const r=new Uint8Array([13,10]);g=0;let o=false;for(const[t,n]of e){if(typeof n==="string"){const e=S.encode(A+`; name="${escape(normalizeLinefeeds(t))}"`+`\r\n\r\n${normalizeLinefeeds(n)}\r\n`);s.push(e);g+=e.byteLength}else{const e=S.encode(`${A}; name="${escape(normalizeLinefeeds(t))}"`+(n.name?`; filename="${escape(n.name)}"`:"")+"\r\n"+`Content-Type: ${n.type||"application/octet-stream"}\r\n\r\n`);s.push(e,n,r);if(typeof n.size==="number"){g+=e.byteLength+n.size+r.byteLength}else{o=true}}}const n=S.encode(`--${t}--`);s.push(n);g+=n.byteLength;if(o){g=null}l=e;c=async function*(){for(const e of s){if(e.stream){yield*e.stream()}else{yield e}}};u="multipart/form-data; boundary="+t}else if(n(e)){l=e;g=e.size;if(e.type){u=e.type}}else if(typeof e[Symbol.asyncIterator]==="function"){if(t){throw new TypeError("keepalive")}if(r.isDisturbed(e)||e.locked){throw new TypeError("Response body object should not be disturbed or locked")}s=e instanceof R?e:o(e)}if(typeof l==="string"||r.isBuffer(l)){g=Buffer.byteLength(l)}if(c!=null){let t;s=new R({async start(){t=c(e)[Symbol.asyncIterator]()},async pull(e){const{value:A,done:r}=await t.next();if(r){queueMicrotask((()=>{e.close()}))}else{if(!B(s)){e.enqueue(new Uint8Array(A))}}return e.desiredSize>0},async cancel(e){await t.return()},type:undefined})}const E={stream:s,source:l,length:g};return[E,u]}function safelyExtractBody(e,t=false){if(!R){R=A(3774).ReadableStream}if(e instanceof R){I(!r.isDisturbed(e),"The body has already been consumed.");I(!e.locked,"The stream is locked.")}return extractBody(e,t)}function cloneBody(e){const[t,A]=e.stream.tee();const s=d(A,{transfer:[A]});const[,r]=s.tee();e.stream=t;return{stream:r,length:e.length,source:e.source}}async function*consumeBody(e){if(e){if(m(e)){yield e}else{const t=e.stream;if(r.isDisturbed(t)){throw new TypeError("The body has already been consumed.")}if(t.locked){throw new TypeError("The stream is locked.")}t[Q]=true;yield*t}}}function throwIfAborted(e){if(e.aborted){throw new h("The operation was aborted.","AbortError")}}function bodyMixinMethods(e){const t={blob(){return specConsumeBody(this,(e=>{let t=bodyMimeType(this);if(t==="failure"){t=""}else if(t){t=k(t)}return new p([e],{type:t})}),e)},arrayBuffer(){return specConsumeBody(this,(e=>new Uint8Array(e).buffer),e)},text(){return specConsumeBody(this,utf8DecodeBytes,e)},json(){return specConsumeBody(this,parseJSONFromBytes,e)},async formData(){E.brandCheck(this,e);throwIfAborted(this[u]);const t=this.headers.get("Content-Type");if(/multipart\/form-data/.test(t)){const e={};for(const[t,A]of this.headers)e[t.toLowerCase()]=A;const t=new g;let A;try{A=new s({headers:e,preservePath:true})}catch(e){throw new h(`${e}`,"AbortError")}A.on("field",((e,A)=>{t.append(e,A)}));A.on("file",((e,A,s,r,o)=>{const n=[];if(r==="base64"||r.toLowerCase()==="base64"){let r="";A.on("data",(e=>{r+=e.toString().replace(/[\r\n]/gm,"");const t=r.length-r.length%4;n.push(Buffer.from(r.slice(0,t),"base64"));r=r.slice(t)}));A.on("end",(()=>{n.push(Buffer.from(r,"base64"));t.append(e,new D(n,s,{type:o}))}))}else{A.on("data",(e=>{n.push(e)}));A.on("end",(()=>{t.append(e,new D(n,s,{type:o}))}))}}));const r=new Promise(((e,t)=>{A.on("finish",e);A.on("error",(e=>t(new TypeError(e))))}));if(this.body!==null)for await(const e of consumeBody(this[u].body))A.write(e);A.end();await r;return t}else if(/application\/x-www-form-urlencoded/.test(t)){let e;try{let t="";const A=new TextDecoder("utf-8",{ignoreBOM:true});for await(const e of consumeBody(this[u].body)){if(!m(e)){throw new TypeError("Expected Uint8Array chunk")}t+=A.decode(e,{stream:true})}t+=A.decode();e=new URLSearchParams(t)}catch(e){throw Object.assign(new TypeError,{cause:e})}const t=new g;for(const[A,s]of e){t.append(A,s)}return t}else{await Promise.resolve();throwIfAborted(this[u]);throw E.errors.exception({header:`${e.name}.formData`,message:"Could not parse content as FormData."})}}};return t}function mixinBody(e){Object.assign(e.prototype,bodyMixinMethods(e))}async function specConsumeBody(e,t,A){E.brandCheck(e,A);throwIfAborted(e[u]);if(bodyUnusable(e[u].body)){throw new TypeError("Body is unusable")}const s=c();const errorSteps=e=>s.reject(e);const successSteps=e=>{try{s.resolve(t(e))}catch(e){errorSteps(e)}};if(e[u].body==null){successSteps(new Uint8Array);return s.promise}await l(e[u].body,successSteps,errorSteps);return s.promise}function bodyUnusable(e){return e!=null&&(e.stream.locked||r.isDisturbed(e.stream))}function utf8DecodeBytes(e){if(e.length===0){return""}if(e[0]===239&&e[1]===187&&e[2]===191){e=e.subarray(3)}const t=T.decode(e);return t}function parseJSONFromBytes(e){return JSON.parse(utf8DecodeBytes(e))}function bodyMimeType(e){const{headersList:t}=e[u];const A=t.get("content-Line truncated
|
||||
/*! ws. MIT License. Einar Otto Stangvik <[email protected]> */o[r-4]=this.maskKey[0];o[r-3]=this.maskKey[1];o[r-2]=this.maskKey[2];o[r-1]=this.maskKey[3];o[1]=A;if(A===126){o.writeUInt16BE(t,2)}else if(A===127){o[2]=o[3]=0;o.writeUIntBE(t,4,6)}o[1]|=128;for(let e=0;e<t;e++){o[r+e]=this.frameData[e]^this.maskKey[e%4]}return o}}e.exports={WebsocketFrameSend:WebsocketFrameSend}},2287:(e,t,A)=>{"use strict";const{Writable:s}=A(2203);const r=A(1637);const{parserStates:o,opcodes:n,states:i,emptyBuffer:a}=A(9189);const{kReadyState:c,kSentClose:l,kResponse:g,kReceivedClose:u}=A(7265);const{isValidStatusCode:E,failWebsocketConnection:h,websocketMessageReceived:d}=A(7386);const{WebsocketFrameSend:p}=A(3841);const C={};C.ping=r.channel("undici:websocket:ping");C.pong=r.channel("undici:websocket:pong");class ByteParser extends s{#n=[];#i=0;#a=o.INFO;#c={};#l=[];constructor(e){super();this.ws=e}_write(e,t,A){this.#n.push(e);this.#i+=e.length;this.run(A)}run(e){while(true){if(this.#a===o.INFO){if(this.#i<2){return e()}const t=this.consume(2);this.#c.fin=(t[0]&128)!==0;this.#c.opcode=t[0]&15;this.#c.originalOpcode??=this.#c.opcode;this.#c.fragmented=!this.#c.fin&&this.#c.opcode!==n.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==n.BINARY&&this.#c.opcode!==n.TEXT){h(this.ws,"Invalid frame type was fragmented.");return}const A=t[1]&127;if(A<=125){this.#c.payloadLength=A;this.#a=o.READ_DATA}else if(A===126){this.#a=o.PAYLOADLENGTH_16}else if(A===127){this.#a=o.PAYLOADLENGTH_64}if(this.#c.fragmented&&A>125){h(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#c.opcode===n.PING||this.#c.opcode===n.PONG||this.#c.opcode===n.CLOSE)&&A>125){h(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===n.CLOSE){if(A===1){h(this.ws,"Received close frame with a 1-byte body.");return}const e=this.consume(A);this.#c.closeInfo=this.parseCloseBody(false,e);if(!this.ws[l]){const e=Buffer.allocUnsafe(2);e.writeUInt16BE(this.#c.closeInfo.code,0);const t=new p(e);this.ws[g].socket.write(t.createFrame(n.CLOSE),(e=>{if(!e){this.ws[l]=true}}))}this.ws[c]=i.CLOSING;this.ws[u]=true;this.end();return}else if(this.#c.opcode===n.PING){const t=this.consume(A);if(!this.ws[u]){const e=new p(t);this.ws[g].socket.write(e.createFrame(n.PONG));if(C.ping.hasSubscribers){C.ping.publish({payload:t})}}this.#a=o.INFO;if(this.#i>0){continue}else{e();return}}else if(this.#c.opcode===n.PONG){const t=this.consume(A);if(C.pong.hasSubscribers){C.pong.publish({payload:t})}if(this.#i>0){continue}else{e();return}}}else if(this.#a===o.PAYLOADLENGTH_16){if(this.#i<2){return e()}const t=this.consume(2);this.#c.payloadLength=t.readUInt16BE(0);this.#a=o.READ_DATA}else if(this.#a===o.PAYLOADLENGTH_64){if(this.#i<8){return e()}const t=this.consume(8);const A=t.readUInt32BE(0);if(A>2**31-1){h(this.ws,"Received payload length > 2^31 bytes.");return}const s=t.readUInt32BE(4);this.#c.payloadLength=(A<<8)+s;this.#a=o.READ_DATA}else if(this.#a===o.READ_DATA){if(this.#i<this.#c.payloadLength){return e()}else if(this.#i>=this.#c.payloadLength){const e=this.consume(this.#c.payloadLength);this.#l.push(e);if(!this.#c.fragmented||this.#c.fin&&this.#c.opcode===n.CONTINUATION){const e=Buffer.concat(this.#l);d(this.ws,this.#c.originalOpcode,e);this.#c={};this.#l.length=0}this.#a=o.INFO}}if(this.#i>0){continue}else{e();break}}}consume(e){if(e>this.#i){return null}else if(e===0){return a}if(this.#n[0].length===e){this.#i-=this.#n[0].length;return this.#n.shift()}const t=Buffer.allocUnsafe(e);let A=0;while(A!==e){const s=this.#n[0];const{length:r}=s;if(r+A===e){t.set(this.#n.shift(),A);break}else if(r+A>e){t.set(s.subarray(0,e-A),A);this.#n[0]=s.subarray(e-A);break}else{t.set(this.#n.shift(),A);A+=s.length}}this.#i-=e;return t}parseCloseBody(e,t){let A;if(t.length>=2){A=t.readUInt16BE(0)}if(e){if(!E(A)){return null}return{code:A}}let s=t.subarray(2);if(s[0]===239&&s[1]===187&&s[2]===191){s=s.subarray(3)}if(A!==undefined&&!E(A)){return null}try{s=new TextDecoder("utf-8",{fatal:true}).decode(s)}catch{return null}return{code:A,reason:s}}get closingInfo(){return this.#c.closeInfo}}e.exports={ByteParser:ByteParser}},7265:e=>{"use strict";e.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}},7386:(e,t,A)=>{"use strict";const{kReadyState:s,kController:r,kResponse:o,kBinaryType:n,kWebSocketURL:i}=A(7265);const{states:a,opcodes:c}=A(9189);const{MessageEvent:l,ErrorEvent:g}=A(9779);function isEstablished(e){return e[s]===a.OPEN}function isClosing(e){return e[s]===a.CLOSING}function isClosed(e){return e[s]===a.CLOSED}function fireEvent(e,t,A=Event,s){const r=new A(e,s);t.dispatchEvent(r)}function websocketMessageReceived(e,t,A){if(e[s]!==a.OPEN){return}let r;if(t===c.TEXT){try{r=new TextDecoder("utf-8",{fatal:true}).decode(A)Line truncated
|
||||
require('./sourcemap-register.js');(()=>{var e={252:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generateChangelog=generateChangelog;const s=A(4708);const r=A(9456);const o=A(3820);async function generateChangelog(e){const{owner:t,repo:A}=(0,o.repository)();const n=new r.ChangelogNode;for await(const r of(0,o.iterateCommits)(t,A,e)){const e=r.commit.message.split("\n")[0];(0,s.debug)(`commit message -> ${e}`);let{type:t,scope:A,description:i,pr:a,flag:c,breaking:l}=(0,o.parseCommitMessage)(e);i=(0,o.trim)(i);if(!i)continue;c=(0,o.trim)(c);if(c==="ignore")continue;const u=n.addType(t);const g=u.addScope(A);const h=g.addCommit(i,l);const E=h.addAuthor(r.author?.login);E.addReference(r.sha,a)}const i=n.print();if(i)return`${i}\n`;return""}},6351:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generateFooter=generateFooter;const s=A(7409);const r=A(8642);const o=A(3820);async function generateFooter(e){const{owner:t,repo:A,url:n}=(0,o.repository)();const i=(0,r.releaseName)();const a=[];if((0,r.mentionNewContributors)()){const{rest:r}=(0,o.octokit)();const{data:n}=await r.repos.generateReleaseNotes({owner:t,repo:A,tag_name:i,previous_tag_name:e});const c=s.marked.lexer(n.body);const l=c.findIndex((e=>e.type==="heading"&&e.text==="New Contributors"));const u=c[l+1];if(u.type==="list")a.push(`## New Contributors\n${u.raw}\n`)}if((0,r.includeCompareLink)()&&e){let t=`${n}/compare/${e}...${i}`;if(!(0,r.useGitHubAutolink)()||(0,r.releaseNamePrefix)())t=`\`[${e}...${i}](${n}/compare/${e}...${i})\``;a.push(`**Full Changelog**: ${t}`)}if(a.length>0)a.unshift("");return a.join("\n\n")}},3139:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generate=generate;const s=A(252);const r=A(6351);const o=A(6027);const n=A(146);async function generate(){const{prerelease:e,releaseId:t,previous:A}=await(0,n.getTagInfo)();(0,o.setPrerelease)(e);(0,o.setReleaseId)(t);let i=await(0,s.generateChangelog)(A?.sha);i+=await(0,r.generateFooter)(A?.name);(0,o.setChangelog)(i)}},8453:function(e,t,A){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.commitTypes=commitTypes;const r=s(A(5625));const o=A(5020);function commitTypes(){return(0,o.input)("commit-types",(e=>r.default.parse(e)))}},2878:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.defaultCommitType=defaultCommitType;const s=A(5020);function defaultCommitType(){return(0,s.input)("default-commit-type")}},5595:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.gitHubToken=gitHubToken;const s=A(5020);function gitHubToken(){return(0,s.input)("github-token")}},1822:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.includeCommitLinks=includeCommitLinks;const s=A(3545);function includeCommitLinks(){return(0,s.booleanInput)("include-commit-links")}},1589:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.includeCompareLink=includeCompareLink;const s=A(3545);function includeCompareLink(){return(0,s.booleanInput)("include-compare-link")}},2065:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.includePRLinks=includePRLinks;const s=A(3545);function includePRLinks(){return(0,s.booleanInput)("include-pr-links")}},8642:function(e,t,A){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,A,s){if(s===undefined)s=A;var r=Object.getOwnPropertyDescriptor(t,A);if(!r||("get"in r?!t.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return t[A]}}}Object.defineProperty(e,s,r)}:function(e,t,A,s){if(s===undefined)s=A;e[s]=t[A]});var r=this&&this.__exportStar||function(e,t){for(var A in e)if(A!=="default"&&!Object.prototype.hasOwnProperty.call(t,A))s(t,e,A)};Object.defineProperty(t,"__esModule",{value:true});r(A(8453),t);r(A(2878),t);r(A(5595),t);r(A(1822),t);r(A(1589),t);r(A(2065),t);r(A(3317),t);r(A(9530),t);r(A(4876),t);r(A(7211),t);r(A(6340),t);r(A(4593),t)},3317:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.mentionAuthors=mentionAuthors;const s=A(3545);function mentionAuthors(){return(0,s.booleanInput)("mention-authors")}},9530:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.mentionNewContributors=mentionNewContributors;const s=A(3545);function mentionNewContributors(){return(0,s.booleanInput)("mention-new-contributors")}},4876:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.releaseNamePrefix=releaseNamePrefix;const s=A(5020);function releaseNamePrefix(){return(0,s.input)("release-name-prefix",false)}},7211:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.releaseName=releaseName;const s=A(5020);function releaseName(){return(0,s.input)("release-name")}},6340:(e,t,A)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.semver=sLine truncated
|
||||
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */;const escape=e=>e.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22");const normalizeLinefeeds=e=>e.replace(/\r?\n|\r/g,"\r\n");const s=[];const r=new Uint8Array([13,10]);u=0;let o=false;for(const[t,n]of e){if(typeof n==="string"){const e=T.encode(A+`; name="${escape(normalizeLinefeeds(t))}"`+`\r\n\r\n${normalizeLinefeeds(n)}\r\n`);s.push(e);u+=e.byteLength}else{const e=T.encode(`${A}; name="${escape(normalizeLinefeeds(t))}"`+(n.name?`; filename="${escape(n.name)}"`:"")+"\r\n"+`Content-Type: ${n.type||"application/octet-stream"}\r\n\r\n`);s.push(e,n,r);if(typeof n.size==="number"){u+=e.byteLength+n.size+r.byteLength}else{o=true}}}const n=T.encode(`--${t}--`);s.push(n);u+=n.byteLength;if(o){u=null}l=e;c=async function*(){for(const e of s){if(e.stream){yield*e.stream()}else{yield e}}};g="multipart/form-data; boundary="+t}else if(n(e)){l=e;u=e.size;if(e.type){g=e.type}}else if(typeof e[Symbol.asyncIterator]==="function"){if(t){throw new TypeError("keepalive")}if(r.isDisturbed(e)||e.locked){throw new TypeError("Response body object should not be disturbed or locked")}s=e instanceof D?e:o(e)}if(typeof l==="string"||r.isBuffer(l)){u=Buffer.byteLength(l)}if(c!=null){let t;s=new D({async start(){t=c(e)[Symbol.asyncIterator]()},async pull(e){const{value:A,done:r}=await t.next();if(r){queueMicrotask((()=>{e.close()}))}else{if(!I(s)){e.enqueue(new Uint8Array(A))}}return e.desiredSize>0},async cancel(e){await t.return()},type:undefined})}const h={stream:s,source:l,length:u};return[h,g]}function safelyExtractBody(e,t=false){if(!D){D=A(3774).ReadableStream}if(e instanceof D){B(!r.isDisturbed(e),"The body has already been consumed.");B(!e.locked,"The stream is locked.")}return extractBody(e,t)}function cloneBody(e){const[t,A]=e.stream.tee();const s=d(A,{transfer:[A]});const[,r]=s.tee();e.stream=t;return{stream:r,length:e.length,source:e.source}}async function*consumeBody(e){if(e){if(m(e)){yield e}else{const t=e.stream;if(r.isDisturbed(t)){throw new TypeError("The body has already been consumed.")}if(t.locked){throw new TypeError("The stream is locked.")}t[Q]=true;yield*t}}}function throwIfAborted(e){if(e.aborted){throw new E("The operation was aborted.","AbortError")}}function bodyMixinMethods(e){const t={blob(){return specConsumeBody(this,(e=>{let t=bodyMimeType(this);if(t==="failure"){t=""}else if(t){t=k(t)}return new p([e],{type:t})}),e)},arrayBuffer(){return specConsumeBody(this,(e=>new Uint8Array(e).buffer),e)},text(){return specConsumeBody(this,utf8DecodeBytes,e)},json(){return specConsumeBody(this,parseJSONFromBytes,e)},async formData(){h.brandCheck(this,e);throwIfAborted(this[g]);const t=this.headers.get("Content-Type");if(/multipart\/form-data/.test(t)){const e={};for(const[t,A]of this.headers)e[t.toLowerCase()]=A;const t=new u;let A;try{A=new s({headers:e,preservePath:true})}catch(e){throw new E(`${e}`,"AbortError")}A.on("field",((e,A)=>{t.append(e,A)}));A.on("file",((e,A,s,r,o)=>{const n=[];if(r==="base64"||r.toLowerCase()==="base64"){let r="";A.on("data",(e=>{r+=e.toString().replace(/[\r\n]/gm,"");const t=r.length-r.length%4;n.push(Buffer.from(r.slice(0,t),"base64"));r=r.slice(t)}));A.on("end",(()=>{n.push(Buffer.from(r,"base64"));t.append(e,new S(n,s,{type:o}))}))}else{A.on("data",(e=>{n.push(e)}));A.on("end",(()=>{t.append(e,new S(n,s,{type:o}))}))}}));const r=new Promise(((e,t)=>{A.on("finish",e);A.on("error",(e=>t(new TypeError(e))))}));if(this.body!==null)for await(const e of consumeBody(this[g].body))A.write(e);A.end();await r;return t}else if(/application\/x-www-form-urlencoded/.test(t)){let e;try{let t="";const A=new TextDecoder("utf-8",{ignoreBOM:true});for await(const e of consumeBody(this[g].body)){if(!m(e)){throw new TypeError("Expected Uint8Array chunk")}t+=A.decode(e,{stream:true})}t+=A.decode();e=new URLSearchParams(t)}catch(e){throw Object.assign(new TypeError,{cause:e})}const t=new u;for(const[A,s]of e){t.append(A,s)}return t}else{await Promise.resolve();throwIfAborted(this[g]);throw h.errors.exception({header:`${e.name}.formData`,message:"Could not parse content as FormData."})}}};return t}function mixinBody(e){Object.assign(e.prototype,bodyMixinMethods(e))}async function specConsumeBody(e,t,A){h.brandCheck(e,A);throwIfAborted(e[g]);if(bodyUnusable(e[g].body)){throw new TypeError("Body is unusable")}const s=c();const errorSteps=e=>s.reject(e);const successSteps=e=>{try{s.resolve(t(e))}catch(e){errorSteps(e)}};if(e[g].body==null){successSteps(new Uint8Array);return s.promise}await l(e[g].body,successSteps,errorSteps);return s.promise}function bodyUnusable(e){return e!=null&&(e.stream.locked||r.isDisturbed(e.stream))}function utf8DecodeBytes(e){if(e.length===0){return""}if(e[0]===239&&e[1]===187&&e[2]===191){e=e.subarray(3)}const t=N.decode(e);return t}function parseJSONFromBytes(e){return JSON.parse(utf8DecodeBytes(e))}function bodyMimeType(e){const{headersList:t}=e[g];const A=t.get("content-Line truncated
|
||||
/*! ws. MIT License. Einar Otto Stangvik <[email protected]> */o[r-4]=this.maskKey[0];o[r-3]=this.maskKey[1];o[r-2]=this.maskKey[2];o[r-1]=this.maskKey[3];o[1]=A;if(A===126){o.writeUInt16BE(t,2)}else if(A===127){o[2]=o[3]=0;o.writeUIntBE(t,4,6)}o[1]|=128;for(let e=0;e<t;e++){o[r+e]=this.frameData[e]^this.maskKey[e%4]}return o}}e.exports={WebsocketFrameSend:WebsocketFrameSend}},7730:(e,t,A)=>{"use strict";const{Writable:s}=A(2203);const r=A(1637);const{parserStates:o,opcodes:n,states:i,emptyBuffer:a}=A(3754);const{kReadyState:c,kSentClose:l,kResponse:u,kReceivedClose:g}=A(6362);const{isValidStatusCode:h,failWebsocketConnection:E,websocketMessageReceived:d}=A(7655);const{WebsocketFrameSend:p}=A(6866);const C={};C.ping=r.channel("undici:websocket:ping");C.pong=r.channel("undici:websocket:pong");class ByteParser extends s{#n=[];#i=0;#a=o.INFO;#c={};#l=[];constructor(e){super();this.ws=e}_write(e,t,A){this.#n.push(e);this.#i+=e.length;this.run(A)}run(e){while(true){if(this.#a===o.INFO){if(this.#i<2){return e()}const t=this.consume(2);this.#c.fin=(t[0]&128)!==0;this.#c.opcode=t[0]&15;this.#c.originalOpcode??=this.#c.opcode;this.#c.fragmented=!this.#c.fin&&this.#c.opcode!==n.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==n.BINARY&&this.#c.opcode!==n.TEXT){E(this.ws,"Invalid frame type was fragmented.");return}const A=t[1]&127;if(A<=125){this.#c.payloadLength=A;this.#a=o.READ_DATA}else if(A===126){this.#a=o.PAYLOADLENGTH_16}else if(A===127){this.#a=o.PAYLOADLENGTH_64}if(this.#c.fragmented&&A>125){E(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#c.opcode===n.PING||this.#c.opcode===n.PONG||this.#c.opcode===n.CLOSE)&&A>125){E(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===n.CLOSE){if(A===1){E(this.ws,"Received close frame with a 1-byte body.");return}const e=this.consume(A);this.#c.closeInfo=this.parseCloseBody(false,e);if(!this.ws[l]){const e=Buffer.allocUnsafe(2);e.writeUInt16BE(this.#c.closeInfo.code,0);const t=new p(e);this.ws[u].socket.write(t.createFrame(n.CLOSE),(e=>{if(!e){this.ws[l]=true}}))}this.ws[c]=i.CLOSING;this.ws[g]=true;this.end();return}else if(this.#c.opcode===n.PING){const t=this.consume(A);if(!this.ws[g]){const e=new p(t);this.ws[u].socket.write(e.createFrame(n.PONG));if(C.ping.hasSubscribers){C.ping.publish({payload:t})}}this.#a=o.INFO;if(this.#i>0){continue}else{e();return}}else if(this.#c.opcode===n.PONG){const t=this.consume(A);if(C.pong.hasSubscribers){C.pong.publish({payload:t})}if(this.#i>0){continue}else{e();return}}}else if(this.#a===o.PAYLOADLENGTH_16){if(this.#i<2){return e()}const t=this.consume(2);this.#c.payloadLength=t.readUInt16BE(0);this.#a=o.READ_DATA}else if(this.#a===o.PAYLOADLENGTH_64){if(this.#i<8){return e()}const t=this.consume(8);const A=t.readUInt32BE(0);if(A>2**31-1){E(this.ws,"Received payload length > 2^31 bytes.");return}const s=t.readUInt32BE(4);this.#c.payloadLength=(A<<8)+s;this.#a=o.READ_DATA}else if(this.#a===o.READ_DATA){if(this.#i<this.#c.payloadLength){return e()}else if(this.#i>=this.#c.payloadLength){const e=this.consume(this.#c.payloadLength);this.#l.push(e);if(!this.#c.fragmented||this.#c.fin&&this.#c.opcode===n.CONTINUATION){const e=Buffer.concat(this.#l);d(this.ws,this.#c.originalOpcode,e);this.#c={};this.#l.length=0}this.#a=o.INFO}}if(this.#i>0){continue}else{e();break}}}consume(e){if(e>this.#i){return null}else if(e===0){return a}if(this.#n[0].length===e){this.#i-=this.#n[0].length;return this.#n.shift()}const t=Buffer.allocUnsafe(e);let A=0;while(A!==e){const s=this.#n[0];const{length:r}=s;if(r+A===e){t.set(this.#n.shift(),A);break}else if(r+A>e){t.set(s.subarray(0,e-A),A);this.#n[0]=s.subarray(e-A);break}else{t.set(this.#n.shift(),A);A+=s.length}}this.#i-=e;return t}parseCloseBody(e,t){let A;if(t.length>=2){A=t.readUInt16BE(0)}if(e){if(!h(A)){return null}return{code:A}}let s=t.subarray(2);if(s[0]===239&&s[1]===187&&s[2]===191){s=s.subarray(3)}if(A!==undefined&&!h(A)){return null}try{s=new TextDecoder("utf-8",{fatal:true}).decode(s)}catch{return null}return{code:A,reason:s}}get closingInfo(){return this.#c.closeInfo}}e.exports={ByteParser:ByteParser}},6362:e=>{"use strict";e.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}},7655:(e,t,A)=>{"use strict";const{kReadyState:s,kController:r,kResponse:o,kBinaryType:n,kWebSocketURL:i}=A(6362);const{states:a,opcodes:c}=A(3754);const{MessageEvent:l,ErrorEvent:u}=A(4190);function isEstablished(e){return e[s]===a.OPEN}function isClosing(e){return e[s]===a.CLOSING}function isClosed(e){return e[s]===a.CLOSED}function fireEvent(e,t,A=Event,s){const r=new A(e,s);t.dispatchEvent(r)}function websocketMessageReceived(e,t,A){if(e[s]!==a.OPEN){return}let r;if(t===c.TEXT){try{r=new TextDecoder("utf-8",{fatal:true}).decode(A)Line truncated
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","names":["Object","defineProperty","exports","value","generateChangelog","core_1","__webpack_require__","index_js_1","index_js_2","async","lastSha","owner","repo","repository","changelogNode","ChangelogNode","commit","iterateCommits","message","split","debug","type","scope","description","pr","flag","breaking","parseCommitMessage","trim","typeNode","addType","scopeNode","addScope","commitNote","addCommit","authorNode","addAuthor","author","login","addReference","sha","changelog","print","generateFooter","marked_1","previousTagName","url","tagName","releaseName","footer","mentionNewContributors","rest","octokit","data","repos","generateReleaseNotes","tag_name","previous_tag_name","tokens","marked","lexer","body","index","findIndex","markdownToken","text","push","raw","includeCompareLink","link","useGitHubAutolink","releaseNamePrefix","length","unshift","join","generate","changelog_js_1","footer_js_1","tag_js_1","prerelease","releaseId","previous","getTagInfo","setPrerelease","setReleaseId","name","setChangelog","__importDefault","this","mod","__esModule","default","commitTypes","yaml_1","input_js_1","input","parse","defaultCommitType","gitHubToken","includeCommitLinks","boolean_input_js_1","booleanInput","includePRLinks","__createBinding","create","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","writable","configurable","enumerable","get","__exportStar","p","prototype","hasOwnProperty","call","mentionAuthors","semver","node_js_1","type_js_1","Node","defaultType","typeMap","types","Map","has","TypeNode","set","prefix","size","acceptedTypes","Set","values","concat","parts","key","printedType","CommitAuthorNode","commit_hash_js_1","pull_request_js_1","username","shouldMentionAuthor","references","constructor","super","reference","PullRequestNode","CommitHashNode","existingRef","serverUrl","shouldUseGithubAutolink","printedReferences","printedReference","shouldNotPrint","slice","CommitNode","commit_author_js_1","authors","previousAuthor","printedAuthor","github_1","context","ScopeNode","commit_js_1","commits","commitNode","scope_js_1","scopes","scopeKeys","keys","sort","a","b","localeCompare","printedScope","output","paginate","info","semVer","parseSemVer","Error","iterator","listTags","per_page","loop","version","compare","cache_js_1","required","cache","getBooleanInput","clearCache","CACHE","overwrite","clear","octokit_js_1","sha_js_1","from","listCommits","parser","getInput","getOctokit","setOutput","REGEX","exec","groups","semver_1","replace","RegExp","includePrerelease","__setModuleDefault","v","__importStar","result","issue","issueCommand","os","utils_1","command","properties","cmd","Command","process","stdout","write","toString","EOL","CMD_STRING","cmdStr","first","val","escapeProperty","escapeData","s","toCommandValue","__awaiter","thisArg","_arguments","P","generator","adopt","resolve","Promise","reject","fulfilled","step","next","e","rejected","done","then","apply","platform","toPlatformPath","toWin32Path","toPosixPath","markdownSummary","summary","getIDToken","getState","saveState","group","endGroup","startGroup","notice","warning","error","isDebug","setFailed","setCommandEcho","getMultilineInput","addPath","setSecret","exportVariable","ExitCode","command_1","file_command_1","path","oidc_utils_1","convertedVal","env","filePath","issueFileCommand","prepareKeyValueMessage","secret","inputPath","delimiter","options","toUpperCase","trimWhitespace","inputs","filter","x","map","trueValue","falseValue","includes","TypeError","enabled","exitCode","Failure","toCommandProperties","fn","aud","OidcClient","summary_1","summary_2","path_utils_1","crypto","fs","existsSync","appendFileSync","encoding","randomUUID","convertedValue","http_client_1","auth_1","createHttpClient","allowRetry","maxRetry","requestOptions","allowRetries","maxRetries","HttpClient","BearerCredentialHandler","getRequestToken","token","getIDTokenUrl","runtimeUrl","getCall","id_token_url","_a","httpclient","res","getJson","catch","statusCode","id_token","audience","encodedAudience","encodeURIComponent","pth","sep","getDetails","isLinux","isMacOS","isWindows","arch","os_1","getWindowsInfo","getExecOutput","silent","getMacOsInfo","_b","_c","_d","match","getLinuxInfo","assign","SUMMARY_DOCS_URL","SUMMARY_ENV_VAR","fs_1","access","appendFile","writeFile","promises","Summary","_buffer","_filePath","pathFromEnv","constants","R_OK","W_OK","wrap","tag","content","attrs","htmlAttrs","entries","writeFunc","emptyBuffer","stringify","isEmptyBuffer","addRaw","addEOL","addCodeBlock","code","lang","element","addList","items","ordered","listItems","item","addTable","rows","tableBody","row","cells","cell","header","colspan","rowspan","addDetails","label","addImage","src","alt","width","height","addHeading","level","allowedTag","addSeparator","addBreak","addQuote","cite","addLink","href","_summary","String","JSON","annotationProperties","title","file","line","startLine","endLine","col","startColumn","endColumn","stringLine truncated
|
||||
{"version":3,"file":"index.js","names":["Object","defineProperty","exports","value","generateChangelog","core_1","__webpack_require__","index_js_1","index_js_2","async","lastSha","owner","repo","repository","changelogNode","ChangelogNode","commit","iterateCommits","message","split","debug","type","scope","description","pr","flag","breaking","parseCommitMessage","trim","typeNode","addType","scopeNode","addScope","commitNote","addCommit","authorNode","addAuthor","author","login","addReference","sha","changelog","print","generateFooter","marked_1","previousTagName","url","tagName","releaseName","footer","mentionNewContributors","rest","octokit","data","repos","generateReleaseNotes","tag_name","previous_tag_name","tokens","marked","lexer","body","index","findIndex","markdownToken","text","push","raw","includeCompareLink","link","useGitHubAutolink","releaseNamePrefix","length","unshift","join","generate","changelog_js_1","footer_js_1","tag_js_1","prerelease","releaseId","previous","getTagInfo","setPrerelease","setReleaseId","name","setChangelog","__importDefault","this","mod","__esModule","default","commitTypes","yaml_1","input_js_1","input","parse","defaultCommitType","gitHubToken","includeCommitLinks","boolean_input_js_1","booleanInput","includePRLinks","__createBinding","create","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","writable","configurable","enumerable","get","__exportStar","p","prototype","hasOwnProperty","call","mentionAuthors","semver","node_js_1","type_js_1","Node","defaultType","typeMap","types","Map","has","TypeNode","set","prefix","size","acceptedTypes","Set","values","parts","key","printedType","CommitAuthorNode","commit_hash_js_1","pull_request_js_1","username","shouldMentionAuthor","references","constructor","super","reference","PullRequestNode","CommitHashNode","existingReference","serverUrl","shouldUseGithubAutolink","printedReferences","printedReference","shouldNotPrint","slice","CommitNode","commit_author_js_1","authors","previousAuthor","at","printedAuthor","github_1","context","ScopeNode","commit_js_1","commits","commitNode","scope_js_1","scopes","scopeKeys","keys","sort","a","b","localeCompare","printedScope","output","paginate","info","semanticVersion","parseSemanticVersion","Error","iterator","listTags","per_page","loop","version","compare","cache_js_1","required","cache","getBooleanInput","clearCache","CACHE","overwrite","clear","octokit_js_1","sha_js_1","from","listCommits","parser","getInput","getOctokit","setOutput","REGEX","exec","groups","semver_1","replace","RegExp","includePrerelease","replaceAll","__setModuleDefault","v","__importStar","result","issue","issueCommand","os","utils_1","command","properties","cmd","Command","process","stdout","write","toString","EOL","CMD_STRING","cmdStr","first","val","escapeProperty","escapeData","s","toCommandValue","__awaiter","thisArg","_arguments","P","generator","adopt","resolve","Promise","reject","fulfilled","step","next","e","rejected","done","then","apply","platform","toPlatformPath","toWin32Path","toPosixPath","markdownSummary","summary","getIDToken","getState","saveState","group","endGroup","startGroup","notice","warning","error","isDebug","setFailed","setCommandEcho","getMultilineInput","addPath","setSecret","exportVariable","ExitCode","command_1","file_command_1","path","oidc_utils_1","convertedVal","env","filePath","issueFileCommand","prepareKeyValueMessage","secret","inputPath","delimiter","options","toUpperCase","trimWhitespace","inputs","filter","x","map","trueValue","falseValue","includes","TypeError","enabled","exitCode","Failure","toCommandProperties","fn","aud","OidcClient","summary_1","summary_2","path_utils_1","crypto","fs","existsSync","appendFileSync","encoding","randomUUID","convertedValue","http_client_1","auth_1","createHttpClient","allowRetry","maxRetry","requestOptions","allowRetries","maxRetries","HttpClient","BearerCredentialHandler","getRequestToken","token","getIDTokenUrl","runtimeUrl","getCall","id_token_url","_a","httpclient","res","getJson","catch","statusCode","id_token","audience","encodedAudience","encodeURIComponent","pth","sep","getDetails","isLinux","isMacOS","isWindows","arch","os_1","getWindowsInfo","getExecOutput","silent","getMacOsInfo","_b","_c","_d","match","getLinuxInfo","assign","SUMMARY_DOCS_URL","SUMMARY_ENV_VAR","fs_1","access","appendFile","writeFile","promises","Summary","_buffer","_filePath","pathFromEnv","constants","R_OK","W_OK","wrap","tag","content","attrs","htmlAttrs","entries","writeFunc","emptyBuffer","stringify","isEmptyBuffer","addRaw","addEOL","addCodeBlock","code","lang","element","addList","items","ordered","listItems","item","addTable","rows","tableBody","row","cells","cell","header","colspan","rowspan","addDetails","label","addImage","src","alt","width","height","addHeading","level","allowedTag","addSeparator","addBreak","addQuote","cite","addLink","href","_summary","String","JSON","annotationProperties","title","file","line","startLine","endLine","col",Line truncated
|
||||
@@ -22,6 +22,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
// @ts-expect-error Commitlint doesn't support `.mts` files yet!
|
||||
import { type UserConfig } from "@commitlint/types";
|
||||
|
||||
export default {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2025 Ardalan Amini
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
import { globalIgnores } from "eslint/config";
|
||||
import gitignore from "eslint-config-flat-gitignore";
|
||||
import { configs, smartConfig } from "eslint-config-noir";
|
||||
|
||||
export default smartConfig(
|
||||
gitignore(),
|
||||
globalIgnores(["action/*"]),
|
||||
configs.recommended,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: "./tsconfig.json",
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
+13
-7
@@ -93,7 +93,9 @@ export default {
|
||||
// A set of global variables that need to be available in all test environments
|
||||
// globals: {},
|
||||
|
||||
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
||||
// The maximum amount of workers used to run your tests. Can be specified as % or a number.
|
||||
// E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number.
|
||||
// maxWorkers: 2 will use a maximum of 2 workers.
|
||||
// maxWorkers: "50%",
|
||||
|
||||
// An array of directory names to be searched recursively up from the requiring module's location
|
||||
@@ -113,12 +115,14 @@ export default {
|
||||
// "node"
|
||||
// ],
|
||||
|
||||
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
||||
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources
|
||||
// with a single module
|
||||
moduleNameMapper: {
|
||||
"^(\\.{1,2}/.*)\\.js$": "$1",
|
||||
},
|
||||
|
||||
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
||||
// An array of regexp pattern strings, matched against all module paths
|
||||
// before considered 'visible' to the module loader
|
||||
// modulePathIgnorePatterns: [],
|
||||
|
||||
// Activates notifications for test results
|
||||
@@ -136,7 +140,7 @@ export default {
|
||||
// Use this configuration option to add custom reporters to Jest
|
||||
reporters: ["default", "github-actions"],
|
||||
|
||||
// Automatically reset mock state before every test
|
||||
// Automatically reset the mock state before every test
|
||||
// resetMocks: false,
|
||||
|
||||
// Reset the module registry before running each individual test
|
||||
@@ -145,7 +149,7 @@ export default {
|
||||
// A path to a custom resolver
|
||||
// resolver: undefined,
|
||||
|
||||
// Automatically restore mock state and implementation before every test
|
||||
// Automatically restore the mock state and implementation before every test
|
||||
// restoreMocks: false,
|
||||
|
||||
// The root directory that Jest should scan for tests and modules within
|
||||
@@ -207,13 +211,15 @@ export default {
|
||||
"^.+\\.[cm]?[jt]sx?$": "@swc/jest",
|
||||
},
|
||||
|
||||
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
||||
// An array of regexp pattern strings that are matched against all source file paths,
|
||||
// matched files will skip transformation
|
||||
// transformIgnorePatterns: [
|
||||
// "/node_modules/",
|
||||
// "\\.pnp\\.[^\\/]+$"
|
||||
// ],
|
||||
|
||||
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
||||
// An array of regexp pattern strings that are matched against all modules
|
||||
// before the module loader will automatically return a mock for them
|
||||
// unmockedModulePathPatterns: undefined,
|
||||
|
||||
// Indicates whether each individual test should be reported during the run
|
||||
|
||||
+5
-9
@@ -24,9 +24,8 @@
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"prepare": "is-ci || husky",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --cache --cache-location ./.cache/eslint/ .",
|
||||
"lint:fix": "pnpm lint --fix",
|
||||
"lint:format": "prettier --write src",
|
||||
"build": "tsc -p ./tsconfig.build.json",
|
||||
"build:watch": "pnpm build --watch",
|
||||
"package": "ncc build --out action --minify --source-map --license licenses.txt",
|
||||
@@ -50,18 +49,15 @@
|
||||
"@swc/jest": "^0.2.38",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||
"@typescript-eslint/parser": "^6.21.0",
|
||||
"@vercel/ncc": "^0.38.2",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-noir": "^1.5.2",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint": "^9.28.0",
|
||||
"eslint-config-flat-gitignore": "^2.1.0",
|
||||
"eslint-config-noir": "^3.0.0",
|
||||
"fetch-mock": "^12.5.2",
|
||||
"husky": "^9.1.7",
|
||||
"is-ci": "^4.1.0",
|
||||
"jest": "^29.7.0",
|
||||
"prettier": "^3.3.3",
|
||||
"jiti": "^2.4.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.8.3"
|
||||
}
|
||||
|
||||
Generated
+986
-648
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -50,7 +50,7 @@ export async function generateFooter(previousTagName?: string): Promise<string>
|
||||
|
||||
const tokens = marked.lexer(data.body);
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
// eslint-disable-next-line @stylistic/max-len
|
||||
const index = tokens.findIndex(markdownToken => markdownToken.type === "heading" && markdownToken.text === "New Contributors");
|
||||
|
||||
const markdownToken = tokens[index + 1];
|
||||
|
||||
+2
-2
@@ -25,12 +25,12 @@
|
||||
export * from "./commit-types.js";
|
||||
export * from "./default-commit-type.js";
|
||||
export * from "./github-token.js";
|
||||
export * from "./include-compare-link.js";
|
||||
export * from "./include-commit-links.js";
|
||||
export * from "./include-compare-link.js";
|
||||
export * from "./include-pr-links.js";
|
||||
export * from "./mention-authors.js";
|
||||
export * from "./mention-new-contributors.js";
|
||||
export * from "./release-name.js";
|
||||
export * from "./release-name-prefix.js";
|
||||
export * from "./release-name.js";
|
||||
export * from "./semver.js";
|
||||
export * from "./use-github-autolink.js";
|
||||
@@ -22,10 +22,10 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
import { commitTypes, defaultCommitType } from "../inputs/index.js";
|
||||
import { trim } from "../utils/index.js";
|
||||
import { Node } from "./node.js";
|
||||
import { TypeNode } from "./type.js";
|
||||
import { commitTypes, defaultCommitType } from "../inputs/index.js";
|
||||
import { trim } from "../utils/index.js";
|
||||
|
||||
/**
|
||||
* Represents a changelog node which organizes and processes commit types into structured changelog entries.
|
||||
@@ -70,14 +70,14 @@ export class ChangelogNode extends Node {
|
||||
* @returns A concatenated string of all printed types with the applied prefix, or null if no types are available.
|
||||
*/
|
||||
public print(prefix = ""): string | null {
|
||||
const { types } = this;
|
||||
const { types, typeMap, defaultType } = this;
|
||||
|
||||
if (types.size === 0) return null;
|
||||
|
||||
/**
|
||||
* Using this instead of iterating over the `types` values allows the action users to apply their own custom order.
|
||||
*/
|
||||
const acceptedTypes = [...new Set(Object.values(this.typeMap).concat(this.defaultType))];
|
||||
const acceptedTypes = [...new Set([...Object.values(typeMap), ...defaultType])];
|
||||
|
||||
const parts: string[] = [];
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
import { mentionAuthors } from "../inputs/index.js";
|
||||
import { CommitHashNode } from "./commit-hash.js";
|
||||
import { Node } from "./node.js";
|
||||
import { PullRequestNode } from "./pull-request.js";
|
||||
import { mentionAuthors } from "../inputs/index.js";
|
||||
|
||||
/**
|
||||
* Represents a node for a commit author, containing information about the author
|
||||
@@ -55,18 +55,15 @@ export class CommitAuthorNode extends Node {
|
||||
* @returns The created reference node, either a CommitHashNode or a PullRequestNode.
|
||||
*/
|
||||
public addReference(sha: string, pr?: string): CommitHashNode | PullRequestNode {
|
||||
let reference: CommitHashNode | PullRequestNode;
|
||||
|
||||
// PR references take priority over commit hash references
|
||||
if (pr) reference = new PullRequestNode(pr);
|
||||
else reference = new CommitHashNode(sha);
|
||||
const reference = pr ? new PullRequestNode(pr) : new CommitHashNode(sha);
|
||||
|
||||
// Check if a reference already exists to avoid duplicates
|
||||
for (const existingRef of this.references) {
|
||||
for (const existingReference of this.references) {
|
||||
if (
|
||||
(!pr && existingRef instanceof CommitHashNode && existingRef.sha === sha)
|
||||
|| (existingRef instanceof PullRequestNode && existingRef.pr === pr)
|
||||
) return existingRef;
|
||||
(!pr && existingReference instanceof CommitHashNode && existingReference.sha === sha)
|
||||
|| (existingReference instanceof PullRequestNode && existingReference.pr === pr)
|
||||
) return existingReference;
|
||||
}
|
||||
|
||||
this.references.push(reference);
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
import { includeCommitLinks } from "../inputs/index.js";
|
||||
import { Node } from "./node.js";
|
||||
import { includeCommitLinks } from "../inputs/index.js";
|
||||
|
||||
/**
|
||||
* Represents a node that holds a commit hash (SHA) and provides functionality
|
||||
|
||||
+2
-1
@@ -57,7 +57,8 @@ export class CommitNode extends Node {
|
||||
// Only reuse authors with known usernames.
|
||||
if (username && authors.length > 0) {
|
||||
// Only if the last reference is to the same author, reuse the node.
|
||||
const previousAuthor = authors[authors.length - 1];
|
||||
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
||||
const previousAuthor = authors.at(-1)!;
|
||||
|
||||
if (previousAuthor.username === username) return previousAuthor;
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,9 +23,9 @@
|
||||
*/
|
||||
|
||||
export * from "./changelog.js";
|
||||
export * from "./commit.js";
|
||||
export * from "./commit-author.js";
|
||||
export * from "./commit-hash.js";
|
||||
export * from "./commit.js";
|
||||
export * from "./node.js";
|
||||
export * from "./pull-request.js";
|
||||
export * from "./scope.js";
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
import { includePRLinks } from "../inputs/index.js";
|
||||
import { Node } from "./node.js";
|
||||
import { includePRLinks } from "../inputs/index.js";
|
||||
|
||||
/**
|
||||
* Represents a node associated with a pull request or issue link.
|
||||
|
||||
+1
-1
@@ -22,9 +22,9 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
import { trim } from "../utils/index.js";
|
||||
import { Node } from "./node.js";
|
||||
import { ScopeNode } from "./scope.js";
|
||||
import { trim } from "../utils/index.js";
|
||||
|
||||
/**
|
||||
* Represents a node for a specific type that manages associated scopes.
|
||||
|
||||
+16
-13
@@ -24,15 +24,18 @@
|
||||
|
||||
import { type SemVer } from "semver";
|
||||
import { releaseName, semver } from "./inputs/index.js";
|
||||
import { octokit, parseSemVer, repository, sha } from "./utils/index.js";
|
||||
import { octokit, parseSemanticVersion as parseSemVersion, repository, sha } from "./utils/index.js";
|
||||
|
||||
export interface TRelease {
|
||||
name: string;
|
||||
|
||||
sha: string;
|
||||
}
|
||||
|
||||
export interface TagInfoI {
|
||||
prerelease: boolean;
|
||||
|
||||
previous?: {
|
||||
name: string;
|
||||
sha: string;
|
||||
};
|
||||
previous?: TRelease;
|
||||
|
||||
releaseId: string;
|
||||
}
|
||||
@@ -46,16 +49,16 @@ export async function getTagInfo(): Promise<TagInfoI> {
|
||||
prerelease: false,
|
||||
};
|
||||
|
||||
let semVer: SemVer | null = null;
|
||||
let semanticVersion: SemVer | null = null;
|
||||
|
||||
if (semver()) {
|
||||
semVer = parseSemVer();
|
||||
semanticVersion = parseSemVersion();
|
||||
|
||||
if (semVer == null) throw new Error(`Expected a semver compatible releaseName, got "${ releaseName() }" instead.`);
|
||||
if (semanticVersion == null) throw new Error(`Expected a semver compatible releaseName, got "${ releaseName() }" instead.`);
|
||||
|
||||
info.prerelease = semVer.prerelease.length > 0;
|
||||
info.prerelease = semanticVersion.prerelease.length > 0;
|
||||
|
||||
if (info.prerelease) info.releaseId = `${ semVer.prerelease[0] }`;
|
||||
if (info.prerelease) info.releaseId = `${ semanticVersion.prerelease[0] }`;
|
||||
}
|
||||
|
||||
const iterator = paginate.iterator(
|
||||
@@ -71,7 +74,7 @@ export async function getTagInfo(): Promise<TagInfoI> {
|
||||
for (const { name, commit } of data) {
|
||||
if (sha() === commit.sha) continue;
|
||||
|
||||
if (semVer == null) {
|
||||
if (semanticVersion == null) {
|
||||
info.previous = {
|
||||
name,
|
||||
sha: commit.sha,
|
||||
@@ -80,9 +83,9 @@ export async function getTagInfo(): Promise<TagInfoI> {
|
||||
break loop;
|
||||
}
|
||||
|
||||
const version = parseSemVer(name);
|
||||
const version = parseSemVersion(name);
|
||||
|
||||
if (version == null || semVer.compare(version) <= 0) continue;
|
||||
if (version == null || semanticVersion.compare(version) <= 0) continue;
|
||||
|
||||
if (version.prerelease.length > 0 && !info.prerelease) continue;
|
||||
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ export * from "./input.js";
|
||||
export * from "./octokit.js";
|
||||
export * from "./output.js";
|
||||
export * from "./parse-commit-message.js";
|
||||
export * from "./parse-semver.js";
|
||||
export * from "./parse-semantic-version.js";
|
||||
export * from "./repository.js";
|
||||
export * from "./sha.js";
|
||||
export * from "./trim.js";
|
||||
+4
-2
@@ -25,10 +25,10 @@
|
||||
import { getInput } from "@actions/core";
|
||||
import { cache } from "./cache.js";
|
||||
|
||||
export function input<T = string>(
|
||||
export function input(
|
||||
name: string,
|
||||
required?: boolean,
|
||||
): T;
|
||||
): string;
|
||||
export function input<T = string>(
|
||||
name: string,
|
||||
parser: (value: string) => T,
|
||||
@@ -36,12 +36,14 @@ export function input<T = string>(
|
||||
): T;
|
||||
export function input<T = string>(
|
||||
name: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
parser: boolean | ((value: string) => T) = (value): T => value as T,
|
||||
required = true,
|
||||
): T {
|
||||
if (typeof parser === "boolean") {
|
||||
required = parser;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
parser = (value): T => value as T;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
import { getOctokit } from "@actions/github";
|
||||
import { type GitHub } from "@actions/github/lib/utils.js";
|
||||
import { gitHubToken } from "../inputs/index.js";
|
||||
import { cache } from "./cache.js";
|
||||
import { gitHubToken } from "../inputs/index.js";
|
||||
|
||||
export function octokit(): InstanceType<typeof GitHub> {
|
||||
return cache("octokit", () => getOctokit(gitHubToken()));
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
const REGEX = /^(?<type>[^!:() ]*)(?:\((?<scope>[^!()]*?)\)|)(?<breaking>!?): *(?<description>.+?) *(?:\(#(?<pr>[1-9]\d*?)\)|) *(?:\[(?<flag>[^[\]]*?)]|)\s*$/;
|
||||
const REGEX = /^(?<type>[^ !():]*)(?:\((?<scope>[^!()]*?)\)|)(?<breaking>!?): *(?<description>.+?) *(?:\(#(?<pr>[1-9]\d*?)\)|) *(?:\[(?<flag>[^[\]]*?)]|)\s*$/;
|
||||
|
||||
export function parseCommitMessage(message: string): ParsedCommitMessageI {
|
||||
const { description, flag, pr, scope, type, breaking } = REGEX.exec(message)?.groups ?? {};
|
||||
@@ -39,9 +39,14 @@ export function parseCommitMessage(message: string): ParsedCommitMessageI {
|
||||
|
||||
export interface ParsedCommitMessageI {
|
||||
breaking: boolean;
|
||||
|
||||
description?: string;
|
||||
|
||||
flag?: string;
|
||||
|
||||
pr?: string;
|
||||
|
||||
scope?: string;
|
||||
|
||||
type?: string;
|
||||
}
|
||||
@@ -22,11 +22,12 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
import { parse, type SemVer } from "semver";
|
||||
import { releaseName, releaseNamePrefix } from "../inputs/index.js";
|
||||
import { type SemVer, parse } from "semver";
|
||||
import { cache } from "./cache.js";
|
||||
import { releaseName, releaseNamePrefix } from "../inputs/index.js";
|
||||
|
||||
export function parseSemVer(version = releaseName()): SemVer | null {
|
||||
export function parseSemanticVersion(version = releaseName()): SemVer | null {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
return cache(`semver-${ version }`, () => parse(version.replace(new RegExp(`^${ releaseNamePrefix() }`), ""), { includePrerelease: true } as never));
|
||||
}
|
||||
|
||||
@@ -25,7 +25,15 @@
|
||||
import { context } from "@actions/github";
|
||||
import { cache } from "./cache.js";
|
||||
|
||||
export function repository(): { owner: string; repo: string; url: string } {
|
||||
export interface TRepository {
|
||||
owner: string;
|
||||
|
||||
repo: string;
|
||||
|
||||
url: string;
|
||||
}
|
||||
|
||||
export function repository(): TRepository {
|
||||
return cache("repo", () => {
|
||||
const { repo: { owner, repo }, serverUrl } = context;
|
||||
|
||||
|
||||
+2
-1
@@ -25,5 +25,6 @@
|
||||
export function trim<T extends string | null | undefined>(value: T): T {
|
||||
if (!value) return value;
|
||||
|
||||
return value.trim().replace(/ {2,}/g, " ") as T;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
return value.trim().replaceAll(/ {2,}/g, " ") as T;
|
||||
}
|
||||
@@ -22,7 +22,6 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
||||
import { getBooleanInput, getInput } from "@actions/core";
|
||||
import { getOctokit } from "@actions/github";
|
||||
import { GitHub } from "@actions/github/lib/utils";
|
||||
|
||||
@@ -163,7 +163,7 @@ it("should print a commit without scope", () => {
|
||||
|
||||
expect(commitNode).toBeInstanceOf(CommitNode);
|
||||
|
||||
expect(scopeNode.print()).toBe(`${ commitNode.print() }`);
|
||||
expect(scopeNode.print()).toBe(commitNode.print());
|
||||
});
|
||||
|
||||
it("should print multiple commits without scope", () => {
|
||||
|
||||
+18
-18
@@ -28,63 +28,63 @@ it("should cache value", () => {
|
||||
const name = "foo";
|
||||
const value = "bar";
|
||||
|
||||
const fn = jest.fn(() => value);
|
||||
const mockFunction = jest.fn(() => value);
|
||||
|
||||
const firstCallResult = cache(name, fn);
|
||||
const firstCallResult = cache(name, mockFunction);
|
||||
|
||||
expect(firstCallResult).toBe(value);
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
expect(mockFunction).toHaveBeenCalledTimes(1);
|
||||
|
||||
fn.mockClear();
|
||||
mockFunction.mockClear();
|
||||
|
||||
const secondCallResult = cache(name, fn);
|
||||
const secondCallResult = cache(name, mockFunction);
|
||||
|
||||
expect(secondCallResult).toBe(value);
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(0);
|
||||
expect(mockFunction).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should overwrite cache value", () => {
|
||||
const name = "foo";
|
||||
const value = "bar";
|
||||
|
||||
const fn = jest.fn(() => value);
|
||||
const mockFunction = jest.fn(() => value);
|
||||
|
||||
const firstCallResult = cache(name, fn);
|
||||
const firstCallResult = cache(name, mockFunction);
|
||||
|
||||
expect(firstCallResult).toBe(value);
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
expect(mockFunction).toHaveBeenCalledTimes(1);
|
||||
|
||||
fn.mockClear();
|
||||
mockFunction.mockClear();
|
||||
|
||||
const secondCallResult = cache(name, fn, true);
|
||||
const secondCallResult = cache(name, mockFunction, true);
|
||||
|
||||
expect(secondCallResult).toBe(value);
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
expect(mockFunction).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("should clear cache", () => {
|
||||
const name = "foo";
|
||||
const value = "bar";
|
||||
|
||||
const fn = jest.fn(() => value);
|
||||
const mockFunction = jest.fn(() => value);
|
||||
|
||||
const firstCallResult = cache(name, fn);
|
||||
const firstCallResult = cache(name, mockFunction);
|
||||
|
||||
expect(firstCallResult).toBe(value);
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
expect(mockFunction).toHaveBeenCalledTimes(1);
|
||||
|
||||
fn.mockClear();
|
||||
mockFunction.mockClear();
|
||||
|
||||
clearCache();
|
||||
|
||||
const secondCallResult = cache(name, fn);
|
||||
const secondCallResult = cache(name, mockFunction);
|
||||
|
||||
expect(secondCallResult).toBe(value);
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
expect(mockFunction).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
import { getInput } from "@actions/core";
|
||||
import { parseSemVer } from "../../src/utils";
|
||||
import { parseSemanticVersion } from "../../src/utils";
|
||||
|
||||
it("should parse the semver version string", () => {
|
||||
const major = 1;
|
||||
@@ -41,7 +41,7 @@ it("should parse the semver version string", () => {
|
||||
return "";
|
||||
});
|
||||
|
||||
const result = parseSemVer(raw);
|
||||
const result = parseSemanticVersion(raw);
|
||||
|
||||
expect(result).toBeDefined();
|
||||
expect(result).toEqual({
|
||||
@@ -82,7 +82,7 @@ it("should parse the release name by default", () => {
|
||||
}
|
||||
});
|
||||
|
||||
const result = parseSemVer();
|
||||
const result = parseSemanticVersion();
|
||||
|
||||
expect(result).toBeDefined();
|
||||
expect(result).toEqual({
|
||||
|
||||
@@ -37,7 +37,7 @@ it("should handle null value", () => {
|
||||
});
|
||||
|
||||
it("should handle undefined value", () => {
|
||||
// eslint-disable-next-line no-undefined,@typescript-eslint/no-confusing-void-expression
|
||||
// eslint-disable-next-line no-undefined,@typescript-eslint/no-confusing-void-expression,unicorn/no-useless-undefined
|
||||
expect(trim(undefined)).toBeUndefined();
|
||||
});
|
||||
|
||||
|
||||
+2
-1
@@ -4,5 +4,6 @@
|
||||
"rootDir": "src",
|
||||
"tsBuildInfoFile": "./.cache/typescript/tsconfig.build.tsbuildinfo"
|
||||
},
|
||||
"exclude": ["commitlint.config.cts", "jest.config.ts", "tests", "__mocks__"]
|
||||
"exclude": [
|
||||
"commitlint.config.cts", "eslint.config.mts", "jest.config.ts", "tests", "action", "__mocks__"]
|
||||
}
|
||||
+4
-3
@@ -5,7 +5,7 @@
|
||||
/* Basic Options */
|
||||
"incremental": true, /* Enable incremental compilation */
|
||||
"target": "ESNext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
||||
"module": "Node16", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
||||
"lib": ["ESNext"], /* Specify library files to be included in the compilation. */
|
||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||
// "checkJs": true, /* Report errors in .js files. */
|
||||
@@ -41,7 +41,7 @@
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
|
||||
/* Module Resolution Options */
|
||||
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
"moduleResolution": "Node16", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
@@ -65,5 +65,6 @@
|
||||
/* Advanced Options */
|
||||
"skipLibCheck": true, /* Skip type checking of declaration files. */
|
||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
||||
}
|
||||
},
|
||||
"exclude": ["action"]
|
||||
}
|
||||
Reference in new issue
Block a user