feng3d-cli 0.0.2 → 0.0.4

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 (45) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +0 -2
  3. package/dist/cli.js +10 -0
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/create.d.ts.map +1 -1
  6. package/dist/commands/create.js +9 -2
  7. package/dist/commands/create.js.map +1 -1
  8. package/dist/commands/oss.d.ts.map +1 -1
  9. package/dist/commands/oss.js +26 -1
  10. package/dist/commands/oss.js.map +1 -1
  11. package/dist/commands/update.d.ts +10 -0
  12. package/dist/commands/update.d.ts.map +1 -1
  13. package/dist/commands/update.js +442 -24
  14. package/dist/commands/update.js.map +1 -1
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/templates.d.ts +56 -3
  20. package/dist/templates.d.ts.map +1 -1
  21. package/dist/templates.js +95 -7
  22. package/dist/templates.js.map +1 -1
  23. package/dist/types/config.d.ts +111 -0
  24. package/dist/types/config.d.ts.map +1 -0
  25. package/dist/types/config.js +50 -0
  26. package/dist/types/config.js.map +1 -0
  27. package/dist/versions.d.ts +2 -0
  28. package/dist/versions.d.ts.map +1 -1
  29. package/dist/versions.js +6 -0
  30. package/dist/versions.js.map +1 -1
  31. package/package.json +81 -64
  32. package/schemas/feng3d.schema.json +191 -0
  33. package/templates/.cursorrules +97 -17
  34. package/templates/.github/workflows/pages.yml +93 -0
  35. package/templates/.github/workflows/publish.yml +128 -0
  36. package/templates/.github/workflows/pull-request.yml +36 -0
  37. package/templates/.husky/pre-commit +2 -0
  38. package/templates/.vscode/settings.json +10 -0
  39. package/templates/LICENSE +15 -0
  40. package/templates/eslint.config.js +116 -65
  41. package/templates/feng3d.json +42 -0
  42. package/templates/gitignore +23 -0
  43. package/templates/test/_.test.ts +5 -0
  44. package/templates/tsconfig.json +14 -13
  45. package/templates/typedoc.json +2 -2
