Skip to content

Commit

Permalink
feat(uvue): manifest.json 补充 uni-app-x compilerVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
fxy060608 committed Mar 6, 2024
1 parent 462c849 commit fb63c98
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
15 changes: 2 additions & 13 deletions packages/uni-app-uts/src/plugins/android/manifestJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
parseUniXSplashScreen,
} from '@dcloudio/uni-cli-shared'
import { ENTRY_FILENAME, stringifyMap } from './utils'
import { isManifest } from '../utils'
import { isManifest, normalizeManifestJson } from '../utils'

let outputManifestJson: Record<string, any> | undefined = undefined

Expand Down Expand Up @@ -89,18 +89,7 @@ export class UniAppConfig extends AppConfig {
}
},
writeBundle() {
const app = manifestJson.app || {}
outputManifestJson = {
id: manifestJson.appid || '',
name: manifestJson.name || '',
description: manifestJson.description || '',
version: {
name: manifestJson.versionName || '',
code: manifestJson.versionCode || '',
},
'uni-app-x': manifestJson['uni-app-x'] || {},
app,
}
outputManifestJson = normalizeManifestJson(manifestJson)
if (process.env.NODE_ENV !== 'production') {
// 发行模式下,需要等解析ext-api模块
fs.outputFileSync(
Expand Down
15 changes: 2 additions & 13 deletions packages/uni-app-uts/src/plugins/ios/manifestJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path'
import fs from 'fs-extra'
import type { Plugin } from 'vite'
import { MANIFEST_JSON_UTS, parseJson } from '@dcloudio/uni-cli-shared'
import { isManifest } from '../utils'
import { isManifest, normalizeManifestJson } from '../utils'

let outputManifestJson: Record<string, any> | undefined = undefined

Expand Down Expand Up @@ -43,18 +43,7 @@ export function uniAppManifestPlugin(): Plugin {
}
},
writeBundle() {
const app = manifestJson.app || {}
outputManifestJson = {
id: manifestJson.appid || '',
name: manifestJson.name || '',
description: manifestJson.description || '',
version: {
name: manifestJson.versionName || '',
code: manifestJson.versionCode || '',
},
'uni-app-x': manifestJson['uni-app-x'] || {},
app,
}
outputManifestJson = normalizeManifestJson(manifestJson)
if (process.env.NODE_ENV !== 'production') {
// 发行模式下,需要等解析ext-api模块
fs.outputFileSync(
Expand Down
17 changes: 17 additions & 0 deletions packages/uni-app-uts/src/plugins/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,20 @@ export function relativeInputDir(filename: string) {
}
return filename
}

export function normalizeManifestJson(userManifestJson: Record<string, any>) {
const app = userManifestJson.app || {}
const x = userManifestJson['uni-app-x'] || {}
x.compilerVersion = process.env.UNI_COMPILER_VERSION || ''
return {
id: userManifestJson.appid || '',
name: userManifestJson.name || '',
description: userManifestJson.description || '',
version: {
name: userManifestJson.versionName || '',
code: userManifestJson.versionCode || '',
},
'uni-app-x': x,
app,
}
}

0 comments on commit fb63c98

Please sign in to comment.