@gogenger/go-gen 1.0.0 → 1.0.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ ## [1.0.2](https://github.com/goGenger/go-gen/compare/v1.0.1...v1.0.2) (2026-01-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * 修改发布工作流以响应标签推送而非分支推送 ([6f22ed1](https://github.com/goGenger/go-gen/commit/6f22ed14d07451636261b84134bdc166a6f395e8))
7
+
8
+ ## [1.0.1](https://github.com/goGenger/go-gen/compare/v1.0.0...v1.0.1) (2026-01-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **utils:** 移除pascalCase函数中的冗余注释 ([c5813ff](https://github.com/goGenger/go-gen/commit/c5813ff97ff844f0a0ce2631be0020a037a18c02))
14
+
15
+ # 1.0.0 (2026-01-04)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **ci:** 修正工作流中包名称的路径错误 ([5f3af29](https://github.com/goGenger/go-gen/commit/5f3af29fe9ae0208a4ef941fd2ed8c2eeb1a6b12))
21
+ * **fetch-mode:** 修复请求取消逻辑和竞态条件问题 ([7d52d83](https://github.com/goGenger/go-gen/commit/7d52d830a40fb431d60ac0fd331071dc187afc6e))
22
+ * **fetch-mode:** 移除未使用的spinner参数并修复userCancelled变量声明 ([6e5c519](https://github.com/goGenger/go-gen/commit/6e5c519a6d965f8eee50d5850547b4ca37f29ce9))
23
+ * 将userCancelled改为可变量以标记请求取消状态 ([15de5a4](https://github.com/goGenger/go-gen/commit/15de5a45ae9aa8d3606ce9a4a2f47469c20cf975))
24
+
25
+
26
+ ### Features
27
+
28
+ * **ci:** 添加 GitHub issue 模板和 release 工作流 ([43a2655](https://github.com/goGenger/go-gen/commit/43a265589d066f29a526f7c6d005a137c611d121))
29
+ * 重构核心模块并更新项目元数据 ([4f8bb3e](https://github.com/goGenger/go-gen/commit/4f8bb3e0148a664e5fdc3cc22da53426e201f5b3))
30
+
1
31
  # 更新日志 / Changelog
2
32
 
3
33
  本文档记录项目的所有重要变更。
package/README.en.md CHANGED
@@ -124,16 +124,6 @@ Issues and Pull Requests are welcome!
124
124
 
125
125
  Check out [Contributing Guide](./CONTRIBUTING.md) to learn how to participate in development.
126
126
 
127
- ## 🧪 Testing
128
-
129
- ```bash
130
- # Run all tests
131
- npm test
132
-
133
- # View coverage
134
- npm test -- --coverage
135
- ```
136
-
137
127
  ## 📄 License
138
128
 
139
129
  [MIT](./LICENSE)
package/README.md CHANGED
@@ -124,16 +124,6 @@ go-gen config --global
124
124
 
125
125
  查看 [贡献指南](./CONTRIBUTING.md) 了解如何参与项目开发。
126
126
 
127
- ## 🧪 测试
128
-
129
- ```bash
130
- # 运行所有测试
131
- npm test
132
-
133
- # 查看覆盖率
134
- npm test -- --coverage
135
- ```
136
-
137
127
  ## 📄 License
138
128
 
139
129
  [MIT](./LICENSE)
@@ -113,7 +113,7 @@ function createAbortError() {
113
113
  * 监听用户输入,允许按 Ctrl+C 取消请求
114
114
  * 🔥 关键修复: 使用 once + 立即清理机制
115
115
  */
116
- function setupCancelListener(spinner) {
116
+ function setupCancelListener() {
117
117
  console.log(chalk.gray('\n💡 提示: 请求过程中可以按 Ctrl+C 取消\n'));
118
118
 
119
119
  let isHandled = false; // 防止重复处理
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "@gogenger/go-gen",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "一款 TypeScript API 代码生成器,支持从 API 响应或 OpenAPI 文档一键生成 TypeScript 接口代码和类型定义",
5
5
  "bin": {
6
6
  "go-gen": "./bin/index.js"
7
7
  },
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
8
11
  "scripts": {
9
12
  "test": "jest --coverage",
10
13
  "test:watch": "jest --watch",
11
14
  "lint": "eslint core/**/*.js",
12
15
  "prepare": "husky install",
13
16
  "format": "prettier --write .",
14
- "format:check": "prettier --check ."
17
+ "format:check": "prettier --check .",
18
+ "release": "semantic-release"
15
19
  },
16
20
  "keywords": [
17
21
  "quicktype",
@@ -24,6 +28,14 @@
24
28
  "license": "MIT",
25
29
  "author": "goGenger",
26
30
  "email": "bg2582266166@gmail.com",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/goGenger/go-gen"
34
+ },
35
+ "homepage": "https://github.com/goGenger/go-gen#readme",
36
+ "bugs": {
37
+ "url": "https://github.com/goGenger/go-gen/issues"
38
+ },
27
39
  "lint-staged": {
28
40
  "**/*.{js}": [
29
41
  "prettier --write",
@@ -40,14 +52,20 @@
40
52
  "CHANGELOG.md"
41
53
  ],
42
54
  "devDependencies": {
55
+ "@semantic-release/changelog": "6",
56
+ "@semantic-release/commit-analyzer": "11",
57
+ "@semantic-release/git": "10",
58
+ "@semantic-release/npm": "11",
59
+ "@semantic-release/release-notes-generator": "12",
43
60
  "eslint": "^8.47.0",
61
+ "eslint-config-prettier": "^10.1.8",
62
+ "eslint-plugin-prettier": "^5.5.4",
63
+ "husky": "^9.1.7",
44
64
  "jest": "^29.6.0",
65
+ "lint-staged": "^16.2.7",
45
66
  "nock": "^13.3.3",
46
67
  "prettier": "^3.7.4",
47
- "lint-staged": "^16.2.7",
48
- "husky": "^9.1.7",
49
- "eslint-config-prettier": "^10.1.8",
50
- "eslint-plugin-prettier": "^5.5.4"
68
+ "semantic-release": "22"
51
69
  },
52
70
  "dependencies": {
53
71
  "@darkobits/lolcatjs": "3.1.3",
@@ -58,9 +76,9 @@
58
76
  "node-fetch": "^2.7.0",
59
77
  "openapi-sampler": "^1.6.2",
60
78
  "ora": "^5.4.1",
79
+ "prompts": "^2.4.2",
61
80
  "quicktype-core": "^23.2.6",
62
- "shelljs": "^0.10.0",
63
- "prompts": "^2.4.2"
81
+ "shelljs": "^0.10.0"
64
82
  },
65
83
  "engines": {
66
84
  "node": ">=20.0.0"
package/utils/name.js CHANGED
@@ -7,8 +7,6 @@ function pascalCase(name) {
7
7
  if (isValidIdentifier(name)) {
8
8
  return name;
9
9
  }
10
-
11
- // 否则才进行 pascalCase
12
10
  return name
13
11
  .replace(/[-_/](.)/g, (_, c) => c.toUpperCase())
14
12
  .replace(/^(.)/, (_, c) => c.toUpperCase());
package/utils/sampler.js CHANGED
@@ -1,6 +1,6 @@
1
1
  function schemaToSample(schema) {
2
2
  if (!schema) return {};
3
-
3
+
4
4
  if (schema.type === 'object' && schema.properties) {
5
5
  const sample = {};
6
6
  for (const [key, prop] of Object.entries(schema.properties)) {
@@ -8,11 +8,11 @@ function schemaToSample(schema) {
8
8
  }
9
9
  return sample;
10
10
  }
11
-
11
+
12
12
  if (schema.type === 'array' && schema.items) {
13
13
  return [schemaToSample(schema.items)];
14
14
  }
15
-
15
+
16
16
  const typeDefaults = {
17
17
  string: 'example',
18
18
  number: 0,
@@ -21,8 +21,8 @@ function schemaToSample(schema) {
21
21
  object: {},
22
22
  array: [],
23
23
  };
24
-
24
+
25
25
  return typeDefaults[schema.type] || null;
26
26
  }
27
27
 
28
- module.exports = { schemaToSample };
28
+ module.exports = { schemaToSample };