addon-ui 0.3.0 → 0.4.0

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.
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": [
3
+ "@commitlint/config-conventional"
4
+ ]
5
+ }
package/.gitattributes ADDED
@@ -0,0 +1,6 @@
1
+ # Enforce LF for all text files
2
+ * text=auto eol=lf
3
+
4
+ # Keep Windows command scripts with CRLF line endings
5
+ *.bat text eol=crlf
6
+ *.cmd text eol=crlf
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env sh
2
+
3
+ # Husky commit-msg hook: validate commit message with commitlint
4
+
5
+ npx --no -- commitlint --edit "$1"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env sh
2
+
3
+ # Husky pre-commit hook: format and run related tests on staged files
4
+
5
+ npm run test:related
6
+ npm run format
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env sh
2
+
3
+ # Husky pre-push hook: typecheck, run full tests, and build
4
+
5
+ npm run typecheck || exit 1
6
+ npm run lint || exit 1
7
+ #npm run test:ci || exit 1
8
+ #npm run build || exit 1
package/.mailmap ADDED
@@ -0,0 +1,2 @@
1
+ Addon Stack <191148085+addon-stack@users.noreply.github.com> <addonbonedev@gmail.com>
2
+ Addon Stack <addon-stack@users.noreply.github.com> <addonbonedev@gmail.com>
@@ -0,0 +1,256 @@
1
+ const {execSync} = require("node:child_process");
2
+ const pkg = require("./package.json");
3
+
4
+ function deriveGithubFromEmail(email) {
5
+ if (!email) {
6
+ return {};
7
+ }
8
+
9
+ const m = email.match(/^([^@]+)@users\.noreply\.github\.com$/i);
10
+
11
+ if (!m) {
12
+ return {};
13
+ }
14
+
15
+ const local = m[1];
16
+ const login = local.includes("+") ? local.split("+").pop() : local;
17
+
18
+ if (!login) {
19
+ return {};
20
+ }
21
+
22
+ return {login, url: `https://github.com/${login}`};
23
+ }
24
+
25
+ function getContributors() {
26
+ try {
27
+ let fromTag;
28
+
29
+ try {
30
+ const tag = execSync("git describe --tags --abbrev=0", {encoding: "utf8"}).trim();
31
+ fromTag = tag || null;
32
+ } catch {
33
+ fromTag = null;
34
+ }
35
+
36
+ const range = fromTag ? `${fromTag}..HEAD` : "";
37
+ const cmd = `git shortlog -sne ${range}`.trim();
38
+ const out = execSync(cmd, {encoding: "utf8"}).trim();
39
+
40
+ if (!out) {
41
+ return [];
42
+ }
43
+
44
+ const lines = out.split("\n").filter(Boolean);
45
+
46
+ const map = new Map();
47
+
48
+ for (const line of lines) {
49
+ const m = line.match(/^\s*(\d+)\s+(.*?)(?:\s+<([^>]+)>)?\s*$/);
50
+
51
+ const count = Number(m?.[1] || 0);
52
+
53
+ const displayName = (m?.[2] || "").trim() || undefined;
54
+ const displayEmail = (m?.[3] || "").trim() || undefined;
55
+
56
+ const lcName = (displayName || "").toLowerCase();
57
+ const lcEmail = (displayEmail || "").toLowerCase();
58
+
59
+ // Filter bots using lowercase keys only
60
+ if (lcName.includes("bot") || lcEmail.includes("bot")) {
61
+ continue;
62
+ }
63
+
64
+ const gh = deriveGithubFromEmail(displayEmail);
65
+ const loginKey = gh.login ? gh.login.toLowerCase() : null;
66
+
67
+ const key = loginKey ? `gh:${loginKey}` : lcEmail ? `em:${lcEmail}` : `nm:${lcName}`;
68
+
69
+ const existing = map.get(key);
70
+
71
+ if (existing) {
72
+ existing.count += count;
73
+ if (!existing.login && gh.login) {
74
+ existing.login = gh.login;
75
+ existing.url = gh.url;
76
+ }
77
+ if (!existing.name && displayName) {
78
+ existing.name = displayName;
79
+ }
80
+ if (!existing.email && displayEmail) {
81
+ existing.email = displayEmail;
82
+ }
83
+ } else {
84
+ map.set(key, {count, name: displayName, email: displayEmail, ...gh});
85
+ }
86
+ }
87
+
88
+ return Array.from(map.values());
89
+ } catch {
90
+ return [];
91
+ }
92
+ }
93
+
94
+ const types = new Map([
95
+ ["feat", "✨ Features"],
96
+ ["fix", "🐛 Bug Fixed"],
97
+ ["perf", "⚡️ Performance Improvements"],
98
+ ["refactor", "🛠️ Refactoring"],
99
+ ["docs", "📝 Documentation"],
100
+ ["test", "🧪 Tests"],
101
+ ["build", "🏗️ Build System"],
102
+ ["ci", "🤖 CI"],
103
+ ["chore", "🧹 Chores"],
104
+ ["revert", "⏪ Reverts"],
105
+ ]);
106
+
107
+ const normalizeRepoUrl = url => url.replace(/^git\+/, "").replace(/\.git$/, "");
108
+ const repoUrl = pkg?.repository?.url ? normalizeRepoUrl(pkg.repository.url) : null;
109
+
110
+ module.exports = () => {
111
+ const contributors = getContributors();
112
+
113
+ return {
114
+ ci: true,
115
+
116
+ git: {
117
+ requireCleanWorkingDir: true,
118
+ requireUpstream: false,
119
+ requireBranch: false,
120
+ commit: true,
121
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: release-it placeholder
122
+ commitMessage: "chore(release): v${version}",
123
+ tag: true,
124
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: release-it placeholder
125
+ tagName: "v${version}",
126
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: release-it placeholder
127
+ tagAnnotation: "v${version}",
128
+ push: true,
129
+ },
130
+
131
+ github: {
132
+ release: true,
133
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: release-it placeholder
134
+ releaseName: "v${version}",
135
+ autoGenerate: false,
136
+ // Ensure GitHub receives exactly the generated changelog body
137
+ releaseNotes: ({changelog}) => changelog,
138
+ },
139
+
140
+ npm: {
141
+ publish: true,
142
+ versionArgs: ["--no-git-tag-version"],
143
+ publishArgs: ["--provenance", "--access", "public"],
144
+ },
145
+
146
+ plugins: {
147
+ "@release-it/conventional-changelog": {
148
+ infile: "CHANGELOG.md",
149
+ preset: "conventionalcommits",
150
+
151
+ parserOpts: {
152
+ headerPattern: /^(\w+)(?:\(([^)]+)\))?(!)?:\s(.+?)(?:\s\(#\d+\))?$/,
153
+ headerCorrespondence: ["type", "scope", "breaking", "subject"],
154
+ noteKeywords: ["BREAKING CHANGE", "BREAKING-CHANGE"],
155
+ },
156
+
157
+ presetConfig: {
158
+ types: [...types.entries()].map(([type, section]) => ({type, section, hidden: false})),
159
+ },
160
+
161
+ context: {
162
+ name: pkg.name,
163
+ pkg: {name: pkg.name},
164
+ repoUrl,
165
+ contributors,
166
+ },
167
+
168
+ recommendedBumpOpts: {
169
+ preset: "conventionalcommits",
170
+ whatBump: commits => {
171
+ let isMajor = false;
172
+ let isMinor = false;
173
+ let isPatch = false;
174
+
175
+ for (const commit of commits) {
176
+ if (commit.notes?.some(n => /BREAKING CHANGE/i.test(n.title || n.text || ""))) {
177
+ isMajor = true;
178
+ break;
179
+ }
180
+
181
+ const type = (commit.type || "").toLowerCase();
182
+
183
+ if (type === "feat") {
184
+ isMinor = true;
185
+ }
186
+
187
+ if (["fix", "perf", "refactor", "ci"].includes(type)) {
188
+ isPatch = true;
189
+ }
190
+ }
191
+
192
+ if (isMajor) return {level: 0};
193
+ if (isMinor) return {level: 1};
194
+ if (isPatch) return {level: 2};
195
+
196
+ return null;
197
+ },
198
+ },
199
+ writerOpts: {
200
+ headerPartial:
201
+ "## 🚀 Release {{#if name}}`{{name}}` {{else}}{{#if @root.pkg}}`{{@root.pkg.name}}` {{/if}}{{/if}}v{{version}} ({{date}})\n\n",
202
+ footerPartial: `{{#if @root.contributors.length}}\n### 🙌 Contributors\n\n{{#each @root.contributors}}- {{#if url}}{{#if name}}[{{name}}]({{url}}){{#if login}} (@{{login}}){{/if}}{{else}}[@{{login}}]({{url}}){{/if}}{{else}}{{#if email}}{{#if name}}[{{name}}](mailto:{{email}}){{else}}{{email}}{{/if}}{{else}}{{name}}{{/if}}{{/if}} — commits: {{count}}\n{{/each}}{{/if}}`,
203
+ mainTemplate:
204
+ "{{> header}}\n" +
205
+ "{{#if noteGroups}}\n### 💥 Breaking Changes\n\n{{#each noteGroups}}{{#each notes}}* {{{text}}}\n\n{{/each}}{{/each}}{{/if}}" +
206
+ "{{#each commitGroups}}\n### {{title}}\n\n{{#each commits}}{{> commit root=@root}}\n{{/each}}\n\n{{/each}}" +
207
+ "{{#unless commitGroups}}\n{{#each commits}}{{> commit root=@root}}\n{{/each}}{{/unless}}\n\n" +
208
+ "{{> footer}}",
209
+ commitPartial:
210
+ "{{#if type}}* {{#if scope}}**{{scope}}:** {{/if}}{{#if subject}}{{subject}}{{else}}{{header}}{{/if}}{{#if href}} ([{{shorthash}}]({{href}})){{/if}}\n\n{{#if body}}{{{body}}}\n{{/if}}{{/if}}",
211
+ groupBy: "type",
212
+ commitGroupsSort: "title",
213
+ commitsSort: ["scope", "subject"],
214
+ transform: commit => {
215
+ const nextCommit = {...commit};
216
+
217
+ // If header had a '!' (captured into `breaking` by parser), ensure we surface a BREAKING note
218
+ if (nextCommit.breaking && (!nextCommit.notes || nextCommit.notes.length === 0)) {
219
+ const text = nextCommit.subject || nextCommit.header;
220
+ nextCommit.notes = [{title: "BREAKING CHANGE", text}];
221
+ }
222
+
223
+ // Normalize type: lowercase and drop trailing '!' so 'feat!' maps to 'feat'
224
+ const type = (nextCommit.type || "").toLowerCase().replace(/!+$/, "");
225
+ const section = types.get(type);
226
+
227
+ if (section) {
228
+ nextCommit.type = section;
229
+ } else {
230
+ nextCommit.type = "🧩 Other";
231
+ }
232
+
233
+ if (nextCommit.body) {
234
+ const body = nextCommit.body.replace(/\r\n/g, "\n").trim();
235
+
236
+ nextCommit.body = body
237
+ .split("\n")
238
+ .map(line => (line ? ` ${line}` : ""))
239
+ .join("\n");
240
+ }
241
+
242
+ if (!nextCommit.href && nextCommit.hash && repoUrl) {
243
+ nextCommit.href = `${repoUrl}/commit/${nextCommit.hash}`;
244
+ }
245
+
246
+ if (!nextCommit.shorthash && nextCommit.hash) {
247
+ nextCommit.shorthash = nextCommit.hash.slice(0, 7);
248
+ }
249
+
250
+ return nextCommit;
251
+ },
252
+ },
253
+ },
254
+ },
255
+ };
256
+ };
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2025 Addon Stack; Anjey Tsibylskij
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.