@wneng/create-keel 0.3.0 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +26 -1
  2. package/dist/index.js +118 -5
  3. package/dist/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/src/templates/ci-gitee/files/PULL_REQUEST_TEMPLATE.md +62 -0
  6. package/src/templates/ci-gitee/files/pipeline.yml +150 -16
  7. package/src/templates/ci-gitee/fragment.yaml +4 -1
  8. package/src/templates/ci-github/files/PULL_REQUEST_TEMPLATE.md +62 -0
  9. package/src/templates/ci-github/files/ci.yml +199 -6
  10. package/src/templates/ci-github/fragment.yaml +4 -1
  11. package/src/templates/contracts-base/files/_spectral.yaml +21 -0
  12. package/src/templates/contracts-base/fragment.yaml +4 -1
  13. package/src/templates/docs-skeleton/files/README.md +3 -3
  14. package/src/templates/docs-skeleton/files/governance-checklists.md +3 -3
  15. package/src/templates/docs-skeleton/files/governance-security.md +6 -2
  16. package/src/templates/root-files/files/CODEOWNERS +40 -0
  17. package/src/templates/root-files/fragment.yaml +3 -0
  18. package/src/templates/server-go/files/_golangci.yml +41 -0
  19. package/src/templates/server-go/fragment.yaml +4 -1
  20. package/src/templates/server-java/files/checkstyle.xml +62 -0
  21. package/src/templates/server-java/files/pom.xml +57 -0
  22. package/src/templates/server-java/fragment.yaml +4 -1
  23. package/src/templates/server-node/files/_eslintrc.cjs +20 -0
  24. package/src/templates/server-node/files/_prettierrc +12 -0
  25. package/src/templates/server-node/files/package.json +14 -1
  26. package/src/templates/server-node/fragment.yaml +7 -1
  27. package/src/templates/server-python/files/pyproject.toml +44 -0
  28. package/src/templates/web-react/files/_eslintrc.cjs +34 -0
  29. package/src/templates/web-react/files/_prettierrc +12 -0
  30. package/src/templates/web-react/files/package.json +11 -1
  31. package/src/templates/web-react/fragment.yaml +7 -1
  32. package/src/templates/web-vue/files/_eslintrc.cjs +28 -0
  33. package/src/templates/web-vue/files/_prettierrc +12 -0
  34. package/src/templates/web-vue/fragment.yaml +7 -1
@@ -0,0 +1,40 @@
1
+ # CODEOWNERS — review routing for <%= it.options.projectName %>
2
+ #
3
+ # Format: path-pattern @owner1 @owner2
4
+ # - Match order matters: later rules override earlier ones.
5
+ # - Replace placeholder owners (`@TBD`) with real Git accounts before
6
+ # the first PR. CI rejects merging when CODEOWNERS still contains @TBD.
7
+ #
8
+ # References:
9
+ # - AGENTS.md §3.1 (PR review obligations)
10
+ # - docs/governance/git-workflow.md (PR template + CODEOWNERS rules)
11
+
12
+ # Default owner for everything not matched below.
13
+ * @TBD
14
+
15
+ # Architecture and contracts: high-impact paths require named reviewers.
16
+ /AGENTS.md @TBD
17
+ /contracts/ @TBD
18
+ /docs/02-系统方案与架构/ @TBD
19
+ /docs/governance/ @TBD
20
+
21
+ # Per-execution-environment routing (placeholders; adjust per team).
22
+ /server/ @TBD
23
+ /web/ @TBD
24
+ <% if (it.options.mobile !== 'none') { %>/mobile/ @TBD
25
+ <% } %><% if (it.options.miniapp !== 'none') { %>/miniapp/ @TBD
26
+ <% } %><% if (it.options.agent !== 'none') { %>/agent/ @TBD
27
+ <% } %>
28
+
29
+ # Operations & deployment.
30
+ /ops/ @TBD
31
+ /deploy/ @TBD
32
+
33
+ # CI configuration.
34
+ <% if (it.options.ci === 'github') { %>/.github/ @TBD
35
+ <% } else if (it.options.ci === 'gitee') { %>/.gitee/ @TBD
36
+ <% } %>
37
+
38
+ # Tooling.
39
+ /tools/ @TBD
40
+ /scripts/ @TBD
@@ -18,3 +18,6 @@ files:
18
18
  - from: files/.editorconfig
19
19
  to: .editorconfig
20
20
  render: false