@@ -10,12 +10,12 @@ export default [
10
10
  // 忽略检查的文件和目录
11
11
  {
12
12
  ignores: [
13
- '**/node_modules/**',
14
- '**/dist/**',
15
- '**/lib/**',
16
- '**/public/**',
17
- '**/coverage/**',
18
- '**/.git/**',
13
+ '**/node_modules/**', // 忽略所有 node_modules 目录
14
+ '**/dist/**', // 忽略所有 dist 目录
15
+ '**/lib/**', // 忽略所有 lib 目录
16
+ '**/public/**', // 忽略所有 public 目录
17
+ '**/coverage/**', // 忽略所有 coverage 目录
18
+ '**/.git/**', // 忽略所有 .git 目录
19
19
  ],
20
20
  },
21
21
  // 使用 ESLint 推荐配置
@@ -25,84 +25,135 @@ export default [
25
25
  {
26
26
  // 语言选项配置
27
27
  languageOptions: {
28
+ // 全局变量配置
28
29
  globals: {
29
- ...globals.browser,
30
- ...globals.node,
31
- ...globals.es2021,
32
- global: false,
30
+ ...globals.browser, // 浏览器环境全局变量
31
+ ...globals.node, // Node.js 环境全局变量
32
+ ...globals.es2021, // ES2021 全局变量
33
+ global: false, // 禁用 global 全局变量
33
34
  },
35
+ // 解析器选项
34
36
  parserOptions: {
35
- ecmaVersion: 2021,
36
- sourceType: 'module',
37
- tsconfigRootDir: import.meta.dirname,
37
+ ecmaVersion: 2021, // 使用 ES2021 语法
38
+ sourceType: 'module', // 使用 ES 模块
39
+ tsconfigRootDir: import.meta.dirname, // 明确指定 tsconfig 根目录
38
40
  },
39
41
  },
40
42
  rules: {
41
- '@typescript-eslint/no-unused-vars': 'off',
42
- '@typescript-eslint/no-explicit-any': 'off',
43
- 'no-prototype-builtins': 'off',
44
- '@typescript-eslint/ban-ts-comment': 'off',
45
- '@typescript-eslint/no-unused-expressions': 'off',
46
- '@typescript-eslint/no-empty-object-type': 'off',
47
- '@typescript-eslint/no-unsafe-declaration-merging': 'off',
48
- '@typescript-eslint/no-unsafe-function-type': 'off',
49
- '@typescript-eslint/no-this-alias': 'off',
50
- 'prefer-const': 'off',
51
- 'no-fallthrough': 'off',
52
- 'no-constant-binary-expression': 'off',
43
+ '@typescript-eslint/no-unused-vars': 'off', // 允许未使用的变量
44
+ '@typescript-eslint/no-explicit-any': 'off', // 允许使用 any 类型
45
+ 'no-prototype-builtins': 'off', // 允许直接使用 Object.prototype 方法
46
+ '@typescript-eslint/ban-ts-comment': 'off', // 允许使用 @ts 注释
47
+ '@typescript-eslint/no-unused-expressions': 'off', // 允许未使用的表达式
48
+ '@typescript-eslint/no-empty-object-type': 'off', // 允许空对象类型
49
+ '@typescript-eslint/no-unsafe-declaration-merging': 'off', // 允许不安全的声明合并
50
+ '@typescript-eslint/no-unsafe-function-type': 'off', // 允许不安全的函数类型
51
+ '@typescript-eslint/no-this-alias': 'off', // 允许 this 别名
52
+ 'prefer-const': 'off', // 不强制使用 const
53
+ 'no-fallthrough': 'off', // 允许 fallthrough
54
+ 'no-constant-binary-expression': 'off', // 允许常量二进制表达式
53
55
 
54
56
  // 注释格式规则
55
57
  'spaced-comment': ['warn', 'always', {
56
- 'line': { 'markers': ['/'], 'exceptions': ['-', '+'] },
57
- 'block': { 'markers': ['!'], 'exceptions': ['*'], 'balanced': true },
58
+ 'line': {
59
+ 'markers': ['/'], // / 开头的注释需要空格
60
+ 'exceptions': ['-', '+'], // 允许以 - 和 + 开头的注释不需要空格
61
+ },
62
+ 'block': {
63
+ 'markers': ['!'], // 以 ! 开头的块级注释需要空格
64
+ 'exceptions': ['*'], // 允许以 * 开头的块级注释不需要空格
65
+ 'balanced': true, // 要求块级注释的 * 对齐
66
+ },
58
67
  }],
59
68
 
60
69
  // 空格和换行规则
61
- 'no-trailing-spaces': ['warn', { 'skipBlankLines': false, 'ignoreComments': false }],
62
- 'no-multiple-empty-lines': ['warn', { 'max': 1, 'maxEOF': 1, 'maxBOF': 0 }],
63
- 'lines-between-class-members': ['warn', 'always', { 'exceptAfterSingleLine': true }],
64
- 'padding-line-between-statements': [
70
+ 'no-trailing-spaces': ['warn', { // 禁止行尾空格
71
+ 'skipBlankLines': false, // 不跳过空行
72
+ 'ignoreComments': false, // 不忽略注释
73
+ }],
74
+ 'no-multiple-empty-lines': ['warn', { // 限制空行数量
75
+ 'max': 1, // 最多允许 1 个空行
76
+ 'maxEOF': 1, // 文件末尾最多 1 个空行
77
+ 'maxBOF': 0, // 文件开头不允许空行
78
+ }],
79
+ 'lines-between-class-members': ['warn', 'always', { // 类成员之间需要空行
80
+ 'exceptAfterSingleLine': true, // 单行成员后可以没有空行
81
+ }],
82
+ 'padding-line-between-statements': [ // 语句之间的空行规则
65
83
  'warn',
66
- { 'blankLine': 'always', 'prev': '*', 'next': 'return' },
67
- { 'blankLine': 'any', 'prev': ['const', 'let', 'var'], 'next': ['const', 'let', 'var'] },
84
+ { 'blankLine': 'always', 'prev': '*', 'next': 'return' }, // return 前需要空行
85
+ { 'blankLine': 'always', 'prev': ['const', 'let', 'var'], 'next': '*' }, // 变量声明后需要空行
86
+ { 'blankLine': 'any', 'prev': ['const', 'let', 'var'], 'next': ['const', 'let', 'var'] }, // 变量声明之间可以没有空行
68
87
  ],
69
88
 
70
- // 缩进规则 - 4 空格
71
- 'indent': ['warn', 4, {
72
- 'SwitchCase': 1,
73
- 'VariableDeclarator': 'first',
74
- 'outerIIFEBody': 1,
75
- 'MemberExpression': 1,
76
- 'FunctionDeclaration': { 'parameters': 1, 'body': 1 },
77
- 'FunctionExpression': { 'parameters': 1, 'body': 1 },
78
- 'CallExpression': { 'arguments': 1 },
79
- 'ArrayExpression': 1,
80
- 'ObjectExpression': 1,
81
- 'ImportDeclaration': 1,
82
- 'flatTernaryExpressions': false,
83
- 'ignoreComments': false,
89
+ // 缩进规则
90
+ 'indent': ['warn', 4, { // 使用 4 空格缩进
91
+ 'SwitchCase': 1, // switch case 缩进 1 级
92
+ 'VariableDeclarator': 'first', // 变量声明对齐到第一个变量
93
+ 'outerIIFEBody': 1, // 外层 IIFE 缩进 1 级
94
+ 'MemberExpression': 1, // 成员表达式缩进 1 级
95
+ 'FunctionDeclaration': { // 函数声明缩进规则
96
+ 'parameters': 1, // 参数缩进 1
97
+ 'body': 1, // 函数体缩进 1
98
+ },
99
+ 'FunctionExpression': { // 函数表达式缩进规则
100
+ 'parameters': 1, // 参数缩进 1 级
101
+ 'body': 1, // 函数体缩进 1 级
102
+ },
103
+ 'CallExpression': { // 函数调用缩进规则
104
+ 'arguments': 1, // 参数缩进 1 级
105
+ },
106
+ 'ArrayExpression': 1, // 数组表达式缩进 1 级
107
+ 'ObjectExpression': 1, // 对象表达式缩进 1 级
108
+ 'ImportDeclaration': 1, // import 声明缩进 1 级
109
+ 'flatTernaryExpressions': false, // 不扁平化三元表达式
110
+ 'ignoreComments': false, // 不忽略注释
84
111
  }],
85
112
 
86
- // 引号规则 - 单引号
87
- 'quotes': ['warn', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }],
113
+ // 引号规则
114
+ 'quotes': ['warn', 'single', { // 使用单引号
115
+ 'avoidEscape': true, // 允许使用转义字符
116
+ 'allowTemplateLiterals': true, // 允许使用模板字符串
117
+ }],
88
118
 
89
119
  // 其他格式规则
90
- 'semi': ['off'],
91
- 'comma-dangle': ['warn', 'always-multiline'],
92
- 'object-curly-spacing': ['warn', 'always'],
93
- 'array-bracket-spacing': ['warn', 'never'],
94
- 'arrow-spacing': ['warn', { 'before': true, 'after': true }],
95
- 'block-spacing': ['warn', 'always'],
96
- 'comma-spacing': ['warn', { 'before': false, 'after': true }],
97
- 'comma-style': ['warn', 'last'],
98
- 'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true }],
99
- 'keyword-spacing': ['warn', { 'before': true, 'after': true }],
100
- 'space-before-blocks': ['warn', 'always'],
101
- 'space-before-function-paren': ['warn', { 'anonymous': 'always', 'named': 'never', 'asyncArrow': 'always' }],
102
- 'space-in-parens': ['warn', 'never'],
103
- 'space-infix-ops': ['warn'],
104
- 'space-unary-ops': ['warn', { 'words': true, 'nonwords': false }],
120
+ 'semi': ['off'], // 要求使用分号
121
+ 'comma-dangle': ['warn', 'always-multiline'], // 多行时要求尾随逗号
122
+ 'object-curly-spacing': ['warn', 'always'], // 对象括号内要求空格
123
+ 'array-bracket-spacing': ['warn', 'never'], // 数组括号内不允许空格
124
+ 'arrow-spacing': ['warn', { // 箭头函数空格规则
125
+ 'before': true, // 箭头前需要空格
126
+ 'after': true, // 箭头后需要空格
127
+ }],
128
+ 'block-spacing': ['warn', 'always'], // 块级代码需要空格
129
+ 'brace-style': ['warn', 'allman', { // 大括号风格
130
+ 'allowSingleLine': false, // 不允许单行大括号
131
+ }],
132
+ 'comma-spacing': ['warn', { // 逗号空格规则
133
+ 'before': false, // 逗号前不允许空格
134
+ 'after': true, // 逗号后需要空格
135
+ }],
136
+ 'comma-style': ['warn', 'last'], // 逗号放在行尾
137
+ 'key-spacing': ['warn', { // 对象键值对空格规则
138
+ 'beforeColon': false, // 冒号前不允许空格
139
+ 'afterColon': true, // 冒号后需要空格
140
+ }],
141
+ 'keyword-spacing': ['warn', { // 关键字空格规则
142
+ 'before': true, // 关键字前需要空格
143
+ 'after': true, // 关键字后需要空格
144
+ }],
145
+ 'space-before-blocks': ['warn', 'always'], // 块级代码前需要空格
146
+ 'space-before-function-paren': ['warn', { // 函数括号前空格规则
147
+ 'anonymous': 'always', // 匿名函数括号前需要空格
148
+ 'named': 'never', // 命名函数括号前不允许空格
149
+ 'asyncArrow': 'always', // 异步箭头函数括号前需要空格
150
+ }],
151
+ 'space-in-parens': ['warn', 'never'], // 括号内不允许空格
152
+ 'space-infix-ops': ['warn'], // 操作符前后需要空格
153
+ 'space-unary-ops': ['warn', { // 一元操作符空格规则
154
+ 'words': true, // 单词类操作符需要空格
155
+ 'nonwords': false, // 非单词类操作符不需要空格
156
+ }],
105
157
  },
106
158
  },
107
159
  ];
108
-
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "./node_modules/feng3d-cli/schemas/feng3d.schema.json",
3
+ "name": "{{name}}",
4
+ "eslint": {
5
+ "enabled": true,
6
+ "ignores": [],
7
+ "rules": {}
8
+ },
9
+ "vitest": {
10
+ "enabled": true,
11
+ "testTimeout": 0
12
+ },
13
+ "typedoc": {
14
+ "enabled": true,
15
+ "outDir": "public"
16
+ },
17
+ "oss": {
18
+ "localDir": "./public",
19
+ "ossDir": ""
20
+ },
21
+ "templates": {
22
+ "examples": true,
23
+ "test": true
24
+ },
25
+ "update": {
26
+ "config": true,
27
+ "eslint": true,
28
+ "gitignore": true,
29
+ "cursorrules": true,
30
+ "publish": true,
31
+ "pages": true,
32
+ "pullRequest": true,
33
+ "typedoc": true,
34
+ "test": true,
35
+ "deps": true,
36
+ "husky": true,
37
+ "license": true,
38
+ "vscode": true,
39
+ "tsconfig": true
40
+ }
41
+ }
42
+
@@ -0,0 +1,23 @@
1
+ node_modules
2
+ package-lock.json
3
+ dist
4
+ lib
5
+ public
6
+ out
7
+ # 自动生成的测试配置文件
8
+ **/test-config.ts
9
+ # 测试构建输出目录
10
+ test_dist
11
+ # 测试覆盖率
12
+ coverage
13
+
14
+ # 以下文件可由 feng3d-cli 自动生成,无需提交
15
+ # 运行 `feng3d-cli update` 可重新生成
16
+ feng3d.json
17
+ .cursorrules
18
+ eslint.config.js
19
+ typedoc.json
20
+ test/_.test.ts
21
+ .husky/pre-commit
22
+ .vscode/settings.json
23
+ tsconfig.json
@@ -0,0 +1,5 @@
1
+ import { test } from 'vitest';
2
+
3
+ test('_', () =>
4
+ { });
5
+
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "ES5",
4
- "module": "CommonJS",
5
- "noImplicitAny": false,
6
- "sourceMap": true,
7
- "declarationMap": true,
8
- "declaration": true,
9
- "experimentalDecorators": true,
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
10
7
  "emitDeclarationOnly": true,
11
- "skipLibCheck": true,
8
+ "declaration": true,
9
+ "declarationMap": true,
10
+ "outDir": "lib",
12
11
  "esModuleInterop": true,
13
- "downlevelIteration": true,
14
- "lib": ["ES2015", "ES2017", "ES2020", "DOM"],
15
- "outDir": "lib"
12
+ "allowSyntheticDefaultImports": true,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "skipLibCheck": true,
15
+ "resolveJsonModule": true,
16
+ "isolatedModules": true
16
17
  },
17
- "include": ["src/**/*.ts"]
18
+ "include": ["src/**/*.ts"],
19
+ "exclude": ["node_modules", "dist", "lib", "public"]
18
20
  }
19
-
@@ -1,8 +1,8 @@
1
1
  {
2
- "name": "{{name}}",
3
2
  "$schema": "https://typedoc.org/schema.json",
4
3
  "entryPoints": ["src/index.ts"],
5
4
  "sourceLinkTemplate": "https://github.com/feng3d-labs/{{repoName}}/tree/master/{path}#L{line}",
6
- "out": "public/docs"
5
+ "out": "public",
6
+ "includeVersion": true
7
7
  }
8
8