
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
uni-packing-wgt
Advanced tools
由于官方的HBuilderX编译器打包wgt每次都要手动的操作有些繁琐,也不支持多环境打包,在开发阶段与原生项目交互调试是极其不方便。
而uni-packing-wgt正好可以解决这些问题。
uni-packing-wgt是uniapp跨平台多环境资源打包、调试、发布的脚本工具。
主要特性:
工具仅限于vite cli创建的项目使用,不支持HBuilderX创建的项目。
安装:
npm i uni-packing-wgt
1、在package.json中配置uniapp的打包命令,如下:
"build:app-plus-dev": "uni build -p app-plus --mode development --outDir=./dist/dev/app",
"build:app-plus-beta": "uni build -p app-plus --mode beta --outDir=./dist/beta/app",
"build:app-plus-release": "uni build -p app-plus --mode production --outDir=./dist/release/app"
其中development、beta、production是vite多环境配置的文件名,vite必须遵守这种命名规范,不然脚本会执行失败。
2、执行build-wgt命令行生成dist资源和uni wgt包,从1.2.0版本可以携带环境参数执行,之前config.json的runDev、runBeta、runRelease字段已弃用。
build-wgt -d
如果是在vscode和命令终端上运行命令,记得加上
npx,即npx build-wgt, WebStorm则不用。
在初次执行命令时,会在项目根目录创建三个配置文件,可根据需求自由配置:
config-output.json和config-release.json文件记得在
.gitignore配置忽略不用提交,每个开发者的参数是不一样的。
config.json
{
"runDev": true, // 指定打包的环境
"runBeta": false,
"runRelease": false,
"refreshUrl": true, // 是否刷新七牛cdn缓存
"isIncrementVersion": true, // 版本是否自增
"uploadWgtPackage": false, // wgt包是否上传到云平台上,需要结合upload参数使用
"pkgCopyToNativeDir": false, // 是否将资源包同步到原生项目上,需要在config-output.json配置路径
"upload": { // 七牛配置参数
"devAccessKey": "",
"devSecretKey": "",
"devBucket": "",
"devDomainName": "",
"devDir": "app"
}
}
生成环境的七牛参数需要在config-release.json#upload配置,如果是外部使用,其他参数无须配置。
在打包资源同步到原生项目中调试,需要在config-output.json文件中配置原生项目的目标目录。以Android为例:
同步到原生项目中调试,需要版本自增才会生效,把
isIncrementVersion设置true即可。
{
"sourceDir": "./dist/dev/app",
"targetDir": "替换成项目路径/app/src/main/assets/apps/替换成uniAppId/www"
}
./dist/dev/app;以dev环境为例,控制台输出结果:
hzwei@HZWeis-Mac-mini uni-mall-staff % build-wgt
======开始生成资源包=====
======资源包生成完成=====
======资源包开始压缩=====
{ status: 'fulfilled', value: './dist/dev/__UNI__xxxx60.wgt' }
======资源包压缩任务完成=====
======资源包开始复制=====
{
hash: 'Fop4lZ8NADlAsThMVWIiTjoTh_JT',
key: 'app/dev/__UNI__xxxx60.wgt'
}
前往刷新url: https://xxxx.com/app/dev/__UNI__xxxx60.wgt
======资源包上传完成=====
ohos目录,可在config.json#isHarmonySeparateDir配置true, 也可以在config-release.json#configs#updateOhos配置true。config.json#versionLength配置FAQs
uniapp wgt多环境打包、调试、发布(七牛云)插件
The npm package uni-packing-wgt receives a total of 12 weekly downloads. As such, uni-packing-wgt popularity was classified as not popular.
We found that uni-packing-wgt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.