@winjs-dev/create-win 1.0.2 → 1.0.3-y.0

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/dist/index.d.ts CHANGED
@@ -21,6 +21,9 @@ interface ITemplateParams extends ITemplatePluginParams {
21
21
  email: string;
22
22
  withHusky: boolean;
23
23
  extraNpmrc: string;
24
+ vueVersion?: EVueVersion;
25
+ isVue2?: boolean;
26
+ isVue3?: boolean;
24
27
  }
25
28
  declare enum ENpmClient {
26
29
  npm = "npm",
@@ -33,8 +36,13 @@ declare enum ETemplate {
33
36
  plugin = "plugin",
34
37
  sample = "sample"
35
38
  }
39
+ declare enum EVueVersion {
40
+ vue2 = "2",
41
+ vue3 = "3"
42
+ }
36
43
  export interface IDefaultData extends ITemplateParams {
37
44
  appTemplate?: ETemplate;
45
+ vueVersion?: EVueVersion;
38
46
  }
39
47
  interface IGeneratorOpts {
40
48
  cwd: string;
package/dist/index.js CHANGED
@@ -54,6 +54,13 @@ function getUUID() {
54
54
  function generateOnlyContainer(str) {
55
55
  return `${parseStr(str)}${getUUID()}`;
56
56
  }
57
+ var ETemplate = /* @__PURE__ */ ((ETemplate2) => {
58
+ ETemplate2["app"] = "app";
59
+ ETemplate2["pc"] = "pc";
60
+ ETemplate2["plugin"] = "plugin";
61
+ ETemplate2["sample"] = "sample";
62
+ return ETemplate2;
63
+ })(ETemplate || {});
57
64
  var pkg = require("../package");
58
65
  var DEFAULT_DATA = {
59
66
  pluginName: "winjs-plugin-demo",
@@ -66,7 +73,8 @@ var DEFAULT_DATA = {
66
73
  registry: import_template.ERegistry.npm,
67
74
  withHusky: false,
68
75
  extraNpmrc: "",
69
- appTemplate: "app" /* app */
76
+ appTemplate: "app" /* app */,
77
+ vueVersion: "3" /* vue3 */
70
78
  };
71
79
  var src_default = async ({
72
80
  cwd,
@@ -77,6 +85,7 @@ var src_default = async ({
77
85
  let npmClient = "pnpm" /* pnpm */;
78
86
  let registry = import_template.ERegistry.npm;
79
87
  let appTemplate = (defaultData == null ? void 0 : defaultData.appTemplate) || "app" /* app */;
88
+ let vueVersion = (defaultData == null ? void 0 : defaultData.vueVersion) || "3" /* vue3 */;
80
89
  const { username, email } = await (0, import_utils.getGitInfo)();
81
90
  const author = email && username ? `${username} <${email}>` : "";
82
91
  let pluginName = `winjs-plugin-${name || "demo"}`;
@@ -133,6 +142,16 @@ var src_default = async ({
133
142
  initialValue: "yarn" /* yarn */
134
143
  });
135
144
  };
145
+ const selectVueVersion = async () => {
146
+ vueVersion = await select({
147
+ message: "选择 Vue 版本",
148
+ options: [
149
+ { label: "Vue 3", value: "3" /* vue3 */, hint: "推荐" },
150
+ { label: "Vue 2", value: "2" /* vue2 */ }
151
+ ],
152
+ initialValue: "3" /* vue3 */
153
+ });
154
+ };
136
155
  const selectRegistry = async () => {
137
156
  registry = await select({
138
157
  message: "Pick Npm Registry",
@@ -161,6 +180,13 @@ var src_default = async ({
161
180
  if (isCancel(appTemplate)) {
162
181
  exitPrompt();
163
182
  }
183
+ const needsVueSelection = appTemplate !== "plugin" /* plugin */ && appTemplate !== ETemplate.huipro;
184
+ if (needsVueSelection) {
185
+ await selectVueVersion();
186
+ if (isCancel(vueVersion)) {
187
+ exitPrompt();
188
+ }
189
+ }
164
190
  await selectNpmClient();
165
191
  if (isCancel(npmClient)) {
166
192
  exitPrompt();
@@ -238,7 +264,10 @@ var src_default = async ({
238
264
  extraNpmrc: isPnpm ? pnpmExtraNpmrc : "",
239
265
  pluginName,
240
266
  projectName,
241
- appContainerName
267
+ appContainerName,
268
+ vueVersion,
269
+ isVue2: vueVersion === "2" /* vue2 */,
270
+ isVue3: vueVersion === "3" /* vue3 */
242
271
  }
243
272
  });
244
273
  await generator.run();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winjs-dev/create-win",
3
- "version": "1.0.2",
3
+ "version": "1.0.3-y.0",
4
4
  "description": "@winjs-dev/create-win",
5
5
  "keywords": [
6
6
  "WinJS",
@@ -80,14 +80,6 @@ export default defineConfig({
80
80
  },
81
81
  title: '{{{ projectName }}}',
82
82
  mountElementId: '{{{ appContainerName }}}',
83
- mfsu: {
84
- shared: {
85
- vue: {
86
- singleton: true,
87
- eager: true
88
- }
89
- }
90
- },
91
83
  // 开发使用内联CSS,生产使用构建的CSS文件
92
84
  styleLoader: process.env.NODE_ENV === 'production' ? false : {},
93
85
  // 开发使用 cheap-source-map
@@ -10,7 +10,7 @@ WinJS App 模板是一个开箱即用的 H5 应用开发脚手架,集成了现
10
10
 
11
11
  - 🚀 **现代化技术栈**:基于 Vue 3.2+ 和 Vue Router 4.x
12
12
  - 📱 **移动端优化**:内置 REM 适配和移动端调试工具
13
- - 🛠️ **完整工具链**:集成 ESLintPrettier、StyleLint 等代码质量工具
13
+ - 🛠️ **完整工具链**:集成 Biome、StyleLint 等代码质量工具
14
14
  - 🔧 **插件化架构**:支持请求拦截、移动端调试等插件
15
15
  - 📦 **模块联邦**:支持微前端架构和模块共享
16
16
  - 🎨 **样式解决方案**:支持 Less 预处理器和全局样式注入
@@ -39,8 +39,7 @@ WinJS App 模板是一个开箱即用的 H5 应用开发脚手架,集成了现
39
39
 
40
40
  ### 代码质量
41
41
 
42
- - **ESLint** - JavaScript 代码检查工具
43
- - **Prettier** - 代码格式化工具
42
+ - **Biome** - 快速、零配置的代码格式化和 Linter 工具(替代 ESLint + Prettier)
44
43
  - **StyleLint** - CSS 代码检查工具
45
44
  - **F2ELint** - 前端代码规范工具
46
45
 
@@ -79,10 +78,13 @@ npm run build
79
78
  # 预览构建结果
80
79
  npm run preview
81
80
 
82
- # 代码检查
81
+ # 代码检查(Biome)
83
82
  npm run lint
84
83
 
85
- # 代码格式化
84
+ # 代码检查并自动修复(Biome)
85
+ npm run lint:fix
86
+
87
+ # 代码格式化(Biome)
86
88
  npm run format
87
89
 
88
90
  # F2ELint 扫描
@@ -144,15 +146,15 @@ npm run f2elint-fix
144
146
 
145
147
  1. **@winner-fed/plugin-request**
146
148
 
147
- - 基于 axios 的网络请求解决方案
148
- - 支持请求/响应拦截器
149
- - 统一错误处理机制
149
+ - 基于 axios 的网络请求解决方案
150
+ - 支持请求/响应拦截器
151
+ - 统一错误处理机制
150
152
 
151
153
  2. **@winner-fed/plugin-wconsole**
152
154
 
153
- - 移动端调试工具
154
- - 支持 vConsole 集成
155
- - 可配置开启/关闭
155
+ - 移动端调试工具
156
+ - 支持 vConsole 集成
157
+ - 可配置开启/关闭
156
158
 
157
159
  ## 📱 移动端适配
158
160
 
@@ -184,9 +186,9 @@ npm run f2elint-fix
184
186
 
185
187
  ### 代码规范
186
188
 
187
- - 遵循 ESLint 规则
188
- - 使用 Prettier 进行代码格式化
189
+ - 使用 Biome 进行代码检查和格式化(替代 ESLint + Prettier)
189
190
  - StyleLint 检查 CSS 代码质量
191
+ - F2ELint 进行前端代码规范检查
190
192
 
191
193
  ### Git 提交规范
192
194
 
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
3
+ "extends": ["@winner-fed/biome-config-win"],
4
+ "files": {
5
+ "includes": [
6
+ "!src/assets/**/*",
7
+ "!build/*",
8
+ "!package/*"
9
+ ]
10
+ }
11
+ }
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- extends: ['@winner-fed/commitlint-config-win/hs']
2
+ extends: ['@winner-fed/commitlint-config-win']
3
3
  };
@@ -1,6 +1,4 @@
1
1
  module.exports = {
2
- enableESLint: true,
3
2
  enableStylelint: true,
4
- enableMarkdownlint: false,
5
- enablePrettier: true
3
+ enableMarkdownlint: false
6
4
  };
@@ -7,10 +7,11 @@
7
7
  "scripts": {
8
8
  "dev": "win dev",
9
9
  "build": "cross-env WIN_APP_ENV=production win build",
10
- "lint": "win lint",
10
+ "lint": "biome lint .",
11
+ "lint:fix": "biome lint --write .",
11
12
  "f2elint-scan": "f2elint scan --include src",
12
13
  "f2elint-fix": "f2elint fix --include src",
13
- "format": "prettier --write \"src/**/*.{js,jsx,json,ts,tsx,css,less,scss,vue,html,md}\" \"package.json\"",
14
+ "format": "biome format --write .",
14
15
  "postinstall": "win setup",
15
16
  "prepare": "husky install",
16
17
  "setup": "win setup",
@@ -20,12 +21,15 @@
20
21
  "dependencies": {
21
22
  "@winner-fed/cloud-utils": "^2.0.1",
22
23
  "@winner-fed/magicless": "*",
23
- "@winner-fed/winjs": "*"
24
+ "@winner-fed/winjs": "{{{ version }}}"{{#isVue2}},
25
+ "vue": "^2.7.14"{{/isVue2}}
24
26
  },
25
27
  "devDependencies": {
26
28
  "@winner-fed/plugin-request": "^1.0.1",
27
- "@winner-fed/plugin-wconsole": "^1.0.0",
28
- "@winner-fed/f2elint": "^3.0.0",
29
+ "@winner-fed/plugin-wconsole": "^1.0.0",{{#isVue2}}
30
+ "@winner-fed/preset-vue2": "{{{ version }}}",{{/isVue2}}{{^isVue2}}
31
+ "@winner-fed/preset-vue": "{{{ version }}}",{{/isVue2}}
32
+ "@winner-fed/f2elint": "^4.0.0",
29
33
  "cross-env": "^7.0.3",
30
34
  "husky": "8.0.3",
31
35
  "lint-staged": "13.2.3",
@@ -59,14 +59,6 @@ export default defineConfig({
59
59
  },
60
60
  title: '{{{ projectName }}}',
61
61
  mountElementId: '{{{ appContainerName }}}',
62
- mfsu: {
63
- shared: {
64
- vue: {
65
- singleton: true,
66
- eager: true
67
- }
68
- }
69
- },
70
62
  // 开发使用内联CSS,生产使用构建的CSS文件
71
63
  styleLoader: process.env.NODE_ENV === 'production' ? false : {},
72
64
  // 开发使用 cheap-source-map
@@ -22,8 +22,7 @@
22
22
 
23
23
  ### 代码质量
24
24
 
25
- - **ESLint** - JavaScript/TypeScript 代码检查
26
- - **Prettier** - 代码格式化工具
25
+ - **Biome** - 快速、零配置的代码格式化和 Linter 工具(替代 ESLint + Prettier)
27
26
  - **Stylelint** - CSS/Less 样式检查
28
27
  - **F2ELint** - 前端代码规范工具
29
28
  - **Husky** - Git hooks 管理
@@ -102,8 +101,7 @@ npm run preview
102
101
  ├── .winrc.ts # WinJS 配置文件
103
102
  ├── package.json # 项目依赖配置
104
103
  ├── tsconfig.json # TypeScript 配置
105
- ├── .eslintrc.js # ESLint 配置
106
- ├── .prettierrc.js # Prettier 配置
104
+ ├── biome.json # Biome 配置(代码格式化和 Linter)
107
105
  ├── .stylelintrc.js # Stylelint 配置
108
106
  └── README.md # 项目说明文档
109
107
  ```
@@ -114,11 +112,18 @@ npm run preview
114
112
 
115
113
  项目集成了完整的代码规范工具链:
116
114
 
115
+ - **Biome**:用于 JavaScript/TypeScript 代码检查和格式化(替代 ESLint + Prettier)
116
+ - **Stylelint**:用于 CSS/Less 代码检查
117
+ - **F2ELint**:用于前端代码规范检查
118
+
117
119
  ```bash
118
- # 代码检查
120
+ # 代码检查(Biome)
119
121
  npm run lint
120
122
 
121
- # 代码格式化
123
+ # 代码检查并自动修复(Biome)
124
+ npm run lint:fix
125
+
126
+ # 代码格式化(Biome)
122
127
  npm run format
123
128
 
124
129
  # F2ELint 扫描
@@ -232,7 +237,7 @@ targets: {
232
237
  项目配置了多层代码质量保障:
233
238
 
234
239
  1. **提交前检查**: 通过 Husky 和 lint-staged 在提交前自动检查代码
235
- 2. **实时检查**: 编辑器集成 ESLintPrettier、Stylelint
240
+ 2. **实时检查**: 编辑器集成 Biome、Stylelint
236
241
  3. **CI/CD 集成**: 支持持续集成环境的代码检查
237
242
 
238
243
  ## 📚 相关文档
@@ -247,8 +252,7 @@ targets: {
247
252
  如果您在使用过程中遇到问题,请通过以下方式反馈:
248
253
 
249
254
  1. 提交 Issue
250
- 2. 联系维护团队
251
- 3. 查阅官方文档
255
+ 2. 查阅官方文档
252
256
 
253
257
  ---
254
258
 
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
3
+ "extends": ["@winner-fed/biome-config-win"],
4
+ "files": {
5
+ "includes": [
6
+ "!src/assets/**/*",
7
+ "!build/*",
8
+ "!package/*"
9
+ ]
10
+ }
11
+ }
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- extends: ['@winner-fed/commitlint-config-win/hs']
2
+ extends: ['@winner-fed/commitlint-config-win']
3
3
  };
@@ -1,6 +1,4 @@
1
1
  module.exports = {
2
- enableESLint: true,
3
2
  enableStylelint: true,
4
- enableMarkdownlint: false,
5
- enablePrettier: false
3
+ enableMarkdownlint: false
6
4
  };
@@ -7,10 +7,11 @@
7
7
  "scripts": {
8
8
  "dev": "win dev",
9
9
  "build": "cross-env WIN_APP_ENV=production win build",
10
- "lint": "win lint",
10
+ "lint": "biome lint .",
11
+ "lint:fix": "biome lint --write .",
11
12
  "f2elint-scan": "f2elint scan --include src",
12
13
  "f2elint-fix": "f2elint fix --include src",
13
- "format": "prettier --write \"src/**/*.{js,jsx,json,ts,tsx,css,less,scss,vue,html,md}\" \"package.json\"",
14
+ "format": "biome format --write .",
14
15
  "postinstall": "win setup",
15
16
  "prepare": "husky install",
16
17
  "setup": "win setup",
@@ -20,11 +21,14 @@
20
21
  "dependencies": {
21
22
  "@winner-fed/cloud-utils": "^2.0.1",
22
23
  "@winner-fed/magicless": "*",
23
- "@winner-fed/winjs": "*"
24
+ "@winner-fed/winjs": "{{{ version }}}"{{#isVue2}},
25
+ "vue": "^2.7.14"{{/isVue2}}
24
26
  },
25
27
  "devDependencies": {
26
- "@winner-fed/plugin-request": "^1.0.1",
27
- "@winner-fed/f2elint": "^3.0.0",
28
+ "@winner-fed/plugin-request": "^1.0.1",{{#isVue2}}
29
+ "@winner-fed/preset-vue2": "{{{ version }}}",{{/isVue2}}{{^isVue2}}
30
+ "@winner-fed/preset-vue": "{{{ version }}}",{{/isVue2}}
31
+ "@winner-fed/f2elint": "^4.0.0",
28
32
  "cross-env": "^7.0.3",
29
33
  "husky": "8.0.3",
30
34
  "lint-staged": "13.2.3",
@@ -1,13 +0,0 @@
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
-
@@ -1,9 +0,0 @@
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
- };
@@ -1,13 +0,0 @@
1
- **/*.svg
2
- output.js
3
- src/assets/
4
- dist/**
5
- public/**
6
- src/services/RESTFULURL.js
7
- src/icons
8
- src/.win
9
- src/.win-production
10
- .npmrc
11
- .yarnrc
12
- node_modules
13
-
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- ...require('@winner-fed/prettier-config-win'),
3
- plugins: ['prettier-plugin-organize-imports', 'prettier-plugin-packagejson']
4
- }
@@ -1,13 +0,0 @@
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
-
@@ -1,9 +0,0 @@
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
- };
@@ -1,13 +0,0 @@
1
- **/*.svg
2
- output.js
3
- src/assets/
4
- dist/**
5
- public/**
6
- src/services/RESTFULURL.js
7
- src/icons
8
- src/.win
9
- src/.win-production
10
- .npmrc
11
- .yarnrc
12
- node_modules
13
-
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- ...require('@winner-fed/prettier-config-win'),
3
- plugins: ['prettier-plugin-organize-imports', 'prettier-plugin-packagejson']
4
- }