21
+ - from: files/CODEOWNERS
22
+ to: CODEOWNERS
23
+ render: true
@@ -0,0 +1,41 @@
1
+ # golangci-lint config for <%= it.options.projectName %>-server.
2
+ # Source of truth referenced by docs/03-工程规范与研发基础设施/coding-style-go.md.
3
+ # CI runs `golangci-lint run` and aborts on errors.
4
+
5
+ run:
6
+ timeout: 3m
7
+ tests: true
8
+
9
+ linters:
10
+ disable-all: true
11
+ enable:
12
+ - errcheck
13
+ - gosimple
14
+ - govet
15
+ - ineffassign
16
+ - staticcheck
17
+ - unused
18
+ - revive
19
+ - gofmt
20
+ - goimports
21
+ - misspell
22
+ - unconvert
23
+ - nakedret
24
+
25
+ linters-settings:
26
+ revive:
27
+ rules:
28
+ - name: package-comments
29
+ - name: exported
30
+ arguments: ['checkPrivateReceivers', 'sayRepetitiveInsteadOfStutters']
31
+ goimports:
32
+ local-prefixes: example.com
33
+
34
+ issues:
35
+ exclude-use-default: false
36
+ max-issues-per-linter: 0
37
+ max-same-issues: 0
38
+ exclude-rules:
39
+ - path: _test\.go
40
+ linters:
41
+ - errcheck
@@ -1,5 +1,5 @@
1
1
  name: server-go
2
- version: 1.0.0
2
+ version: 1.1.0
3
3
  appliesWhen:
4
4
  backend: go
5
5
  priority: 30
@@ -13,6 +13,9 @@ files:
13
13
  - from: files/main.go
14
14
  to: server/cmd/server/main.go
15
15
  render: false
16
+ - from: files/_golangci.yml
17
+ to: server/.golangci.yml
18
+ render: true
16
19
  - from: files/generated-gitkeep
17
20
  to: server/generated/.gitkeep
18
21
  render: false
@@ -0,0 +1,62 @@
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE module PUBLIC
3
+ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4
+ "https://checkstyle.org/dtds/configuration_1_3.dtd">
5
+ <!--
6
+ Checkstyle config for <%= it.options.projectName %>-server.
7
+ Source of truth referenced by:
8
+ docs/03-工程规范与研发基础设施/coding-style-java.md
9
+
10
+ Tweak rules with care. CI runs `mvn verify` which invokes
11
+ `maven-checkstyle-plugin` and aborts on errors.
12
+ -->
13
+ <module name="Checker">
14
+ <property name="charset" value="UTF-8"/>
15
+ <property name="severity" value="error"/>
16
+ <property name="fileExtensions" value="java, properties, xml"/>
17
+
18
+ <module name="FileTabCharacter">
19
+ <property name="eachLine" value="true"/>
20
+ </module>
21
+
22
+ <module name="LineLength">
23
+ <property name="max" value="120"/>
24
+ <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
25
+ </module>
26
+
27
+ <module name="TreeWalker">
28
+ <!-- Imports -->
29
+ <module name="AvoidStarImport"/>
30
+ <module name="UnusedImports"/>
31
+
32
+ <!-- Naming -->
33
+ <module name="PackageName">
34
+ <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
35
+ </module>
36
+ <module name="TypeName"/>
37
+ <module name="MethodName"/>
38
+ <module name="LocalVariableName"/>
39
+ <module name="ConstantName"/>
40
+
41
+ <!-- Whitespace / blocks -->
42
+ <module name="EmptyBlock"/>
43
+ <module name="LeftCurly"/>
44
+ <module name="RightCurly"/>
45
+ <module name="NeedBraces"/>
46
+
47
+ <!-- JavaDoc on public types and methods -->
48
+ <module name="MissingJavadocType">
49
+ <property name="scope" value="public"/>
50
+ </module>
51
+ <module name="JavadocMethod">
52
+ <property name="accessModifiers" value="public"/>
53
+ </module>
54
+
55
+ <!-- Misc -->
56
+ <module name="ModifierOrder"/>
57
+ <module name="RedundantModifier"/>
58
+ <module name="MissingSwitchDefault"/>
59
+ <module name="EqualsHashCode"/>
60
+ <module name="StringLiteralEquality"/>
61
+ </module>
62
+ </module>
@@ -92,6 +92,63 @@
92
92
  <groupId>org.springframework.boot</groupId>
93
93
  <artifactId>spring-boot-maven-plugin</artifactId>
