@winjs-dev/create-win 1.0.0-alpha.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.
Files changed (150) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +195 -0
  3. package/bin/create-win.js +4 -0
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +23 -0
  6. package/dist/index.d.ts +45 -0
  7. package/dist/index.js +396 -0
  8. package/dist/template.d.ts +13 -0
  9. package/dist/template.js +123 -0
  10. package/package.json +36 -0
  11. package/templates/app/.cursor/rules/clean-code.mdc +55 -0
  12. package/templates/app/.cursor/rules/general.mdc +51 -0
  13. package/templates/app/.cursor/rules/git-conventional-commit-messages.mdc +127 -0
  14. package/templates/app/.cursor/rules/gitflow.mdc +111 -0
  15. package/templates/app/.cursor/rules/project-structure.mdc +69 -0
  16. package/templates/app/.cursor/rules/typescript.mdc +57 -0
  17. package/templates/app/.cursor/rules/vue.mdc +86 -0
  18. package/templates/app/.editorconfig.tpl +23 -0
  19. package/templates/app/.eslintignore +13 -0
  20. package/templates/app/.eslintrc.js +9 -0
  21. package/templates/app/.gitignore.tpl +55 -0
  22. package/templates/app/.husky/commit-msg +6 -0
  23. package/templates/app/.husky/pre-commit +5 -0
  24. package/templates/app/.lintstagedrc.tpl +5 -0
  25. package/templates/app/.npmrc.tpl +2 -0
  26. package/templates/app/.prettierignore +13 -0
  27. package/templates/app/.prettierrc.js +4 -0
  28. package/templates/app/.stylelintignore +6 -0
  29. package/templates/app/.stylelintrc.js +16 -0
  30. package/templates/app/.winrc.ts.tpl +95 -0
  31. package/templates/app/README.md +244 -0
  32. package/templates/app/commitlint.config.js +3 -0
  33. package/templates/app/f2elint.config.js +6 -0
  34. package/templates/app/package.json.tpl +34 -0
  35. package/templates/app/plugin.ts.tpl +23 -0
  36. package/templates/app/src/app.js +55 -0
  37. package/templates/app/src/assets/fonts/demo.css +412 -0
  38. package/templates/app/src/assets/fonts/demo_fontclass.html +42 -0
  39. package/templates/app/src/assets/fonts/demo_symbol.html +69 -0
  40. package/templates/app/src/assets/fonts/demo_unicode.html +77 -0
  41. package/templates/app/src/assets/fonts/iconfont.css +20 -0
  42. package/templates/app/src/assets/fonts/iconfont.eot +0 -0
  43. package/templates/app/src/assets/fonts/iconfont.js +96 -0
  44. package/templates/app/src/assets/fonts/iconfont.svg +36 -0
  45. package/templates/app/src/assets/fonts/iconfont.ttf +0 -0
  46. package/templates/app/src/assets/fonts/iconfont.woff +0 -0
  47. package/templates/app/src/assets/img/logo.png +0 -0
  48. package/templates/app/src/assets/js/.gitkeep +0 -0
  49. package/templates/app/src/assets/style/app.less +5 -0
  50. package/templates/app/src/assets/style/main.less +39 -0
  51. package/templates/app/src/assets/style/variable.less +53 -0
  52. package/templates/app/src/constant.js +5 -0
  53. package/templates/app/src/global.less +1 -0
  54. package/templates/app/src/icons/cat.svg +1 -0
  55. package/templates/app/src/icons/dog.svg +1 -0
  56. package/templates/app/src/layouts/index.vue +15 -0
  57. package/templates/app/src/pages/docs.vue +5 -0
  58. package/templates/app/src/pages/hello/index.vue +88 -0
  59. package/templates/app/src/pages/hello/style.less +41 -0
  60. package/templates/app/src/pages/index.vue +9 -0
  61. package/templates/app/src/services/RESTFULURL.js +3 -0
  62. package/templates/app/src/services/autoMatchBaseUrl.js +18 -0
  63. package/templates/app/src/services/index.js +11 -0
  64. package/templates/app/src/services/request.js +178 -0
  65. package/templates/app/tsconfig.json.tpl +3 -0
  66. package/templates/app/typings.d.ts +1 -0
  67. package/templates/pc/.cursor/rules/clean-code.mdc +55 -0
  68. package/templates/pc/.cursor/rules/general.mdc +51 -0
  69. package/templates/pc/.cursor/rules/git-conventional-commit-messages.mdc +127 -0
  70. package/templates/pc/.cursor/rules/gitflow.mdc +111 -0
  71. package/templates/pc/.cursor/rules/project-structure.mdc +69 -0
  72. package/templates/pc/.cursor/rules/typescript.mdc +57 -0
  73. package/templates/pc/.cursor/rules/vue.mdc +86 -0
  74. package/templates/pc/.editorconfig.tpl +23 -0
  75. package/templates/pc/.eslintignore +13 -0
  76. package/templates/pc/.eslintrc.js +9 -0
  77. package/templates/pc/.gitignore.tpl +54 -0
  78. package/templates/pc/.husky/commit-msg +6 -0
  79. package/templates/pc/.husky/pre-commit +5 -0
  80. package/templates/pc/.lintstagedrc.tpl +5 -0
  81. package/templates/pc/.npmrc.tpl +2 -0
  82. package/templates/pc/.prettierignore +13 -0
  83. package/templates/pc/.prettierrc.js +4 -0
  84. package/templates/pc/.stylelintignore +6 -0
  85. package/templates/pc/.stylelintrc.js +16 -0
  86. package/templates/pc/.winrc.ts.tpl +74 -0
  87. package/templates/pc/README.md +255 -0
  88. package/templates/pc/commitlint.config.js +3 -0
  89. package/templates/pc/f2elint.config.js +6 -0
  90. package/templates/pc/package.json.tpl +33 -0
  91. package/templates/pc/plugin.ts.tpl +23 -0
  92. package/templates/pc/src/app.js +55 -0
  93. package/templates/pc/src/assets/fonts/demo.css +412 -0
  94. package/templates/pc/src/assets/fonts/demo_fontclass.html +42 -0
  95. package/templates/pc/src/assets/fonts/demo_symbol.html +69 -0
  96. package/templates/pc/src/assets/fonts/demo_unicode.html +77 -0
  97. package/templates/pc/src/assets/fonts/iconfont.css +20 -0
  98. package/templates/pc/src/assets/fonts/iconfont.eot +0 -0
  99. package/templates/pc/src/assets/fonts/iconfont.js +96 -0
  100. package/templates/pc/src/assets/fonts/iconfont.svg +36 -0
  101. package/templates/pc/src/assets/fonts/iconfont.ttf +0 -0
  102. package/templates/pc/src/assets/fonts/iconfont.woff +0 -0
  103. package/templates/pc/src/assets/img/logo.png +0 -0
  104. package/templates/pc/src/assets/js/.gitkeep +0 -0
  105. package/templates/pc/src/assets/style/app.less +5 -0
  106. package/templates/pc/src/assets/style/main.less +39 -0
  107. package/templates/pc/src/assets/style/variable.less +53 -0
  108. package/templates/pc/src/constant.js +5 -0
  109. package/templates/pc/src/global.less +1 -0
  110. package/templates/pc/src/icons/cat.svg +1 -0
  111. package/templates/pc/src/icons/dog.svg +1 -0
  112. package/templates/pc/src/layouts/index.vue +16 -0
  113. package/templates/pc/src/pages/docs.vue +5 -0
  114. package/templates/pc/src/pages/hello/index.vue +88 -0
  115. package/templates/pc/src/pages/hello/style.less +41 -0
  116. package/templates/pc/src/pages/index.vue +9 -0
  117. package/templates/pc/src/services/RESTFULURL.js +3 -0
  118. package/templates/pc/src/services/autoMatchBaseUrl.js +18 -0
  119. package/templates/pc/src/services/index.js +11 -0
  120. package/templates/pc/src/services/request.js +178 -0
  121. package/templates/pc/tsconfig.json.tpl +3 -0
  122. package/templates/pc/typings.d.ts +1 -0
  123. package/templates/plugin/.fatherrc.ts +5 -0
  124. package/templates/plugin/.gitignore.tpl +2 -0
  125. package/templates/plugin/.npmrc.tpl +2 -0
  126. package/templates/plugin/README.md.tpl +29 -0
  127. package/templates/plugin/package.json.tpl +26 -0
  128. package/templates/plugin/src/index.ts.tpl +5 -0
  129. package/templates/plugin/tsconfig.json +19 -0
  130. package/templates/sample/.cursor/rules/clean-code.mdc +55 -0
  131. package/templates/sample/.cursor/rules/general.mdc +51 -0
  132. package/templates/sample/.cursor/rules/git-conventional-commit-messages.mdc +127 -0
  133. package/templates/sample/.cursor/rules/gitflow.mdc +111 -0
  134. package/templates/sample/.cursor/rules/project-structure.mdc +69 -0
  135. package/templates/sample/.cursor/rules/typescript.mdc +57 -0
  136. package/templates/sample/.cursor/rules/vue.mdc +86 -0
  137. package/templates/sample/.editorconfig.tpl +23 -0
  138. package/templates/sample/.gitignore.tpl +19 -0
  139. package/templates/sample/.npmrc.tpl +2 -0
  140. package/templates/sample/.winrc.ts.tpl +7 -0
  141. package/templates/sample/package.json.tpl +21 -0
  142. package/templates/sample/plugin.ts.tpl +7 -0
  143. package/templates/sample/src/assets/img/logo.png +0 -0
  144. package/templates/sample/src/layouts/index.vue +8 -0
  145. package/templates/sample/src/pages/docs.vue +5 -0
  146. package/templates/sample/src/pages/hello/index.vue +77 -0
  147. package/templates/sample/src/pages/hello/style.less +41 -0
  148. package/templates/sample/src/pages/index.vue +9 -0
  149. package/templates/sample/tsconfig.json.tpl +3 -0
  150. package/templates/sample/typings.d.ts +1 -0
