@tarsilla/commit-wizard 1.4.9 → 2.0.3

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/README.md CHANGED
@@ -5,6 +5,7 @@ A custom configuration library for [commitizen](https://github.com/commitizen/cz
5
5
  ## Features
6
6
 
7
7
  **@tarsilla/commit-wizard** provides a unified solution to enforce standardized commit messages and automate releases. It bundles tailored configurations for:
8
+
8
9
  - **Commitizen** – interactive commit prompt
9
10
  - **Commitlint** – commit message linting
10
11
  - **Semantic-release** – automated release management
@@ -62,7 +63,7 @@ module.exports = {
62
63
  };
63
64
  ```
64
65
 
65
- The semantic-release configuration automates version management and changelog generation.
66
+ The semantic-release configuration automates version management and changelog generation.
66
67
  It is recommended to configure CI/CD to run semantic-release, ex. using github actions (e.g. see [.github/workflows/npm-publish.yml](src/semantic-release/npm-publish.yml)).
67
68
 
68
69
  ## Configuration Options
@@ -70,9 +71,9 @@ It is recommended to configure CI/CD to run semantic-release, ex. using github a
70
71
  You can override default settings by creating a `commit-wizard.config.json` file in your project root.
71
72
  The plugin accepts an object of type `CommitWizardOptions`:
72
73
 
73
- | Option | Type | Description | Default |
74
- |----------|--------|--------------------------------------------------------------|-------------|
75
- | maxLineLength | number | The maximum length of the commit message. If not provided, the plugin will run with the default settings. | 120 |
74
+ | Option | Type | Description | Default |
75
+ |---------------|--------|-----------------------------------------------------------------------------------------------------------|---------|
76
+ | maxLineLength | number | The maximum length of the commit message. If not provided, the plugin will run with the default settings. | 120 |
76
77
 
77
78
  Example `commit-wizard.config.json`:
78
79
 
@@ -88,4 +89,4 @@ Contributions are welcome! Please ensure your pull request adheres to the projec
88
89
 
89
90
  ## License
90
91
 
91
- Released under the [MIT License](LICENSE).
92
+ Released under the [MIT License](LICENSE).
@@ -1,2 +1,2 @@
1
- import e from"fs";import t from"path";function n({answers:e}){const t=e.scope?`(${e.scope})`:"";if("break"===e.type){return`feat${t}!: ${e.subject}`}return`${e.type}${t}: ${e.subject}`}function a({answers:e,maxLineLength:t}){const n=e.scope?`(${e.scope})`:"";return t-((e.type?e.type.length:0)+n.length+2)}const s={maxLineLength:120};const r=function({maxLineLength:e}){return{prompter:function(t,s){const r=[{type:"list",name:"type",message:"Select the type of change that you're committing:",choices:[{value:"feat",name:"🚀 feat: A new feature"},{value:"fix",name:"🐛 fix: A bug fix"},{value:"docs",name:"📚 docs: Documentation only changes"},{value:"style",name:"🎨 style: Changes that do not affect the meaning of the code (white-space, formatting, etc)"},{value:"refactor",name:"🔨 refactor: A code change that neither fixes a bug nor adds a feature"},{value:"perf",name:"⚡️ perf: A code change that improves performance"},{value:"test",name:"🔍 test: Adding missing tests or correcting existing tests"},{value:"build",name:"📦 build: Changes that affect the build system or external dependencies"},{value:"ci",name:"🤖 ci: Changes to our CI configuration files and scripts"},{value:"chore",name:"🧹 chore: Other changes that don't modify src or test files"},{value:"break",name:"💥 break: A change that breaks existing functionality"},{value:"revert",name:"⏪ revert: Reverts a previous commit"}]},{type:"input",name:"scope",message:"What is the scope of this change (e.g. component or file name): (press enter to skip)"},{type:"input",name:"subject",message:t=>`Write a short, imperative tense description of the change (max ${a({answers:t,maxLineLength:e})} chars):`,validate:(t,n)=>{if(!t.trim())return"Subject is required";const s=a({answers:n,maxLineLength:e});return t.length<=s||`Subject length must be less than or equal to ${s} characters. Current length is ${t.length} characters.`},transformer:(t,n)=>a({answers:n,maxLineLength:e})-t.length<0?`\n(${t.length}) ${t}`:`\n(${t.length}) ${t}`},{type:"list",name:"confirmCommit",choices:[{value:"yes",name:"Yes"},{value:"no",name:"Abort commit"}],default:0,message(e){const t="--------------------------------------------------------",a=n({answers:e});return console.info(`\n${t}\n\n${a}\n\n${t}\n`),"Are you sure you want to proceed with the commit above?"}}];t.prompt(r).then((e=>{if("no"===e.confirmCommit)console.info("Commit aborted.");else{const t=n({answers:e});s(t)}}))}}}(function(){const n=t.resolve(process.cwd(),"commit-wizard.config.json");if(!e.existsSync(n))return s;const a=require(n);return{...s,...a}}());export{r as default};
1
+ import e from"fs";import t from"path";const n={maxLineLength:120};function a({answers:e}){const t=e.scope?`(${e.scope})`:"";if("break"===e.type){return`feat${t}!: ${e.subject}`}return`${e.type}${t}: ${e.subject}`}function s({answers:e,maxLineLength:t}){const n=e.scope?`(${e.scope})`:"";return t-((e.type?e.type.length:0)+n.length+2)}const o=function({maxLineLength:e}){return{prompter:function(t,n){const o=[{choices:[{name:"🚀 feat: A new feature",value:"feat"},{name:"🐛 fix: A bug fix",value:"fix"},{name:"📚 docs: Documentation only changes",value:"docs"},{name:"🎨 style: Changes that do not affect the meaning of the code (white-space, formatting, etc)",value:"style"},{name:"🔨 refactor: A code change that neither fixes a bug nor adds a feature",value:"refactor"},{name:"⚡️ perf: A code change that improves performance",value:"perf"},{name:"🔍 test: Adding missing tests or correcting existing tests",value:"test"},{name:"📦 build: Changes that affect the build system or external dependencies",value:"build"},{name:"🤖 ci: Changes to our CI configuration files and scripts",value:"ci"},{name:"🧹 chore: Other changes that don't modify src or test files",value:"chore"},{name:"💥 break: A change that breaks existing functionality",value:"break"},{name:"⏪ revert: Reverts a previous commit",value:"revert"}],message:"Select the type of change that you're committing:",name:"type",type:"list"},{message:"What is the scope of this change (e.g. component or file name): (press enter to skip)",name:"scope",type:"input"},{message:t=>`Write a short, imperative tense description of the change (max ${s({answers:t,maxLineLength:e})} chars):`,name:"subject",transformer:(t,n)=>s({answers:n,maxLineLength:e})-t.length<0?`\n(${t.length}) ${t}`:`\n(${t.length}) ${t}`,type:"input",validate:(t,n)=>{if(!t.trim())return"Subject is required";const a=s({answers:n,maxLineLength:e});return t.length<=a||`Subject length must be less than or equal to ${a} characters. Current length is ${t.length} characters.`}},{choices:[{name:"Yes",value:"yes"},{name:"Abort commit",value:"no"}],default:0,message(e){const t="--------------------------------------------------------",n=a({answers:e});return console.info(`\n${t}\n\n${n}\n\n${t}\n`),"Are you sure you want to proceed with the commit above?"},name:"confirmCommit",type:"list"}];t.prompt(o).then(e=>{if("no"===e.confirmCommit)console.info("Commit aborted.");else{const t=a({answers:e});n(t)}})}}}(function(){const a=t.resolve(process.cwd(),"commit-wizard.config.json");if(!e.existsSync(a))return n;const s=e.readFileSync(a,"utf8"),o=JSON.parse(s);return o&&"object"==typeof o?{...n,...o}:n}());export{o as default};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/commitizen/prompter.ts","../../src/config-loader/configLoader.ts","../../src/commitizen/index.ts"],"sourcesContent":["import { Commitizen, Prompter, Question } from 'commitizen';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nexport type CommitAnswers = {\n type: string;\n scope: string;\n subject: string;\n confirmCommit: string;\n};\n\nfunction getCommitMessage({ answers }: { answers: CommitAnswers }) {\n const scopeText = answers.scope ? `(${answers.scope})` : '';\n if (answers.type === 'break') {\n const message = `feat${scopeText}!: ${answers.subject}`;\n return message;\n }\n const message = `${answers.type}${scopeText}: ${answers.subject}`;\n return message;\n}\n\nfunction getMaxSubject({ answers, maxLineLength }: { answers: CommitAnswers; maxLineLength: number }) {\n const scopeText = answers.scope ? `(${answers.scope})` : '';\n // +2 accounts for \": \" after type and scope.\n const prefixLength = (answers.type ? answers.type.length : 0) + scopeText.length + 2;\n const maxSubject = maxLineLength - prefixLength;\n return maxSubject;\n}\n\nfunction prompter({ maxLineLength }: CommitWizardOptions): Prompter {\n return {\n prompter: function (cz: Commitizen, commit: (message: string) => void) {\n const questions: Question<CommitAnswers> = [\n {\n type: 'list',\n name: 'type',\n message: \"Select the type of change that you're committing:\",\n choices: [\n { value: 'feat', name: '🚀 feat: A new feature' },\n { value: 'fix', name: '🐛 fix: A bug fix' },\n { value: 'docs', name: '📚 docs: Documentation only changes' },\n {\n value: 'style',\n name: '🎨 style: Changes that do not affect the meaning of the code (white-space, formatting, etc)',\n },\n { value: 'refactor', name: '🔨 refactor: A code change that neither fixes a bug nor adds a feature' },\n { value: 'perf', name: '⚡️ perf: A code change that improves performance' },\n { value: 'test', name: '🔍 test: Adding missing tests or correcting existing tests' },\n { value: 'build', name: '📦 build: Changes that affect the build system or external dependencies' },\n { value: 'ci', name: '🤖 ci: Changes to our CI configuration files and scripts' },\n { value: 'chore', name: \"🧹 chore: Other changes that don't modify src or test files\" },\n { value: 'break', name: '💥 break: A change that breaks existing functionality' },\n { value: 'revert', name: '⏪ revert: Reverts a previous commit' },\n ],\n },\n {\n type: 'input',\n name: 'scope',\n message: 'What is the scope of this change (e.g. component or file name): (press enter to skip)',\n },\n {\n type: 'input',\n name: 'subject',\n message: (answers) => {\n const maxSubject = getMaxSubject({ answers, maxLineLength });\n return `Write a short, imperative tense description of the change (max ${maxSubject} chars):`;\n },\n validate: (input, answers) => {\n if (!input.trim()) {\n // \\u001b[31m is red\n return `\\u001b[31mSubject is required\\u001b[39m`;\n }\n const maxSubject = getMaxSubject({ answers: answers!, maxLineLength });\n if (input.length <= maxSubject) {\n return true;\n }\n // \\u001b[31m is red\n return `\\u001b[31mSubject length must be less than or equal to ${maxSubject} characters. Current length is ${input.length} characters.\\u001b[39m`;\n },\n transformer: (input, answers) => {\n const maxSubject = getMaxSubject({ answers, maxLineLength });\n const remaining = maxSubject - input.length;\n if (remaining < 0) {\n // Red if remaining < 0: \\u001b[31m is red, \\u001b[39m resets the color.\n return `\\n\\u001b[31m(${input.length}) ${input}\\u001b[39m`;\n }\n // Green if valid: \\u001b[32m is green, \\u001b[39m resets the color.\n return `\\n\\u001b[32m(${input.length}) ${input}\\u001b[39m`;\n },\n },\n {\n type: 'list',\n name: 'confirmCommit',\n choices: [\n { value: 'yes', name: 'Yes' },\n { value: 'no', name: 'Abort commit' },\n ],\n default: 0,\n message(answers) {\n const SEP = '--------------------------------------------------------';\n const message = getCommitMessage({ answers });\n console.info(`\\n${SEP}\\n\\n${message}\\n\\n${SEP}\\n`);\n return 'Are you sure you want to proceed with the commit above?';\n },\n },\n ];\n\n cz.prompt(questions).then((answers) => {\n if (answers.confirmCommit === 'no') {\n console.info('Commit aborted.');\n } else {\n const message = getCommitMessage({ answers });\n commit(message);\n }\n });\n },\n };\n}\n\nexport default prompter;\n","import fs from 'fs';\nimport path from 'path';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst config: CommitWizardOptions = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): CommitWizardOptions {\n const configPath = path.resolve(process.cwd(), file);\n\n if (!fs.existsSync(configPath)) {\n return config;\n }\n\n const loadedConfig = require(configPath);\n return { ...config, ...loadedConfig };\n}\n\nexport default configLoader;\n","import commitizenPrompter from './prompter.js';\nimport configLoader from '../config-loader/configLoader.js';\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst loadedConfig: CommitWizardOptions = configLoader();\nconst prompter = commitizenPrompter(loadedConfig);\n\nexport default prompter;\n"],"names":["getCommitMessage","answers","scopeText","scope","type","subject","getMaxSubject","maxLineLength","length","config","prompter","cz","commit","questions","name","message","choices","value","validate","input","trim","maxSubject","transformer","default","SEP","console","info","prompt","then","confirmCommit","commitizenPrompter","configPath","path","resolve","process","cwd","fs","existsSync","loadedConfig","require","configLoader"],"mappings":"sCAWA,SAASA,GAAiBC,QAAEA,IAC1B,MAAMC,EAAYD,EAAQE,MAAQ,IAAIF,EAAQE,SAAW,GACzD,GAAqB,UAAjBF,EAAQG,KAAkB,CAE5B,MADgB,OAAOF,OAAeD,EAAQI,SAEhD,CAEA,MADgB,GAAGJ,EAAQG,OAAOF,MAAcD,EAAQI,SAE1D,CAEA,SAASC,GAAcL,QAAEA,EAAOM,cAAEA,IAChC,MAAML,EAAYD,EAAQE,MAAQ,IAAIF,EAAQE,SAAW,GAIzD,OADmBI,IADGN,EAAQG,KAAOH,EAAQG,KAAKI,OAAS,GAAKN,EAAUM,OAAS,EAGrF,CCtBA,MAAMC,EAA8B,CAClCF,cAAe,KCFjB,MACMG,EFwBN,UAAkBH,cAAEA,IAClB,MAAO,CACLG,SAAU,SAAUC,EAAgBC,GA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QAAQC,KAAK,uBACR,CACL,MAAMX,EAAUf,EAAiB,CAAEC,YACnCW,EAAOG,EACT,IAEJ,EAEJ,CEhHiBe,CDKjB,WACE,MAAMC,EAAaC,EAAKC,QAAQC,QAAQC,MAH7B,6BAKX,IAAKC,EAAGC,WAAWN,GACjB,OAAOtB,EAGT,MAAM6B,EAAeC,QAAQR,GAC7B,MAAO,IAAKtB,KAAW6B,EACzB,CCf0CE"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/config-loader/configLoader.ts","../../src/commitizen/prompter.ts","../../src/commitizen/index.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst config: CommitWizardOptions = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): CommitWizardOptions {\n const configPath = path.resolve(process.cwd(), file);\n\n if (!fs.existsSync(configPath)) {\n return config;\n }\n\n const rawConfig = fs.readFileSync(configPath, 'utf8');\n const parsedConfig: unknown = JSON.parse(rawConfig);\n\n if (!parsedConfig || typeof parsedConfig !== 'object') {\n return config;\n }\n\n return { ...config, ...parsedConfig };\n}\n\nexport default configLoader;\n","import { Commitizen, Prompter } from 'commitizen';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nexport type CommitAnswers = {\n confirmCommit: string;\n scope: string;\n subject: string;\n type: string;\n};\n\nfunction getCommitMessage({ answers }: { answers: Partial<CommitAnswers> }) {\n const scopeText = answers.scope ? `(${answers.scope})` : '';\n if (answers.type === 'break') {\n const message = `feat${scopeText}!: ${answers.subject}`;\n return message;\n }\n const message = `${answers.type}${scopeText}: ${answers.subject}`;\n return message;\n}\n\nfunction getMaxSubject({ answers, maxLineLength }: { answers: Partial<CommitAnswers>; maxLineLength: number }) {\n const scopeText = answers.scope ? `(${answers.scope})` : '';\n // +2 accounts for \": \" after type and scope.\n const prefixLength = (answers.type ? answers.type.length : 0) + scopeText.length + 2;\n const maxSubject = maxLineLength - prefixLength;\n return maxSubject;\n}\n\nfunction prompter({ maxLineLength }: CommitWizardOptions): Prompter {\n return {\n prompter: function (cz: Commitizen, commit: (message: string) => void) {\n const questions = [\n {\n choices: [\n { name: '🚀 feat: A new feature', value: 'feat' },\n { name: '🐛 fix: A bug fix', value: 'fix' },\n { name: '📚 docs: Documentation only changes', value: 'docs' },\n {\n name: '🎨 style: Changes that do not affect the meaning of the code (white-space, formatting, etc)',\n value: 'style',\n },\n { name: '🔨 refactor: A code change that neither fixes a bug nor adds a feature', value: 'refactor' },\n { name: '⚡️ perf: A code change that improves performance', value: 'perf' },\n { name: '🔍 test: Adding missing tests or correcting existing tests', value: 'test' },\n { name: '📦 build: Changes that affect the build system or external dependencies', value: 'build' },\n { name: '🤖 ci: Changes to our CI configuration files and scripts', value: 'ci' },\n { name: \"🧹 chore: Other changes that don't modify src or test files\", value: 'chore' },\n { name: '💥 break: A change that breaks existing functionality', value: 'break' },\n { name: '⏪ revert: Reverts a previous commit', value: 'revert' },\n ],\n message: \"Select the type of change that you're committing:\",\n name: 'type',\n type: 'list',\n },\n {\n message: 'What is the scope of this change (e.g. component or file name): (press enter to skip)',\n name: 'scope',\n type: 'input',\n },\n {\n message: (answers: Partial<CommitAnswers>) => {\n const maxSubject = getMaxSubject({ answers, maxLineLength });\n return `Write a short, imperative tense description of the change (max ${maxSubject} chars):`;\n },\n name: 'subject',\n transformer: (input: string, answers: Partial<CommitAnswers>) => {\n const maxSubject = getMaxSubject({ answers, maxLineLength });\n const remaining = maxSubject - input.length;\n if (remaining < 0) {\n // Red if remaining < 0: \\u001b[31m is red, \\u001b[39m resets the color.\n return `\\n\\u001b[31m(${input.length}) ${input}\\u001b[39m`;\n }\n // Green if valid: \\u001b[32m is green, \\u001b[39m resets the color.\n return `\\n\\u001b[32m(${input.length}) ${input}\\u001b[39m`;\n },\n type: 'input',\n validate: (input: string, answers: Partial<CommitAnswers>) => {\n if (!input.trim()) {\n // \\u001b[31m is red\n return `\\u001b[31mSubject is required\\u001b[39m`;\n }\n const maxSubject = getMaxSubject({ answers: answers, maxLineLength });\n if (input.length <= maxSubject) {\n return true;\n }\n // \\u001b[31m is red\n return `\\u001b[31mSubject length must be less than or equal to ${maxSubject} characters. Current length is ${input.length} characters.\\u001b[39m`;\n },\n },\n {\n choices: [\n { name: 'Yes', value: 'yes' },\n { name: 'Abort commit', value: 'no' },\n ],\n default: 0,\n message(answers: Partial<CommitAnswers>) {\n const SEP = '--------------------------------------------------------';\n const message = getCommitMessage({ answers });\n console.info(`\\n${SEP}\\n\\n${message}\\n\\n${SEP}\\n`);\n return 'Are you sure you want to proceed with the commit above?';\n },\n name: 'confirmCommit',\n type: 'list',\n },\n ];\n\n void cz.prompt<Partial<CommitAnswers>>(questions).then((answers) => {\n if (answers.confirmCommit === 'no') {\n console.info('Commit aborted.');\n } else {\n const message = getCommitMessage({ answers });\n commit(message);\n }\n });\n },\n };\n}\n\nexport default prompter;\n","import configLoader from '../config-loader/configLoader.js';\nimport commitizenPrompter from './prompter.js';\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst loadedConfig: CommitWizardOptions = configLoader();\nconst prompter = commitizenPrompter(loadedConfig);\n\nexport default prompter;\n"],"names":["config","maxLineLength","getCommitMessage","answers","scopeText","scope","type","subject","getMaxSubject","length","prompter","cz","commit","questions","choices","name","value","message","transformer","input","validate","trim","maxSubject","default","SEP","console","info","prompt","then","confirmCommit","commitizenPrompter","configPath","path","resolve","process","cwd","fs","existsSync","rawConfig","readFileSync","parsedConfig","JSON","parse","configLoader"],"mappings":"sCAKA,MAAMA,EAA8B,CAClCC,cAAe,KCKjB,SAASC,GAAiBC,QAAEA,IAC1B,MAAMC,EAAYD,EAAQE,MAAQ,IAAIF,EAAQE,SAAW,GACzD,GAAqB,UAAjBF,EAAQG,KAAkB,CAE5B,MADgB,OAAOF,OAAeD,EAAQI,SAEhD,CAEA,MADgB,GAAGJ,EAAQG,OAAOF,MAAcD,EAAQI,SAE1D,CAEA,SAASC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EjCO,QAAS,EACTN,OAAAA,CAAQd,GACN,MAAMqB,EAAM,2DACNP,EAAUf,EAAiB,CAAEC,YAEnC,OADAsB,QAAQC,KAAK,KAAKF,QAAUP,QAAcO,OACnC,yDACT,EACAT,KAAM,gBACNT,KAAM,SAILK,EAAGgB,OAA+Bd,GAAWe,KAAMzB,IACtD,GAA8B,OAA1BA,EAAQ0B,cACVJ,QAAQC,KAAK,uBACR,CACL,MAAMT,EAAUf,EAAiB,CAAEC,YACnCS,EAAOK,EACT,GAEJ,EAEJ,CChHiBa,CFKjB,WACE,MAAMC,EAAaC,EAAKC,QAAQC,QAAQC,MAH7B,6BAKX,IAAKC,EAAGC,WAAWN,GACjB,OAAO/B,EAGT,MAAMsC,EAAYF,EAAGG,aAAaR,EAAY,QACxCS,EAAwBC,KAAKC,MAAMJ,GAEzC,OAAKE,GAAwC,iBAAjBA,EAIrB,IAAKxC,KAAWwC,GAHdxC,CAIX,CErB0C2C"}
@@ -1,2 +1,2 @@
1
- import e from"fs";import t from"path";const n={maxLineLength:120};const o=function({maxLineLength:e}){return{extends:["@commitlint/config-conventional"],parserPreset:{parserOpts:{headerPattern:RegExp("^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$"),headerCorrespondence:["type","exclamation1","scope","exclamation2","subject"]}},rules:{"header-max-length":[2,"always",e]}}}(function(){const o=t.resolve(process.cwd(),"commit-wizard.config.json");if(!e.existsSync(o))return n;const r=require(o);return{...n,...r}}());export{o as default};
1
+ import e from"fs";import t from"path";const n={maxLineLength:120};const o=function({maxLineLength:e}){return{extends:["@commitlint/config-conventional"],parserPreset:{parserOpts:{headerCorrespondence:["type","exclamation1","scope","exclamation2","subject"],headerPattern:/^(?<type>\w+)(?<exclamation1>!?)(?:\((?<scope>[^)]+)\)(?<exclamation2>!?))?: (?<subject>.+)$/}},rules:{"header-max-length":[2,"always",e]}}}(function(){const o=t.resolve(process.cwd(),"commit-wizard.config.json");if(!e.existsSync(o))return n;const r=e.readFileSync(o,"utf8"),a=JSON.parse(r);return a&&"object"==typeof a?{...n,...a}:n}());export{o as default};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/config-loader/configLoader.ts","../../src/commitlint/index.ts","../../src/commitlint/userConfig.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst config: CommitWizardOptions = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): CommitWizardOptions {\n const configPath = path.resolve(process.cwd(), file);\n\n if (!fs.existsSync(configPath)) {\n return config;\n }\n\n const loadedConfig = require(configPath);\n return { ...config, ...loadedConfig };\n}\n\nexport default configLoader;\n","import { UserConfig } from '@commitlint/types';\n\nimport commitlintUserConfig from './userConfig.js';\nimport configLoader from '../config-loader/configLoader.js';\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst loadedConfig: CommitWizardOptions = configLoader();\nconst userConfig: UserConfig = commitlintUserConfig(loadedConfig);\n\nexport default userConfig;\n","import { UserConfig } from '@commitlint/types';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nfunction userConfig({ maxLineLength }: CommitWizardOptions): UserConfig {\n return {\n extends: ['@commitlint/config-conventional'],\n parserPreset: {\n parserOpts: {\n headerPattern: /^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$/,\n headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],\n },\n },\n rules: {\n 'header-max-length': [2, 'always', maxLineLength] as [number, 'always' | 'never', number],\n },\n };\n}\n\nexport default userConfig;\n"],"names":["config","maxLineLength","userConfig","extends","parserPreset","parserOpts","headerPattern","RegExp","headerCorrespondence","rules","commitlintUserConfig","configPath","path","resolve","process","cwd","fs","existsSync","loadedConfig","require","configLoader"],"mappings":"sCAKA,MAAMA,EAA8B,CAClCC,cAAe,KCAjB,MACMC,ECHN,UAAoBD,cAAEA,IACpB,MAAO,CACLE,QAAS,CAAC,mCACVC,aAAc,CACZC,WAAY,CACVC,cAAeC,OAAA,mGACfC,qBAAsB,CAAC,OAAQ,eAAgB,QAAS,eAAgB,aAG5EC,MAAO,CACL,oBAAqB,CAAC,EAAG,SAAUR,IAGzC,CDV+BS,CDG/B,WACE,MAAMC,EAAaC,EAAKC,QAAQC,QAAQC,MAH7B,6BAKX,IAAKC,EAAGC,WAAWN,GACjB,OAAOX,EAGT,MAAMkB,EAAeC,QAAQR,GAC7B,MAAO,IAAKX,KAAWkB,EACzB,CCb0CE"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/config-loader/configLoader.ts","../../src/commitlint/index.ts","../../src/commitlint/userConfig.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nconst config: CommitWizardOptions = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): CommitWizardOptions {\n const configPath = path.resolve(process.cwd(), file);\n\n if (!fs.existsSync(configPath)) {\n return config;\n }\n\n const rawConfig = fs.readFileSync(configPath, 'utf8');\n const parsedConfig: unknown = JSON.parse(rawConfig);\n\n if (!parsedConfig || typeof parsedConfig !== 'object') {\n return config;\n }\n\n return { ...config, ...parsedConfig };\n}\n\nexport default configLoader;\n","import { UserConfig } from '@commitlint/types';\n\nimport configLoader from '../config-loader/configLoader.js';\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\nimport commitlintUserConfig from './userConfig.js';\n\nconst loadedConfig: CommitWizardOptions = configLoader();\nconst userConfig: UserConfig = commitlintUserConfig(loadedConfig);\n\nexport default userConfig;\n","import { UserConfig } from '@commitlint/types';\n\nimport CommitWizardOptions from '../types/CommitWizardOptions.js';\n\nfunction userConfig({ maxLineLength }: CommitWizardOptions): UserConfig {\n return {\n extends: ['@commitlint/config-conventional'],\n parserPreset: {\n parserOpts: {\n headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],\n headerPattern: /^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$/,\n },\n },\n rules: {\n 'header-max-length': [2, 'always', maxLineLength] as [number, 'always' | 'never', number],\n },\n };\n}\n\nexport default userConfig;\n"],"names":["config","maxLineLength","userConfig","extends","parserPreset","parserOpts","headerCorrespondence","headerPattern","rules","commitlintUserConfig","configPath","path","resolve","process","cwd","fs","existsSync","rawConfig","readFileSync","parsedConfig","JSON","parse","configLoader"],"mappings":"sCAKA,MAAMA,EAA8B,CAClCC,cAAe,KCAjB,MACMC,ECHN,UAAoBD,cAAEA,IACpB,MAAO,CACLE,QAAS,CAAC,mCACVC,aAAc,CACZC,WAAY,CACVC,qBAAsB,CAAC,OAAQ,eAAgB,QAAS,eAAgB,WACxEC,cAAe,iGAGnBC,MAAO,CACL,oBAAqB,CAAC,EAAG,SAAUP,IAGzC,CDV+BQ,CDG/B,WACE,MAAMC,EAAaC,EAAKC,QAAQC,QAAQC,MAH7B,6BAKX,IAAKC,EAAGC,WAAWN,GACjB,OAAOV,EAGT,MAAMiB,EAAYF,EAAGG,aAAaR,EAAY,QACxCS,EAAwBC,KAAKC,MAAMJ,GAEzC,OAAKE,GAAwC,iBAAjBA,EAIrB,IAAKnB,KAAWmB,GAHdnB,CAIX,CCnB0CsB"}
@@ -1,2 +1,2 @@
1
- import{execSync as e}from"child_process";import a from"crypto";import t from"fs";import{analyzeCommits as s}from"@semantic-release/commit-analyzer";import{prepare as r,verifyConditions as n}from"@semantic-release/git";import{addChannel as i,fail as o,publish as c,success as l,verifyConditions as p}from"@semantic-release/github";import{generateNotes as m}from"@semantic-release/release-notes-generator";const f="nextTag-stable.tar.gz",y={preset:"conventionalcommits",parserOpts:{headerPattern:RegExp("^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$"),headerCorrespondence:["type","exclamation1","scope","exclamation2","subject"]},releaseRules:[{type:"feat",exclamation1:"!",release:"major"},{type:"feat",exclamation2:"!",release:"major"},{type:"feat",release:"minor"},{type:"fix",release:"patch"},{type:"docs",release:"patch"},{type:"style",release:"patch"},{type:"refactor",release:"patch"},{type:"perf",release:"patch"},{type:"test",release:"patch"},{type:"build",release:"patch"},{type:"ci",release:"patch"},{type:"chore",release:"patch"},{type:"revert",release:"patch"}]};let u=!1;function h(e,a){const{options:t}=a,s=t.repositoryUrl,r=new URL(s).pathname,n=(r.startsWith("/")?r.slice(1):r).split("/").pop();return e.tap??`${n}.rb`}async function w(e,s){const{nextRelease:r,options:n}=s,i=`v${r.version}`,o=n.repositoryUrl,c=new URL(o).pathname,l=`https://github.com/${c.startsWith("/")?c.slice(1):c}/releases/download/${i}/${f.replace("nextTag",i)}`,p=function(e,s){const{nextRelease:r}=s,n=`v${r.version}`,i=f.replace("nextTag",n),o=t.readFileSync(i),c=a.createHash("sha256");return c.update(o),c.digest("hex")}(0,s),m=h(e,s);let y=t.readFileSync(m,"utf8");y=y.replace(/url ".*"/,`url "${l}"`),y=y.replace(/sha256 ".*"/,`sha256 "${p}"`),t.writeFileSync(m,y)}async function x(e,a){p&&await p(e,a),n&&await n(e,a),u=!0}const d={addChannel:async function(e,a){u||(await x(e,a),u=!0),i&&await i(e,a)},verifyConditions:x,analyzeCommits:async function(e,a){return u||(await x(e,a),u=!0),s(y,a)},generateNotes:async function(e,a){return u||(await x(e,a),u=!0),m({},a)},prepare:async function(a,t){if(u||(await x(a,t),u=!0),r){const{nextRelease:s}=t;if(!s?.version)throw new Error("Next release version is not available.");const n=h(a,t);!function(a,t){const{nextRelease:s}=t,r=`v${s.version}`,n=f.replace("nextTag",r);e(`git archive --format=tar.gz --output=${n} HEAD`)}(0,t),await w(a,t),await r({assets:[n],message:"chore(release): ${nextRelease.version}"},t)}},publish:async function(e,a){if(u||(await x(e,a),u=!0),c){const{nextRelease:t}=a,s=`v${t.version}`,r=f.replace("nextTag",s),n={...e,assets:[{path:r,label:`Homebrew Tarball (${s})`}]};await c(n,a)}return null},success:async function(e,a){u||(await x(e,a),u=!0),l&&await l(e,a)},fail:async function(e,a){o&&await r(e,a)}};export{d as default};
1
+ import{execSync as e}from"child_process";import a from"crypto";import t from"fs";import{analyzeCommits as r}from"@semantic-release/commit-analyzer";import{prepare as s,verifyConditions as n}from"@semantic-release/git";import{addChannel as o,fail as i,publish as c,success as l,verifyConditions as p}from"@semantic-release/github";import{generateNotes as m}from"@semantic-release/release-notes-generator";const y="nextTag-stable.tar.gz",f={parserOpts:{headerCorrespondence:["type","exclamation1","scope","exclamation2","subject"],headerPattern:/^(?<type>\w+)(?<exclamation1>!?)(?:\((?<scope>[^)]+)\)(?<exclamation2>!?))?: (?<subject>.+)$/},preset:"conventionalcommits",releaseRules:[{exclamation1:"!",release:"major",type:"feat"},{exclamation2:"!",release:"major",type:"feat"},{release:"minor",type:"feat"},{release:"patch",type:"fix"},{release:"patch",type:"docs"},{release:"patch",type:"style"},{release:"patch",type:"refactor"},{release:"patch",type:"perf"},{release:"patch",type:"test"},{release:"patch",type:"build"},{release:"patch",type:"ci"},{release:"patch",type:"chore"},{release:"patch",type:"revert"}]};let u=!1;function h(e,a){const{options:t}=a,r=t.repositoryUrl;if(!r)throw new Error("semantic-release repositoryUrl is required");const s=new URL(r).pathname,n=(s.startsWith("/")?s.slice(1):s).split("/").pop();return e.tap??`${n}.rb`}async function w(e,a){await p(e,a),await n(e,a),u=!0}const d={addChannel:async function(e,a){u||(await w(e,a),u=!0),await o(e,a)},analyzeCommits:async function(e,a){return u||(await w(e,a),u=!0),r(f,a)},fail:async function(e,a){await i(e,a)},generateNotes:async function(e,a){return u||(await w(e,a),u=!0),m({},a)},prepare:async function(r,n){u||(await w(r,n),u=!0);const{nextRelease:o}=n;if(!o.version)throw new Error("Next release version is not available.");const i=h(r,n);!function(a,t){const{nextRelease:r}=t,s=`v${r.version}`,n=y.replace("nextTag",s);e(`git archive --format=tar.gz --output=${n} HEAD`)}(0,n),function(e,r){const{nextRelease:s,options:n}=r,o=`v${s.version}`,i=n.repositoryUrl;if(!i)throw new Error("semantic-release repositoryUrl is required");const c=new URL(i).pathname,l=c.startsWith("/")?c.slice(1):c,p=y.replace("nextTag",o),m=`https://github.com/${l}/releases/download/${o}/${p}`,f=function(e,r){const{nextRelease:s}=r,n=`v${s.version}`,o=y.replace("nextTag",n),i=t.readFileSync(o),c=a.createHash("sha256");return c.update(i),c.digest("hex")}(0,r),u=h(e,r);let w=t.readFileSync(u,"utf8");w=w.replace(/url ".*"/,`url "${m}"`),w=w.replace(/sha256 ".*"/,`sha256 "${f}"`),t.writeFileSync(u,w)}(r,n),await s({assets:[i],message:"chore(release): ${nextRelease.version}"},n)},publish:async function(e,a){u||(await w(e,a),u=!0);const{nextRelease:t}=a,r=`v${t.version}`,s=y.replace("nextTag",r),n={...e,assets:[{label:`Homebrew Tarball (${r})`,path:s}]};return await c(n,a),null},success:async function(e,a){u||(await w(e,a),u=!0),await l(e,a)},verifyConditions:w};export{d as default};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/semantic-release/brew/index.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport crypto from 'crypto';\nimport fs from 'fs';\n\n//@ts-ignore\nimport { analyzeCommits as commitAnalyzerAnalyzeCommits } from '@semantic-release/commit-analyzer';\nimport {\n prepare as gitPrepare,\n verifyConditions as gitVerifyConditions,\n //@ts-ignore\n} from '@semantic-release/git';\nimport {\n addChannel as gitHubAddChanel,\n fail as gitHubFail,\n publish as gitHubPublish,\n success as gitHubSuccess,\n verifyConditions as gitHubVerifyConditions,\n //@ts-ignore\n} from '@semantic-release/github';\n//@ts-ignore\nimport { generateNotes as notesGeneratorGenerateNotes } from '@semantic-release/release-notes-generator';\nimport {\n AddChannelContext,\n AnalyzeCommitsContext,\n FailContext,\n GenerateNotesContext,\n PrepareContext,\n PublishContext,\n SuccessContext,\n VerifyConditionsContext,\n} from 'semantic-release';\n\nimport { SemanticReleasePlugin } from '../types.js';\n\nconst tarballFile = 'nextTag-stable.tar.gz';\n\nconst analyzerConfig = {\n preset: 'conventionalcommits',\n parserOpts: {\n headerPattern: /^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$/,\n headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],\n },\n releaseRules: [\n { type: 'feat', exclamation1: '!', release: 'major' },\n { type: 'feat', exclamation2: '!', release: 'major' },\n { type: 'feat', release: 'minor' },\n { type: 'fix', release: 'patch' },\n { type: 'docs', release: 'patch' },\n { type: 'style', release: 'patch' },\n { type: 'refactor', release: 'patch' },\n { type: 'perf', release: 'patch' },\n { type: 'test', release: 'patch' },\n { type: 'build', release: 'patch' },\n { type: 'ci', release: 'patch' },\n { type: 'chore', release: 'patch' },\n { type: 'revert', release: 'patch' },\n ],\n};\n\ntype PluginConfig = { tap?: string };\n\nlet verified = false;\n\nfunction getFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): string {\n const { options } = context;\n const repositoryUrl = options.repositoryUrl!;\n const url = new URL(repositoryUrl);\n const repositoryPath = url.pathname;\n const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;\n const project = repository.split('/').pop();\n\n return pluginConfig.tap ?? `${project}.rb`;\n}\n\nfunction generateTarball(_pluginConfig: PluginConfig, context: PrepareContext) {\n const { nextRelease } = context;\n\n const nextTag = `v${nextRelease.version}`;\n const tarFilePath = tarballFile.replace('nextTag', nextTag);\n\n execSync(`git archive --format=tar.gz --output=${tarFilePath} HEAD`);\n}\n\nfunction calculateSha256(_pluginConfig: PluginConfig, context: PrepareContext) {\n const { nextRelease } = context;\n\n const nextTag = `v${nextRelease.version}`;\n const tarFilePath = tarballFile.replace('nextTag', nextTag);\n\n const fileBuffer = fs.readFileSync(tarFilePath);\n const hash = crypto.createHash('sha256');\n hash.update(fileBuffer);\n\n return hash.digest('hex');\n}\n\nasync function updateFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): Promise<void> {\n const { nextRelease, options } = context;\n\n const nextTag = `v${nextRelease.version}`;\n\n const repositoryUrl = options.repositoryUrl!;\n const url = new URL(repositoryUrl);\n const repositoryPath = url.pathname;\n const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;\n const tarFilePath = tarballFile.replace('nextTag', nextTag);\n\n const tarUrl = `https://github.com/${repository}/releases/download/${nextTag}/${tarFilePath}`;\n //const tarUrl = `https://codeload.github.com/${repository}/tar.gz/refs/tags/${tarFilePath}`;\n\n const sha256 = calculateSha256(pluginConfig, context);\n const formulaFile = getFormulaFile(pluginConfig, context);\n\n let formulaContent = fs.readFileSync(formulaFile, 'utf8');\n formulaContent = formulaContent.replace(/url \".*\"/, `url \"${tarUrl}\"`);\n formulaContent = formulaContent.replace(/sha256 \".*\"/, `sha256 \"${sha256}\"`);\n fs.writeFileSync(formulaFile, formulaContent);\n}\n\nasync function addChannel(pluginConfig: PluginConfig, context: AddChannelContext): Promise<void> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n if (gitHubAddChanel) {\n await gitHubAddChanel(pluginConfig, context);\n }\n}\n\nasync function analyzeCommits(pluginConfig: PluginConfig, context: AnalyzeCommitsContext): Promise<string | false> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n return commitAnalyzerAnalyzeCommits(analyzerConfig, context);\n}\n\nasync function fail(pluginConfig: PluginConfig, context: FailContext): Promise<void> {\n if (gitHubFail) {\n await gitPrepare(pluginConfig, context);\n }\n}\n\nasync function generateNotes(pluginConfig: PluginConfig, context: GenerateNotesContext): Promise<string> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n return notesGeneratorGenerateNotes({}, context);\n}\n\nasync function prepare(pluginConfig: PluginConfig, context: PrepareContext): Promise<void> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n if (gitPrepare) {\n const { nextRelease } = context;\n if (!nextRelease?.version) {\n throw new Error('Next release version is not available.');\n }\n\n const formulaFile = getFormulaFile(pluginConfig, context);\n\n generateTarball(pluginConfig, context);\n\n await updateFormulaFile(pluginConfig, context);\n\n await gitPrepare(\n {\n assets: [formulaFile],\n message: 'chore(release): ${nextRelease.version}',\n },\n context,\n );\n }\n}\n\nasync function publish(pluginConfig: PluginConfig, context: PublishContext): Promise<unknown> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n if (gitHubPublish) {\n const { nextRelease } = context;\n const nextTag = `v${nextRelease.version}`;\n const tarFilePath = tarballFile.replace('nextTag', nextTag);\n\n const customPluginConfig = {\n ...pluginConfig,\n assets: [\n {\n path: tarFilePath,\n label: `Homebrew Tarball (${nextTag})`,\n },\n ],\n };\n await gitHubPublish(customPluginConfig, context);\n }\n //await updateFormulaFile(pluginConfig, context);\n\n //await commitFormulaFile(pluginConfig, context);\n\n return null;\n}\n\nasync function success(pluginConfig: PluginConfig, context: SuccessContext): Promise<void> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n if (gitHubSuccess) {\n await gitHubSuccess(pluginConfig, context);\n }\n}\n\nasync function verifyConditions(pluginConfig: PluginConfig, context: VerifyConditionsContext): Promise<void> {\n if (gitHubVerifyConditions) {\n await gitHubVerifyConditions(pluginConfig, context);\n }\n if (gitVerifyConditions) {\n await gitVerifyConditions(pluginConfig, context);\n }\n verified = true;\n}\n\nconst plugin: SemanticReleasePlugin<{ tap: string }> = {\n addChannel,\n verifyConditions,\n analyzeCommits,\n generateNotes,\n prepare,\n publish,\n success,\n fail,\n};\n\nexport default plugin;\n"],"names":["tarballFile","analyzerConfig","preset","parserOpts","headerPattern","RegExp","headerCorrespondence","releaseRules","type","exclamation1","release","exclamation2","verified","getFormulaFile","pluginConfig","context","options","repositoryUrl","repositoryPath","URL","pathname","project","startsWith","slice","split","pop","tap","async","updateFormulaFile","nextRelease","nextTag","version","tarUrl","replace","sha256","_pluginConfig","tarFilePath","fileBuffer","fs","readFileSync","hash","crypto","createHash","update","digest","calculateSha256","formulaFile","formulaContent","writeFileSync","verifyConditions","gitHubVerifyConditions","gitVerifyConditions","plugin","addChannel","gitHubAddChanel","analyzeCommits","commitAnalyzerAnalyzeCommits","generateNotes","notesGeneratorGenerateNotes","prepare","gitPrepare","Error","execSync","generateTarball","assets","message","publish","gitHubPublish","customPluginConfig","path","label","success","gitHubSuccess","fail","gitHubFail"],"mappings":"oZAkCA,MAAMA,EAAc,wBAEdC,EAAiB,CACrBC,OAAQ,sBACRC,WAAY,CACVC,cAAeC,OAAA,mGACfC,qBAAsB,CAAC,OAAQ,eAAgB,QAAS,eAAgB,YAE1EC,aAAc,CACZ,CAAEC,KAAM,OAAQC,aAAc,IAAKC,QAAS,SAC5C,CAAEF,KAAM,OAAQG,aAAc,IAAKD,QAAS,SAC5C,CAAEF,KAAM,OAAQE,QAAS,SACzB,CAAEF,KAAM,MAAOE,QAAS,SACxB,CAAEF,KAAM,OAAQE,QAAS,SACzB,CAAEF,KAAM,QAASE,QAAS,SAC1B,CAAEF,KAAM,WAAYE,QAAS,SAC7B,CAAEF,KAAM,OAAQE,QAAS,SACzB,CAAEF,KAAM,OAAQE,QAAS,SACzB,CAAEF,KAAM,QAASE,QAAS,SAC1B,CAAEF,KAAM,KAAME,QAAS,SACvB,CAAEF,KAAM,QAASE,QAAS,SAC1B,CAAEF,KAAM,SAAUE,QAAS,WAM/B,IAAIE,GAAW,EAEf,SAASC,EAAeC,EAA4BC,GAClD,MAAMC,QAAEA,GAAYD,EACdE,EAAgBD,EAAQC,cAExBC,EADM,IAAIC,IAAIF,GACOG,SAErBC,GADaH,EAAeI,WAAW,KAAOJ,EAAeK,MAAM,GAAKL,GACnDM,MAAM,KAAKC,MAEtC,OAAOX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8C,EAA4B,CAAI3C,EAAAA,EACzC,EAqFE4C,QAnFFhC,eAAuBb,EAA4BC,GAMjD,GALKH,UACGqC,EAAiBnC,EAAcC,GACrCH,GAAW,GAGTgD,EAAY,CACd,MAAM/B,YAAEA,GAAgBd,EACxB,IAAKc,GAAaE,QAChB,MAAM,IAAI8B,MAAM,0CAGlB,MAAMf,EAAcjC,EAAeC,EAAcC,IA5FrD,SAAyBoB,EAA6BpB,GACpD,MAAMc,YAAEA,GAAgBd,EAElBe,EAAU,IAAID,EAAYE,UAC1BK,EAAcpC,EAAYiC,QAAQ,UAAWH,GAEnDgC,EAAS,wCAAwC1B,SACnD,CAuFI2B,CAAgBjD,EAAcC,SAExBa,EAAkBd,EAAcC,SAEhC6C,EACJ,CACEI,OAAQ,CAAClB,GACTmB,QAAS,0CAEXlD,EAEJ,CACF,EA0DEmD,QAxDFvC,eAAuBb,EAA4BC,GAMjD,GALKH,UACGqC,EAAiBnC,EAAcC,GACrCH,GAAW,GAGTuD,EAAe,CACjB,MAAMtC,YAAEA,GAAgBd,EAClBe,EAAU,IAAID,EAAYE,UAC1BK,EAAcpC,EAAYiC,QAAQ,UAAWH,GAE7CsC,EAAqB,IACtBtD,EACHkD,OAAQ,CACN,CACEK,KAAMjC,EACNkC,MAAO,qBAAqBxC,cAI5BqC,EAAcC,EAAoBrD,EAC1C,CAKA,OAAO,IACT,EA8BEwD,QA5BF5C,eAAuBb,EAA4BC,GAC5CH,UACGqC,EAAiBnC,EAAcC,GACrCH,GAAW,GAGT4D,SACIA,EAAc1D,EAAcC,EAEtC,EAoBE0D,KArGF9C,eAAoBb,EAA4BC,GAC1C2D,SACId,EAAW9C,EAAcC,EAEnC"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/semantic-release/brew/index.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport crypto from 'crypto';\nimport fs from 'fs';\n\nimport {\n AddChannelContext,\n AnalyzeCommitsContext,\n FailContext,\n GenerateNotesContext,\n PrepareContext,\n PublishContext,\n SuccessContext,\n VerifyConditionsContext,\n} from 'semantic-release';\nimport { analyzeCommits as commitAnalyzerAnalyzeCommits } from '@semantic-release/commit-analyzer';\nimport { prepare as gitPrepare, verifyConditions as gitVerifyConditions } from '@semantic-release/git';\nimport {\n addChannel as gitHubAddChanel,\n fail as gitHubFail,\n publish as gitHubPublish,\n success as gitHubSuccess,\n verifyConditions as gitHubVerifyConditions,\n} from '@semantic-release/github';\nimport { generateNotes as notesGeneratorGenerateNotes } from '@semantic-release/release-notes-generator';\n\nimport { SemanticReleasePlugin } from '../types.js';\n\nconst tarballFile = 'nextTag-stable.tar.gz';\n\nconst analyzerConfig = {\n parserOpts: {\n headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],\n headerPattern: /^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$/,\n },\n preset: 'conventionalcommits',\n releaseRules: [\n { exclamation1: '!', release: 'major', type: 'feat' },\n { exclamation2: '!', release: 'major', type: 'feat' },\n { release: 'minor', type: 'feat' },\n { release: 'patch', type: 'fix' },\n { release: 'patch', type: 'docs' },\n { release: 'patch', type: 'style' },\n { release: 'patch', type: 'refactor' },\n { release: 'patch', type: 'perf' },\n { release: 'patch', type: 'test' },\n { release: 'patch', type: 'build' },\n { release: 'patch', type: 'ci' },\n { release: 'patch', type: 'chore' },\n { release: 'patch', type: 'revert' },\n ],\n};\n\ntype PluginConfig = {\n tap?: string;\n};\n\nlet verified = false;\n\nasync function addChannel(pluginConfig: PluginConfig, context: AddChannelContext): Promise<void> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n await gitHubAddChanel(pluginConfig, context);\n}\n\nasync function analyzeCommits(pluginConfig: PluginConfig, context: AnalyzeCommitsContext): Promise<string | false> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n return commitAnalyzerAnalyzeCommits(analyzerConfig, context);\n}\n\nfunction calculateSha256(_pluginConfig: PluginConfig, context: PrepareContext) {\n const { nextRelease } = context;\n\n const nextTag = `v${nextRelease.version}`;\n const tarFilePath = tarballFile.replace('nextTag', nextTag);\n\n const fileBuffer = fs.readFileSync(tarFilePath);\n const hash = crypto.createHash('sha256');\n hash.update(fileBuffer);\n\n return hash.digest('hex');\n}\n\nasync function fail(pluginConfig: PluginConfig, context: FailContext): Promise<void> {\n await gitHubFail(pluginConfig, context);\n}\n\nasync function generateNotes(pluginConfig: PluginConfig, context: GenerateNotesContext): Promise<string> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n return notesGeneratorGenerateNotes({}, context);\n}\n\nfunction generateTarball(_pluginConfig: PluginConfig, context: PrepareContext) {\n const { nextRelease } = context;\n\n const nextTag = `v${nextRelease.version}`;\n const tarFilePath = tarballFile.replace('nextTag', nextTag);\n\n execSync(`git archive --format=tar.gz --output=${tarFilePath} HEAD`);\n}\n\nfunction getFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): string {\n const { options } = context;\n const repositoryUrl = options.repositoryUrl;\n if (!repositoryUrl) {\n throw new Error('semantic-release repositoryUrl is required');\n }\n const url = new URL(repositoryUrl);\n const repositoryPath = url.pathname;\n const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;\n const project = repository.split('/').pop();\n\n return pluginConfig.tap ?? `${project}.rb`;\n}\n\nasync function prepare(pluginConfig: PluginConfig, context: PrepareContext): Promise<void> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n const { nextRelease } = context;\n if (!nextRelease.version) {\n throw new Error('Next release version is not available.');\n }\n\n const formulaFile = getFormulaFile(pluginConfig, context);\n\n generateTarball(pluginConfig, context);\n updateFormulaFile(pluginConfig, context);\n\n await gitPrepare(\n {\n assets: [formulaFile],\n message: 'chore(release): ${nextRelease.version}',\n },\n context,\n );\n}\n\nasync function publish(pluginConfig: PluginConfig, context: PublishContext): Promise<unknown> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n const { nextRelease } = context;\n const nextTag = `v${nextRelease.version}`;\n const tarFilePath = tarballFile.replace('nextTag', nextTag);\n\n const customPluginConfig = {\n ...pluginConfig,\n assets: [\n {\n label: `Homebrew Tarball (${nextTag})`,\n path: tarFilePath,\n },\n ],\n };\n await gitHubPublish(customPluginConfig, context);\n\n //await updateFormulaFile(pluginConfig, context);\n //await commitFormulaFile(pluginConfig, context);\n\n return null;\n}\n\nasync function success(pluginConfig: PluginConfig, context: SuccessContext): Promise<void> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n await gitHubSuccess(pluginConfig, context);\n}\n\nfunction updateFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): void {\n const { nextRelease, options } = context;\n\n const nextTag = `v${nextRelease.version}`;\n\n const repositoryUrl = options.repositoryUrl;\n if (!repositoryUrl) {\n throw new Error('semantic-release repositoryUrl is required');\n }\n const url = new URL(repositoryUrl);\n const repositoryPath = url.pathname;\n const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;\n const tarFilePath = tarballFile.replace('nextTag', nextTag);\n\n const tarUrl = `https://github.com/${repository}/releases/download/${nextTag}/${tarFilePath}`;\n //const tarUrl = `https://codeload.github.com/${repository}/tar.gz/refs/tags/${tarFilePath}`;\n\n const sha256 = calculateSha256(pluginConfig, context);\n const formulaFile = getFormulaFile(pluginConfig, context);\n\n let formulaContent = fs.readFileSync(formulaFile, 'utf8');\n formulaContent = formulaContent.replace(/url \".*\"/, `url \"${tarUrl}\"`);\n formulaContent = formulaContent.replace(/sha256 \".*\"/, `sha256 \"${sha256}\"`);\n fs.writeFileSync(formulaFile, formulaContent);\n}\n\nasync function verifyConditions(pluginConfig: PluginConfig, context: VerifyConditionsContext): Promise<void> {\n await gitHubVerifyConditions(pluginConfig, context);\n await gitVerifyConditions(pluginConfig, context);\n verified = true;\n}\n\nconst plugin: SemanticReleasePlugin<{ tap: string }> = {\n addChannel,\n analyzeCommits,\n fail,\n generateNotes,\n prepare,\n publish,\n success,\n verifyConditions,\n};\n\nexport default plugin;\n"],"names":["tarballFile","analyzerConfig","parserOpts","headerCorrespondence","headerPattern","preset","releaseRules","exclamation1","release","type","exclamation2","verified","getFormulaFile","pluginConfig","context","options","repositoryUrl","Error","repositoryPath","URL","pathname","project","startsWith","slice","split","pop","tap","async","verifyConditions","gitHubVerifyConditions","gitVerifyConditions","plugin","addChannel","gitHubAddChanel","analyzeCommits","commitAnalyzerAnalyzeCommits","fail","gitHubFail","generateNotes","notesGeneratorGenerateNotes","prepare","nextRelease","version","formulaFile","_pluginConfig","nextTag","tarFilePath","replace","execSync","generateTarball","repository","tarUrl","sha256","fileBuffer","fs","readFileSync","hash","crypto","createHash","update","digest","calculateSha256","formulaContent","writeFileSync","updateFormulaFile","gitPrepare","assets","message","publish","customPluginConfig","label","path","gitHubPublish","success","gitHubSuccess"],"mappings":"oZA2BA,MAAMA,EAAc,wBAEdC,EAAiB,CACrBC,WAAY,CACVC,qBAAsB,CAAC,OAAQ,eAAgB,QAAS,eAAgB,WACxEC,cAAe,gGAEjBC,OAAQ,sBACRC,aAAc,CACZ,CAAEC,aAAc,IAAKC,QAAS,QAASC,KAAM,QAC7C,CAAEC,aAAc,IAAKF,QAAS,QAASC,KAAM,QAC7C,CAAED,QAAS,QAASC,KAAM,QAC1B,CAAED,QAAS,QAASC,KAAM,OAC1B,CAAED,QAAS,QAASC,KAAM,QAC1B,CAAED,QAAS,QAASC,KAAM,SAC1B,CAAED,QAAS,QAASC,KAAM,YAC1B,CAAED,QAAS,QAASC,KAAM,QAC1B,CAAED,QAAS,QAASC,KAAM,QAC1B,CAAED,QAAS,QAASC,KAAM,SAC1B,CAAED,QAAS,QAASC,KAAM,MAC1B,CAAED,QAAS,QAASC,KAAM,SAC1B,CAAED,QAAS,QAASC,KAAM,YAQ9B,IAAIE,GAAW,EAuDf,SAASC,EAAeC,EAA4BC,GAClD,MAAMC,Q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C,EACpC,EA0CEc"}
@@ -1,2 +1,2 @@
1
- import{analyzeCommits as e}from"@semantic-release/commit-analyzer";import{prepare as a,verifyConditions as t}from"@semantic-release/git";import{publish as s,prepare as r,verifyConditions as p,addChannel as c}from"@semantic-release/npm";import{generateNotes as o}from"@semantic-release/release-notes-generator";const n={preset:"conventionalcommits",parserOpts:{headerPattern:RegExp("^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$"),headerCorrespondence:["type","exclamation1","scope","exclamation2","subject"]},releaseRules:[{type:"feat",exclamation1:"!",release:"major"},{type:"feat",exclamation2:"!",release:"major"},{type:"feat",release:"minor"},{type:"fix",release:"patch"},{type:"docs",release:"patch"},{type:"style",release:"patch"},{type:"refactor",release:"patch"},{type:"perf",release:"patch"},{type:"test",release:"patch"},{type:"build",release:"patch"},{type:"ci",release:"patch"},{type:"chore",release:"patch"},{type:"revert",release:"patch"}]},l={tag:"latest",npmPublish:!0,optional:!1},i={assets:["package.json","package-lock.json"],message:"chore(release): ${nextRelease.version}"},m={addChannel:async(e,a)=>{c&&await c(l,a)},verifyConditions:async(e,a)=>{p&&await p(l,a),t&&await t(i,a)},analyzeCommits:async(a,t)=>e(n,t),generateNotes:async(e,a)=>o({},a),prepare:async(e,t)=>{r&&await r(l,t),a&&await a(i,t)},publish:async(e,a)=>{s&&await s(l,a)},success:async(e,a)=>{},fail:async(e,a)=>{}};export{m as default};
1
+ import{analyzeCommits as e}from"@semantic-release/commit-analyzer";import{verifyConditions as a,prepare as t}from"@semantic-release/git";import{verifyConditions as s,publish as r,prepare as c}from"@semantic-release/npm";import{generateNotes as p}from"@semantic-release/release-notes-generator";const n={parserOpts:{headerCorrespondence:["type","exclamation1","scope","exclamation2","subject"],headerPattern:/^(?<type>\w+)(?<exclamation1>!?)(?:\((?<scope>[^)]+)\)(?<exclamation2>!?))?: (?<subject>.+)$/},preset:"conventionalcommits",releaseRules:[{exclamation1:"!",release:"major",type:"feat"},{exclamation2:"!",release:"major",type:"feat"},{release:"minor",type:"feat"},{release:"patch",type:"fix"},{release:"patch",type:"docs"},{release:"patch",type:"style"},{release:"patch",type:"refactor"},{release:"patch",type:"perf"},{release:"patch",type:"test"},{release:"patch",type:"build"},{release:"patch",type:"ci"},{release:"patch",type:"chore"},{release:"patch",type:"revert"}]},o={npmPublish:!0},l={assets:["package.json","package-lock.json"],message:"chore(release): ${nextRelease.version}"},i={addChannel:async(e,a)=>{},analyzeCommits:async(a,t)=>e(n,t),fail:async(e,a)=>{},generateNotes:async(e,a)=>p({},a),prepare:async(e,a)=>{await c(o,a),await t(l,a)},publish:async(e,a)=>{await r(o,a)},success:async(e,a)=>{},verifyConditions:async(e,t)=>{await s(o,t),await a(l,t)}};export{i as default};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/semantic-release/npm/index.ts"],"sourcesContent":["//@ts-ignore\nimport { analyzeCommits } from '@semantic-release/commit-analyzer';\nimport {\n prepare as gitPrepare,\n verifyConditions as gitVerifyConditions,\n //@ts-ignore\n} from '@semantic-release/git';\nimport {\n addChannel as npmAddChannel,\n prepare as npmPrepare,\n publish as npmPublish,\n verifyConditions as npmVerifyConditions,\n //@ts-ignore\n} from '@semantic-release/npm';\n//@ts-ignore\nimport { generateNotes } from '@semantic-release/release-notes-generator';\n\nimport { SemanticReleasePlugin } from '../types.js';\n\nconst analyzerConfig = {\n preset: 'conventionalcommits',\n parserOpts: {\n headerPattern: /^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$/,\n headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],\n },\n releaseRules: [\n { type: 'feat', exclamation1: '!', release: 'major' },\n { type: 'feat', exclamation2: '!', release: 'major' },\n { type: 'feat', release: 'minor' },\n { type: 'fix', release: 'patch' },\n { type: 'docs', release: 'patch' },\n { type: 'style', release: 'patch' },\n { type: 'refactor', release: 'patch' },\n { type: 'perf', release: 'patch' },\n { type: 'test', release: 'patch' },\n { type: 'build', release: 'patch' },\n { type: 'ci', release: 'patch' },\n { type: 'chore', release: 'patch' },\n { type: 'revert', release: 'patch' },\n ],\n};\n\nconst npmConfig = {\n tag: 'latest',\n npmPublish: true,\n optional: false,\n};\n\nconst gitConfig = {\n assets: ['package.json', 'package-lock.json'],\n message: 'chore(release): ${nextRelease.version}',\n};\n\nconst plugin: SemanticReleasePlugin = {\n addChannel: async (_pluginConfig, context) => {\n if (npmAddChannel) {\n await npmAddChannel(npmConfig, context);\n }\n },\n verifyConditions: async (_pluginConfig, context) => {\n if (npmVerifyConditions) {\n await npmVerifyConditions(npmConfig, context);\n }\n if (gitVerifyConditions) {\n await gitVerifyConditions(gitConfig, context);\n }\n },\n\n analyzeCommits: async (_pluginConfig, context) => {\n return analyzeCommits(analyzerConfig, context);\n },\n\n generateNotes: async (_pluginConfig, context) => {\n return generateNotes({}, context);\n },\n\n prepare: async (_pluginConfig, context) => {\n if (npmPrepare) {\n await npmPrepare(npmConfig, context);\n }\n if (gitPrepare) {\n await gitPrepare(gitConfig, context);\n }\n },\n\n publish: async (_pluginConfig, context) => {\n if (npmPublish) {\n await npmPublish(npmConfig, context);\n }\n /*if (gitPublish) {\n await gitPublish(gitConfig, context);\n }*/\n },\n\n success: async (_pluginConfig, _context) => {\n /*if (gitSuccess) {\n await gitSuccess(gitConfig, context);\n }*/\n },\n\n fail: async (_pluginConfig, _context) => {\n /*if (gitFail) {\n await gitFail(gitConfig, context);\n }*/\n },\n};\n\nexport default plugin;\n"],"names":["analyzerConfig","preset","parserOpts","headerPattern","RegExp","headerCorrespondence","releaseRules","type","exclamation1","release","exclamation2","npmConfig","tag","npmPublish","optional","gitConfig","assets","message","plugin","addChannel","async","_pluginConfig","context","npmAddChannel","verifyConditions","npmVerifyConditions","gitVerifyConditions","analyzeCommits","generateNotes","prepare","npmPrepare","gitPrepare","publish","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d"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/semantic-release/npm/index.ts"],"sourcesContent":["import { analyzeCommits } from '@semantic-release/commit-analyzer';\nimport { prepare as gitPrepare, verifyConditions as gitVerifyConditions } from '@semantic-release/git';\nimport {\n prepare as npmPrepare,\n publish as npmPublish,\n verifyConditions as npmVerifyConditions,\n} from '@semantic-release/npm';\nimport { generateNotes } from '@semantic-release/release-notes-generator';\n\nimport { SemanticReleasePlugin } from '../types.js';\n\nconst analyzerConfig = {\n parserOpts: {\n headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],\n headerPattern: /^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$/,\n },\n preset: 'conventionalcommits',\n releaseRules: [\n { exclamation1: '!', release: 'major', type: 'feat' },\n { exclamation2: '!', release: 'major', type: 'feat' },\n { release: 'minor', type: 'feat' },\n { release: 'patch', type: 'fix' },\n { release: 'patch', type: 'docs' },\n { release: 'patch', type: 'style' },\n { release: 'patch', type: 'refactor' },\n { release: 'patch', type: 'perf' },\n { release: 'patch', type: 'test' },\n { release: 'patch', type: 'build' },\n { release: 'patch', type: 'ci' },\n { release: 'patch', type: 'chore' },\n { release: 'patch', type: 'revert' },\n ],\n};\n\nconst npmConfig = {\n npmPublish: true,\n};\n\nconst gitConfig = {\n assets: ['package.json', 'package-lock.json'],\n message: 'chore(release): ${nextRelease.version}',\n};\n\nconst plugin: SemanticReleasePlugin = {\n addChannel: async (_pluginConfig, _context) => {\n //await npmAddChannel(npmConfig, context);\n },\n analyzeCommits: async (_pluginConfig, context) => {\n return analyzeCommits(analyzerConfig, context);\n },\n\n fail: async (_pluginConfig, _context) => {\n //await gitFail(gitConfig, context);\n },\n\n generateNotes: async (_pluginConfig, context) => {\n return generateNotes({}, context);\n },\n\n prepare: async (_pluginConfig, context) => {\n await npmPrepare(npmConfig, context);\n await gitPrepare(gitConfig, context);\n },\n\n publish: async (_pluginConfig, context) => {\n await npmPublish(npmConfig, context);\n //await gitPublish(gitConfig, context);\n },\n\n success: async (_pluginConfig, _context) => {\n //await gitSuccess(gitConfig, context);\n },\n\n verifyConditions: async (_pluginConfig, context) => {\n await npmVerifyConditions(npmConfig, context);\n await gitVerifyConditions(gitConfig, context);\n },\n};\n\nexport default plugin;\n"],"names":["analyzerConfig","parserOpts","headerCorrespondence","headerPattern","preset","releaseRules","exclamation1","release","type","exclamation2","npmConfig","npmPublish","gitConfig","assets","message","plugin","addChannel","async","_pluginConfig","_context","analyzeCommits","context","fail","generateNotes","prepare","npmPrepare","gitPrepare","publish","success","verifyConditions","npmVerifyConditions","gitVerifyConditions"],"mappings":"sSAWA,MAAMA,EAAiB,CACrBC,WAAY,CACVC,qBAAsB,CAAC,OAAQ,eAAgB,QAAS,eAAgB,WACxEC,cAAe,gGAEjBC,OAAQ,sBACRC,aAAc,CACZ,CAAEC,aAAc,IAAKC,QAAS,QAASC,KAAM,QAC7C,CAAEC,aAAc,IAAKF,QAAS,QAASC,KAAM,QAC7C,CAAED,QAAS,QAASC,KAAM,QAC1B,CAAED,QAAS,QAASC,KAAM,OAC1B,CAAED,QAAS,QAASC,KAAM,QAC1B,CAAED,QAAS,QAASC,KAAM,SAC1B,CAAED,QAAS,QAASC,KAAM,YAC1B,CAAED,QAAS,QAASC,KAAM,QAC1B,CAAED,QAAS,QAASC,KAAM,QAC1B,CAAED,QAAS,QAASC,KAAM,SAC1B,CAAED,QAAS,QAASC,KAAM,MAC1B,CAAED,QAAS,QAASC,KAAM,SAC1B,CAAED,QAAS,QAASC,KAAM,YAIxBE,EAAY,CAChBC,YAAY,GAGRC,EAAY,CAChBC,OAAQ,CAAC,eAAgB,qBACzBC,QAAS,0CAGLC,EAAgC,CACpCC,WAAYC,MAAOC,EAAeC,OAGlCC,eAAgBH,MAAOC,EAAeG,IAC7BD,EAAepB,EAAgBqB,GAGxCC,KAAML,MAAOC,EAAeC,OAI5BI,cAAeN,MAAOC,EAAeG,IAC5BE,EAAc,CAAA,EAAIF,GAG3BG,QAASP,MAAOC,EAAeG,WACvBI,EAAWf,EAAWW,SACtBK,EAAWd,EAAWS,IAG9BM,QAASV,MAAOC,EAAeG,WACvBV,EAAWD,EAAWW,IAI9BO,QAASX,MAAOC,EAAeC,OAI/BU,iBAAkBZ,MAAOC,EAAeG,WAChCS,EAAoBpB,EAAWW,SAC/BU,EAAoBnB,EAAWS"}
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@tarsilla/commit-wizard",
3
- "version": "1.4.9",
3
+ "version": "2.0.3",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/tarsilla-app/commit-wizard"
7
+ },
4
8
  "publishConfig": {
5
9
  "access": "public"
6
10
  },
7
11
  "engines": {
8
- "node": ">=22"
12
+ "node": ">=25"
9
13
  },
10
14
  "exports": {
11
15
  "./commitizen": {
@@ -49,40 +53,46 @@
49
53
  "prepare": "husky"
50
54
  },
51
55
  "peerDependencies": {
52
- "@commitlint/cli": "^19",
53
- "@commitlint/config-conventional": "^19",
54
- "@semantic-release/commit-analyzer": "^13",
55
- "@semantic-release/git": "^10",
56
- "@semantic-release/npm": "^12",
57
- "@semantic-release/release-notes-generator": "^14",
56
+ "@commitlint/cli": "^20",
58
57
  "commitizen": "^4",
59
- "semantic-release": "^24"
58
+ "semantic-release": "^25"
60
59
  },
61
60
  "dependencies": {
62
- "@octokit/rest": "^21.1.1",
63
- "@semantic-release/github": "^11.0.1",
64
- "chokidar": "^4.0.3",
65
- "inquirer": "^8.2.6"
61
+ "@commitlint/config-conventional": "^20.5.0",
62
+ "@octokit/rest": "^22.0.1",
63
+ "@semantic-release/commit-analyzer": "^13.0.1",
64
+ "@semantic-release/git": "^10.0.1",
65
+ "@semantic-release/github": "^12.0.6",
66
+ "@semantic-release/npm": "^13.1.5",
67
+ "@semantic-release/release-notes-generator": "^14.1.0",
68
+ "chokidar": "^5.0.0"
66
69
  },
67
70
  "devDependencies": {
68
- "@eslint/js": "^9.23.0",
69
- "@rollup/plugin-commonjs": "^28.0.3",
70
- "@rollup/plugin-node-resolve": "^16.0.1",
71
+ "@eslint/js": "^10.0.1",
72
+ "@rollup/plugin-commonjs": "^29.0.2",
73
+ "@rollup/plugin-node-resolve": "^16.0.3",
71
74
  "@rollup/plugin-swc": "^0.4.0",
72
- "@rollup/plugin-terser": "^0.4.4",
73
- "@types/inquirer": "^8.2.10",
74
- "eslint": "^9.23.0",
75
- "eslint-config-prettier": "^10.1.1",
76
- "eslint-import-resolver-typescript": "^4.3.1",
77
- "eslint-plugin-import": "^2.31.0",
78
- "eslint-plugin-prettier": "^5.2.5",
79
- "eslint-plugin-unused-imports": "^4.1.4",
75
+ "@rollup/plugin-terser": "^1.0.0",
76
+ "@types/inquirer": "^9.0.9",
77
+ "eslint": "^10.2.0",
78
+ "eslint-config-prettier": "^10.1.8",
79
+ "eslint-import-resolver-typescript": "^4.4.4",
80
+ "eslint-plugin-perfectionist": "^5.8.0",
81
+ "eslint-plugin-prettier": "^5.5.5",
82
+ "eslint-plugin-unused-imports": "^4.4.1",
83
+ "globals": "^17.4.0",
80
84
  "husky": "^9.1.7",
81
- "prettier": "^3.5.3",
82
- "rollup": "^4.38.0",
83
- "rollup-plugin-dts": "^6.2.1",
85
+ "prettier": "^3.8.2",
86
+ "rollup": "^4.60.1",
87
+ "rollup-plugin-dts": "^6.4.1",
84
88
  "rollup-plugin-peer-deps-external": "^2.2.4",
85
- "typescript": "^5.8.2",
86
- "typescript-eslint": "^8.29.0"
89
+ "typescript": "^5.9.3",
90
+ "typescript-eslint": "^8.58.1"
91
+ },
92
+ "overrides": {
93
+ "commitizen": {
94
+ "inquirer": "^8.2.7",
95
+ "lodash": "^4.18.1"
96
+ }
87
97
  }
88
98
  }
@@ -1,5 +1,5 @@
1
- import commitizenPrompter from './prompter.js';
2
1
  import configLoader from '../config-loader/configLoader.js';
2
+ import commitizenPrompter from './prompter.js';
3
3
  import CommitWizardOptions from '../types/CommitWizardOptions.js';
4
4
 
5
5
  const loadedConfig: CommitWizardOptions = configLoader();
@@ -1,15 +1,15 @@
1
- import { Commitizen, Prompter, Question } from 'commitizen';
1
+ import { Commitizen, Prompter } from 'commitizen';
2
2
 
3
3
  import CommitWizardOptions from '../types/CommitWizardOptions.js';
4
4
 
5
5
  export type CommitAnswers = {
6
- type: string;
6
+ confirmCommit: string;
7
7
  scope: string;
8
8
  subject: string;
9
- confirmCommit: string;
9
+ type: string;
10
10
  };
11
11
 
12
- function getCommitMessage({ answers }: { answers: CommitAnswers }) {
12
+ function getCommitMessage({ answers }: { answers: Partial<CommitAnswers> }) {
13
13
  const scopeText = answers.scope ? `(${answers.scope})` : '';
14
14
  if (answers.type === 'break') {
15
15
  const message = `feat${scopeText}!: ${answers.subject}`;
@@ -19,7 +19,7 @@ function getCommitMessage({ answers }: { answers: CommitAnswers }) {
19
19
  return message;
20
20
  }
21
21
 
22
- function getMaxSubject({ answers, maxLineLength }: { answers: CommitAnswers; maxLineLength: number }) {
22
+ function getMaxSubject({ answers, maxLineLength }: { answers: Partial<CommitAnswers>; maxLineLength: number }) {
23
23
  const scopeText = answers.scope ? `(${answers.scope})` : '';
24
24
  // +2 accounts for ": " after type and scope.
25
25
  const prefixLength = (answers.type ? answers.type.length : 0) + scopeText.length + 2;
@@ -30,82 +30,82 @@ function getMaxSubject({ answers, maxLineLength }: { answers: CommitAnswers; max
30
30
  function prompter({ maxLineLength }: CommitWizardOptions): Prompter {
31
31
  return {
32
32
  prompter: function (cz: Commitizen, commit: (message: string) => void) {
33
- const questions: Question<CommitAnswers> = [
33
+ const questions = [
34
34
  {
35
- type: 'list',
36
- name: 'type',
37
- message: "Select the type of change that you're committing:",
38
35
  choices: [
39
- { value: 'feat', name: '🚀 feat: A new feature' },
40
- { value: 'fix', name: '🐛 fix: A bug fix' },
41
- { value: 'docs', name: '📚 docs: Documentation only changes' },
36
+ { name: '🚀 feat: A new feature', value: 'feat' },
37
+ { name: '🐛 fix: A bug fix', value: 'fix' },
38
+ { name: '📚 docs: Documentation only changes', value: 'docs' },
42
39
  {
43
- value: 'style',
44
40
  name: '🎨 style: Changes that do not affect the meaning of the code (white-space, formatting, etc)',
41
+ value: 'style',
45
42
  },
46
- { value: 'refactor', name: '🔨 refactor: A code change that neither fixes a bug nor adds a feature' },
47
- { value: 'perf', name: '⚡️ perf: A code change that improves performance' },
48
- { value: 'test', name: '🔍 test: Adding missing tests or correcting existing tests' },
49
- { value: 'build', name: '📦 build: Changes that affect the build system or external dependencies' },
50
- { value: 'ci', name: '🤖 ci: Changes to our CI configuration files and scripts' },
51
- { value: 'chore', name: "🧹 chore: Other changes that don't modify src or test files" },
52
- { value: 'break', name: '💥 break: A change that breaks existing functionality' },
53
- { value: 'revert', name: '⏪ revert: Reverts a previous commit' },
43
+ { name: '🔨 refactor: A code change that neither fixes a bug nor adds a feature', value: 'refactor' },
44
+ { name: '⚡️ perf: A code change that improves performance', value: 'perf' },
45
+ { name: '🔍 test: Adding missing tests or correcting existing tests', value: 'test' },
46
+ { name: '📦 build: Changes that affect the build system or external dependencies', value: 'build' },
47
+ { name: '🤖 ci: Changes to our CI configuration files and scripts', value: 'ci' },
48
+ { name: "🧹 chore: Other changes that don't modify src or test files", value: 'chore' },
49
+ { name: '💥 break: A change that breaks existing functionality', value: 'break' },
50
+ { name: '⏪ revert: Reverts a previous commit', value: 'revert' },
54
51
  ],
52
+ message: "Select the type of change that you're committing:",
53
+ name: 'type',
54
+ type: 'list',
55
55
  },
56
56
  {
57
- type: 'input',
58
- name: 'scope',
59
57
  message: 'What is the scope of this change (e.g. component or file name): (press enter to skip)',
58
+ name: 'scope',
59
+ type: 'input',
60
60
  },
61
61
  {
62
- type: 'input',
63
- name: 'subject',
64
- message: (answers) => {
62
+ message: (answers: Partial<CommitAnswers>) => {
65
63
  const maxSubject = getMaxSubject({ answers, maxLineLength });
66
64
  return `Write a short, imperative tense description of the change (max ${maxSubject} chars):`;
67
65
  },
68
- validate: (input, answers) => {
66
+ name: 'subject',
67
+ transformer: (input: string, answers: Partial<CommitAnswers>) => {
68
+ const maxSubject = getMaxSubject({ answers, maxLineLength });
69
+ const remaining = maxSubject - input.length;
70
+ if (remaining < 0) {
71
+ // Red if remaining < 0: \u001b[31m is red, \u001b[39m resets the color.
72
+ return `\n\u001b[31m(${input.length}) ${input}\u001b[39m`;
73
+ }
74
+ // Green if valid: \u001b[32m is green, \u001b[39m resets the color.
75
+ return `\n\u001b[32m(${input.length}) ${input}\u001b[39m`;
76
+ },
77
+ type: 'input',
78
+ validate: (input: string, answers: Partial<CommitAnswers>) => {
69
79
  if (!input.trim()) {
70
80
  // \u001b[31m is red
71
81
  return `\u001b[31mSubject is required\u001b[39m`;
72
82
  }
73
- const maxSubject = getMaxSubject({ answers: answers!, maxLineLength });
83
+ const maxSubject = getMaxSubject({ answers: answers, maxLineLength });
74
84
  if (input.length <= maxSubject) {
75
85
  return true;
76
86
  }
77
87
  // \u001b[31m is red
78
88
  return `\u001b[31mSubject length must be less than or equal to ${maxSubject} characters. Current length is ${input.length} characters.\u001b[39m`;
79
89
  },
80
- transformer: (input, answers) => {
81
- const maxSubject = getMaxSubject({ answers, maxLineLength });
82
- const remaining = maxSubject - input.length;
83
- if (remaining < 0) {
84
- // Red if remaining < 0: \u001b[31m is red, \u001b[39m resets the color.
85
- return `\n\u001b[31m(${input.length}) ${input}\u001b[39m`;
86
- }
87
- // Green if valid: \u001b[32m is green, \u001b[39m resets the color.
88
- return `\n\u001b[32m(${input.length}) ${input}\u001b[39m`;
89
- },
90
90
  },
91
91
  {
92
- type: 'list',
93
- name: 'confirmCommit',
94
92
  choices: [
95
- { value: 'yes', name: 'Yes' },
96
- { value: 'no', name: 'Abort commit' },
93
+ { name: 'Yes', value: 'yes' },
94
+ { name: 'Abort commit', value: 'no' },
97
95
  ],
98
96
  default: 0,
99
- message(answers) {
97
+ message(answers: Partial<CommitAnswers>) {
100
98
  const SEP = '--------------------------------------------------------';
101
99
  const message = getCommitMessage({ answers });
102
100
  console.info(`\n${SEP}\n\n${message}\n\n${SEP}\n`);
103
101
  return 'Are you sure you want to proceed with the commit above?';
104
102
  },
103
+ name: 'confirmCommit',
104
+ type: 'list',
105
105
  },
106
106
  ];
107
107
 
108
- cz.prompt(questions).then((answers) => {
108
+ void cz.prompt<Partial<CommitAnswers>>(questions).then((answers) => {
109
109
  if (answers.confirmCommit === 'no') {
110
110
  console.info('Commit aborted.');
111
111
  } else {
@@ -1,8 +1,8 @@
1
1
  import { UserConfig } from '@commitlint/types';
2
2
 
3
- import commitlintUserConfig from './userConfig.js';
4
3
  import configLoader from '../config-loader/configLoader.js';
5
4
  import CommitWizardOptions from '../types/CommitWizardOptions.js';
5
+ import commitlintUserConfig from './userConfig.js';
6
6
 
7
7
  const loadedConfig: CommitWizardOptions = configLoader();
8
8
  const userConfig: UserConfig = commitlintUserConfig(loadedConfig);
@@ -7,8 +7,8 @@ function userConfig({ maxLineLength }: CommitWizardOptions): UserConfig {
7
7
  extends: ['@commitlint/config-conventional'],
8
8
  parserPreset: {
9
9
  parserOpts: {
10
- headerPattern: /^(?<type>\w+)(?<exclamation1>!?)(?:\((?<scope>[^)]+)\)(?<exclamation2>!?))?: (?<subject>.+)$/,
11
10
  headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],
11
+ headerPattern: /^(?<type>\w+)(?<exclamation1>!?)(?:\((?<scope>[^)]+)\)(?<exclamation2>!?))?: (?<subject>.+)$/,
12
12
  },
13
13
  },
14
14
  rules: {
@@ -15,8 +15,14 @@ function configLoader(): CommitWizardOptions {
15
15
  return config;
16
16
  }
17
17
 
18
- const loadedConfig = require(configPath);
19
- return { ...config, ...loadedConfig };
18
+ const rawConfig = fs.readFileSync(configPath, 'utf8');
19
+ const parsedConfig: unknown = JSON.parse(rawConfig);
20
+
21
+ if (!parsedConfig || typeof parsedConfig !== 'object') {
22
+ return config;
23
+ }
24
+
25
+ return { ...config, ...parsedConfig };
20
26
  }
21
27
 
22
28
  export default configLoader;
@@ -2,23 +2,6 @@ import { execSync } from 'child_process';
2
2
  import crypto from 'crypto';
3
3
  import fs from 'fs';
4
4
 
5
- //@ts-ignore
6
- import { analyzeCommits as commitAnalyzerAnalyzeCommits } from '@semantic-release/commit-analyzer';
7
- import {
8
- prepare as gitPrepare,
9
- verifyConditions as gitVerifyConditions,
10
- //@ts-ignore
11
- } from '@semantic-release/git';
12
- import {
13
- addChannel as gitHubAddChanel,
14
- fail as gitHubFail,
15
- publish as gitHubPublish,
16
- success as gitHubSuccess,
17
- verifyConditions as gitHubVerifyConditions,
18
- //@ts-ignore
19
- } from '@semantic-release/github';
20
- //@ts-ignore
21
- import { generateNotes as notesGeneratorGenerateNotes } from '@semantic-release/release-notes-generator';
22
5
  import {
23
6
  AddChannelContext,
24
7
  AnalyzeCommitsContext,
@@ -29,56 +12,66 @@ import {
29
12
  SuccessContext,
30
13
  VerifyConditionsContext,
31
14
  } from 'semantic-release';
15
+ import { analyzeCommits as commitAnalyzerAnalyzeCommits } from '@semantic-release/commit-analyzer';
16
+ import { prepare as gitPrepare, verifyConditions as gitVerifyConditions } from '@semantic-release/git';
17
+ import {
18
+ addChannel as gitHubAddChanel,
19
+ fail as gitHubFail,
20
+ publish as gitHubPublish,
21
+ success as gitHubSuccess,
22
+ verifyConditions as gitHubVerifyConditions,
23
+ } from '@semantic-release/github';
24
+ import { generateNotes as notesGeneratorGenerateNotes } from '@semantic-release/release-notes-generator';
32
25
 
33
26
  import { SemanticReleasePlugin } from '../types.js';
34
27
 
35
28
  const tarballFile = 'nextTag-stable.tar.gz';
36
29
 
37
30
  const analyzerConfig = {
38
- preset: 'conventionalcommits',
39
31
  parserOpts: {
40
- headerPattern: /^(?<type>\w+)(?<exclamation1>!?)(?:\((?<scope>[^)]+)\)(?<exclamation2>!?))?: (?<subject>.+)$/,
41
32
  headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],
33
+ headerPattern: /^(?<type>\w+)(?<exclamation1>!?)(?:\((?<scope>[^)]+)\)(?<exclamation2>!?))?: (?<subject>.+)$/,
42
34
  },
35
+ preset: 'conventionalcommits',
43
36
  releaseRules: [
44
- { type: 'feat', exclamation1: '!', release: 'major' },
45
- { type: 'feat', exclamation2: '!', release: 'major' },
46
- { type: 'feat', release: 'minor' },
47
- { type: 'fix', release: 'patch' },
48
- { type: 'docs', release: 'patch' },
49
- { type: 'style', release: 'patch' },
50
- { type: 'refactor', release: 'patch' },
51
- { type: 'perf', release: 'patch' },
52
- { type: 'test', release: 'patch' },
53
- { type: 'build', release: 'patch' },
54
- { type: 'ci', release: 'patch' },
55
- { type: 'chore', release: 'patch' },
56
- { type: 'revert', release: 'patch' },
37
+ { exclamation1: '!', release: 'major', type: 'feat' },
38
+ { exclamation2: '!', release: 'major', type: 'feat' },
39
+ { release: 'minor', type: 'feat' },
40
+ { release: 'patch', type: 'fix' },
41
+ { release: 'patch', type: 'docs' },
42
+ { release: 'patch', type: 'style' },
43
+ { release: 'patch', type: 'refactor' },
44
+ { release: 'patch', type: 'perf' },
45
+ { release: 'patch', type: 'test' },
46
+ { release: 'patch', type: 'build' },
47
+ { release: 'patch', type: 'ci' },
48
+ { release: 'patch', type: 'chore' },
49
+ { release: 'patch', type: 'revert' },
57
50
  ],
58
51
  };
59
52
 
60
- type PluginConfig = { tap?: string };
53
+ type PluginConfig = {
54
+ tap?: string;
55
+ };
61
56
 
62
57
  let verified = false;
63
58
 
64
- function getFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): string {
65
- const { options } = context;
66
- const repositoryUrl = options.repositoryUrl!;
67
- const url = new URL(repositoryUrl);
68
- const repositoryPath = url.pathname;
69
- const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;
70
- const project = repository.split('/').pop();
59
+ async function addChannel(pluginConfig: PluginConfig, context: AddChannelContext): Promise<void> {
60
+ if (!verified) {
61
+ await verifyConditions(pluginConfig, context);
62
+ verified = true;
63
+ }
71
64
 
72
- return pluginConfig.tap ?? `${project}.rb`;
65
+ await gitHubAddChanel(pluginConfig, context);
73
66
  }
74
67
 
75
- function generateTarball(_pluginConfig: PluginConfig, context: PrepareContext) {
76
- const { nextRelease } = context;
77
-
78
- const nextTag = `v${nextRelease.version}`;
79
- const tarFilePath = tarballFile.replace('nextTag', nextTag);
68
+ async function analyzeCommits(pluginConfig: PluginConfig, context: AnalyzeCommitsContext): Promise<string | false> {
69
+ if (!verified) {
70
+ await verifyConditions(pluginConfig, context);
71
+ verified = true;
72
+ }
80
73
 
81
- execSync(`git archive --format=tar.gz --output=${tarFilePath} HEAD`);
74
+ return commitAnalyzerAnalyzeCommits(analyzerConfig, context);
82
75
  }
83
76
 
84
77
  function calculateSha256(_pluginConfig: PluginConfig, context: PrepareContext) {
@@ -94,62 +87,40 @@ function calculateSha256(_pluginConfig: PluginConfig, context: PrepareContext) {
94
87
  return hash.digest('hex');
95
88
  }
96
89
 
97
- async function updateFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): Promise<void> {
98
- const { nextRelease, options } = context;
99
-
100
- const nextTag = `v${nextRelease.version}`;
101
-
102
- const repositoryUrl = options.repositoryUrl!;
103
- const url = new URL(repositoryUrl);
104
- const repositoryPath = url.pathname;
105
- const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;
106
- const tarFilePath = tarballFile.replace('nextTag', nextTag);
107
-
108
- const tarUrl = `https://github.com/${repository}/releases/download/${nextTag}/${tarFilePath}`;
109
- //const tarUrl = `https://codeload.github.com/${repository}/tar.gz/refs/tags/${tarFilePath}`;
110
-
111
- const sha256 = calculateSha256(pluginConfig, context);
112
- const formulaFile = getFormulaFile(pluginConfig, context);
113
-
114
- let formulaContent = fs.readFileSync(formulaFile, 'utf8');
115
- formulaContent = formulaContent.replace(/url ".*"/, `url "${tarUrl}"`);
116
- formulaContent = formulaContent.replace(/sha256 ".*"/, `sha256 "${sha256}"`);
117
- fs.writeFileSync(formulaFile, formulaContent);
90
+ async function fail(pluginConfig: PluginConfig, context: FailContext): Promise<void> {
91
+ await gitHubFail(pluginConfig, context);
118
92
  }
119
93
 
120
- async function addChannel(pluginConfig: PluginConfig, context: AddChannelContext): Promise<void> {
94
+ async function generateNotes(pluginConfig: PluginConfig, context: GenerateNotesContext): Promise<string> {
121
95
  if (!verified) {
122
96
  await verifyConditions(pluginConfig, context);
123
97
  verified = true;
124
98
  }
125
99
 
126
- if (gitHubAddChanel) {
127
- await gitHubAddChanel(pluginConfig, context);
128
- }
100
+ return notesGeneratorGenerateNotes({}, context);
129
101
  }
130
102
 
131
- async function analyzeCommits(pluginConfig: PluginConfig, context: AnalyzeCommitsContext): Promise<string | false> {
132
- if (!verified) {
133
- await verifyConditions(pluginConfig, context);
134
- verified = true;
135
- }
103
+ function generateTarball(_pluginConfig: PluginConfig, context: PrepareContext) {
104
+ const { nextRelease } = context;
136
105
 
137
- return commitAnalyzerAnalyzeCommits(analyzerConfig, context);
138
- }
106
+ const nextTag = `v${nextRelease.version}`;
107
+ const tarFilePath = tarballFile.replace('nextTag', nextTag);
139
108
 
140
- async function fail(pluginConfig: PluginConfig, context: FailContext): Promise<void> {
141
- if (gitHubFail) {
142
- await gitPrepare(pluginConfig, context);
143
- }
109
+ execSync(`git archive --format=tar.gz --output=${tarFilePath} HEAD`);
144
110
  }
145
111
 
146
- async function generateNotes(pluginConfig: PluginConfig, context: GenerateNotesContext): Promise<string> {
147
- if (!verified) {
148
- await verifyConditions(pluginConfig, context);
149
- verified = true;
112
+ function getFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): string {
113
+ const { options } = context;
114
+ const repositoryUrl = options.repositoryUrl;
115
+ if (!repositoryUrl) {
116
+ throw new Error('semantic-release repositoryUrl is required');
150
117
  }
118
+ const url = new URL(repositoryUrl);
119
+ const repositoryPath = url.pathname;
120
+ const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;
121
+ const project = repository.split('/').pop();
151
122
 
152
- return notesGeneratorGenerateNotes({}, context);
123
+ return pluginConfig.tap ?? `${project}.rb`;
153
124
  }
154
125
 
155
126
  async function prepare(pluginConfig: PluginConfig, context: PrepareContext): Promise<void> {
@@ -158,26 +129,23 @@ async function prepare(pluginConfig: PluginConfig, context: PrepareContext): Pro
158
129
  verified = true;
159
130
  }
160
131
 
161
- if (gitPrepare) {
162
- const { nextRelease } = context;
163
- if (!nextRelease?.version) {
164
- throw new Error('Next release version is not available.');
165
- }
166
-
167
- const formulaFile = getFormulaFile(pluginConfig, context);
132
+ const { nextRelease } = context;
133
+ if (!nextRelease.version) {
134
+ throw new Error('Next release version is not available.');
135
+ }
168
136
 
169
- generateTarball(pluginConfig, context);
137
+ const formulaFile = getFormulaFile(pluginConfig, context);
170
138
 
171
- await updateFormulaFile(pluginConfig, context);
139
+ generateTarball(pluginConfig, context);
140
+ updateFormulaFile(pluginConfig, context);
172
141
 
173
- await gitPrepare(
174
- {
175
- assets: [formulaFile],
176
- message: 'chore(release): ${nextRelease.version}',
177
- },
178
- context,
179
- );
180
- }
142
+ await gitPrepare(
143
+ {
144
+ assets: [formulaFile],
145
+ message: 'chore(release): ${nextRelease.version}',
146
+ },
147
+ context,
148
+ );
181
149
  }
182
150
 
183
151
  async function publish(pluginConfig: PluginConfig, context: PublishContext): Promise<unknown> {
@@ -186,24 +154,22 @@ async function publish(pluginConfig: PluginConfig, context: PublishContext): Pro
186
154
  verified = true;
187
155
  }
188
156
 
189
- if (gitHubPublish) {
190
- const { nextRelease } = context;
191
- const nextTag = `v${nextRelease.version}`;
192
- const tarFilePath = tarballFile.replace('nextTag', nextTag);
193
-
194
- const customPluginConfig = {
195
- ...pluginConfig,
196
- assets: [
197
- {
198
- path: tarFilePath,
199
- label: `Homebrew Tarball (${nextTag})`,
200
- },
201
- ],
202
- };
203
- await gitHubPublish(customPluginConfig, context);
204
- }
205
- //await updateFormulaFile(pluginConfig, context);
157
+ const { nextRelease } = context;
158
+ const nextTag = `v${nextRelease.version}`;
159
+ const tarFilePath = tarballFile.replace('nextTag', nextTag);
206
160
 
161
+ const customPluginConfig = {
162
+ ...pluginConfig,
163
+ assets: [
164
+ {
165
+ label: `Homebrew Tarball (${nextTag})`,
166
+ path: tarFilePath,
167
+ },
168
+ ],
169
+ };
170
+ await gitHubPublish(customPluginConfig, context);
171
+
172
+ //await updateFormulaFile(pluginConfig, context);
207
173
  //await commitFormulaFile(pluginConfig, context);
208
174
 
209
175
  return null;
@@ -215,30 +181,50 @@ async function success(pluginConfig: PluginConfig, context: SuccessContext): Pro
215
181
  verified = true;
216
182
  }
217
183
 
218
- if (gitHubSuccess) {
219
- await gitHubSuccess(pluginConfig, context);
184
+ await gitHubSuccess(pluginConfig, context);
185
+ }
186
+
187
+ function updateFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): void {
188
+ const { nextRelease, options } = context;
189
+
190
+ const nextTag = `v${nextRelease.version}`;
191
+
192
+ const repositoryUrl = options.repositoryUrl;
193
+ if (!repositoryUrl) {
194
+ throw new Error('semantic-release repositoryUrl is required');
220
195
  }
196
+ const url = new URL(repositoryUrl);
197
+ const repositoryPath = url.pathname;
198
+ const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;
199
+ const tarFilePath = tarballFile.replace('nextTag', nextTag);
200
+
201
+ const tarUrl = `https://github.com/${repository}/releases/download/${nextTag}/${tarFilePath}`;
202
+ //const tarUrl = `https://codeload.github.com/${repository}/tar.gz/refs/tags/${tarFilePath}`;
203
+
204
+ const sha256 = calculateSha256(pluginConfig, context);
205
+ const formulaFile = getFormulaFile(pluginConfig, context);
206
+
207
+ let formulaContent = fs.readFileSync(formulaFile, 'utf8');
208
+ formulaContent = formulaContent.replace(/url ".*"/, `url "${tarUrl}"`);
209
+ formulaContent = formulaContent.replace(/sha256 ".*"/, `sha256 "${sha256}"`);
210
+ fs.writeFileSync(formulaFile, formulaContent);
221
211
  }
222
212
 
223
213
  async function verifyConditions(pluginConfig: PluginConfig, context: VerifyConditionsContext): Promise<void> {
224
- if (gitHubVerifyConditions) {
225
- await gitHubVerifyConditions(pluginConfig, context);
226
- }
227
- if (gitVerifyConditions) {
228
- await gitVerifyConditions(pluginConfig, context);
229
- }
214
+ await gitHubVerifyConditions(pluginConfig, context);
215
+ await gitVerifyConditions(pluginConfig, context);
230
216
  verified = true;
231
217
  }
232
218
 
233
219
  const plugin: SemanticReleasePlugin<{ tap: string }> = {
234
220
  addChannel,
235
- verifyConditions,
236
221
  analyzeCommits,
222
+ fail,
237
223
  generateNotes,
238
224
  prepare,
239
225
  publish,
240
226
  success,
241
- fail,
227
+ verifyConditions,
242
228
  };
243
229
 
244
230
  export default plugin;
@@ -1,49 +1,39 @@
1
- //@ts-ignore
2
1
  import { analyzeCommits } from '@semantic-release/commit-analyzer';
2
+ import { prepare as gitPrepare, verifyConditions as gitVerifyConditions } from '@semantic-release/git';
3
3
  import {
4
- prepare as gitPrepare,
5
- verifyConditions as gitVerifyConditions,
6
- //@ts-ignore
7
- } from '@semantic-release/git';
8
- import {
9
- addChannel as npmAddChannel,
10
4
  prepare as npmPrepare,
11
5
  publish as npmPublish,
12
6
  verifyConditions as npmVerifyConditions,
13
- //@ts-ignore
14
7
  } from '@semantic-release/npm';
15
- //@ts-ignore
16
8
  import { generateNotes } from '@semantic-release/release-notes-generator';
17
9
 
18
10
  import { SemanticReleasePlugin } from '../types.js';
19
11
 
20
12
  const analyzerConfig = {
21
- preset: 'conventionalcommits',
22
13
  parserOpts: {
23
- headerPattern: /^(?<type>\w+)(?<exclamation1>!?)(?:\((?<scope>[^)]+)\)(?<exclamation2>!?))?: (?<subject>.+)$/,
24
14
  headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],
15
+ headerPattern: /^(?<type>\w+)(?<exclamation1>!?)(?:\((?<scope>[^)]+)\)(?<exclamation2>!?))?: (?<subject>.+)$/,
25
16
  },
17
+ preset: 'conventionalcommits',
26
18
  releaseRules: [
27
- { type: 'feat', exclamation1: '!', release: 'major' },
28
- { type: 'feat', exclamation2: '!', release: 'major' },
29
- { type: 'feat', release: 'minor' },
30
- { type: 'fix', release: 'patch' },
31
- { type: 'docs', release: 'patch' },
32
- { type: 'style', release: 'patch' },
33
- { type: 'refactor', release: 'patch' },
34
- { type: 'perf', release: 'patch' },
35
- { type: 'test', release: 'patch' },
36
- { type: 'build', release: 'patch' },
37
- { type: 'ci', release: 'patch' },
38
- { type: 'chore', release: 'patch' },
39
- { type: 'revert', release: 'patch' },
19
+ { exclamation1: '!', release: 'major', type: 'feat' },
20
+ { exclamation2: '!', release: 'major', type: 'feat' },
21
+ { release: 'minor', type: 'feat' },
22
+ { release: 'patch', type: 'fix' },
23
+ { release: 'patch', type: 'docs' },
24
+ { release: 'patch', type: 'style' },
25
+ { release: 'patch', type: 'refactor' },
26
+ { release: 'patch', type: 'perf' },
27
+ { release: 'patch', type: 'test' },
28
+ { release: 'patch', type: 'build' },
29
+ { release: 'patch', type: 'ci' },
30
+ { release: 'patch', type: 'chore' },
31
+ { release: 'patch', type: 'revert' },
40
32
  ],
41
33
  };
42
34
 
43
35
  const npmConfig = {
44
- tag: 'latest',
45
36
  npmPublish: true,
46
- optional: false,
47
37
  };
48
38
 
49
39
  const gitConfig = {
@@ -52,56 +42,38 @@ const gitConfig = {
52
42
  };
53
43
 
54
44
  const plugin: SemanticReleasePlugin = {
55
- addChannel: async (_pluginConfig, context) => {
56
- if (npmAddChannel) {
57
- await npmAddChannel(npmConfig, context);
58
- }
59
- },
60
- verifyConditions: async (_pluginConfig, context) => {
61
- if (npmVerifyConditions) {
62
- await npmVerifyConditions(npmConfig, context);
63
- }
64
- if (gitVerifyConditions) {
65
- await gitVerifyConditions(gitConfig, context);
66
- }
45
+ addChannel: async (_pluginConfig, _context) => {
46
+ //await npmAddChannel(npmConfig, context);
67
47
  },
68
-
69
48
  analyzeCommits: async (_pluginConfig, context) => {
70
49
  return analyzeCommits(analyzerConfig, context);
71
50
  },
72
51
 
52
+ fail: async (_pluginConfig, _context) => {
53
+ //await gitFail(gitConfig, context);
54
+ },
55
+
73
56
  generateNotes: async (_pluginConfig, context) => {
74
57
  return generateNotes({}, context);
75
58
  },
76
59
 
77
60
  prepare: async (_pluginConfig, context) => {
78
- if (npmPrepare) {
79
- await npmPrepare(npmConfig, context);
80
- }
81
- if (gitPrepare) {
82
- await gitPrepare(gitConfig, context);
83
- }
61
+ await npmPrepare(npmConfig, context);
62
+ await gitPrepare(gitConfig, context);
84
63
  },
85
64
 
86
65
  publish: async (_pluginConfig, context) => {
87
- if (npmPublish) {
88
- await npmPublish(npmConfig, context);
89
- }
90
- /*if (gitPublish) {
91
- await gitPublish(gitConfig, context);
92
- }*/
66
+ await npmPublish(npmConfig, context);
67
+ //await gitPublish(gitConfig, context);
93
68
  },
94
69
 
95
70
  success: async (_pluginConfig, _context) => {
96
- /*if (gitSuccess) {
97
- await gitSuccess(gitConfig, context);
98
- }*/
71
+ //await gitSuccess(gitConfig, context);
99
72
  },
100
73
 
101
- fail: async (_pluginConfig, _context) => {
102
- /*if (gitFail) {
103
- await gitFail(gitConfig, context);
104
- }*/
74
+ verifyConditions: async (_pluginConfig, context) => {
75
+ await npmVerifyConditions(npmConfig, context);
76
+ await gitVerifyConditions(gitConfig, context);
105
77
  },
106
78
  };
107
79