@quicktvui/web-cli 1.0.0-beta.17 → 1.0.0-beta.19
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/bin/qt-web-cli.js +12 -14
- package/lib/webpack.config.js +0 -10
- package/package.json +9 -14
package/bin/qt-web-cli.js
CHANGED
|
@@ -47,8 +47,7 @@ Examples:
|
|
|
47
47
|
qt-web-cli --config ./my.webpack.js
|
|
48
48
|
|
|
49
49
|
特点:
|
|
50
|
-
-
|
|
51
|
-
- 若无 webMain,自动使用 src/web 或 @quicktvui/web-renderer 包
|
|
50
|
+
- 自动检测项目入口 (main-native.ts/js, main.ts/js)
|
|
52
51
|
- 零配置启动 web 开发服务器
|
|
53
52
|
`)
|
|
54
53
|
process.exit(0)
|
|
@@ -78,30 +77,27 @@ async function main() {
|
|
|
78
77
|
|
|
79
78
|
// 入口候选列表
|
|
80
79
|
const entryCandidates = [
|
|
81
|
-
{ name: '
|
|
80
|
+
{ name: 'src/main-native.ts', path: './src/main-native.ts', type: 'package' },
|
|
81
|
+
{ name: 'src/main-native.js', path: './src/main-native.js', type: 'package' },
|
|
82
82
|
{ name: 'src/main.ts', path: './src/main.ts', type: 'package' },
|
|
83
83
|
{ name: 'src/main.js', path: './src/main.js', type: 'package' },
|
|
84
84
|
{ name: 'main (package.json)', path: pkg.main, type: 'package' },
|
|
85
85
|
]
|
|
86
86
|
|
|
87
|
-
// 检查 src/web 本地渲染器
|
|
88
|
-
const hasLocalWebRenderer = fs.existsSync(path.join(projectRoot, 'src/web/index.js'))
|
|
89
|
-
|
|
90
87
|
for (const candidate of entryCandidates) {
|
|
91
88
|
if (!candidate.path) continue
|
|
92
89
|
const entryFullPath = path.resolve(projectRoot, candidate.path)
|
|
93
90
|
if (fs.existsSync(entryFullPath)) {
|
|
94
91
|
mainEntry = candidate.path
|
|
95
|
-
entryType =
|
|
92
|
+
entryType = candidate.type
|
|
96
93
|
signale.info(`主入口: ${mainEntry}`)
|
|
97
|
-
signale.info(`Web 渲染器: ${hasLocalWebRenderer ? 'src/web (本地)' : '@quicktvui/web-renderer (包)'}`)
|
|
98
94
|
break
|
|
99
95
|
}
|
|
100
96
|
}
|
|
101
97
|
|
|
102
98
|
if (!mainEntry) {
|
|
103
99
|
signale.error('无法找到有效的入口文件,请检查以下路径:')
|
|
104
|
-
signale.error(' -
|
|
100
|
+
signale.error(' - src/main-native.ts 或 src/main-native.js')
|
|
105
101
|
signale.error(' - src/main.ts 或 src/main.js')
|
|
106
102
|
signale.error(' - package.json 中的 main 字段')
|
|
107
103
|
process.exit(1)
|
|
@@ -143,11 +139,13 @@ async function main() {
|
|
|
143
139
|
// 如果需要打开浏览器,等待服务器就绪后打开
|
|
144
140
|
if (args.open) {
|
|
145
141
|
const url = `http://localhost:${args.port}`
|
|
146
|
-
waitForServer(url, 30000)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
142
|
+
waitForServer(url, 30000)
|
|
143
|
+
.then(() => {
|
|
144
|
+
openOrRefreshBrowser(url)
|
|
145
|
+
})
|
|
146
|
+
.catch((err) => {
|
|
147
|
+
signale.warn(`自动打开浏览器失败: ${err.message}`)
|
|
148
|
+
})
|
|
151
149
|
}
|
|
152
150
|
|
|
153
151
|
const result = exec(webpackCmd, { stdio: 'inherit' })
|
package/lib/webpack.config.js
CHANGED
|
@@ -111,7 +111,6 @@ module.exports = {
|
|
|
111
111
|
devServer: {
|
|
112
112
|
port,
|
|
113
113
|
hot: true,
|
|
114
|
-
liveReload: true,
|
|
115
114
|
proxy: [
|
|
116
115
|
{
|
|
117
116
|
context: ['/proxy'],
|
|
@@ -139,10 +138,6 @@ module.exports = {
|
|
|
139
138
|
},
|
|
140
139
|
},
|
|
141
140
|
],
|
|
142
|
-
static: {
|
|
143
|
-
directory: path.join(projectRoot, 'public'),
|
|
144
|
-
publicPath: '/',
|
|
145
|
-
},
|
|
146
141
|
client: {
|
|
147
142
|
overlay: { errors: true, warnings: false },
|
|
148
143
|
},
|
|
@@ -281,9 +276,4 @@ module.exports = {
|
|
|
281
276
|
|
|
282
277
|
// 忽略 entry-local.js 中动态 require 的警告(这是预期行为)
|
|
283
278
|
ignoreWarnings: [/Critical dependency: the request of a dependency is an expression/],
|
|
284
|
-
|
|
285
|
-
cache: {
|
|
286
|
-
type: 'filesystem',
|
|
287
|
-
buildDependencies: { config: [__filename] },
|
|
288
|
-
},
|
|
289
279
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quicktvui/web-cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.19",
|
|
4
4
|
"description": "CLI tool for QuickTVUI web development - zero configuration",
|
|
5
5
|
"author": "QuickTVUI Team",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,20 +25,15 @@
|
|
|
25
25
|
"shelljs": "^0.10.0",
|
|
26
26
|
"signale": "^1.4.0",
|
|
27
27
|
"@quicktvui/web-renderer": "^1.0.6",
|
|
28
|
-
"scope-loader": "^1.0.3"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"webpack": "^
|
|
32
|
-
"webpack-cli": "^5.0.0",
|
|
33
|
-
"webpack-dev-server": "^4.0.0",
|
|
28
|
+
"scope-loader": "^1.0.3",
|
|
29
|
+
"webpack": "^5.89.0",
|
|
30
|
+
"webpack-cli": "^5.1.0",
|
|
31
|
+
"webpack-dev-server": "^4.15.0",
|
|
34
32
|
"vue-loader": "^17.0.0",
|
|
35
|
-
"html-webpack-plugin": "^5.
|
|
36
|
-
"@babel/core": "^7.
|
|
37
|
-
"babel-loader": "^9.
|
|
38
|
-
"ts-loader": "^9.4.0"
|
|
39
|
-
"css-loader": "^6.0.0",
|
|
40
|
-
"@extscreen/es3-router": ">=3.0.1",
|
|
41
|
-
"@extscreen/es3-vue": ">=3.0.0"
|
|
33
|
+
"html-webpack-plugin": "^5.5.0",
|
|
34
|
+
"@babel/core": "^7.23.0",
|
|
35
|
+
"babel-loader": "^9.1.0",
|
|
36
|
+
"ts-loader": "^9.4.0"
|
|
42
37
|
},
|
|
43
38
|
"peerDependenciesMeta": {
|
|
44
39
|
"less-loader": {
|