@@ -0,0 +1,55 @@
1
+ ---
2
+ description: Guidelines for writing clean, maintainable, and human-readable code. Apply these rules when writing or reviewing code to ensure consistency and quality.
3
+ globs:
4
+ ---
5
+ # Clean Code Guidelines
6
+
7
+ ## Constants Over Magic Numbers
8
+ - Replace hard-coded values with named constants
9
+ - Use descriptive constant names that explain the value's purpose
10
+ - Keep constants at the top of the file or in a dedicated constants file
11
+
12
+ ## Meaningful Names
13
+ - Variables, functions, and classes should reveal their purpose
14
+ - Names should explain why something exists and how it's used
15
+ - Avoid abbreviations unless they're universally understood
16
+
17
+ ## Smart Comments
18
+ - Don't comment on what the code does - make the code self-documenting
19
+ - Use comments to explain why something is done a certain way
20
+ - Document APIs, complex algorithms, and non-obvious side effects
21
+
22
+ ## Single Responsibility
23
+ - Each function should do exactly one thing
24
+ - Functions should be small and focused
25
+ - If a function needs a comment to explain what it does, it should be split
26
+
27
+ ## DRY (Don't Repeat Yourself)
28
+ - Extract repeated code into reusable functions
29
+ - Share common logic through proper abstraction
30
+ - Maintain single sources of truth
31
+
32
+ ## Clean Structure
33
+ - Keep related code together
34
+ - Organize code in a logical hierarchy
35
+ - Use consistent file and folder naming conventions
36
+
37
+ ## Encapsulation
38
+ - Hide implementation details
39
+ - Expose clear interfaces
40
+ - Move nested conditionals into well-named functions
41
+
42
+ ## Code Quality Maintenance
43
+ - Refactor continuously
44
+ - Fix technical debt early
45
+ - Leave code cleaner than you found it
46
+
47
+ ## Testing
48
+ - Write tests before fixing bugs
49
+ - Keep tests readable and maintainable
50
+ - Test edge cases and error conditions
51
+
52
+ ## Version Control
53
+ - Write clear commit messages
54
+ - Make small, focused commits
55
+ - Use meaningful branch names
@@ -0,0 +1,51 @@
1
+ ---
2
+ description: WinJS 前端编码通用规则
3
+ globs: ["**/*.js", "**/*.ts", "**/*.vue" ] # 适用的文件模式
4
+ alwaysApply: false # 是否始终应用
5
+ ---
6
+
7
+ ## 角色
8
+ 你是一名资深前端开发工程师,并且是 Vue2/3、NuxtJS、JavaScript、TypeScript、HTML、CSS以及现代用户界面/用户体验框架(例如TailwindCSS、ShadcnUI、Radix、Element-UI、VantUI、AntDesignUI、VuetifyUI、BootstrapUI、MaterialUI、MantineUI、ChakraUI、HeadlessUI、SkeletonUI、QuasarUI、IonicUI、FluentUI、SemanticUI、IcoMoonUI、IcoFontUI、FontAwesomeUI、EvaIconsUI、MaterialIconsUI、TablerIconsUI、BoxIconsUI)方面的专家。你思维缜密,能够给出细致入微的答案,并且在推理方面才华出众。你会认真地提供准确、真实、周全的答案,是推理方面的天才。
9
+
10
+ 你应始终遵循一下规则:
11
+
12
+ ## 编写代码时:
13
+ - 仔细且严格地遵循用户的要求。
14
+ - 首先要逐步思考——用伪代码详细描述你要构建内容的计划。
15
+ - 确认计划后,再编写代码!- 始终编写正确的、符合最佳实践的、遵循DRY原则(不要重复自己)的、无错误的、功能完备且能正常运行的代码,同时代码应符合下面"代码实现指南"中列出的规则。
16
+ - 相比于追求性能,更要专注于编写简洁易读的代码。
17
+ - 完整实现所有要求的功能。
18
+ - 不要留下待办事项、占位符或缺失的部分。
19
+ - 确保代码是完整的!要彻底检查并最终确定。
20
+ - 包含所有必需的导入,并确保关键组件的命名恰当。
21
+ - 简洁明了,尽量减少其他不必要的文字表述。
22
+ - 如果你认为可能不存在正确答案,要如实说明。
23
+ - 如果你不知道答案,直接说明,而不要猜测。
24
+ - 代码结构:强调代码的清晰性、模块化、可维护性,遵循最佳实践(如 DRY 原则、最小权限原则、响应式设计等)。
25
+ - 代码安全性:在编写代码时,始终考虑安全性,避免引入漏洞,确保用户输入的安全处理。
26
+ - 性能优化:优化代码的性能,减少资源占用,提升加载速度,确保项目的高效运行。
27
+ - 测试与文档:编写单元测试,确保代码的健壮性,并提供清晰的中文注释和文档,方便后续阅读和维护。
28
+
29
+ ## 技术栈:
30
+ - ReactJS
31
+ - VueJS
32
+ - NextJS
33
+ - NuxtJS
34
+ - JavaScript
35
+ - TypeScript
36
+ - TailwindCSS
37
+ - HTML
38
+ - CSS
39
+
40
+ ## 代码实现指南编写代码时请遵循以下规则:
41
+ - 尽可能使用提前返回(early returns),以使代码更具可读性。
42
+ - 始终使用Tailwind类来设置HTML元素的样式;避免使用CSS或标签样式。
43
+ - 只要有可能,在类标签中使用"class:"而不是三元运算符。
44
+ - 使用描述性的变量和函数/常量名称。此外,事件函数应以"handle"作为前缀命名,例如,onClick事件对应的函数命名为"handleClick",onKeyDown事件对应的函数命名为"handleKeyDown"。
45
+ - 在元素上实现可访问性特性。例如,一个标签应该有tabindex="0"、aria-label、on:click和on:keydown等类似属性。
46
+ - 使用常量(const)而不是函数,例如,"const toggle = () =>"。并且,尽可能定义类型。
47
+
48
+ ## 规范
49
+ 1. 编码规范
50
+ - `.js/.ts/.vue/.jsx/.tsx`:使用`@winner-fed/f2elint`进行代码检查。
51
+ - `.js/.ts/.vue/.jsx/.tsx`:使用`prettier`进行代码格式化。
@@ -0,0 +1,127 @@
1
+ ---
2
+ description:
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Git 提交流程
8
+
9
+ # 步骤一
10
+ 进行 Code Review,若遇到 git 命令分页的情况,请加上`| cat`,分析是存在以下几种级别的问题:
11
+
12
+ ## 严重
13
+ - 分析是否包含敏感信息,如密码、密钥、证书等
14
+
15
+ ## 警告
16
+ - 分析是否有破坏性的代码改动,如有则需要全部列举出来
17
+ - 分析是否有明显的性能问题,进行说明并给出优化建议
18
+
19
+ ## 提醒
20
+ - 分析本次代码改动的影响范围,以简洁的语言进行描述
21
+ - 分析代码是否已经格式化
22
+
23
+
24
+ # 步骤二
25
+
26
+ ## 提交信息格式:
27
+
28
+ 提交信息应遵循以下格式:
29
+
30
+ ```
31
+ <type>(<scope>): <subject>
32
+
33
+ [optional body]
34
+
35
+ [optional footer(s)]
36
+ ```
37
+
38
+ 提交信息涉及换行时使用多个 -m 参数提交,如:
39
+
40
+ ```
41
+ git commit -m "feat(auth): 添加用户登录功能" -m "实现了基于 JWT 的用户登录认证功能:" -m "- 添加登录接口" -m "- 实现 token 生成和验证" -m "- 添加用户信息缓存" -m "Closes #123"
42
+ ```
43
+
44
+ ### type 类型包括:
45
+ - feat: 新功能 ✨
46
+ - fix: 修复 bug 🐛
47
+ - docs: 文档更新 📚
48
+ - style: 代码格式调整,不影响代码逻辑 🎨
49
+ - refactor: 重构代码,不修复 bug 也不添加新功能 🧹
50
+ - test: 添加或修改测试代码 🧪
51
+ - chore: 构建过程或辅助工具的变动 🔧
52
+
53
+ ### scope 范围包括:
54
+ - 模块名(如:auth、user、order、product等)
55
+ - 文件名(如:index、login、register等)
56
+ - 函数名(如:login、register、getUserInfo等)
57
+ - 组件名(如:Button、Input、Table等)
58
+ - 路由名(如:/login、/register、/user/:id等)
59
+ - 接口名(如:getUserInfo、createOrder等)
60
+ - 变量名(如:user、order、product等)
61
+ - 常量名(如:API_BASE_URL、API_TIMEOUT等)
62
+ - 枚举名(如:UserRole、OrderStatus等)
63
+ - 类型名(如:User、Order、Product等)
64
+ - 接口名(如:UserService、OrderService、ProductService等)
65
+ - 其他(如:config、env、utils等)
66
+
67
+ ### Subject 主题
68
+
69
+ - 用简短的语言描述本次提交的主要内容
70
+ - 不超过 50 个字符
71
+ - 以动词开头,使用第一人称现在时
72
+ - 第一个字母小写
73
+ - 结尾不加句号
74
+
75
+ ### Body 正文
76
+
77
+ - 对本次提交的详细描述
78
+ - 可以分成多行
79
+ - 说明代码变动的动机,以及与以前行为的对比
80
+
81
+ ### Footer 页脚
82
+
83
+ - 用于关联 Issue 或破坏性变更说明
84
+ - Breaking Changes 必须以 `BREAKING CHANGE:` 开头
85
+ - 关联 Issue 使用 `Closes #123, #456`
86
+
87
+ ## 示例
88
+
89
+ ```
90
+ feat(auth): 添加用户登录功能
91
+
92
+ 实现了基于 JWT 的用户登录认证功能:
93
+ - 添加登录接口
94
+ - 实现 token 生成和验证
95
+ - 添加用户信息缓存
96
+
97
+ Closes #123
98
+ ```
99
+
100
+ ```
101
+ fix(api): 修复用户查询接口返回错误
102
+
103
+ 修复了当用户不存在时返回 500 错误的问题,
104
+ 现在会正确返回 404 状态码。
105
+
106
+ Closes #456
107
+ ```
108
+
109
+ ## 规范详情
110
+
111
+ 本文档中的关键词 “必须(MUST)”、“不得(MUST NOT)”、“要求(REQUIRED)”、“应(SHALL)”、“不应(SHALL NOT)”、“应该(SHOULD)”、“不应该(SHOULD NOT)”、“推荐(RECOMMENDED)”、“可以(MAY)” 和 “可选(OPTIONAL)” 应按照 RFC 2119 中的描述进行解释。
112
+ 提交记录必须以一个类型作为前缀,该类型由一个名词(如 “feat”(新特性)、“fix”(修复)等)组成,后面可选择性地跟作用域、可选择性地跟 “!”,以及必须有的冒号和空格。
113
+ 当提交为你的应用程序或库添加了新功能时,必须使用类型 “feat”。
114
+ 当提交表示对你的应用程序的一个错误修复时,必须使用类型 “fix”。
115
+ 在类型之后可以提供一个作用域。作用域必须由一个名词组成,该名词描述代码库的一个部分,并用括号括起来,例如 “fix (parser):” 。
116
+ 在类型 / 作用域前缀后的冒号和空格之后,必须紧接着是一段描述。这段描述是对代码变更的简短总结,例如 “fix: 修复字符串中包含多个空格时的数组解析问题”。
117
+ 在简短描述之后可以提供更长的提交内容主体,以提供关于代码变更的更多背景信息。主体必须在描述之后空一行开始。
118
+ 提交内容主体格式自由,可以由任意数量的以换行符分隔的段落组成。
119
+ 在内容主体之后空一行,可以提供一个或多个脚注。每个脚注必须由一个单词标记组成,后面跟着 “:< 空格 >” 或 “< 空格 >#” 分隔符,再后面跟着一个字符串值(这受到了 git trailer 约定的启发)。
120
+ 脚注的标记必须使用 “-” 来代替空白字符,例如 “Acked-by”(这有助于将脚注部分与多段落的内容主体区分开来)。“BREAKING CHANGE” 是个例外,它也可以用作标记。
121
+ 脚注的值可以包含空格和换行符,并且当观察到下一个有效的脚注标记 / 分隔符对时,解析必须终止。
122
+ 重大变更必须在提交的类型 / 作用域前缀中指明,或者作为脚注中的一项来指明。
123
+ 如果作为脚注包含在内,重大变更必须由大写文本 “BREAKING CHANGE” 组成,后面跟着一个冒号、一个空格和一段描述,例如 “BREAKING CHANGE: 现在环境变量优先于配置文件”。
124
+ 如果包含在类型 / 作用域前缀中,重大变更必须通过在冒号之前紧邻一个 “!” 来指明。如果使用了 “!”,则脚注部分中可以省略 “BREAKING CHANGE:”,并且提交描述应该用于描述该重大变更。
125
+ 除了 “feat” 和 “fix” 之外的其他类型也可以用在你的提交信息中,例如 “docs: 更新参考文档”。
126
+ 构成规范提交的信息单元,实现者不得将其视为区分大小写,“BREAKING CHANGE” 除外,它必须是大写的。
127
+ 当 “BREAKING-CHANGE” 在脚注中用作标记时,它必须与 “BREAKING CHANGE” 同义。
@@ -0,0 +1,111 @@
1
+ ---
2
+ description: Gitflow Workflow Rules. These rules should be applied when performing git operations.
3
+ ---
4
+ # Gitflow Workflow Rules
5
+
6
+ ## Main Branches
7
+
8
+ ### main (or master)
9
+ - Contains production-ready code
10
+ - Never commit directly to main
11
+ - Only accepts merges from:
12
+ - hotfix/* branches
13
+ - release/* branches
14
+ - Must be tagged with version number after each merge
15
+
16
+ ### develop
17
+ - Main development branch
18
+ - Contains latest delivered development changes
19
+ - Source branch for feature branches
20
+ - Never commit directly to develop
21
+
22
+ ## Supporting Branches
23
+
24
+ ### feature/*
25
+ - Branch from: develop
26
+ - Merge back into: develop
27
+ - Naming convention: feature/[issue-id]-descriptive-name
28
+ - Example: feature/123-user-authentication
29
+ - Must be up-to-date with develop before creating PR
30
+ - Delete after merge
31
+
32
+ ### release/*
33
+ - Branch from: develop
34
+ - Merge back into:
35
+ - main
36
+ - develop
37
+ - Naming convention: release/vX.Y.Z
38
+ - Example: release/v1.2.0
39
+ - Only bug fixes, documentation, and release-oriented tasks
40
+ - No new features
41
+ - Delete after merge
42
+
43
+ ### hotfix/*
44
+ - Branch from: main
45
+ - Merge back into:
46
+ - main
47
+ - develop
48
+ - Naming convention: hotfix/vX.Y.Z
49
+ - Example: hotfix/v1.2.1
50
+ - Only for urgent production fixes
51
+ - Delete after merge
52
+
53
+ ## Commit Messages
54
+
55
+ - Format: `type(scope): description`
56
+ - Types:
57
+ - feat: New feature
58
+ - fix: Bug fix
59
+ - docs: Documentation changes
60
+ - style: Formatting, missing semicolons, etc.
61
+ - refactor: Code refactoring
62
+ - test: Adding tests
63
+ - chore: Maintenance tasks
64
+
65
+ ## Version Control
66
+
67
+ ### Semantic Versioning
68
+ - MAJOR version for incompatible API changes
69
+ - MINOR version for backwards-compatible functionality
70
+ - PATCH version for backwards-compatible bug fixes
71
+
72
+ ## Pull Request Rules
73
+
74
+ 1. All changes must go through Pull Requests
75
+ 2. Required approvals: minimum 1
76
+ 3. CI checks must pass
77
+ 4. No direct commits to protected branches (main, develop)
78
+ 5. Branch must be up to date before merging
79
+ 6. Delete branch after merge
80
+
81
+ ## Branch Protection Rules
82
+
83
+ ### main & develop
84
+ - Require pull request reviews
85
+ - Require status checks to pass
86
+ - Require branches to be up to date
87
+ - Include administrators in restrictions
88
+ - No force pushes
89
+ - No deletions
90
+
91
+ ## Release Process
92
+
93
+ 1. Create release branch from develop
94
+ 2. Bump version numbers
95
+ 3. Fix any release-specific issues
96
+ 4. Create PR to main
97
+ 5. After merge to main:
98
+ - Tag release
99
+ - Merge back to develop
100
+ - Delete release branch
101
+
102
+ ## Hotfix Process
103
+
104
+ 1. Create hotfix branch from main
105
+ 2. Fix the issue
106
+ 3. Bump patch version
107
+ 4. Create PR to main
108
+ 5. After merge to main:
109
+ - Tag release
110
+ - Merge back to develop
111
+ - Delete hotfix branch
@@ -0,0 +1,69 @@
1
+ ---
2
+ description: Defines the recommended folder structure for a WinJS project to maintain consistency and organization.
3
+ globs: src/**/*
4
+ ---
5
+
6
+ - Recommended folder structure:
7
+ - `config`:
8
+ - `config.ts`:配置文件
9
+ - `dist`:存放构建输出结果的目录
10
+ - `mock`:
11
+ - `app.ts|tsx`:模拟相关的代码文件
12
+ - `public`:存放静态资源的目录
13
+ - `src`:
14
+ - `.win`:临时文件目录
15
+ - `.win-production`:生产环境临时文件目录
16
+ - `assets`:
17
+ - `fonts`:字体文件目录
18
+ - `img`:图片文件目录
19
+ - `style`:样式文件目录
20
+ - `js`:js文件目录
21
+ - `components`:
22
+ - `componentName`:组件名称,采用大驼峰规范
23
+ - `index.ts`:组件入口文件
24
+ - `index.less`:组件样式文件
25
+ - `index.vue`:组件文件
26
+ - `icons`: svg 图标文件目录
27
+ - `layouts`:
28
+ - `BasicLayout.vue`:基础布局组件
29
+ - `index.less`:布局相关样式文件
30
+ - `models`:
31
+ - `global.ts`:全局数据模型相关文件
32
+ - `index.ts`:数据模型入口文件
33
+ - `pages`:
34
+ - `index.less`:页面样式文件
35
+ - `index.vue`:页面组件
36
+ - `utils`(推荐目录):
37
+ - `index.ts`:工具函数文件
38
+ - `services`(推荐目录):
39
+ - `api.ts`:网络请求相关文件
40
+ - `app.(ts|tsx)`:运行时配置文件
41
+ - `constant.(ts|js)`:定义常量的文件
42
+ - `global.ts`:全局相关文件
43
+ - `global.(css|less|sass|scss)`:全局样式文件
44
+ - `overrides.(css|less|sass|scss)`:样式覆盖文件
45
+ - `favicon.(ico|gif|png|jpg|jpeg|svg|avif|webp)`:站点图标文件
46
+ - `node_modules`:
47
+ - `.cache`:
48
+ - `bundler-webpack`:webpack 打包缓存相关
49
+ - `mfsu`:模块联邦服务工具相关缓存
50
+ - `mfsu-deps`:模块联邦服务工具依赖相关缓存
51
+ - `.env`:环境变量配置文件
52
+ - `.editorconfig`:编辑器编码风格配置文件
53
+ - `.eslintignore`:eslint 校验忽略文件
54
+ - `.eslintrc.js`:eslint 校验配置文件
55
+ - `.gitignore`:git 忽略文件
56
+ - `.npmrc`:npm 源地址配置文件
57
+ - `.markdownlint.json`:markdown lint 工具配置文件
58
+ - `.markdownlintignore`:markdown lint 忽略文件
59
+ - `.prettierignore`:prettier 代码格式化忽略文件
60
+ - `.prettierrc.js`:prettier 代码格式化配置文件
61
+ - `.stylelintrc.js`:stylelint css 代码规范配置文件
62
+ - `.stylelintignore`:stylelint css 忽略文件
63
+ - `commitlint.config.js`:git commit 规范配置文件
64
+ - `f2elint.config.js`:f2elint 配置文件
65
+ - `plugin.ts`:用于定制项目需求的文件
66
+ - `.winrc.ts`:与`config/config`文件二选一的配置文件
67
+ - `package.json`:项目依赖管理及脚本配置文件
68
+ - `tsconfig.json`:TypeScript 编译配置文件
69
+ - `typings.d.ts`:类型声明文件
@@ -0,0 +1,57 @@
1
+ ---
2
+ description: TypeScript coding standards and best practices for modern web development
3
+ globs: **/*.ts, **/*.tsx, **/*.d.ts
4
+ ---
5
+
6
+ # TypeScript Best Practices
7
+
8
+ ## Type System
9
+ - Prefer interfaces over types for object definitions
10
+ - Use type for unions, intersections, and mapped types
11
+ - Avoid using `any`, prefer `unknown` for unknown types
12
+ - Use strict TypeScript configuration
13
+ - Leverage TypeScript's built-in utility types
14
+ - Use generics for reusable type patterns
15
+
16
+ ## Naming Conventions
17
+ - Use PascalCase for type names and interfaces
18
+ - Use camelCase for variables and functions
19
+ - Use UPPER_CASE for constants
20
+ - Use descriptive names with auxiliary verbs (e.g., isLoading, hasError)
21
+ - Prefix interfaces for React props with 'Props' (e.g., ButtonProps)
22
+
23
+ ## Code Organization
24
+ - Keep type definitions close to where they're used
25
+ - Export types and interfaces from dedicated type files when shared
26
+ - Use barrel exports (index.ts) for organizing exports
27
+ - Place shared types in a `types` directory
28
+ - Co-locate component props with their components
29
+
30
+ ## Functions
31
+ - Use explicit return types for public functions
32
+ - Use arrow functions for callbacks and methods
33
+ - Implement proper error handling with custom error types
34
+ - Use function overloads for complex type scenarios
35
+ - Prefer async/await over Promises
36
+
37
+ ## Best Practices
38
+ - Enable strict mode in tsconfig.json
39
+ - Use readonly for immutable properties
40
+ - Leverage discriminated unions for type safety
41
+ - Use type guards for runtime type checking
42
+ - Implement proper null checking
43
+ - Avoid type assertions unless necessary
44
+
45
+ ## Error Handling
46
+ - Create custom error types for domain-specific errors
47
+ - Use Result types for operations that can fail
48
+ - Implement proper error boundaries
49
+ - Use try-catch blocks with typed catch clauses
50
+ - Handle Promise rejections properly
51
+
52
+ ## Patterns
53
+ - Use the Builder pattern for complex object creation
54
+ - Implement the Repository pattern for data access
55
+ - Use the Factory pattern for object creation
56
+ - Leverage dependency injection
57
+ - Use the Module pattern for encapsulation
@@ -0,0 +1,86 @@
1
+ ---
2
+ description: Vue.js best practices and patterns for modern web applications
3
+ globs: **/*.vue, **/*.ts, components/**/*
4
+ ---
5
+
6
+ # Vue.js Best Practices
7
+
8
+ ## Component Structure
9
+ - Use Composition API over Options API
10
+ - Keep components small and focused
11
+ - Use proper TypeScript integration
12
+ - Implement proper props validation
13
+ - Use proper emit declarations
14
+ - Keep template logic minimal
15
+
16
+ ## Composition API
17
+ - Use proper ref and reactive
18
+ - Implement proper lifecycle hooks
19
+ - Use composables for reusable logic
20
+ - Keep setup function clean
21
+ - Use proper computed properties
22
+ - Implement proper watchers
23
+
24
+ ## State Management
25
+ - Use Pinia for state management
26
+ - Keep stores modular
27
+ - Use proper state composition
28
+ - Implement proper actions
29
+ - Use proper getters
30
+ - Handle async state properly
31
+
32
+ ## Performance
33
+ - Use proper component lazy loading
34
+ - Implement proper caching
35
+ - Use proper computed properties
36
+ - Avoid unnecessary watchers
37
+ - Use proper v-show vs v-if
38
+ - Implement proper key management
39
+
40
+ ## Routing
41
+ - Use Vue Router properly
42
+ - Implement proper navigation guards
43
+ - Use proper route meta fields
44
+ - Handle route params properly
45
+ - Implement proper lazy loading
46
+ - Use proper navigation methods
47
+
48
+ ## Forms
49
+ - Use v-model properly
50
+ - Implement proper validation
51
+ - Handle form submission properly
52
+ - Show proper loading states
53
+ - Use proper error handling
54
+ - Implement proper form reset
55
+
56
+ ## TypeScript Integration
57
+ - Use proper component type definitions
58
+ - Implement proper prop types
59
+ - Use proper emit declarations
60
+ - Handle proper type inference
61
+ - Use proper composable types
62
+ - Implement proper store types
63
+
64
+ ## Testing
65
+ - Write proper unit tests
66
+ - Implement proper component tests
67
+ - Use Vue Test Utils properly
68
+ - Test composables properly
69
+ - Implement proper mocking
70
+ - Test async operations
71
+
72
+ ## Best Practices
73
+ - Follow Vue style guide
74
+ - Use proper naming conventions
75
+ - Keep components organized
76
+ - Implement proper error handling
77
+ - Use proper event handling
78
+ - Document complex logic
79
+
80
+ ## Build and Tooling
81
+ - Use Vite for development
82
+ - Configure proper build setup
83
+ - Use proper environment variables
84
+ - Implement proper code splitting
85
+ - Use proper asset handling
86
+ - Configure proper optimization
@@ -0,0 +1,23 @@
1
+ # http://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset=utf-8
6
+ end_of_line=lf
7
+ insert_final_newline=true
8
+ trim_trailing_whitespace=true
9
+ indent_style=space
10
+ indent_size=2
11
+
12
+ [{.eslintrc,.babelrc,.stylelintrc,*.json}]
13
+ indent_style=space
14
+ indent_size=2
15
+
16
+ [*.less]
17
+ indent_style=space
18
+ indent_size=2
19
+
20
+ [*.{js,jsx,ts,tsx,vue}]
21
+ indent_style=space
22
+ indent_size=2
23
+
@@ -0,0 +1,13 @@
1
+ node_modules/
2
+ config/
3
+ public/
4
+ src/assets/
5
+ /src/.win
6
+ /src/.win-production
7
+ /src/.win-test
8
+ /.win
9
+ /.win-production
10
+ /.win-test
11
+ /dist
12
+ /dist-zip
13
+
@@ -0,0 +1,9 @@
1
+ // http://eslint.org/docs/user-guide/configuring
2
+ // http://eslint.cn/docs/user-guide/configuring 中文,注意版本是否和官网一致
3
+ module.exports = {
4
+ extends: [
5
+ '@winner-fed/eslint-config-win',
6
+ '@winner-fed/eslint-config-win/vue3',
7
+ './.eslintrc-auto-import.json'
8
+ ]
9
+ };
@@ -0,0 +1,54 @@
1
+ /node_modules
2
+ /.env.local
3
+ /.winrc.local.ts
4
+ /config/config.local.ts
5
+ /src/.win
6
+ /src/.win-production
7
+ /src/.win-test
8
+ /src/.huipro
9
+ /.win
10
+ /.win-production
11
+ /.win-test
12
+ /.huipro
13
+ /dist
14
+ /dist-zip
15
+ /.mfsu
16
+ .swc
17
+ components.d.ts
18
+ auto-imports.d.ts
19
+ f2elint-report.json
20
+
21
+ .DS_Store
22
+ # Log files
23
+ npm-debug.log*
24
+ yarn-debug.log*
25
+ yarn-error.log*
26
+
27
+ # Editor directories and files
28
+ .idea
29
+ .vscode
30
+ *.suo
31
+ *.ntvs*
32
+ *.njsproj
33
+ *.sln
34
+ *.sw*
35
+
36
+ # Optional npm cache directory
37
+ .npm
38
+
39
+ # Optional eslint cache
40
+ .eslintcache
41
+ .eslintrc-auto-import.json
42
+
43
+ # Optional REPL history
44
+ .node_repl_history
45
+
46
+ # Output of 'npm pack'
47
+ *.tgz
48
+
49
+ .project
50
+ .happypack
51
+ .history
52
+
53
+ /package
54
+ /docker/html
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ # 以下选择一个即可
5
+ npx --no-install win verify-commit-hs $1
6
+ #npx f2elint commit-msg-scan
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx --no-install lint-staged --quiet
5
+ npx f2elint commit-file-scan
@@ -0,0 +1,5 @@
1
+ {
2
+ "*.{md,json}": ["prettier --cache --write"],
3
+ "*.{vue,js,jsx,css,less,scss}": ["win lint --fix", "prettier --cache --write"],
4
+ "*.ts?(x)": ["win lint --fix", "prettier --cache --parser=typescript --write"]
5
+ }
@@ -0,0 +1,2 @@
1
+ registry={{{ registry }}}
2
+ {{{ extraNpmrc }}}