94
94
  </plugin>
95
+
96
+ <!--
97
+ Checkstyle: enforces naming, structure, JavaDoc rules from
98
+ docs/03-工程规范与研发基础设施/coding-style-java.md.
99
+ Aborts the build on violations during `mvn verify`.
100
+ -->
101
+ <plugin>
102
+ <groupId>org.apache.maven.plugins</groupId>
103
+ <artifactId>maven-checkstyle-plugin</artifactId>
104
+ <version>3.5.0</version>
105
+ <configuration>
106
+ <configLocation>checkstyle.xml</configLocation>
107
+ <consoleOutput>true</consoleOutput>
108
+ <failsOnError>true</failsOnError>
109
+ <linkXRef>false</linkXRef>
110
+ </configuration>
111
+ <executions>
112
+ <execution>
113
+ <id>verify-checkstyle</id>
114
+ <phase>verify</phase>
115
+ <goals>
116
+ <goal>check</goal>
117
+ </goals>
118
+ </execution>
119
+ </executions>
120
+ </plugin>
121
+
122
+ <!--
123
+ Spotless: format checker (Google Java Format AOSP style).
124
+ `mvn spotless:check` is wired into verify; run
125
+ `mvn spotless:apply` locally to auto-format.
126
+ -->
127
+ <plugin>
128
+ <groupId>com.diffplug.spotless</groupId>
129
+ <artifactId>spotless-maven-plugin</artifactId>
130
+ <version>2.43.0</version>
131
+ <configuration>
132
+ <java>
133
+ <googleJavaFormat>
134
+ <version>1.22.0</version>
135
+ <style>AOSP</style>
136
+ </googleJavaFormat>
137
+ <removeUnusedImports/>
138
+ <trimTrailingWhitespace/>
139
+ <endWithNewline/>
140
+ </java>
141
+ </configuration>
142
+ <executions>
143
+ <execution>
144
+ <id>verify-spotless</id>
145
+ <phase>verify</phase>
146
+ <goals>
147
+ <goal>check</goal>
148
+ </goals>
149
+ </execution>
150
+ </executions>
151
+ </plugin>
95
152
  </plugins>
96
153
  </build>
97
154
  </project>
@@ -1,5 +1,5 @@
1
1
  name: server-java
2
- version: 1.1.0
2
+ version: 1.2.0
3
3
  appliesWhen:
4
4
  backend: java
5
5
  priority: 30
@@ -19,6 +19,9 @@ files:
19
19
  - from: files/application-test.yaml
20
20
  to: server/src/test/resources/application-test.yaml
21
21
  render: false
22
+ - from: files/checkstyle.xml
23
+ to: server/checkstyle.xml
24
+ render: true
22
25
  - from: files/generated-gitkeep
23
26
  to: server/generated/.gitkeep
24
27
  render: false
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ESLint configuration for the Node + TypeScript server.
3
+ *
4
+ * Source of truth referenced by:
5
+ * docs/03-工程规范与研发基础设施/coding-style-typescript.md
6
+ */
7
+ module.exports = {
8
+ root: true,
9
+ env: { node: true, es2022: true },
10
+ parser: '@typescript-eslint/parser',
11
+ parserOptions: { ecmaVersion: 2022, sourceType: 'module' },
12
+ plugins: ['@typescript-eslint'],
13
+ extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
14
+ rules: {
15
+ '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
16
+ '@typescript-eslint/no-explicit-any': 'warn',
17
+ '@typescript-eslint/consistent-type-imports': 'warn',
18
+ },
19
+ ignorePatterns: ['dist', 'node_modules', 'generated'],
20
+ };
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/prettierrc",
3
+ "printWidth": 100,
4
+ "tabWidth": 2,
5
+ "useTabs": false,
6
+ "semi": true,
7
+ "singleQuote": true,
8
+ "trailingComma": "all",
9
+ "bracketSpacing": true,
10
+ "arrowParens": "always",
11
+ "endOfLine": "lf"
12
+ }
@@ -4,6 +4,19 @@
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
7
- "start": "node src/index.js"
7
+ "start": "node src/index.js",
8
+ "typecheck": "tsc --noEmit",
9
+ "lint": "eslint src --ext .ts",
10
+ "format": "prettier --write \"src/**/*.ts\"",
11
+ "format:check": "prettier --check \"src/**/*.ts\"",
12
+ "test": "echo \"add tests with vitest or jest\" && exit 0"
13
+ },
14
+ "devDependencies": {
15
+ "@types/node": "^20.14.10",
16
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
17
+ "@typescript-eslint/parser": "^7.18.0",
18
+ "eslint": "^8.57.0",
19
+ "prettier": "^3.3.3",
20
+ "typescript": "^5.5.4"
8
21
  }
