Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
f5ff2bbc
U
uni-app
项目概览
qianlong66
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f5ff2bbc
编写于
11月 15, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: add checkVersion
上级
2f3ffbe8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
155 addition
and
12 deletion
+155
-12
packages/uni-cli-shared/src/messages/index.ts
packages/uni-cli-shared/src/messages/index.ts
+1
-0
packages/vite-plugin-uni/src/cli/utils.ts
packages/vite-plugin-uni/src/cli/utils.ts
+4
-0
scripts/checkVersion.js
scripts/checkVersion.js
+137
-0
scripts/updateVersion.js
scripts/updateVersion.js
+1
-12
scripts/utils.js
scripts/utils.js
+12
-0
未找到文件。
packages/uni-cli-shared/src/messages/index.ts
浏览文件 @
f5ff2bbc
...
...
@@ -20,4 +20,5 @@ export const M = {
'
easycom.conflict
'
:
'
easycom组件冲突:
'
,
'
mp.component.args[0]
'
:
'
{0}的第一个参数必须为静态字符串
'
,
'
mp.component.args[1]
'
:
'
{0}需要两个参数
'
,
'
mp.360.unsupported
'
:
'
vue3暂不支持360小程序
'
,
}
packages/vite-plugin-uni/src/cli/utils.ts
浏览文件 @
f5ff2bbc
...
...
@@ -43,6 +43,10 @@ export function addConfigFile(inlineConfig: InlineConfig) {
}
export
function
initEnv
(
type
:
'
dev
'
|
'
build
'
,
options
:
CliOptions
)
{
if
(
options
.
platform
===
'
mp-360
'
)
{
console
.
error
(
M
[
'
mp.360.unsupported
'
])
process
.
exit
(
0
)
}
if
(
type
===
'
dev
'
)
{
process
.
env
.
NODE_ENV
=
'
development
'
}
else
if
(
type
===
'
build
'
)
{
...
...
scripts/checkVersion.js
0 → 100644
浏览文件 @
f5ff2bbc
const
path
=
require
(
'
path
'
)
const
execa
=
require
(
'
execa
'
)
const
{
resolvePackages
}
=
require
(
'
./utils
'
)
async
function
getVersion
(
name
,
tag
=
'
latest
'
)
{
return
(
await
execa
(
'
npm
'
,
[
'
view
'
,
name
+
'
@
'
+
tag
,
'
version
'
])
).
stdout
.
trim
()
}
const
pkgs
=
{
vue
:
{
next
:
'
3.2.22
'
,
},
'
vue-router
'
:
{
next
:
'
4.0.12
'
,
},
vuex
:
{
next
:
'
4.0.2
'
,
},
'
vue-i18n
'
:
{
next
:
'
9.1.7
'
,
},
vite
:
{
latest
:
'
2.6.14
'
,
},
'
@vitejs/plugin-vue
'
:
{
latest
:
'
1.9.4
'
,
},
'
@vitejs/plugin-vue-jsx
'
:
{
latest
:
'
1.2.0
'
,
},
'
@vitejs/plugin-legacy
'
:
{
latest
:
'
1.6.2
'
,
},
'
@dcloudio/types
'
:
{
latest
:
'
2.5.13
'
,
},
}
async
function
checkVersions
()
{
for
(
const
name
of
Object
.
keys
(
pkgs
))
{
for
(
const
tag
of
Object
.
keys
(
pkgs
[
name
]))
{
const
oldVersion
=
pkgs
[
name
][
tag
]
const
newVersion
=
await
getVersion
(
name
,
tag
)
if
(
oldVersion
!==
newVersion
)
{
console
.
log
(
name
+
'
:
'
+
'
'
.
repeat
(
80
-
(
name
+
'
:
'
+
oldVersion
+
'
=>
'
+
newVersion
).
length
)
+
oldVersion
+
'
=>
'
+
newVersion
)
}
else
{
console
.
log
(
name
+
'
:
'
+
'
'
.
repeat
(
80
-
(
name
+
'
:
'
+
newVersion
).
length
)
+
newVersion
)
}
}
}
}
const
packages
=
resolvePackages
(
'
../packages
'
).
filter
(
(
name
)
=>
name
!==
'
size-check
'
)
const
deps
=
Object
.
create
(
null
)
function
resolveDeps
(
owner
,
dependencies
)
{
if
(
!
dependencies
)
{
return
}
Object
.
keys
(
dependencies
).
forEach
((
name
)
=>
{
if
(
name
.
startsWith
(
'
@dcloudio
'
))
{
return
}
;(
deps
[
name
]
||
(
deps
[
name
]
=
{}))[
owner
]
=
dependencies
[
name
]
})
}
function
resolvePkgDeps
(
pkgPath
)
{
const
{
name
,
dependencies
,
devDependencies
,
peerDependencies
,
}
=
require
(
pkgPath
)
resolveDeps
(
name
,
dependencies
)
// resolveDeps(name, devDependencies)
resolveDeps
(
name
,
peerDependencies
)
}
const
paths
=
[
path
.
resolve
(
__dirname
,
'
../packages/vite-plugin-uni/node_modules
'
),
]
const
vuePkgs
=
[
require
.
resolve
(
'
vite/package.json
'
),
require
.
resolve
(
'
@vitejs/plugin-vue/package.json
'
),
require
.
resolve
(
'
@vitejs/plugin-vue-jsx/package.json
'
),
require
.
resolve
(
'
@vitejs/plugin-legacy/package.json
'
,
{
paths
}),
require
.
resolve
(
'
@vue/compiler-core/package.json
'
,
{
paths
}),
require
.
resolve
(
'
@vue/compiler-dom/package.json
'
,
{
paths
}),
require
.
resolve
(
'
@vue/compiler-sfc/package.json
'
,
{
paths
}),
]
function
checkDeps
()
{
vuePkgs
.
forEach
((
pkg
)
=>
resolvePkgDeps
(
pkg
))
packages
.
forEach
((
pkg
)
=>
{
resolvePkgDeps
(
path
.
resolve
(
__dirname
,
'
../packages
'
,
pkg
,
'
package.json
'
))
})
console
.
log
(
Object
.
keys
(
deps
)
.
filter
((
name
)
=>
{
const
versions
=
Object
.
values
(
deps
[
name
])
return
new
Set
(
versions
).
size
>
1
})
.
map
((
name
)
=>
{
return
{
name
,
owners
:
deps
[
name
],
}
})
)
}
async
function
run
()
{
checkDeps
()
await
checkVersions
()
}
run
()
scripts/updateVersion.js
浏览文件 @
f5ff2bbc
...
...
@@ -2,6 +2,7 @@ const fs = require('fs')
const
path
=
require
(
'
path
'
)
const
chalk
=
require
(
'
chalk
'
)
const
{
prompt
}
=
require
(
'
enquirer
'
)
const
{
resolvePackages
}
=
require
(
'
./utils
'
)
const
args
=
process
.
argv
.
slice
(
2
)
const
packages
=
[
...
resolvePackages
(
'
../packages
'
),
...
...
@@ -10,18 +11,6 @@ const packages = [
),
]
function
resolvePackages
(
dirname
)
{
dirname
=
path
.
resolve
(
__dirname
,
dirname
)
return
fs
.
readdirSync
(
dirname
)
.
filter
(
(
p
)
=>
!
p
.
endsWith
(
'
.ts
'
)
&&
!
p
.
startsWith
(
'
.
'
)
&&
fs
.
existsSync
(
path
.
join
(
dirname
,
p
,
'
package.json
'
))
)
}
const
getPkgRoot
=
(
pkg
)
=>
path
.
resolve
(
__dirname
,
'
../packages/
'
+
pkg
)
function
updateVersions
(
module
,
oldVersion
,
newVersion
)
{
...
...
scripts/utils.js
浏览文件 @
f5ff2bbc
...
...
@@ -74,3 +74,15 @@ exports.fuzzyMatchTarget = (partialTargets, includeAllMatching) => {
process
.
exit
(
1
)
}
}
exports
.
resolvePackages
=
(
dirname
)
=>
{
dirname
=
path
.
resolve
(
__dirname
,
dirname
)
return
fs
.
readdirSync
(
dirname
)
.
filter
(
(
p
)
=>
!
p
.
endsWith
(
'
.ts
'
)
&&
!
p
.
startsWith
(
'
.
'
)
&&
fs
.
existsSync
(
path
.
join
(
dirname
,
p
,
'
package.json
'
))
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录