From 0c15cef4455f8aeccb0678ec1b05f94a6ffb5fae Mon Sep 17 00:00:00 2001
From: Burt <1020103647@qq.com>
Date: Mon, 15 Jan 2024 09:18:58 +0800
Subject: [PATCH] =?UTF-8?q?feat(manifest):=20=E5=BC=95=E5=85=A5=20@uni-hel?=
=?UTF-8?q?per/vite-plugin-uni-manifest?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
env/.env | 3 ++
manifest.config.ts | 83 ++++++++++++++++++++++++++++++++++++++++++++++
package.json | 1 +
pnpm-lock.yaml | 15 +++++++++
src/manifest.json | 23 +++++--------
vite.config.ts | 5 ++-
6 files changed, 114 insertions(+), 16 deletions(-)
create mode 100644 manifest.config.ts
diff --git a/env/.env b/env/.env
index 7fd2b2e..54a92a0 100644
--- a/env/.env
+++ b/env/.env
@@ -1,2 +1,5 @@
VITE_APP_TITLE = 'vue3-uniapp'
VITE_APP_PORT = 9000
+
+VIRW_UNI_APPID = 'H5871D791'
+VITE_WX_APPID = 'wxa2abb91f64032a2b'
diff --git a/manifest.config.ts b/manifest.config.ts
new file mode 100644
index 0000000..f63ec20
--- /dev/null
+++ b/manifest.config.ts
@@ -0,0 +1,83 @@
+// manifest.config.ts
+import { defineManifestConfig } from '@uni-helper/vite-plugin-uni-manifest'
+
+export default defineManifestConfig({
+ name: 'unifly',
+ appid: '',
+ description: '',
+ versionName: '1.0.0',
+ versionCode: '100',
+ transformPx: false,
+ /* 5+App特有相关 */
+ 'app-plus': {
+ usingComponents: true,
+ nvueStyleCompiler: 'uni-app',
+ compilerVersion: 3,
+ splashscreen: {
+ alwaysShowBeforeRender: true,
+ waiting: true,
+ autoclose: true,
+ delay: 0,
+ },
+ /* 模块配置 */
+ modules: {},
+ /* 应用发布信息 */
+ distribute: {
+ /* android打包配置 */
+ android: {
+ // minSdkVersion: 30,
+ // targetSdkVersion: 30,
+ // abiFilters: ['armeabi-v7a', 'arm64-v8a'],
+ permissions: [
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ ],
+ },
+ /* ios打包配置 */
+ ios: {},
+ /* SDK配置 */
+ sdkConfigs: {},
+ /* 图标配置 */
+ icons: {
+ android: {},
+ ios: {},
+ },
+ },
+ },
+ /* 快应用特有相关 */
+ quickapp: {},
+ /* 小程序特有相关 */
+ 'mp-weixin': {
+ appid: '',
+ setting: {
+ urlCheck: false,
+ },
+ usingComponents: true,
+ },
+ 'mp-alipay': {
+ usingComponents: true,
+ },
+ 'mp-baidu': {
+ usingComponents: true,
+ },
+ 'mp-toutiao': {
+ usingComponents: true,
+ },
+ uniStatistics: {
+ enable: false,
+ },
+ vueVersion: '3',
+})
diff --git a/package.json b/package.json
index b212401..4c7ab54 100644
--- a/package.json
+++ b/package.json
@@ -98,6 +98,7 @@
"@uni-helper/uni-ui-types": "^0.5.11",
"@uni-helper/unocss-preset-uni": "^0.2.5",
"@uni-helper/vite-plugin-uni-layouts": "^0.1.7",
+ "@uni-helper/vite-plugin-uni-manifest": "^0.2.3",
"@uni-helper/vite-plugin-uni-pages": "^0.2.13",
"@uni-helper/vite-plugin-uni-platform": "^0.0.4",
"@vue/runtime-core": "^3.2.45",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 8718501..600d76e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -112,6 +112,9 @@ devDependencies:
'@uni-helper/vite-plugin-uni-layouts':
specifier: ^0.1.7
version: 0.1.7(eslint-import-resolver-typescript@3.6.1)(typescript@4.9.5)
+ '@uni-helper/vite-plugin-uni-manifest':
+ specifier: ^0.2.3
+ version: 0.2.3
'@uni-helper/vite-plugin-uni-pages':
specifier: ^0.2.13
version: 0.2.13(@types/lodash-es@4.17.12)(lodash-es@4.17.21)(lodash@4.17.21)
@@ -3983,6 +3986,13 @@ packages:
- vitest
dev: true
+ /@uni-helper/vite-plugin-uni-manifest@0.2.3:
+ resolution: {integrity: sha512-cWwefP9mWCrxdHYnVndmYx++diium4jp1WLiBFTCULUFdBSnSWZCpQHITBQfuyGohdSUBSUx9Fe72Av1qOh+Ag==}
+ dependencies:
+ c12: 1.6.1
+ type-fest: 4.9.0
+ dev: true
+
/@uni-helper/vite-plugin-uni-pages@0.2.13(@types/lodash-es@4.17.12)(lodash-es@4.17.21)(lodash@4.17.21):
resolution: {integrity: sha512-QA2bIFQYVYUphcl1aUxN4zUxyiHQPS0hQP0V0c03aUxacuNAEYuM4QUgrYRCT3LReSLkZSUyfAhfr64SPPdccQ==}
dependencies:
@@ -13108,6 +13118,11 @@ packages:
engines: {node: '>=14.16'}
dev: true
+ /type-fest@4.9.0:
+ resolution: {integrity: sha512-KS/6lh/ynPGiHD/LnAobrEFq3Ad4pBzOlJ1wAnJx9N4EYoqFhMfLIBjUT2UEx4wg5ZE+cC1ob6DCSpppVo+rtg==}
+ engines: {node: '>=16'}
+ dev: true
+
/type-is@1.6.18:
resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==}
engines: {node: '>= 0.6'}
diff --git a/src/manifest.json b/src/manifest.json
index 6f26e88..2ca3650 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,11 +1,10 @@
{
- "name": "vue3-uniapp-template",
- "appid": "H5871D791",
+ "name": "unifly",
+ "appid": "",
"description": "",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
- /* 5+App特有相关 */
"app-plus": {
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
@@ -16,15 +15,9 @@
"autoclose": true,
"delay": 0
},
- /* 模块配置 */
"modules": {},
- /* 应用发布信息 */
"distribute": {
- /* android打包配置 */
"android": {
- "minSdkVersion": 30,
- "targetSdkVersion": 30,
- "abiFilters": ["armeabi-v7a", "arm64-v8a", "x86"],
"permissions": [
"",
"",
@@ -43,17 +36,17 @@
""
]
},
- /* ios打包配置 */
"ios": {},
- /* SDK配置 */
- "sdkConfigs": {}
+ "sdkConfigs": {},
+ "icons": {
+ "android": {},
+ "ios": {}
+ }
}
},
- /* 快应用特有相关 */
"quickapp": {},
- /* 小程序特有相关 */
"mp-weixin": {
- "appid": "wxa2abb91f64032a2b",
+ "appid": "",
"setting": {
"urlCheck": false
},
diff --git a/vite.config.ts b/vite.config.ts
index 15c5775..1e61bb5 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -8,6 +8,8 @@ import UniLayouts from '@uni-helper/vite-plugin-uni-layouts'
// @see https://github.com/uni-helper/vite-plugin-uni-platform
// 需要与 @uni-helper/vite-plugin-uni-pages 插件一起使用
import UniPlatform from '@uni-helper/vite-plugin-uni-platform'
+// @see https://github.com/uni-helper/vite-plugin-uni-manifest
+import UniManifest from '@uni-helper/vite-plugin-uni-manifest'
import svgLoader from 'vite-svg-loader'
import { visualizer } from 'rollup-plugin-visualizer'
import ViteRestart from 'vite-plugin-restart'
@@ -31,7 +33,7 @@ export default ({ command, mode }) => {
// process.cwd(): 获取当前文件的目录跟地址
// loadEnv(): 返回当前环境env文件中额外定义的变量
const env = loadEnv(mode, path.resolve(process.cwd(), 'env'))
- console.log(env)
+ // console.log(env)
console.log(process.env.UNI_PLATFORM) // 得到 mp-weixin, h5 等
return defineConfig({
envDir: './env', // 自定义env目录
@@ -41,6 +43,7 @@ export default ({ command, mode }) => {
UniPlatform(),
// UniXX() 都需要在 Uni() 之前引入
Uni(),
+ UniManifest(),
UnoCSS(),
svgLoader(),
// 打包分析插件