9
22
  }
@@ -1,5 +1,5 @@
1
1
  name: server-node
2
- version: 1.0.0
2
+ version: 1.1.0
3
3
  appliesWhen:
4
4
  backend: node
5
5
  priority: 30
@@ -13,6 +13,12 @@ files:
13
13
  - from: files/src-index.ts
14
14
  to: server/src/index.ts
15
15
  render: false
16
+ - from: files/_eslintrc.cjs
17
+ to: server/.eslintrc.cjs
18
+ render: false
19
+ - from: files/_prettierrc
20
+ to: server/.prettierrc
21
+ render: false
16
22
  - from: files/generated-gitkeep
17
23
  to: server/generated/.gitkeep
18
24
  render: false
@@ -3,3 +3,47 @@ name = "<%= it.options.projectName %>-server"
3
3
  version = "0.1.0"
4
4
  requires-python = ">=3.11"
5
5
  dependencies = []
6
+
7
+ [project.optional-dependencies]
8
+ dev = [
9
+ "ruff>=0.6.8",
10
+ "mypy>=1.11.0",
11
+ "pytest>=8.3.0",
12
+ "pip-audit>=2.7.0",
13
+ ]
14
+
15
+ # ruff: linter + formatter (single-tool replacement for black + isort + flake8).
16
+ # Source of truth referenced by docs/03-工程规范与研发基础设施/coding-style-python.md.
17
+ [tool.ruff]
18
+ line-length = 100
19
+ target-version = "py311"
20
+ extend-exclude = ["generated", ".venv"]
21
+
22
+ [tool.ruff.lint]
23
+ select = [
24
+ "E", # pycodestyle errors
25
+ "F", # pyflakes
26
+ "W", # pycodestyle warnings
27
+ "I", # isort
28
+ "B", # flake8-bugbear
29
+ "UP", # pyupgrade
30
+ "N", # pep8-naming
31
+ ]
32
+ ignore = []
33
+
34
+ [tool.ruff.format]
35
+ quote-style = "double"
36
+ indent-style = "space"
37
+ line-ending = "lf"
38
+
39
+ # mypy: strict-ish type checking. Adjust per module if a 3rd-party
40
+ # library has poor stubs.
41
+ [tool.mypy]
42
+ python_version = "3.11"
43
+ strict_optional = true
44
+ disallow_untyped_defs = true
45
+ warn_unused_ignores = true
46
+ exclude = ["generated", ".venv"]
47
+
48
+ [tool.pytest.ini_options]
49
+ testpaths = ["tests"]
@@ -0,0 +1,34 @@
1
+ /**
2
+ * ESLint configuration for the React + TypeScript web app.
3
+ *
4
+ * Source of truth referenced by:
5
+ * docs/03-工程规范与研发基础设施/coding-style-typescript.md
6
+ *
7
+ * Adjust rules with care; CI runs `eslint .` and aborts on errors.
8
+ */
9
+ module.exports = {
10
+ root: true,
11
+ env: { browser: true, es2022: true },
12
+ parser: '@typescript-eslint/parser',
13
+ parserOptions: {
14
+ ecmaVersion: 2022,
15
+ sourceType: 'module',
16
+ ecmaFeatures: { jsx: true },
17
+ },
18
+ plugins: ['@typescript-eslint', 'react', 'react-hooks'],
19
+ extends: [
20
+ 'eslint:recommended',
21
+ 'plugin:@typescript-eslint/recommended',
22
+ 'plugin:react/recommended',
23
+ 'plugin:react-hooks/recommended',
24
+ ],
25
+ settings: { react: { version: 'detect' } },
26
+ rules: {
27
+ 'react/react-in-jsx-scope': 'off',
28
+ 'react/prop-types': 'off',
29
+ '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
30
+ '@typescript-eslint/no-explicit-any': 'warn',
31
+ '@typescript-eslint/consistent-type-imports': 'warn',
32
+ },
33
+ ignorePatterns: ['dist', 'node_modules', 'generated'],
34
+ };
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/prettierrc",
3
+ "printWidth": 100,
4
+ "tabWidth": 2,
5
+ "useTabs": false,
6
+ "semi": true,
7
+ "singleQuote": true,
8
+ "trailingComma": "all",
9
+ "bracketSpacing": true,
10
+ "arrowParens": "always",
11
+ "endOfLine": "lf"
12
+ }
@@ -6,7 +6,11 @@
6
6
  "scripts": {
7
7
  "dev": "vite",
8
8
  "build": "tsc -b && vite build",
9
- "preview": "vite preview"
9
+ "preview": "vite preview",
10
+ "typecheck": "tsc --noEmit",
11
+ "lint": "eslint . --ext .ts,.tsx",
12
+ "format": "prettier --write \"src/**/*.{ts,tsx,css,json}\"",
13
+ "format:check": "prettier --check \"src/**/*.{ts,tsx,css,json}\""
10
14
  },
