@milesight/changelog 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.
Files changed (2) hide show
  1. package/README.md +173 -169
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -1,169 +1,173 @@
1
- # @milesight/changelog
2
-
3
- > A [Changesets](https://github.com/changesets/changesets) changelog generator with [Conventional Commits](https://www.conventionalcommits.org/) support and built-in i18n.
4
-
5
- [![npm version](https://img.shields.io/npm/v/@milesight/changelog)](https://www.npmjs.com/package/@milesight/changelog)
6
- [![license](https://img.shields.io/npm/l/@milesight/changelog)](./LICENSE)
7
-
8
- ## Features
9
-
10
- - **Conventional Commits** — Parses `type(scope)!: description` format and maps each type to an emoji automatically
11
- - **i18n** — Ships with English and Chinese locales; configurable via `.changeset/config.json`
12
- - **Custom types** — Extend or override the built-in commit type set per project
13
- - **Rich summary formats** — Supports single-line, title + details, and multiple independent entries
14
- - **Dual output** — Ships both CJS (`dist/index.js`) and ESM (`dist/index.mjs`) builds
15
-
16
- ## Installation
17
-
18
- ```bash
19
- # npm
20
- npm add -D @milesight/changelog
21
-
22
- # pnpm
23
- pnpm add -D @milesight/changelog
24
-
25
- # yarn
26
- yarn add -D @milesight/changelog
27
- ```
28
-
29
- ## Usage
30
-
31
- Set `changelog` in your `.changeset/config.json`:
32
-
33
- ```json
34
- {
35
- "changelog": ["@milesight/changelog", { "locale": "en" }]
36
- }
37
- ```
38
-
39
- That's it. Run `changeset version` as usual — changelogs are generated automatically.
40
-
41
- ## Options
42
-
43
- | Option | Type | Default | Description |
44
- | ------------- | ---------------------------------------- | ------- | ------------------------------------------------ |
45
- | `locale` | `"en" \| "zh"` | `"en"` | Display language for type labels and UI strings |
46
- | `customTypes` | `Record<string, TypeConfig>` | — | Additional or overriding commit types |
47
-
48
- ### `TypeConfig`
49
-
50
- ```ts
51
- interface TypeConfig {
52
- /** Emoji to display for this commit type */
53
- emoji: string;
54
- /**
55
- * Localized labels keyed by locale code.
56
- * Falls back to the English label, then the type key itself.
57
- */
58
- labels?: Partial<Record<'en' | 'zh', string>>;
59
- }
60
- ```
61
-
62
- ## Built-in Commit Types
63
-
64
- | Type | Emoji | English Label | Chinese Label |
65
- | ---------- | ----- | ------------- | ------------- |
66
- | `feat` | ✨ | New Feature | 新特性 |
67
- | `fix` | 🐛 | Bug Fix | 问题修复 |
68
- | `perf` | ⚡ | Performance | 性能优化 |
69
- | `refactor` | ♻️ | Refactor | 代码重构 |
70
- | `docs` | 📝 | Documentation | 文档 |
71
- | `style` | 💅 | Style | 样式 |
72
- | `test` | ✅ | Tests | 测试 |
73
- | `build` | 🏗️ | Build | 构建 |
74
- | `ci` | 👷 | CI/CD | CI/CD |
75
- | `chore` | 🔧 | Chore | 杂项 |
76
- | `revert` | ⏪ | Revert | 回退 |
77
-
78
- Unrecognised types fall back to 📦.
79
-
80
- ## Custom Types
81
-
82
- Add project-specific commit types via `customTypes`:
83
-
84
- ```json
85
- {
86
- "changelog": [
87
- "@milesight/changelog",
88
- {
89
- "locale": "zh",
90
- "customTypes": {
91
- "release": {
92
- "emoji": "🚀",
93
- "labels": { "en": "Release", "zh": "正式发布" }
94
- },
95
- "security": {
96
- "emoji": "🔒",
97
- "labels": { "en": "Security", "zh": "安全修复" }
98
- }
99
- }
100
- }
101
- ]
102
- }
103
- ```
104
-
105
- Custom types are **merged** with the built-in set. If a key already exists (e.g. `feat`), the custom entry takes precedence.
106
-
107
- ## Changeset Summary Formats
108
-
109
- The generator supports four summary formats:
110
-
111
- **1. Single title**
112
- ```
113
- fix: resolve null pointer in form submit
114
- ```
115
-
116
- **2. Title + details**
117
- ```
118
- feat: add theme token system
119
- - supports light/dark variable sets
120
- - exposes getCSSVariable helper
121
- ```
122
-
123
- **3. Multiple independent titles**
124
- ```
125
- feat: add useTheme hook
126
- fix: correct focus ring on Safari
127
- ```
128
-
129
- **4. Multiple titles each with details** (blank line as separator)
130
- ```
131
- feat: add useTheme hook
132
- - supports ThemeProvider injection
133
- - reactive to system preference
134
-
135
- fix: correct focus ring on Safari
136
- - affected input and button components
137
- ```
138
-
139
- ## Output Example
140
-
141
- Given a changeset with the summary above, the generated changelog entry looks like:
142
-
143
- ```markdown
144
- - ✨ add useTheme hook
145
- - supports ThemeProvider injection
146
- - reactive to system preference
147
-
148
- - 🐛 correct focus ring on Safari
149
- - affected input and button components
150
- ```
151
-
152
- ## i18n
153
-
154
- Switch to Chinese by setting `"locale": "zh"`:
155
-
156
- ```json
157
- { "changelog": ["@milesight/changelog", { "locale": "zh" }] }
158
- ```
159
-
160
- Breaking change markers and dependency update messages will then appear in Chinese:
161
-
162
- ```markdown
163
- - ✨ 重新设计 API 接口 **[破坏性变更]**
164
- - 📦 依赖 `lodash` 升级至 `4.18.0`
165
- ```
166
-
167
- ## License
168
-
169
- [MIT](./LICENSE) © Milesight
1
+ # @milesight/changelog
2
+
3
+ > A [Changesets](https://github.com/changesets/changesets) changelog generator with [Conventional Commits](https://www.conventionalcommits.org/) support and built-in i18n.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@milesight/changelog)](https://www.npmjs.com/package/@milesight/changelog)
6
+ [![license](https://img.shields.io/npm/l/@milesight/changelog)](./LICENSE)
7
+
8
+ ## Features
9
+
10
+ - **Conventional Commits** — Parses `type(scope)!: description` format and maps each type to an emoji automatically
11
+ - **i18n** — Ships with English and Chinese locales; configurable via `.changeset/config.json`
12
+ - **Custom types** — Extend or override the built-in commit type set per project
13
+ - **Rich summary formats** — Supports single-line, title + details, and multiple independent entries
14
+ - **Dual output** — Ships both CJS (`dist/index.js`) and ESM (`dist/index.mjs`) builds
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ # npm
20
+ npm add -D @milesight/changelog
21
+
22
+ # pnpm
23
+ pnpm add -D @milesight/changelog
24
+
25
+ # yarn
26
+ yarn add -D @milesight/changelog
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ Set `changelog` in your `.changeset/config.json`:
32
+
33
+ ```json
34
+ {
35
+ "changelog": ["@milesight/changelog", { "locale": "en" }]
36
+ }
37
+ ```
38
+
39
+ That's it. Run `changeset version` as usual — changelogs are generated automatically.
40
+
41
+ ## Options
42
+
43
+ | Option | Type | Default | Description |
44
+ | ------------- | ---------------------------- | ------- | ----------------------------------------------- |
45
+ | `locale` | `"en" \| "zh"` | `"en"` | Display language for type labels and UI strings |
46
+ | `customTypes` | `Record<string, TypeConfig>` | — | Additional or overriding commit types |
47
+
48
+ ### `TypeConfig`
49
+
50
+ ```ts
51
+ interface TypeConfig {
52
+ /** Emoji to display for this commit type */
53
+ emoji: string;
54
+ /**
55
+ * Localized labels keyed by locale code.
56
+ * Falls back to the English label, then the type key itself.
57
+ */
58
+ labels?: Partial<Record<'en' | 'zh', string>>;
59
+ }
60
+ ```
61
+
62
+ ## Built-in Commit Types
63
+
64
+ | Type | Emoji | English Label | Chinese Label |
65
+ | ---------- | ----- | ------------- | ------------- |
66
+ | `feat` | ✨ | New Feature | 新特性 |
67
+ | `fix` | 🐛 | Bug Fix | 问题修复 |
68
+ | `perf` | ⚡ | Performance | 性能优化 |
69
+ | `refactor` | ♻️ | Refactor | 代码重构 |
70
+ | `docs` | 📝 | Documentation | 文档 |
71
+ | `style` | 💅 | Style | 样式 |
72
+ | `test` | ✅ | Tests | 测试 |
73
+ | `build` | 🏗️ | Build | 构建 |
74
+ | `ci` | 👷 | CI/CD | CI/CD |
75
+ | `chore` | 🔧 | Chore | 杂项 |
76
+ | `revert` | ⏪ | Revert | 回退 |
77
+
78
+ Unrecognised types fall back to 📦.
79
+
80
+ ## Custom Types
81
+
82
+ Add project-specific commit types via `customTypes`:
83
+
84
+ ```json
85
+ {
86
+ "changelog": [
87
+ "@milesight/changelog",
88
+ {
89
+ "locale": "zh",
90
+ "customTypes": {
91
+ "release": {
92
+ "emoji": "🚀",
93
+ "labels": { "en": "Release", "zh": "正式发布" }
94
+ },
95
+ "security": {
96
+ "emoji": "🔒",
97
+ "labels": { "en": "Security", "zh": "安全修复" }
98
+ }
99
+ }
100
+ }
101
+ ]
102
+ }
103
+ ```
104
+
105
+ Custom types are **merged** with the built-in set. If a key already exists (e.g. `feat`), the custom entry takes precedence.
106
+
107
+ ## Changeset Summary Formats
108
+
109
+ The generator supports four summary formats:
110
+
111
+ **1. Single title**
112
+
113
+ ```
114
+ fix: resolve null pointer in form submit
115
+ ```
116
+
117
+ **2. Title + details**
118
+
119
+ ```
120
+ feat: add theme token system
121
+ - supports light/dark variable sets
122
+ - exposes getCSSVariable helper
123
+ ```
124
+
125
+ **3. Multiple independent titles**
126
+
127
+ ```
128
+ feat: add useTheme hook
129
+ fix: correct focus ring on Safari
130
+ ```
131
+
132
+ **4. Multiple titles each with details** (blank line as separator)
133
+
134
+ ```
135
+ feat: add useTheme hook
136
+ - supports ThemeProvider injection
137
+ - reactive to system preference
138
+
139
+ fix: correct focus ring on Safari
140
+ - affected input and button components
141
+ ```
142
+
143
+ ## Output Example
144
+
145
+ Given a changeset with the summary above, the generated changelog entry looks like:
146
+
147
+ ```markdown
148
+ - add useTheme hook
149
+ - supports ThemeProvider injection
150
+ - reactive to system preference
151
+
152
+ - 🐛 correct focus ring on Safari
153
+ - affected input and button components
154
+ ```
155
+
156
+ ## i18n
157
+
158
+ Switch to Chinese by setting `"locale": "zh"`:
159
+
160
+ ```json
161
+ { "changelog": ["@milesight/changelog", { "locale": "zh" }] }
162
+ ```
163
+
164
+ Breaking change markers and dependency update messages will then appear in Chinese:
165
+
166
+ ```markdown
167
+ - ✨ 重新设计 API 接口 **[破坏性变更]**
168
+ - 📦 依赖 `lodash` 升级至 `4.18.0`
169
+ ```
170
+
171
+ ## License
172
+
173
+ [MIT](./LICENSE) © Milesight
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milesight/changelog",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Changesets changelog generator with Conventional Commits support and i18n",
5
5
  "keywords": [
6
6
  "changesets",
@@ -35,6 +35,7 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@milesight/spec": "^1.0.5",
38
+ "eslint": "^9.39.2",
38
39
  "tsup": "^8.5.1",
39
40
  "typescript": "^5.9.3"
40
41
  },