@tarsilla/commit-wizard 1.0.0 โ 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commitizen/index.mjs +1 -180
- package/lib/commitizen/index.mjs.map +1 -1
- package/lib/commitlint/index.mjs +1 -50
- package/lib/commitlint/index.mjs.map +1 -1
- package/lib/semantic-release/index.mjs +1 -133
- package/lib/semantic-release/index.mjs.map +1 -1
- package/package.json +16 -9
- package/lib/commitizen/index.cjs +0 -183
- package/lib/commitizen/index.cjs.map +0 -1
- package/lib/commitlint/index.cjs +0 -53
- package/lib/commitlint/index.cjs.map +0 -1
- package/lib/semantic-release/index.cjs +0 -136
- package/lib/semantic-release/index.cjs.map +0 -1
package/lib/commitizen/index.mjs
CHANGED
|
@@ -1,181 +1,2 @@
|
|
|
1
|
-
import fs from '
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
function getCommitMessage({ answers }) {
|
|
5
|
-
const scopeText = answers.scope ? `(${answers.scope})` : '';
|
|
6
|
-
if (answers.type === 'break') {
|
|
7
|
-
const message = `feat${scopeText}!: ${answers.subject}`;
|
|
8
|
-
return message;
|
|
9
|
-
}
|
|
10
|
-
const message = `${answers.type}${scopeText}: ${answers.subject}`;
|
|
11
|
-
return message;
|
|
12
|
-
}
|
|
13
|
-
function getMaxSubject({ answers, maxLineLength }) {
|
|
14
|
-
const scopeText = answers.scope ? `(${answers.scope})` : '';
|
|
15
|
-
// +2 accounts for ": " after type and scope.
|
|
16
|
-
const prefixLength = (answers.type ? answers.type.length : 0) + scopeText.length + 2;
|
|
17
|
-
const maxSubject = maxLineLength - prefixLength;
|
|
18
|
-
return maxSubject;
|
|
19
|
-
}
|
|
20
|
-
function prompter$1({ maxLineLength }) {
|
|
21
|
-
return {
|
|
22
|
-
prompter: function(cz, commit) {
|
|
23
|
-
const questions = [
|
|
24
|
-
{
|
|
25
|
-
type: 'list',
|
|
26
|
-
name: 'type',
|
|
27
|
-
message: "Select the type of change that you're committing:",
|
|
28
|
-
choices: [
|
|
29
|
-
{
|
|
30
|
-
value: 'feat',
|
|
31
|
-
name: '๐ feat: A new feature'
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
value: 'fix',
|
|
35
|
-
name: '๐ fix: A bug fix'
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
value: 'docs',
|
|
39
|
-
name: '๐ docs: Documentation only changes'
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
value: 'style',
|
|
43
|
-
name: '๐จ style: Changes that do not affect the meaning of the code (white-space, formatting, etc)'
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
value: 'refactor',
|
|
47
|
-
name: '๐จ refactor: A code change that neither fixes a bug nor adds a feature'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
value: 'perf',
|
|
51
|
-
name: 'โก๏ธ perf: A code change that improves performance'
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
value: 'test',
|
|
55
|
-
name: '๐ test: Adding missing tests or correcting existing tests'
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
value: 'build',
|
|
59
|
-
name: '๐ฆ build: Changes that affect the build system or external dependencies'
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
value: 'ci',
|
|
63
|
-
name: '๐ค ci: Changes to our CI configuration files and scripts'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
value: 'chore',
|
|
67
|
-
name: "๐งน chore: Other changes that don't modify src or test files"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
value: 'break',
|
|
71
|
-
name: '๐ฅ break: A change that breaks existing functionality'
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
value: 'revert',
|
|
75
|
-
name: 'โช revert: Reverts a previous commit'
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
type: 'input',
|
|
81
|
-
name: 'scope',
|
|
82
|
-
message: 'What is the scope of this change (e.g. component or file name): (press enter to skip)'
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
type: 'input',
|
|
86
|
-
name: 'subject',
|
|
87
|
-
message: (answers)=>{
|
|
88
|
-
const maxSubject = getMaxSubject({
|
|
89
|
-
answers,
|
|
90
|
-
maxLineLength
|
|
91
|
-
});
|
|
92
|
-
return `Write a short, imperative tense description of the change (max ${maxSubject} chars):`;
|
|
93
|
-
},
|
|
94
|
-
validate: (input, answers)=>{
|
|
95
|
-
if (!input.trim()) {
|
|
96
|
-
// \u001b[31m is red
|
|
97
|
-
return `\u001b[31mSubject is required\u001b[39m`;
|
|
98
|
-
}
|
|
99
|
-
const maxSubject = getMaxSubject({
|
|
100
|
-
answers: answers,
|
|
101
|
-
maxLineLength
|
|
102
|
-
});
|
|
103
|
-
if (input.length <= maxSubject) {
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
// \u001b[31m is red
|
|
107
|
-
return `\u001b[31mSubject length must be less than or equal to ${maxSubject} characters. Current length is ${input.length} characters.\u001b[39m`;
|
|
108
|
-
},
|
|
109
|
-
transformer: (input, answers)=>{
|
|
110
|
-
const maxSubject = getMaxSubject({
|
|
111
|
-
answers,
|
|
112
|
-
maxLineLength
|
|
113
|
-
});
|
|
114
|
-
const remaining = maxSubject - input.length;
|
|
115
|
-
if (remaining < 0) {
|
|
116
|
-
// Red if remaining < 0: \u001b[31m is red, \u001b[39m resets the color.
|
|
117
|
-
return `\n\u001b[31m(${input.length}) ${input}\u001b[39m`;
|
|
118
|
-
}
|
|
119
|
-
// Green if valid: \u001b[32m is green, \u001b[39m resets the color.
|
|
120
|
-
return `\n\u001b[32m(${input.length}) ${input}\u001b[39m`;
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
type: 'list',
|
|
125
|
-
name: 'confirmCommit',
|
|
126
|
-
choices: [
|
|
127
|
-
{
|
|
128
|
-
value: 'yes',
|
|
129
|
-
name: 'Yes'
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
value: 'no',
|
|
133
|
-
name: 'Abort commit'
|
|
134
|
-
}
|
|
135
|
-
],
|
|
136
|
-
default: 0,
|
|
137
|
-
message (answers) {
|
|
138
|
-
const SEP = '--------------------------------------------------------';
|
|
139
|
-
const message = getCommitMessage({
|
|
140
|
-
answers
|
|
141
|
-
});
|
|
142
|
-
console.info(`\n${SEP}\n\n${message}\n\n${SEP}\n`);
|
|
143
|
-
return 'Are you sure you want to proceed with the commit above?';
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
];
|
|
147
|
-
cz.prompt(questions).then((answers)=>{
|
|
148
|
-
if (answers.confirmCommit === 'no') {
|
|
149
|
-
console.info('Commit aborted.');
|
|
150
|
-
} else {
|
|
151
|
-
const message = getCommitMessage({
|
|
152
|
-
answers
|
|
153
|
-
});
|
|
154
|
-
commit(message);
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const config = {
|
|
162
|
-
maxLineLength: 120
|
|
163
|
-
};
|
|
164
|
-
const file = 'commit-wizard.config.json';
|
|
165
|
-
function configLoader() {
|
|
166
|
-
const configPath = path.resolve(process.cwd(), file);
|
|
167
|
-
if (!fs.existsSync(configPath)) {
|
|
168
|
-
return config;
|
|
169
|
-
}
|
|
170
|
-
const loadedConfig = require(configPath);
|
|
171
|
-
return {
|
|
172
|
-
...config,
|
|
173
|
-
...loadedConfig
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const loadedConfig = configLoader();
|
|
178
|
-
const prompter = prompter$1(loadedConfig);
|
|
179
|
-
|
|
180
|
-
export { prompter as default };
|
|
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"[31mSubject is required[39m";const s=a({answers:n,maxLineLength:e});return t.length<=s||`[31mSubject length must be less than or equal to ${s} characters. Current length is ${t.length} characters.[39m`},transformer:(t,n)=>a({answers:n,maxLineLength:e})-t.length<0?`\n[31m(${t.length}) ${t}[39m`:`\n[32m(${t.length}) ${t}[39m`},{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};
|
|
181
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/commitizen/prompter.ts","../../src/configLoader/configLoader.ts","../../src/commitizen/index.ts"],"sourcesContent":["import { Commitizen, Prompter, Question } from 'commitizen';\n\nimport Config from '../types/Config.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 }: Config): 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 Config from '../types/Config.js';\n\nconst config: Config = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): Config {\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 '../configLoader/configLoader.js';\nimport Config from '../types/Config.js';\n\nconst loadedConfig: Config = configLoader();\nconst prompter = commitizenPrompter(loadedConfig);\n\nexport default prompter;\n"],"names":["getCommitMessage","answers","scopeText","scope","type","message","subject","getMaxSubject","maxLineLength","prefixLength","length","maxSubject","prompter","cz","commit","questions","name","choices","value","validate","input","trim","transformer","remaining","default","SEP","console","info","prompt","then","confirmCommit","config","file","configLoader","configPath","path","resolve","process","cwd","fs","existsSync","loadedConfig","require","commitizenPrompter"],"mappings":";;;AAWA,SAASA,gBAAAA,CAAiB,EAAEC,OAAO,EAA8B,EAAA;AAC/D,IAAA,MAAMC,SAAYD,GAAAA,OAAAA,CAAQE,KAAK,GAAG,CAAC,CAAC,EAAEF,OAAAA,CAAQE,KAAK,CAAC,CAAC,CAAC,GAAG,EAAA;IACzD,IAAIF,OAAAA,CAAQG,IAAI,KAAK,OAAS,EAAA;QAC5B,MAAMC,OAAAA,GAAU,CAAC,IAAI,EAAEH,UAAU,GAAG,EAAED,OAAQK,CAAAA,OAAO,CAAE,CAAA;QACvD,OAAOD,OAAAA;AACT;IACA,MAAMA,OAAAA,GAAU,CAAGJ,EAAAA,OAAAA,CAAQG,IAAI,CAAA,EAAGF,UAAU,EAAE,EAAED,OAAQK,CAAAA,OAAO,CAAE,CAAA;IACjE,OAAOD,OAAAA;AACT;AAEA,SAASE,aAAc,CAAA,EAAEN,OAAO,EAAEO,aAAa,EAAqD,EAAA;AAClG,IAAA,MAAMN,SAAYD,GAAAA,OAAAA,CAAQE,KAAK,GAAG,CAAC,CAAC,EAAEF,OAAAA,CAAQE,KAAK,CAAC,CAAC,CAAC,GAAG,EAAA;;AAEzD,IAA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;AACF,KAAA;AACF;;AChHA,MAAM0B,MAAiB,GAAA;IACrBvB,aAAe,EAAA;AACjB,CAAA;AACA,MAAMwB,IAAO,GAAA,2BAAA;AAEb,SAASC,YAAAA,GAAAA;AACP,IAAA,MAAMC,aAAaC,IAAKC,CAAAA,OAAO,CAACC,OAAAA,CAAQC,GAAG,EAAIN,EAAAA,IAAAA,CAAAA;AAE/C,IAAA,IAAI,CAACO,EAAAA,CAAGC,UAAU,CAACN,UAAa,CAAA,EAAA;QAC9B,OAAOH,MAAAA;AACT;AAEA,IAAA,MAAMU,eAAeC,OAAQR,CAAAA,UAAAA,CAAAA;IAC7B,OAAO;AAAE,QAAA,GAAGH,MAAM;AAAE,QAAA,GAAGU;AAAa,KAAA;AACtC;;ACfA,MAAMA,YAAuBR,GAAAA,YAAAA,EAAAA;AAC7B,MAAMrB,WAAW+B,UAAmBF,CAAAA,YAAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/commitizen/prompter.ts","../../src/configLoader/configLoader.ts","../../src/commitizen/index.ts"],"sourcesContent":["import { Commitizen, Prompter, Question } from 'commitizen';\n\nimport Config from '../types/Config.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 }: Config): 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 Config from '../types/Config.js';\n\nconst config: Config = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): Config {\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 '../configLoader/configLoader.js';\nimport Config from '../types/Config.js';\n\nconst loadedConfig: Config = 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,GAAc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MAAO,MAAOH,KAAM,OACtB,CAAEG,MAAO,KAAMH,KAAM,iBAEvBS,QAAS,EACTR,OAAAA,CAAQd,GACN,MAAMuB,EAAM,2DACNT,EAAUf,EAAiB,CAAEC,YAEnC,OADAwB,QAAQC,KAAK,KAAKF,QAAUT,QAAcS,OACnC,yDACT,IAIJb,EAAGgB,OAAOd,GAAWe,MAAM3B,IACzB,GAA8B,OAA1BA,EAAQ4B,cACVJ,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,CCf6BE"}
|
package/lib/commitlint/index.mjs
CHANGED
|
@@ -1,51 +1,2 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
function userConfig$1({ maxLineLength }) {
|
|
5
|
-
return {
|
|
6
|
-
extends: [
|
|
7
|
-
'@commitlint/config-conventional'
|
|
8
|
-
],
|
|
9
|
-
parserPreset: {
|
|
10
|
-
parserOpts: {
|
|
11
|
-
headerPattern: RegExp("^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$"),
|
|
12
|
-
headerCorrespondence: [
|
|
13
|
-
'type',
|
|
14
|
-
'exclamation1',
|
|
15
|
-
'scope',
|
|
16
|
-
'exclamation2',
|
|
17
|
-
'subject'
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
rules: {
|
|
22
|
-
'header-max-length': [
|
|
23
|
-
2,
|
|
24
|
-
'always',
|
|
25
|
-
maxLineLength
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const config = {
|
|
32
|
-
maxLineLength: 120
|
|
33
|
-
};
|
|
34
|
-
const file = 'commit-wizard.config.json';
|
|
35
|
-
function configLoader() {
|
|
36
|
-
const configPath = path.resolve(process.cwd(), file);
|
|
37
|
-
if (!fs.existsSync(configPath)) {
|
|
38
|
-
return config;
|
|
39
|
-
}
|
|
40
|
-
const loadedConfig = require(configPath);
|
|
41
|
-
return {
|
|
42
|
-
...config,
|
|
43
|
-
...loadedConfig
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const loadedConfig = configLoader();
|
|
48
|
-
const userConfig = userConfig$1(loadedConfig);
|
|
49
|
-
|
|
50
|
-
export { userConfig 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:{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};
|
|
51
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/configLoader/configLoader.ts","../../src/commitlint/index.ts","../../src/commitlint/userConfig.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport Config from '../types/Config.js';\n\nconst config: Config = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): Config {\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 '../configLoader/configLoader.js';\nimport Config from '../types/Config.js';\n\nconst loadedConfig: Config = configLoader();\nconst userConfig: UserConfig = commitlintUserConfig(loadedConfig);\n\nexport default userConfig;\n","import { UserConfig } from '@commitlint/types';\n\nimport Config from '../types/Config.js';\n\nfunction userConfig({ maxLineLength }: Config): 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,EAAiB,CACrBC,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,CCb6BE"}
|
|
@@ -1,134 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { prepare as prepare$1, verifyConditions as verifyConditions$1 } from '@semantic-release/git';
|
|
3
|
-
import { publish, prepare, verifyConditions, addChannel } from '@semantic-release/npm';
|
|
4
|
-
import { generateNotes } from '@semantic-release/release-notes-generator';
|
|
5
|
-
|
|
6
|
-
//@ts-ignore
|
|
7
|
-
const analyzerConfig = {
|
|
8
|
-
preset: 'conventionalcommits',
|
|
9
|
-
parserOpts: {
|
|
10
|
-
headerPattern: RegExp("^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$"),
|
|
11
|
-
headerCorrespondence: [
|
|
12
|
-
'type',
|
|
13
|
-
'exclamation1',
|
|
14
|
-
'scope',
|
|
15
|
-
'exclamation2',
|
|
16
|
-
'subject'
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
releaseRules: [
|
|
20
|
-
{
|
|
21
|
-
type: 'feat',
|
|
22
|
-
exclamation1: '!',
|
|
23
|
-
release: 'major'
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
type: 'feat',
|
|
27
|
-
exclamation2: '!',
|
|
28
|
-
release: 'major'
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
type: 'feat',
|
|
32
|
-
release: 'minor'
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
type: 'fix',
|
|
36
|
-
release: 'patch'
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
type: 'docs',
|
|
40
|
-
release: 'patch'
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: 'style',
|
|
44
|
-
release: 'patch'
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
type: 'refactor',
|
|
48
|
-
release: 'patch'
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
type: 'perf',
|
|
52
|
-
release: 'patch'
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
type: 'test',
|
|
56
|
-
release: 'patch'
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
type: 'build',
|
|
60
|
-
release: 'patch'
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
type: 'ci',
|
|
64
|
-
release: 'patch'
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
type: 'chore',
|
|
68
|
-
release: 'patch'
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
type: 'revert',
|
|
72
|
-
release: 'patch'
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
};
|
|
76
|
-
const npmConfig = {
|
|
77
|
-
tag: 'latest',
|
|
78
|
-
npmPublish: true,
|
|
79
|
-
optional: false
|
|
80
|
-
};
|
|
81
|
-
const gitConfig = {
|
|
82
|
-
assets: [
|
|
83
|
-
'package.json',
|
|
84
|
-
'package-lock.json'
|
|
85
|
-
],
|
|
86
|
-
message: 'chore(release): ${nextRelease.version}'
|
|
87
|
-
};
|
|
88
|
-
const plugin = {
|
|
89
|
-
addChannel: async (_pluginConfig, context)=>{
|
|
90
|
-
if (addChannel) {
|
|
91
|
-
await addChannel(npmConfig, context);
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
verifyConditions: async (_pluginConfig, context)=>{
|
|
95
|
-
if (verifyConditions) {
|
|
96
|
-
await verifyConditions(npmConfig, context);
|
|
97
|
-
}
|
|
98
|
-
if (verifyConditions$1) {
|
|
99
|
-
await verifyConditions$1(gitConfig, context);
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
analyzeCommits: async (_pluginConfig, context)=>{
|
|
103
|
-
return analyzeCommits(analyzerConfig, context);
|
|
104
|
-
},
|
|
105
|
-
generateNotes: async (_pluginConfig, context)=>{
|
|
106
|
-
return generateNotes({}, context);
|
|
107
|
-
},
|
|
108
|
-
prepare: async (_pluginConfig, context)=>{
|
|
109
|
-
if (prepare) {
|
|
110
|
-
await prepare(npmConfig, context);
|
|
111
|
-
}
|
|
112
|
-
if (prepare$1) {
|
|
113
|
-
await prepare$1(gitConfig, context);
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
publish: async (_pluginConfig, context)=>{
|
|
117
|
-
if (publish) {
|
|
118
|
-
await publish(npmConfig, context);
|
|
119
|
-
}
|
|
120
|
-
/*if (gitPublish) {
|
|
121
|
-
await gitPublish(gitConfig, context);
|
|
122
|
-
}*/ },
|
|
123
|
-
success: async (_pluginConfig, _context)=>{
|
|
124
|
-
/*if (gitSuccess) {
|
|
125
|
-
await gitSuccess(gitConfig, context);
|
|
126
|
-
}*/ },
|
|
127
|
-
fail: async (_pluginConfig, _context)=>{
|
|
128
|
-
/*if (gitFail) {
|
|
129
|
-
await gitFail(gitConfig, context);
|
|
130
|
-
}*/ }
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export { plugin as default };
|
|
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};
|
|
134
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/semantic-release/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';\nimport {\n AddChannelContext,\n AnalyzeCommitsContext,\n FailContext,\n GenerateNotesContext,\n PrepareContext,\n PublishContext,\n SuccessContext,\n VerifyConditionsContext,\n} from 'semantic-release';\n\n// This interface describes the hooks exposed by a semantic-release plugin.\nexport type SemanticReleasePlugin = {\n addChannel?(pluginConfig: unknown, context: AddChannelContext): Promise<void>;\n analyzeCommits?(pluginConfig: unknown, context: AnalyzeCommitsContext): Promise<string | false>;\n fail?(pluginConfig: unknown, context: FailContext): Promise<void>;\n generateNotes?(pluginConfig: unknown, context: GenerateNotesContext): Promise<string>;\n prepare?(pluginConfig: unknown, context: PrepareContext): Promise<void>;\n publish?(pluginConfig: unknown, context: PublishContext): Promise<unknown>;\n success?(pluginConfig: unknown, context: SuccessContext): Promise<void>;\n verifyConditions?(pluginConfig: unknown, context: VerifyConditionsContext): Promise<void>;\n};\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","headerCorrespondence","releaseRules","type","exclamation1","release","exclamation2","npmConfig","tag","npmPublish","optional","gitConfig","assets","message","plugin","addChannel","_pluginConfig","context","npmAddChannel","verifyConditions","npmVerifyConditions","gitVerifyConditions","analyzeCommits","generateNotes","prepare","npmPrepare","gitPrepare","publish","success","_context","fail"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/semantic-release/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';\nimport {\n AddChannelContext,\n AnalyzeCommitsContext,\n FailContext,\n GenerateNotesContext,\n PrepareContext,\n PublishContext,\n SuccessContext,\n VerifyConditionsContext,\n} from 'semantic-release';\n\n// This interface describes the hooks exposed by a semantic-release plugin.\nexport type SemanticReleasePlugin = {\n addChannel?(pluginConfig: unknown, context: AddChannelContext): Promise<void>;\n analyzeCommits?(pluginConfig: unknown, context: AnalyzeCommitsContext): Promise<string | false>;\n fail?(pluginConfig: unknown, context: FailContext): Promise<void>;\n generateNotes?(pluginConfig: unknown, context: GenerateNotesContext): Promise<string>;\n prepare?(pluginConfig: unknown, context: PrepareContext): Promise<void>;\n publish?(pluginConfig: unknown, context: PublishContext): Promise<unknown>;\n success?(pluginConfig: unknown, context: SuccessContext): Promise<void>;\n verifyConditions?(pluginConfig: unknown, context: VerifyConditionsContext): Promise<void>;\n};\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","success","_context","fail"],"mappings":"sTAuCA,MAAMA,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,WAIzBE,EAAY,CAChBC,IAAK,SACLC,YAAY,EACZC,UAAU,GAGNC,EAAY,CAChBC,OAAQ,CAAC,eAAgB,qBACzBC,QAAS,0CAGLC,EAAgC,CACpCC,WAAYC,MAAOC,EAAeC,KAC5BC,SACIA,EAAcZ,EAAWW,EACjC,EAEFE,iBAAkBJ,MAAOC,EAAeC,KAClCG,SACIA,EAAoBd,EAAWW,GAEnCI,SACIA,EAAoBX,EAAWO,EACvC,EAGFK,eAAgBP,MAAOC,EAAeC,IAC7BK,EAAe3B,EAAgBsB,GAGxCM,cAAeR,MAAOC,EAAeC,IAC5BM,EAAc,CAAIN,EAAAA,GAG3BO,QAAST,MAAOC,EAAeC,KACzBQ,SACIA,EAAWnB,EAAWW,GAE1BS,SACIA,EAAWhB,EAAWO,EAC9B,EAGFU,QAASZ,MAAOC,EAAeC,KACzBT,SACIA,EAAWF,EAAWW,EAC9B,EAMFW,QAASb,MAAOC,EAAea,KAAtBd,EAMTe,KAAMf,MAAOC,EAAea,KAAtBd"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarsilla/commit-wizard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -9,12 +9,19 @@
|
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
11
|
"./commitizen": {
|
|
12
|
-
"require": "./lib/commitizen/index.
|
|
13
|
-
"
|
|
12
|
+
"require": "./lib/commitizen/index.mjs",
|
|
13
|
+
"import": "./lib/commitizen/index.mjs",
|
|
14
|
+
"default": "./lib/commitizen/index.mjs"
|
|
14
15
|
},
|
|
15
16
|
"./commitlint": {
|
|
16
|
-
"require": "./lib/commitlint/index.
|
|
17
|
-
"
|
|
17
|
+
"require": "./lib/commitlint/index.mjs",
|
|
18
|
+
"import": "./lib/commitlint/index.mjs",
|
|
19
|
+
"default": "./lib/commitlint/index.mjs"
|
|
20
|
+
},
|
|
21
|
+
"./semantic-release": {
|
|
22
|
+
"require": "./lib/semantic-release/index.mjs",
|
|
23
|
+
"import": "./lib/semantic-release/index.mjs",
|
|
24
|
+
"default": "./lib/semantic-release/index.mjs"
|
|
18
25
|
},
|
|
19
26
|
"./package.json": "./package.json"
|
|
20
27
|
},
|
|
@@ -43,7 +50,8 @@
|
|
|
43
50
|
"@semantic-release/git": "^10",
|
|
44
51
|
"@semantic-release/npm": "^12",
|
|
45
52
|
"@semantic-release/release-notes-generator": "^14",
|
|
46
|
-
"commitizen": "^4"
|
|
53
|
+
"commitizen": "^4",
|
|
54
|
+
"semantic-release": "^24"
|
|
47
55
|
},
|
|
48
56
|
"dependencies": {
|
|
49
57
|
"chokidar": "^4.0.3",
|
|
@@ -58,16 +66,15 @@
|
|
|
58
66
|
"@types/inquirer": "^8.2.10",
|
|
59
67
|
"eslint": "^9.22.0",
|
|
60
68
|
"eslint-config-prettier": "^10.1.1",
|
|
61
|
-
"eslint-import-resolver-typescript": "^4.2.
|
|
69
|
+
"eslint-import-resolver-typescript": "^4.2.2",
|
|
62
70
|
"eslint-plugin-import": "^2.31.0",
|
|
63
71
|
"eslint-plugin-prettier": "^5.2.3",
|
|
64
72
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
65
73
|
"husky": "^9.1.7",
|
|
66
74
|
"prettier": "^3.5.3",
|
|
67
75
|
"rollup": "^4.36.0",
|
|
68
|
-
"rollup-plugin-dts": "^6.
|
|
76
|
+
"rollup-plugin-dts": "^6.2.0",
|
|
69
77
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
70
|
-
"semantic-release": "^24.2.3",
|
|
71
78
|
"typescript": "^5.8.2",
|
|
72
79
|
"typescript-eslint": "^8.26.1"
|
|
73
80
|
}
|
package/lib/commitizen/index.cjs
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fs = require('fs');
|
|
4
|
-
var path = require('path');
|
|
5
|
-
|
|
6
|
-
function getCommitMessage({ answers }) {
|
|
7
|
-
const scopeText = answers.scope ? `(${answers.scope})` : '';
|
|
8
|
-
if (answers.type === 'break') {
|
|
9
|
-
const message = `feat${scopeText}!: ${answers.subject}`;
|
|
10
|
-
return message;
|
|
11
|
-
}
|
|
12
|
-
const message = `${answers.type}${scopeText}: ${answers.subject}`;
|
|
13
|
-
return message;
|
|
14
|
-
}
|
|
15
|
-
function getMaxSubject({ answers, maxLineLength }) {
|
|
16
|
-
const scopeText = answers.scope ? `(${answers.scope})` : '';
|
|
17
|
-
// +2 accounts for ": " after type and scope.
|
|
18
|
-
const prefixLength = (answers.type ? answers.type.length : 0) + scopeText.length + 2;
|
|
19
|
-
const maxSubject = maxLineLength - prefixLength;
|
|
20
|
-
return maxSubject;
|
|
21
|
-
}
|
|
22
|
-
function prompter$1({ maxLineLength }) {
|
|
23
|
-
return {
|
|
24
|
-
prompter: function(cz, commit) {
|
|
25
|
-
const questions = [
|
|
26
|
-
{
|
|
27
|
-
type: 'list',
|
|
28
|
-
name: 'type',
|
|
29
|
-
message: "Select the type of change that you're committing:",
|
|
30
|
-
choices: [
|
|
31
|
-
{
|
|
32
|
-
value: 'feat',
|
|
33
|
-
name: '๐ feat: A new feature'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
value: 'fix',
|
|
37
|
-
name: '๐ fix: A bug fix'
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
value: 'docs',
|
|
41
|
-
name: '๐ docs: Documentation only changes'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
value: 'style',
|
|
45
|
-
name: '๐จ style: Changes that do not affect the meaning of the code (white-space, formatting, etc)'
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
value: 'refactor',
|
|
49
|
-
name: '๐จ refactor: A code change that neither fixes a bug nor adds a feature'
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
value: 'perf',
|
|
53
|
-
name: 'โก๏ธ perf: A code change that improves performance'
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
value: 'test',
|
|
57
|
-
name: '๐ test: Adding missing tests or correcting existing tests'
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
value: 'build',
|
|
61
|
-
name: '๐ฆ build: Changes that affect the build system or external dependencies'
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
value: 'ci',
|
|
65
|
-
name: '๐ค ci: Changes to our CI configuration files and scripts'
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
value: 'chore',
|
|
69
|
-
name: "๐งน chore: Other changes that don't modify src or test files"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
value: 'break',
|
|
73
|
-
name: '๐ฅ break: A change that breaks existing functionality'
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
value: 'revert',
|
|
77
|
-
name: 'โช revert: Reverts a previous commit'
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
type: 'input',
|
|
83
|
-
name: 'scope',
|
|
84
|
-
message: 'What is the scope of this change (e.g. component or file name): (press enter to skip)'
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
type: 'input',
|
|
88
|
-
name: 'subject',
|
|
89
|
-
message: (answers)=>{
|
|
90
|
-
const maxSubject = getMaxSubject({
|
|
91
|
-
answers,
|
|
92
|
-
maxLineLength
|
|
93
|
-
});
|
|
94
|
-
return `Write a short, imperative tense description of the change (max ${maxSubject} chars):`;
|
|
95
|
-
},
|
|
96
|
-
validate: (input, answers)=>{
|
|
97
|
-
if (!input.trim()) {
|
|
98
|
-
// \u001b[31m is red
|
|
99
|
-
return `\u001b[31mSubject is required\u001b[39m`;
|
|
100
|
-
}
|
|
101
|
-
const maxSubject = getMaxSubject({
|
|
102
|
-
answers: answers,
|
|
103
|
-
maxLineLength
|
|
104
|
-
});
|
|
105
|
-
if (input.length <= maxSubject) {
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
|
-
// \u001b[31m is red
|
|
109
|
-
return `\u001b[31mSubject length must be less than or equal to ${maxSubject} characters. Current length is ${input.length} characters.\u001b[39m`;
|
|
110
|
-
},
|
|
111
|
-
transformer: (input, answers)=>{
|
|
112
|
-
const maxSubject = getMaxSubject({
|
|
113
|
-
answers,
|
|
114
|
-
maxLineLength
|
|
115
|
-
});
|
|
116
|
-
const remaining = maxSubject - input.length;
|
|
117
|
-
if (remaining < 0) {
|
|
118
|
-
// Red if remaining < 0: \u001b[31m is red, \u001b[39m resets the color.
|
|
119
|
-
return `\n\u001b[31m(${input.length}) ${input}\u001b[39m`;
|
|
120
|
-
}
|
|
121
|
-
// Green if valid: \u001b[32m is green, \u001b[39m resets the color.
|
|
122
|
-
return `\n\u001b[32m(${input.length}) ${input}\u001b[39m`;
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
type: 'list',
|
|
127
|
-
name: 'confirmCommit',
|
|
128
|
-
choices: [
|
|
129
|
-
{
|
|
130
|
-
value: 'yes',
|
|
131
|
-
name: 'Yes'
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
value: 'no',
|
|
135
|
-
name: 'Abort commit'
|
|
136
|
-
}
|
|
137
|
-
],
|
|
138
|
-
default: 0,
|
|
139
|
-
message (answers) {
|
|
140
|
-
const SEP = '--------------------------------------------------------';
|
|
141
|
-
const message = getCommitMessage({
|
|
142
|
-
answers
|
|
143
|
-
});
|
|
144
|
-
console.info(`\n${SEP}\n\n${message}\n\n${SEP}\n`);
|
|
145
|
-
return 'Are you sure you want to proceed with the commit above?';
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
];
|
|
149
|
-
cz.prompt(questions).then((answers)=>{
|
|
150
|
-
if (answers.confirmCommit === 'no') {
|
|
151
|
-
console.info('Commit aborted.');
|
|
152
|
-
} else {
|
|
153
|
-
const message = getCommitMessage({
|
|
154
|
-
answers
|
|
155
|
-
});
|
|
156
|
-
commit(message);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const config = {
|
|
164
|
-
maxLineLength: 120
|
|
165
|
-
};
|
|
166
|
-
const file = 'commit-wizard.config.json';
|
|
167
|
-
function configLoader() {
|
|
168
|
-
const configPath = path.resolve(process.cwd(), file);
|
|
169
|
-
if (!fs.existsSync(configPath)) {
|
|
170
|
-
return config;
|
|
171
|
-
}
|
|
172
|
-
const loadedConfig = require(configPath);
|
|
173
|
-
return {
|
|
174
|
-
...config,
|
|
175
|
-
...loadedConfig
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const loadedConfig = configLoader();
|
|
180
|
-
const prompter = prompter$1(loadedConfig);
|
|
181
|
-
|
|
182
|
-
module.exports = prompter;
|
|
183
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/commitizen/prompter.ts","../../src/configLoader/configLoader.ts","../../src/commitizen/index.ts"],"sourcesContent":["import { Commitizen, Prompter, Question } from 'commitizen';\n\nimport Config from '../types/Config.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 }: Config): 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 Config from '../types/Config.js';\n\nconst config: Config = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): Config {\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 '../configLoader/configLoader.js';\nimport Config from '../types/Config.js';\n\nconst loadedConfig: Config = configLoader();\nconst prompter = commitizenPrompter(loadedConfig);\n\nexport default prompter;\n"],"names":["getCommitMessage","answers","scopeText","scope","type","message","subject","getMaxSubject","maxLineLength","prefixLength","length","maxSubject","prompter","cz","commit","questions","name","choices","value","validate","input","trim","transformer","remaining","default","SEP","console","info","prompt","then","confirmCommit","config","file","configLoader","configPath","path","resolve","process","cwd","fs","existsSync","loadedConfig","require","commitizenPrompter"],"mappings":";;;;;AAWA,SAASA,gBAAAA,CAAiB,EAAEC,OAAO,EAA8B,EAAA;AAC/D,IAAA,MAAMC,SAAYD,GAAAA,OAAAA,CAAQE,KAAK,GAAG,CAAC,CAAC,EAAEF,OAAAA,CAAQE,KAAK,CAAC,CAAC,CAAC,GAAG,EAAA;IACzD,IAAIF,OAAAA,CAAQG,IAAI,KAAK,OAAS,EAAA;QAC5B,MAAMC,OAAAA,GAAU,CAAC,IAAI,EAAEH,UAAU,GAAG,EAAED,OAAQK,CAAAA,OAAO,CAAE,CAAA;QACvD,OAAOD,OAAAA;AACT;IACA,MAAMA,OAAAA,GAAU,CAAGJ,EAAAA,OAAAA,CAAQG,IAAI,CAAA,EAAGF,UAAU,EAAE,EAAED,OAAQK,CAAAA,OAAO,CAAE,CAAA;IACjE,OAAOD,OAAAA;AACT;AAEA,SAASE,aAAc,CAAA,EAAEN,OAAO,EAAEO,aAAa,EAAqD,EAAA;AAClG,IAAA,MAAMN,SAAYD,GAAAA,OAAAA,CAAQE,KAAK,GAAG,CAAC,CAAC,EAAEF,OAAAA,CAAQE,KAAK,CAAC,CAAC,CAAC,GAAG,EAAA;;AAE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AA;AACF;AACF,KAAA;AACF;;AChHA,MAAM0B,MAAiB,GAAA;IACrBvB,aAAe,EAAA;AACjB,CAAA;AACA,MAAMwB,IAAO,GAAA,2BAAA;AAEb,SAASC,YAAAA,GAAAA;AACP,IAAA,MAAMC,aAAaC,IAAKC,CAAAA,OAAO,CAACC,OAAAA,CAAQC,GAAG,EAAIN,EAAAA,IAAAA,CAAAA;AAE/C,IAAA,IAAI,CAACO,EAAAA,CAAGC,UAAU,CAACN,UAAa,CAAA,EAAA;QAC9B,OAAOH,MAAAA;AACT;AAEA,IAAA,MAAMU,eAAeC,OAAQR,CAAAA,UAAAA,CAAAA;IAC7B,OAAO;AAAE,QAAA,GAAGH,MAAM;AAAE,QAAA,GAAGU;AAAa,KAAA;AACtC;;ACfA,MAAMA,YAAuBR,GAAAA,YAAAA,EAAAA;AAC7B,MAAMrB,WAAW+B,UAAmBF,CAAAA,YAAAA;;;;"}
|
package/lib/commitlint/index.cjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fs = require('fs');
|
|
4
|
-
var path = require('path');
|
|
5
|
-
|
|
6
|
-
function userConfig$1({ maxLineLength }) {
|
|
7
|
-
return {
|
|
8
|
-
extends: [
|
|
9
|
-
'@commitlint/config-conventional'
|
|
10
|
-
],
|
|
11
|
-
parserPreset: {
|
|
12
|
-
parserOpts: {
|
|
13
|
-
headerPattern: RegExp("^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$"),
|
|
14
|
-
headerCorrespondence: [
|
|
15
|
-
'type',
|
|
16
|
-
'exclamation1',
|
|
17
|
-
'scope',
|
|
18
|
-
'exclamation2',
|
|
19
|
-
'subject'
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
rules: {
|
|
24
|
-
'header-max-length': [
|
|
25
|
-
2,
|
|
26
|
-
'always',
|
|
27
|
-
maxLineLength
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const config = {
|
|
34
|
-
maxLineLength: 120
|
|
35
|
-
};
|
|
36
|
-
const file = 'commit-wizard.config.json';
|
|
37
|
-
function configLoader() {
|
|
38
|
-
const configPath = path.resolve(process.cwd(), file);
|
|
39
|
-
if (!fs.existsSync(configPath)) {
|
|
40
|
-
return config;
|
|
41
|
-
}
|
|
42
|
-
const loadedConfig = require(configPath);
|
|
43
|
-
return {
|
|
44
|
-
...config,
|
|
45
|
-
...loadedConfig
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const loadedConfig = configLoader();
|
|
50
|
-
const userConfig = userConfig$1(loadedConfig);
|
|
51
|
-
|
|
52
|
-
module.exports = userConfig;
|
|
53
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/commitlint/userConfig.ts","../../src/configLoader/configLoader.ts","../../src/commitlint/index.ts"],"sourcesContent":["import { UserConfig } from '@commitlint/types';\n\nimport Config from '../types/Config.js';\n\nfunction userConfig({ maxLineLength }: Config): 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","import fs from 'fs';\nimport path from 'path';\n\nimport Config from '../types/Config.js';\n\nconst config: Config = {\n maxLineLength: 120,\n};\nconst file = 'commit-wizard.config.json';\n\nfunction configLoader(): Config {\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 '../configLoader/configLoader.js';\nimport Config from '../types/Config.js';\n\nconst loadedConfig: Config = configLoader();\nconst userConfig: UserConfig = commitlintUserConfig(loadedConfig);\n\nexport default userConfig;\n"],"names":["userConfig","maxLineLength","extends","parserPreset","parserOpts","headerPattern","headerCorrespondence","rules","config","file","configLoader","configPath","path","resolve","process","cwd","fs","existsSync","loadedConfig","require","commitlintUserConfig"],"mappings":";;;;;AAIA,SAASA,YAAAA,CAAW,EAAEC,aAAa,EAAU,EAAA;IAC3C,OAAO;QACLC,OAAS,EAAA;AAAC,YAAA;AAAkC,SAAA;QAC5CC,YAAc,EAAA;YACZC,UAAY,EAAA;gBACVC,aAAe,EAAA,MAAA,CAAA,iGAAA,CAAA;gBACfC,oBAAsB,EAAA;AAAC,oBAAA,MAAA;AAAQ,oBAAA,cAAA;AAAgB,oBAAA,OAAA;AAAS,oBAAA,cAAA;AAAgB,oBAAA;AAAU;AACpF;AACF,SAAA;QACAC,KAAO,EAAA;YACL,mBAAqB,EAAA;AAAC,gBAAA,CAAA;AAAG,gBAAA,QAAA;AAAUN,gBAAAA;AAAc;AACnD;AACF,KAAA;AACF;;ACZA,MAAMO,MAAiB,GAAA;IACrBP,aAAe,EAAA;AACjB,CAAA;AACA,MAAMQ,IAAO,GAAA,2BAAA;AAEb,SAASC,YAAAA,GAAAA;AACP,IAAA,MAAMC,aAAaC,IAAKC,CAAAA,OAAO,CAACC,OAAAA,CAAQC,GAAG,EAAIN,EAAAA,IAAAA,CAAAA;AAE/C,IAAA,IAAI,CAACO,EAAAA,CAAGC,UAAU,CAACN,UAAa,CAAA,EAAA;QAC9B,OAAOH,MAAAA;AACT;AAEA,IAAA,MAAMU,eAAeC,OAAQR,CAAAA,UAAAA,CAAAA;IAC7B,OAAO;AAAE,QAAA,GAAGH,MAAM;AAAE,QAAA,GAAGU;AAAa,KAAA;AACtC;;ACbA,MAAMA,YAAuBR,GAAAA,YAAAA,EAAAA;AAC7B,MAAMV,aAAyBoB,YAAqBF,CAAAA,YAAAA;;;;"}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var commitAnalyzer = require('@semantic-release/commit-analyzer');
|
|
4
|
-
var git = require('@semantic-release/git');
|
|
5
|
-
var npm = require('@semantic-release/npm');
|
|
6
|
-
var releaseNotesGenerator = require('@semantic-release/release-notes-generator');
|
|
7
|
-
|
|
8
|
-
//@ts-ignore
|
|
9
|
-
const analyzerConfig = {
|
|
10
|
-
preset: 'conventionalcommits',
|
|
11
|
-
parserOpts: {
|
|
12
|
-
headerPattern: RegExp("^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$"),
|
|
13
|
-
headerCorrespondence: [
|
|
14
|
-
'type',
|
|
15
|
-
'exclamation1',
|
|
16
|
-
'scope',
|
|
17
|
-
'exclamation2',
|
|
18
|
-
'subject'
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
|
-
releaseRules: [
|
|
22
|
-
{
|
|
23
|
-
type: 'feat',
|
|
24
|
-
exclamation1: '!',
|
|
25
|
-
release: 'major'
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: 'feat',
|
|
29
|
-
exclamation2: '!',
|
|
30
|
-
release: 'major'
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
type: 'feat',
|
|
34
|
-
release: 'minor'
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
type: 'fix',
|
|
38
|
-
release: 'patch'
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: 'docs',
|
|
42
|
-
release: 'patch'
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
type: 'style',
|
|
46
|
-
release: 'patch'
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
type: 'refactor',
|
|
50
|
-
release: 'patch'
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
type: 'perf',
|
|
54
|
-
release: 'patch'
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
type: 'test',
|
|
58
|
-
release: 'patch'
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
type: 'build',
|
|
62
|
-
release: 'patch'
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
type: 'ci',
|
|
66
|
-
release: 'patch'
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
type: 'chore',
|
|
70
|
-
release: 'patch'
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
type: 'revert',
|
|
74
|
-
release: 'patch'
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
};
|
|
78
|
-
const npmConfig = {
|
|
79
|
-
tag: 'latest',
|
|
80
|
-
npmPublish: true,
|
|
81
|
-
optional: false
|
|
82
|
-
};
|
|
83
|
-
const gitConfig = {
|
|
84
|
-
assets: [
|
|
85
|
-
'package.json',
|
|
86
|
-
'package-lock.json'
|
|
87
|
-
],
|
|
88
|
-
message: 'chore(release): ${nextRelease.version}'
|
|
89
|
-
};
|
|
90
|
-
const plugin = {
|
|
91
|
-
addChannel: async (_pluginConfig, context)=>{
|
|
92
|
-
if (npm.addChannel) {
|
|
93
|
-
await npm.addChannel(npmConfig, context);
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
verifyConditions: async (_pluginConfig, context)=>{
|
|
97
|
-
if (npm.verifyConditions) {
|
|
98
|
-
await npm.verifyConditions(npmConfig, context);
|
|
99
|
-
}
|
|
100
|
-
if (git.verifyConditions) {
|
|
101
|
-
await git.verifyConditions(gitConfig, context);
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
analyzeCommits: async (_pluginConfig, context)=>{
|
|
105
|
-
return commitAnalyzer.analyzeCommits(analyzerConfig, context);
|
|
106
|
-
},
|
|
107
|
-
generateNotes: async (_pluginConfig, context)=>{
|
|
108
|
-
return releaseNotesGenerator.generateNotes({}, context);
|
|
109
|
-
},
|
|
110
|
-
prepare: async (_pluginConfig, context)=>{
|
|
111
|
-
if (npm.prepare) {
|
|
112
|
-
await npm.prepare(npmConfig, context);
|
|
113
|
-
}
|
|
114
|
-
if (git.prepare) {
|
|
115
|
-
await git.prepare(gitConfig, context);
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
publish: async (_pluginConfig, context)=>{
|
|
119
|
-
if (npm.publish) {
|
|
120
|
-
await npm.publish(npmConfig, context);
|
|
121
|
-
}
|
|
122
|
-
/*if (gitPublish) {
|
|
123
|
-
await gitPublish(gitConfig, context);
|
|
124
|
-
}*/ },
|
|
125
|
-
success: async (_pluginConfig, _context)=>{
|
|
126
|
-
/*if (gitSuccess) {
|
|
127
|
-
await gitSuccess(gitConfig, context);
|
|
128
|
-
}*/ },
|
|
129
|
-
fail: async (_pluginConfig, _context)=>{
|
|
130
|
-
/*if (gitFail) {
|
|
131
|
-
await gitFail(gitConfig, context);
|
|
132
|
-
}*/ }
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
module.exports = plugin;
|
|
136
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/semantic-release/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';\nimport {\n AddChannelContext,\n AnalyzeCommitsContext,\n FailContext,\n GenerateNotesContext,\n PrepareContext,\n PublishContext,\n SuccessContext,\n VerifyConditionsContext,\n} from 'semantic-release';\n\n// This interface describes the hooks exposed by a semantic-release plugin.\nexport type SemanticReleasePlugin = {\n addChannel?(pluginConfig: unknown, context: AddChannelContext): Promise<void>;\n analyzeCommits?(pluginConfig: unknown, context: AnalyzeCommitsContext): Promise<string | false>;\n fail?(pluginConfig: unknown, context: FailContext): Promise<void>;\n generateNotes?(pluginConfig: unknown, context: GenerateNotesContext): Promise<string>;\n prepare?(pluginConfig: unknown, context: PrepareContext): Promise<void>;\n publish?(pluginConfig: unknown, context: PublishContext): Promise<unknown>;\n success?(pluginConfig: unknown, context: SuccessContext): Promise<void>;\n verifyConditions?(pluginConfig: unknown, context: VerifyConditionsContext): Promise<void>;\n};\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","headerCorrespondence","releaseRules","type","exclamation1","release","exclamation2","npmConfig","tag","npmPublish","optional","gitConfig","assets","message","plugin","addChannel","_pluginConfig","context","npmAddChannel","verifyConditions","npmVerifyConditions","gitVerifyConditions","analyzeCommits","generateNotes","prepare","npmPrepare","gitPrepare","publish","success","_context","fail"],"mappings":";;;;;;;AAAA;AAuCA,MAAMA,cAAiB,GAAA;IACrBC,MAAQ,EAAA,qBAAA;IACRC,UAAY,EAAA;QACVC,aAAe,EAAA,MAAA,CAAA,iGAAA,CAAA;QACfC,oBAAsB,EAAA;AAAC,YAAA,MAAA;AAAQ,YAAA,cAAA;AAAgB,YAAA,OAAA;AAAS,YAAA,cAAA;AAAgB,YAAA;AAAU;AACpF,KAAA;IACAC,YAAc,EAAA;AACZ,QAAA;YAAEC,IAAM,EAAA,MAAA;YAAQC,YAAc,EAAA,GAAA;YAAKC,OAAS,EAAA;AAAQ,SAAA;AACpD,QAAA;YAAEF,IAAM,EAAA,MAAA;YAAQG,YAAc,EAAA,GAAA;YAAKD,OAAS,EAAA;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