11
15
  "dependencies": {
12
16
  "antd": "^5.21.0",
@@ -18,7 +22,13 @@
18
22
  "devDependencies": {
19
23
  "@types/react": "^18.3.10",
20
24
  "@types/react-dom": "^18.3.0",
25
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
26
+ "@typescript-eslint/parser": "^7.18.0",
21
27
  "@vitejs/plugin-react": "^4.3.1",
28
+ "eslint": "^8.57.0",
29
+ "eslint-plugin-react": "^7.36.1",
30
+ "eslint-plugin-react-hooks": "^4.6.2",
31
+ "prettier": "^3.3.3",
22
32
  "typescript": "^5.6.2",
23
33
  "vite": "^5.4.8"
24
34
  }
@@ -1,5 +1,5 @@
1
1
  name: web-react
2
- version: 1.1.0
2
+ version: 1.2.0
3
3
  appliesWhen:
4
4
  frontend: react
5
5
  priority: 30
@@ -25,6 +25,12 @@ files:
25
25
  - from: files/src-App.tsx
26
26
  to: web/src/App.tsx
27
27
  render: true
28
+ - from: files/_eslintrc.cjs
29
+ to: web/.eslintrc.cjs
30
+ render: false
31
+ - from: files/_prettierrc
32
+ to: web/.prettierrc
33
+ render: false
28
34
  - from: files/generated-gitkeep
29
35
  to: web/generated/.gitkeep
30
36
  render: false
@@ -0,0 +1,28 @@
1
+ /**
2
+ * ESLint configuration for the Vue + TypeScript web app.
3
+ *
4
+ * Source of truth referenced by:
5
+ * docs/03-工程规范与研发基础设施/coding-style-typescript.md
6
+ */
7
+ module.exports = {
8
+ root: true,
9
+ env: { browser: true, es2022: true, node: true },
10
+ parser: 'vue-eslint-parser',
11
+ parserOptions: {
12
+ parser: '@typescript-eslint/parser',
13
+ ecmaVersion: 2022,
14
+ sourceType: 'module',
15
+ },
16
+ plugins: ['@typescript-eslint'],
17
+ extends: [
18
+ 'eslint:recommended',
19
+ 'plugin:vue/vue3-recommended',
20
+ 'plugin:@typescript-eslint/recommended',
21
+ ],
22
+ rules: {
23
+ '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
24
+ '@typescript-eslint/no-explicit-any': 'warn',
25
+ 'vue/multi-word-component-names': 'off',
26
+ },
27
+ ignorePatterns: ['dist', 'node_modules', 'generated'],
28
+ };
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/prettierrc",
3
+ "printWidth": 100,
4
+ "tabWidth": 2,
5
+ "useTabs": false,
6
+ "semi": true,
7
+ "singleQuote": true,
8
+ "trailingComma": "all",
9
+ "bracketSpacing": true,
10
+ "arrowParens": "always",
11
+ "endOfLine": "lf"
12
+ }
@@ -1,5 +1,5 @@
1
1
  name: web-vue
2
- version: 1.0.0
2
+ version: 1.1.0
3
3
  appliesWhen:
4
4
  frontend: vue
5
5
  priority: 30
@@ -16,6 +16,12 @@ files:
16
16
  - from: files/src-main.ts
17
17
  to: web/src/main.ts
18
18
  render: false
19
+ - from: files/_eslintrc.cjs
20
+ to: web/.eslintrc.cjs
21
+ render: false
22
+ - from: files/_prettierrc
23
+ to: web/.prettierrc
24
+ render: false
19
25
  - from: files/generated-gitkeep
20
26
  to: web/generated/.gitkeep
21
27
  render: false