zcw-shared 2.4.0 → 2.8.0
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/dist/functions/android/integrateThirdPartyModule.d.ts +5 -0
- package/dist/functions/android/integrateThirdPartyModule.js +70 -0
- package/dist/functions/android/integrateThirdPartyModule.js.map +1 -1
- package/dist/functions/android/integrateUniPushAndroid.d.ts +23 -0
- package/dist/functions/android/integrateUniPushAndroid.js +266 -0
- package/dist/functions/android/integrateUniPushAndroid.js.map +1 -0
- package/dist/functions/api/auth.d.ts +14 -0
- package/dist/functions/api/auth.js +109 -0
- package/dist/functions/api/auth.js.map +1 -0
- package/dist/functions/api/schemas/auth.schema.d.ts +363 -0
- package/dist/functions/api/schemas/auth.schema.js +39 -0
- package/dist/functions/api/schemas/auth.schema.js.map +1 -0
- package/dist/functions/api/schemas/video.schema.d.ts +391 -0
- package/dist/functions/api/schemas/video.schema.js +55 -0
- package/dist/functions/api/schemas/video.schema.js.map +1 -0
- package/dist/functions/api/video.d.ts +62 -0
- package/dist/functions/api/video.js +243 -0
- package/dist/functions/api/video.js.map +1 -0
- package/dist/functions/browser/isElectron.d.ts +5 -0
- package/dist/functions/browser/isElectron.js +4 -0
- package/dist/functions/browser/isElectron.js.map +1 -0
- package/dist/functions/dom/isTextTruncated.d.ts +4 -0
- package/dist/functions/dom/isTextTruncated.js +16 -0
- package/dist/functions/dom/isTextTruncated.js.map +1 -0
- package/dist/functions/dom/localFileInput.d.ts +14 -0
- package/dist/functions/dom/localFileInput.js +27 -0
- package/dist/functions/dom/localFileInput.js.map +1 -0
- package/dist/functions/file/getIconfontNameByExtension.js +53 -56
- package/dist/functions/file/getIconfontNameByExtension.js.map +1 -1
- package/dist/functions/im/parseImMentionSegments.d.ts +15 -0
- package/dist/functions/im/parseImMentionSegments.js +56 -0
- package/dist/functions/im/parseImMentionSegments.js.map +1 -0
- package/dist/functions/ios/integrateThirdPartyModule.d.ts +9 -1
- package/dist/functions/ios/integrateThirdPartyModule.js +112 -2
- package/dist/functions/ios/integrateThirdPartyModule.js.map +1 -1
- package/dist/functions/ios/integrateUniPushIOS.d.ts +18 -0
- package/dist/functions/ios/integrateUniPushIOS.js +200 -0
- package/dist/functions/ios/integrateUniPushIOS.js.map +1 -0
- package/dist/functions/oss/uploadViaSignedPut.d.ts +35 -0
- package/dist/functions/oss/uploadViaSignedPut.js +86 -0
- package/dist/functions/oss/uploadViaSignedPut.js.map +1 -0
- package/dist/functions/uniapp/app-plus/buildAndroidApp.js +38 -0
- package/dist/functions/uniapp/app-plus/buildAndroidApp.js.map +1 -1
- package/dist/functions/uniapp/app-plus/buildIOSApp.js +38 -0
- package/dist/functions/uniapp/app-plus/buildIOSApp.js.map +1 -1
- package/dist/vue-hooks/dom/useAppendToBody.d.ts +25 -0
- package/dist/vue-hooks/dom/useAppendToBody.js +31 -0
- package/dist/vue-hooks/dom/useAppendToBody.js.map +1 -0
- package/dist/vue-hooks/dom/useDraggable.d.ts +8 -3
- package/dist/vue-hooks/dom/useDraggable.js +57 -19
- package/dist/vue-hooks/dom/useDraggable.js.map +1 -1
- package/package.json +11 -1
- package/references/dom.d.ts +8 -3
- package/types/im-api.d.ts +26 -2
- package/types/im-chat.d.ts +42 -1
- package/types/im-message-display.d.ts +89 -0
- package/types/uniapp-android-build.d.ts +31 -0
- package/types/uniapp-ios-build.d.ts +26 -0
- package/types/user.d.ts +2 -1
- package/dist/functions/async/sleep.d.ts +0 -5
- package/dist/functions/async/sleep.js +0 -6
- package/dist/functions/async/sleep.js.map +0 -1
- package/dist/functions/async/timeout.d.ts +0 -6
- package/dist/functions/async/timeout.js +0 -12
- package/dist/functions/async/timeout.js.map +0 -1
- package/dist/functions/browser/computePosition.d.ts +0 -6
- package/dist/functions/browser/computePosition.js +0 -49
- package/dist/functions/browser/computePosition.js.map +0 -1
- package/dist/functions/browser/createSharedKeyboardCenter.d.ts +0 -18
- package/dist/functions/browser/createSharedKeyboardCenter.js +0 -58
- package/dist/functions/browser/createSharedKeyboardCenter.js.map +0 -1
- package/dist/functions/browser/createThrottledEventListener.d.ts +0 -11
- package/dist/functions/browser/createThrottledEventListener.js +0 -51
- package/dist/functions/browser/createThrottledEventListener.js.map +0 -1
- package/dist/functions/browser/demonstrateResourceLoading.d.ts +0 -32
- package/dist/functions/browser/demonstrateResourceLoading.js +0 -169
- package/dist/functions/browser/demonstrateResourceLoading.js.map +0 -1
- package/dist/functions/browser/detectOverflow.d.ts +0 -12
- package/dist/functions/browser/detectOverflow.js +0 -17
- package/dist/functions/browser/detectOverflow.js.map +0 -1
- package/dist/functions/browser/getAlignment.d.ts +0 -2
- package/dist/functions/browser/getAlignment.js +0 -5
- package/dist/functions/browser/getAlignment.js.map +0 -1
- package/dist/functions/browser/getBasePlacement.d.ts +0 -2
- package/dist/functions/browser/getBasePlacement.js +0 -4
- package/dist/functions/browser/getBasePlacement.js.map +0 -1
- package/dist/functions/browser/getCrossAxisFlip.d.ts +0 -2
- package/dist/functions/browser/getCrossAxisFlip.js +0 -11
- package/dist/functions/browser/getCrossAxisFlip.js.map +0 -1
- package/dist/functions/browser/getElementRect.d.ts +0 -3
- package/dist/functions/browser/getElementRect.js +0 -14
- package/dist/functions/browser/getElementRect.js.map +0 -1
- package/dist/functions/browser/getFlipPlacements.d.ts +0 -2
- package/dist/functions/browser/getFlipPlacements.js +0 -13
- package/dist/functions/browser/getFlipPlacements.js.map +0 -1
- package/dist/functions/browser/getMainAxisFlip.d.ts +0 -2
- package/dist/functions/browser/getMainAxisFlip.js +0 -17
- package/dist/functions/browser/getMainAxisFlip.js.map +0 -1
- package/dist/functions/browser/getRelativePosition.d.ts +0 -3
- package/dist/functions/browser/getRelativePosition.js +0 -14
- package/dist/functions/browser/getRelativePosition.js.map +0 -1
- package/dist/functions/browser/getViewportRect.d.ts +0 -7
- package/dist/functions/browser/getViewportRect.js +0 -15
- package/dist/functions/browser/getViewportRect.js.map +0 -1
- package/dist/functions/browser/isValidPlacement.d.ts +0 -2
- package/dist/functions/browser/isValidPlacement.js +0 -16
- package/dist/functions/browser/isValidPlacement.js.map +0 -1
- package/dist/functions/browser/pickFile.d.ts +0 -15
- package/dist/functions/browser/pickFile.js +0 -48
- package/dist/functions/browser/pickFile.js.map +0 -1
- package/dist/functions/build/generateExports.d.ts +0 -26
- package/dist/functions/build/generateExports.js +0 -34
- package/dist/functions/build/generateExports.js.map +0 -1
- package/dist/functions/core/diff/diff.d.ts +0 -25
- package/dist/functions/core/diff/diff.js +0 -316
- package/dist/functions/core/diff/diff.js.map +0 -1
- package/dist/functions/core/diff/vueDiff.d.ts +0 -38
- package/dist/functions/core/diff/vueDiff.js +0 -333
- package/dist/functions/core/diff/vueDiff.js.map +0 -1
- package/dist/functions/core/generator/generatorUtils.d.ts +0 -16
- package/dist/functions/core/generator/generatorUtils.js +0 -139
- package/dist/functions/core/generator/generatorUtils.js.map +0 -1
- package/dist/functions/core/type/isType.d.ts +0 -11
- package/dist/functions/core/type/isType.js +0 -30
- package/dist/functions/core/type/isType.js.map +0 -1
- package/dist/functions/data/array-object/chunk.d.ts +0 -1
- package/dist/functions/data/array-object/chunk.js +0 -11
- package/dist/functions/data/array-object/chunk.js.map +0 -1
- package/dist/functions/data/array-object/deepClone.d.ts +0 -12
- package/dist/functions/data/array-object/deepClone.js +0 -131
- package/dist/functions/data/array-object/deepClone.js.map +0 -1
- package/dist/functions/data/array-object/evolve.d.ts +0 -3
- package/dist/functions/data/array-object/evolve.js +0 -15
- package/dist/functions/data/array-object/evolve.js.map +0 -1
- package/dist/functions/data/array-object/flatten.d.ts +0 -7
- package/dist/functions/data/array-object/flatten.js +0 -60
- package/dist/functions/data/array-object/flatten.js.map +0 -1
- package/dist/functions/data/array-object/flattenObject.d.ts +0 -5
- package/dist/functions/data/array-object/flattenObject.js +0 -102
- package/dist/functions/data/array-object/flattenObject.js.map +0 -1
- package/dist/functions/data/array-object/groupBy.d.ts +0 -1
- package/dist/functions/data/array-object/groupBy.js +0 -14
- package/dist/functions/data/array-object/groupBy.js.map +0 -1
- package/dist/functions/data/array-object/omit.d.ts +0 -1
- package/dist/functions/data/array-object/omit.js +0 -8
- package/dist/functions/data/array-object/omit.js.map +0 -1
- package/dist/functions/data/array-object/pick.d.ts +0 -1
- package/dist/functions/data/array-object/pick.js +0 -10
- package/dist/functions/data/array-object/pick.js.map +0 -1
- package/dist/functions/data/array-object/shuffle.d.ts +0 -1
- package/dist/functions/data/array-object/shuffle.js +0 -9
- package/dist/functions/data/array-object/shuffle.js.map +0 -1
- package/dist/functions/data/array-object/sortBy.d.ts +0 -1
- package/dist/functions/data/array-object/sortBy.js +0 -13
- package/dist/functions/data/array-object/sortBy.js.map +0 -1
- package/dist/functions/data/array-object/unique.d.ts +0 -10
- package/dist/functions/data/array-object/unique.js +0 -85
- package/dist/functions/data/array-object/unique.js.map +0 -1
- package/dist/functions/data/date/dateRange.d.ts +0 -1
- package/dist/functions/data/date/dateRange.js +0 -18
- package/dist/functions/data/date/dateRange.js.map +0 -1
- package/dist/functions/data/date/formatDate.d.ts +0 -1
- package/dist/functions/data/date/formatDate.js +0 -21
- package/dist/functions/data/date/formatDate.js.map +0 -1
- package/dist/functions/data/date/timeAgo.d.ts +0 -1
- package/dist/functions/data/date/timeAgo.js +0 -49
- package/dist/functions/data/date/timeAgo.js.map +0 -1
- package/dist/functions/data/number/average.d.ts +0 -1
- package/dist/functions/data/number/average.js +0 -8
- package/dist/functions/data/number/average.js.map +0 -1
- package/dist/functions/data/number/clamp.d.ts +0 -1
- package/dist/functions/data/number/clamp.js +0 -7
- package/dist/functions/data/number/clamp.js.map +0 -1
- package/dist/functions/data/number/formatNumber.d.ts +0 -8
- package/dist/functions/data/number/formatNumber.js +0 -16
- package/dist/functions/data/number/formatNumber.js.map +0 -1
- package/dist/functions/data/number/median.d.ts +0 -1
- package/dist/functions/data/number/median.js +0 -14
- package/dist/functions/data/number/median.js.map +0 -1
- package/dist/functions/data/number/percentile.d.ts +0 -1
- package/dist/functions/data/number/percentile.js +0 -18
- package/dist/functions/data/number/percentile.js.map +0 -1
- package/dist/functions/data/number/random.d.ts +0 -4
- package/dist/functions/data/number/random.js +0 -9
- package/dist/functions/data/number/random.js.map +0 -1
- package/dist/functions/data/number/range.d.ts +0 -1
- package/dist/functions/data/number/range.js +0 -18
- package/dist/functions/data/number/range.js.map +0 -1
- package/dist/functions/data/number/sum.d.ts +0 -1
- package/dist/functions/data/number/sum.js +0 -4
- package/dist/functions/data/number/sum.js.map +0 -1
- package/dist/functions/data/randomRegion.d.ts +0 -24
- package/dist/functions/data/randomRegion.js +0 -74
- package/dist/functions/data/randomRegion.js.map +0 -1
- package/dist/functions/data/string/base64.d.ts +0 -5
- package/dist/functions/data/string/base64.js +0 -6
- package/dist/functions/data/string/base64.js.map +0 -1
- package/dist/functions/data/string/capitalize.d.ts +0 -1
- package/dist/functions/data/string/capitalize.js +0 -6
- package/dist/functions/data/string/capitalize.js.map +0 -1
- package/dist/functions/data/string/caseConverter.d.ts +0 -19
- package/dist/functions/data/string/caseConverter.js +0 -94
- package/dist/functions/data/string/caseConverter.js.map +0 -1
- package/dist/functions/data/string/desensitize.d.ts +0 -13
- package/dist/functions/data/string/desensitize.js +0 -107
- package/dist/functions/data/string/desensitize.js.map +0 -1
- package/dist/functions/data/string/htmlEscape.d.ts +0 -20
- package/dist/functions/data/string/htmlEscape.js +0 -80
- package/dist/functions/data/string/htmlEscape.js.map +0 -1
- package/dist/functions/data/string/levenshtein.d.ts +0 -1
- package/dist/functions/data/string/levenshtein.js +0 -27
- package/dist/functions/data/string/levenshtein.js.map +0 -1
- package/dist/functions/data/string/normalize.d.ts +0 -8
- package/dist/functions/data/string/normalize.js +0 -37
- package/dist/functions/data/string/normalize.js.map +0 -1
- package/dist/functions/data/string/pad.d.ts +0 -13
- package/dist/functions/data/string/pad.js +0 -50
- package/dist/functions/data/string/pad.js.map +0 -1
- package/dist/functions/data/string/palindrome.d.ts +0 -3
- package/dist/functions/data/string/palindrome.js +0 -15
- package/dist/functions/data/string/palindrome.js.map +0 -1
- package/dist/functions/data/string/similarity.d.ts +0 -1
- package/dist/functions/data/string/similarity.js +0 -13
- package/dist/functions/data/string/similarity.js.map +0 -1
- package/dist/functions/data/string/template.d.ts +0 -4
- package/dist/functions/data/string/template.js +0 -21
- package/dist/functions/data/string/template.js.map +0 -1
- package/dist/functions/data/string/testRegex.d.ts +0 -20
- package/dist/functions/data/string/testRegex.js +0 -300
- package/dist/functions/data/string/testRegex.js.map +0 -1
- package/dist/functions/data/string/wordCount.d.ts +0 -5
- package/dist/functions/data/string/wordCount.js +0 -11
- package/dist/functions/data/string/wordCount.js.map +0 -1
- package/dist/functions/data/tree/buildTree.d.ts +0 -7
- package/dist/functions/data/tree/buildTree.js +0 -27
- package/dist/functions/data/tree/buildTree.js.map +0 -1
- package/dist/functions/data/tree/filterTree.d.ts +0 -4
- package/dist/functions/data/tree/filterTree.js +0 -21
- package/dist/functions/data/tree/filterTree.js.map +0 -1
- package/dist/functions/data/tree/findNode.d.ts +0 -4
- package/dist/functions/data/tree/findNode.js +0 -21
- package/dist/functions/data/tree/findNode.js.map +0 -1
- package/dist/functions/data/tree/flattenTree.d.ts +0 -6
- package/dist/functions/data/tree/flattenTree.js +0 -21
- package/dist/functions/data/tree/flattenTree.js.map +0 -1
- package/dist/functions/file/walk.d.ts +0 -18
- package/dist/functions/file/walk.js +0 -58
- package/dist/functions/file/walk.js.map +0 -1
- package/dist/functions/hybrid/detectBridgeEnvironment.d.ts +0 -11
- package/dist/functions/hybrid/detectBridgeEnvironment.js +0 -26
- package/dist/functions/hybrid/detectBridgeEnvironment.js.map +0 -1
- package/dist/functions/integrations/ag-grid/generateLicense.d.ts +0 -7
- package/dist/functions/integrations/ag-grid/generateLicense.js +0 -12
- package/dist/functions/integrations/ag-grid/generateLicense.js.map +0 -1
- package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.d.ts +0 -30
- package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.js +0 -884
- package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.js.map +0 -1
- package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.d.ts +0 -31
- package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.js +0 -900
- package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.js.map +0 -1
- package/dist/functions/integrations/uniapp/build.d.ts +0 -21
- package/dist/functions/integrations/uniapp/build.js +0 -83
- package/dist/functions/integrations/uniapp/build.js.map +0 -1
- package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.d.ts +0 -11
- package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.js +0 -30
- package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.js.map +0 -1
- package/dist/functions/integrations/uniapp/detectProjectType.d.ts +0 -20
- package/dist/functions/integrations/uniapp/detectProjectType.js +0 -68
- package/dist/functions/integrations/uniapp/detectProjectType.js.map +0 -1
- package/dist/functions/integrations/uniapp/parseManifest.d.ts +0 -20
- package/dist/functions/integrations/uniapp/parseManifest.js +0 -51
- package/dist/functions/integrations/uniapp/parseManifest.js.map +0 -1
- package/dist/functions/integrations/uniapp/waitForPages.d.ts +0 -7
- package/dist/functions/integrations/uniapp/waitForPages.js +0 -20
- package/dist/functions/integrations/uniapp/waitForPages.js.map +0 -1
- package/dist/functions/integrations/vue/dynamicMount.d.ts +0 -18
- package/dist/functions/integrations/vue/dynamicMount.js +0 -25
- package/dist/functions/integrations/vue/dynamicMount.js.map +0 -1
- package/dist/functions/integrations/vue/extractColorsFromVueFile.d.ts +0 -3
- package/dist/functions/integrations/vue/extractColorsFromVueFile.js +0 -18
- package/dist/functions/integrations/vue/extractColorsFromVueFile.js.map +0 -1
- package/dist/functions/integrations/vue/extractColorsFromVueSection.d.ts +0 -3
- package/dist/functions/integrations/vue/extractColorsFromVueSection.js +0 -53
- package/dist/functions/integrations/vue/extractColorsFromVueSection.js.map +0 -1
- package/dist/functions/integrations/vue/filterSections.d.ts +0 -2
- package/dist/functions/integrations/vue/filterSections.js +0 -11
- package/dist/functions/integrations/vue/filterSections.js.map +0 -1
- package/dist/functions/integrations/vue/isVNode.d.ts +0 -2
- package/dist/functions/integrations/vue/isVNode.js +0 -6
- package/dist/functions/integrations/vue/isVNode.js.map +0 -1
- package/dist/functions/integrations/vue/isVueComponent.d.ts +0 -2
- package/dist/functions/integrations/vue/isVueComponent.js +0 -6
- package/dist/functions/integrations/vue/isVueComponent.js.map +0 -1
- package/dist/functions/integrations/vue/parseVueFile.d.ts +0 -2
- package/dist/functions/integrations/vue/parseVueFile.js +0 -53
- package/dist/functions/integrations/vue/parseVueFile.js.map +0 -1
- package/dist/functions/integrations/wechat/miniapp/downloadFile.d.ts +0 -6
- package/dist/functions/integrations/wechat/miniapp/downloadFile.js +0 -39
- package/dist/functions/integrations/wechat/miniapp/downloadFile.js.map +0 -1
- package/dist/functions/patterns/MyPromise.d.ts +0 -32
- package/dist/functions/patterns/MyPromise.js +0 -254
- package/dist/functions/patterns/MyPromise.js.map +0 -1
- package/dist/functions/patterns/functionBind.d.ts +0 -4
- package/dist/functions/patterns/functionBind.js +0 -33
- package/dist/functions/patterns/functionBind.js.map +0 -1
- package/dist/functions/patterns/myInstanceof.d.ts +0 -5
- package/dist/functions/patterns/myInstanceof.js +0 -56
- package/dist/functions/patterns/myInstanceof.js.map +0 -1
- package/dist/functions/patterns/myNew.d.ts +0 -3
- package/dist/functions/patterns/myNew.js +0 -19
- package/dist/functions/patterns/myNew.js.map +0 -1
- package/dist/functions/platform/android/buildProject.d.ts +0 -13
- package/dist/functions/platform/android/buildProject.js +0 -122
- package/dist/functions/platform/android/buildProject.js.map +0 -1
- package/dist/functions/platform/android/configureAppIcon.d.ts +0 -17
- package/dist/functions/platform/android/configureAppIcon.js +0 -106
- package/dist/functions/platform/android/configureAppIcon.js.map +0 -1
- package/dist/functions/platform/android/configureLaunchScreen.d.ts +0 -21
- package/dist/functions/platform/android/configureLaunchScreen.js +0 -328
- package/dist/functions/platform/android/configureLaunchScreen.js.map +0 -1
- package/dist/functions/platform/android/detectAndroidModules.d.ts +0 -8
- package/dist/functions/platform/android/detectAndroidModules.js +0 -21
- package/dist/functions/platform/android/detectAndroidModules.js.map +0 -1
- package/dist/functions/platform/android/integrateFacebookLogin.d.ts +0 -12
- package/dist/functions/platform/android/integrateFacebookLogin.js +0 -91
- package/dist/functions/platform/android/integrateFacebookLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateGoogleLogin.d.ts +0 -10
- package/dist/functions/platform/android/integrateGoogleLogin.js +0 -199
- package/dist/functions/platform/android/integrateGoogleLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateMiuiLogin.d.ts +0 -13
- package/dist/functions/platform/android/integrateMiuiLogin.js +0 -115
- package/dist/functions/platform/android/integrateMiuiLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateQQLogin.d.ts +0 -12
- package/dist/functions/platform/android/integrateQQLogin.js +0 -130
- package/dist/functions/platform/android/integrateQQLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateShareTrace.d.ts +0 -10
- package/dist/functions/platform/android/integrateShareTrace.js +0 -181
- package/dist/functions/platform/android/integrateShareTrace.js.map +0 -1
- package/dist/functions/platform/android/integrateSinaLogin.d.ts +0 -13
- package/dist/functions/platform/android/integrateSinaLogin.js +0 -85
- package/dist/functions/platform/android/integrateSinaLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateThirdPartyModule.d.ts +0 -46
- package/dist/functions/platform/android/integrateThirdPartyModule.js +0 -251
- package/dist/functions/platform/android/integrateThirdPartyModule.js.map +0 -1
- package/dist/functions/platform/android/integrateUniAppNativePlugin.d.ts +0 -22
- package/dist/functions/platform/android/integrateUniAppNativePlugin.js +0 -631
- package/dist/functions/platform/android/integrateUniAppNativePlugin.js.map +0 -1
- package/dist/functions/platform/android/integrateUniverifyLogin.d.ts +0 -11
- package/dist/functions/platform/android/integrateUniverifyLogin.js +0 -314
- package/dist/functions/platform/android/integrateUniverifyLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateWechatLogin.d.ts +0 -13
- package/dist/functions/platform/android/integrateWechatLogin.js +0 -154
- package/dist/functions/platform/android/integrateWechatLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateWechatShare.d.ts +0 -13
- package/dist/functions/platform/android/integrateWechatShare.js +0 -154
- package/dist/functions/platform/android/integrateWechatShare.js.map +0 -1
- package/dist/functions/platform/android/modifyGradle.d.ts +0 -28
- package/dist/functions/platform/android/modifyGradle.js +0 -119
- package/dist/functions/platform/android/modifyGradle.js.map +0 -1
- package/dist/functions/platform/android/modifyManifest.d.ts +0 -39
- package/dist/functions/platform/android/modifyManifest.js +0 -225
- package/dist/functions/platform/android/modifyManifest.js.map +0 -1
- package/dist/functions/platform/android/permission.d.ts +0 -54
- package/dist/functions/platform/android/permission.js +0 -85
- package/dist/functions/platform/android/permission.js.map +0 -1
- package/dist/functions/platform/ios/configureAppIcon.d.ts +0 -17
- package/dist/functions/platform/ios/configureAppIcon.js +0 -149
- package/dist/functions/platform/ios/configureAppIcon.js.map +0 -1
- package/dist/functions/platform/ios/configureLaunchScreen.d.ts +0 -17
- package/dist/functions/platform/ios/configureLaunchScreen.js +0 -150
- package/dist/functions/platform/ios/configureLaunchScreen.js.map +0 -1
- package/dist/functions/platform/ios/configurePermissions.d.ts +0 -19
- package/dist/functions/platform/ios/configurePermissions.js +0 -120
- package/dist/functions/platform/ios/configurePermissions.js.map +0 -1
- package/dist/functions/platform/ios/integrateNativePlugin.d.ts +0 -35
- package/dist/functions/platform/ios/integrateNativePlugin.js +0 -994
- package/dist/functions/platform/ios/integrateNativePlugin.js.map +0 -1
- package/dist/functions/platform/ios/integrateQQShare.d.ts +0 -14
- package/dist/functions/platform/ios/integrateQQShare.js +0 -132
- package/dist/functions/platform/ios/integrateQQShare.js.map +0 -1
- package/dist/functions/platform/ios/integrateSinaShare.d.ts +0 -16
- package/dist/functions/platform/ios/integrateSinaShare.js +0 -108
- package/dist/functions/platform/ios/integrateSinaShare.js.map +0 -1
- package/dist/functions/platform/ios/integrateThirdPartyModule.d.ts +0 -62
- package/dist/functions/platform/ios/integrateThirdPartyModule.js +0 -883
- package/dist/functions/platform/ios/integrateThirdPartyModule.js.map +0 -1
- package/dist/functions/platform/ios/integrateWechatOauth.d.ts +0 -14
- package/dist/functions/platform/ios/integrateWechatOauth.js +0 -107
- package/dist/functions/platform/ios/integrateWechatOauth.js.map +0 -1
- package/dist/functions/platform/ios/integrateWechatShare.d.ts +0 -14
- package/dist/functions/platform/ios/integrateWechatShare.js +0 -101
- package/dist/functions/platform/ios/integrateWechatShare.js.map +0 -1
- package/dist/functions/platform/ios/modifyInfoPlistKeyValue.d.ts +0 -2
- package/dist/functions/platform/ios/modifyInfoPlistKeyValue.js +0 -45
- package/dist/functions/platform/ios/modifyInfoPlistKeyValue.js.map +0 -1
- package/dist/functions/platform/ios/safelyModifyProjectPbxproj.d.ts +0 -16
- package/dist/functions/platform/ios/safelyModifyProjectPbxproj.js +0 -136
- package/dist/functions/platform/ios/safelyModifyProjectPbxproj.js.map +0 -1
- package/dist/functions/platform/ios/useAltool.d.ts +0 -39
- package/dist/functions/platform/ios/useAltool.js +0 -350
- package/dist/functions/platform/ios/useAltool.js.map +0 -1
- package/dist/functions/style/buildTokens.d.ts +0 -76
- package/dist/functions/style/buildTokens.js +0 -183
- package/dist/functions/style/buildTokens.js.map +0 -1
- package/dist/functions/style/extractCssVariables.d.ts +0 -16
- package/dist/functions/style/extractCssVariables.js +0 -256
- package/dist/functions/style/extractCssVariables.js.map +0 -1
- package/dist/functions/style/generateVariables.d.ts +0 -7
- package/dist/functions/style/generateVariables.js +0 -135
- package/dist/functions/style/generateVariables.js.map +0 -1
- package/dist/functions/style/mixColors.d.ts +0 -1
- package/dist/functions/style/mixColors.js +0 -38
- package/dist/functions/style/mixColors.js.map +0 -1
- package/dist/functions/style/parseDesignTokens.d.ts +0 -10
- package/dist/functions/style/parseDesignTokens.js +0 -216
- package/dist/functions/style/parseDesignTokens.js.map +0 -1
- package/dist/functions/uniapp/app-plus/buildAndroidPlugin.d.ts +0 -3
- package/dist/functions/uniapp/app-plus/buildAndroidPlugin.js +0 -509
- package/dist/functions/uniapp/app-plus/buildAndroidPlugin.js.map +0 -1
- package/dist/functions/uniapp/app-plus/buildIOSPlugin.d.ts +0 -3
- package/dist/functions/uniapp/app-plus/buildIOSPlugin.js +0 -406
- package/dist/functions/uniapp/app-plus/buildIOSPlugin.js.map +0 -1
- package/dist/functions/validation/parseJwtPayload.d.ts +0 -7
- package/dist/functions/validation/parseJwtPayload.js +0 -33
- package/dist/functions/validation/parseJwtPayload.js.map +0 -1
- package/dist/functions/validation/validate.d.ts +0 -11
- package/dist/functions/validation/validate.js +0 -44
- package/dist/functions/validation/validate.js.map +0 -1
|
@@ -1,900 +0,0 @@
|
|
|
1
|
-
import { build } from '../build';
|
|
2
|
-
import { integrateWechatShareIOS } from '../../../platform/ios/integrateWechatShare';
|
|
3
|
-
import { integrateWechatOauthIOS } from '../../../platform/ios/integrateWechatOauth';
|
|
4
|
-
import { integrateQQShareIOS } from '../../../platform/ios/integrateQQShare';
|
|
5
|
-
import { integrateSinaShareIOS } from '../../../platform/ios/integrateSinaShare';
|
|
6
|
-
import { integrateNativePluginIOS } from '../../../platform/ios/integrateNativePlugin';
|
|
7
|
-
import { configureLaunchScreen } from '../../../platform/ios/configureLaunchScreen';
|
|
8
|
-
import { configureAppIconIOS } from '../../../platform/ios/configureAppIcon';
|
|
9
|
-
import { configureIOSPermissions } from '../../../platform/ios/configurePermissions';
|
|
10
|
-
import { modifyInfoPlistKeyValue } from '../../../platform/ios/modifyInfoPlistKeyValue';
|
|
11
|
-
import { safelyModifyProjectPbxproj } from '../../../platform/ios/safelyModifyProjectPbxproj';
|
|
12
|
-
export async function buildIOSApp(options, deps) {
|
|
13
|
-
if (!options.uniappProjectPath) {
|
|
14
|
-
return {
|
|
15
|
-
success: false,
|
|
16
|
-
error: 'uniappProjectPath 是必需的',
|
|
17
|
-
logs: []
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
if (!options.projectPath) {
|
|
21
|
-
return {
|
|
22
|
-
success: false,
|
|
23
|
-
error: 'projectPath 是必需的',
|
|
24
|
-
logs: []
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
if (!options.uniAppId) {
|
|
28
|
-
return {
|
|
29
|
-
success: false,
|
|
30
|
-
error: 'uniAppId 是必需的',
|
|
31
|
-
logs: []
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
if (!options.displayName) {
|
|
35
|
-
return {
|
|
36
|
-
success: false,
|
|
37
|
-
error: 'displayName 是必需的',
|
|
38
|
-
logs: []
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
const version = options.versionName || '1.0.0';
|
|
43
|
-
const buildNumber = options.versionCode || '1';
|
|
44
|
-
const projectFiles = deps.readdirSync(options.projectPath).filter(file => file.endsWith('.xcodeproj'));
|
|
45
|
-
if (projectFiles.length === 0) {
|
|
46
|
-
return {
|
|
47
|
-
success: false,
|
|
48
|
-
error: `在 ${options.projectPath} 中未找到 Xcode 项目文件(.xcodeproj)`,
|
|
49
|
-
logs: []
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
const projectFile = projectFiles[0];
|
|
53
|
-
const projectName = options.sourceDirectoryName || projectFile.replace(/\.xcodeproj$/, '');
|
|
54
|
-
deps.log(`找到 Xcode 项目: ${projectFile}`);
|
|
55
|
-
if (options.sourceDirectoryName) {
|
|
56
|
-
deps.log(`使用指定的源码目录: ${projectName}`);
|
|
57
|
-
}
|
|
58
|
-
deps.log('步骤 1: 同步 project.pbxproj 版本配置');
|
|
59
|
-
const projectPbxprojPath = deps.join(options.projectPath, projectFile, 'project.pbxproj');
|
|
60
|
-
const pbxprojResult = safelyModifyProjectPbxproj(projectPbxprojPath, {
|
|
61
|
-
bundleId: options.bundleId,
|
|
62
|
-
version,
|
|
63
|
-
buildNumber,
|
|
64
|
-
teamId: options.signing?.teamId,
|
|
65
|
-
codeSignIdentity: 'Apple Development'
|
|
66
|
-
}, {
|
|
67
|
-
existsSync: deps.existsSync,
|
|
68
|
-
readFileSync: deps.readFileSync,
|
|
69
|
-
writeFileSync: deps.writeFileSync
|
|
70
|
-
});
|
|
71
|
-
if (pbxprojResult.success) {
|
|
72
|
-
deps.log('project.pbxproj 版本配置同步完成');
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
deps.log(`project.pbxproj 版本配置同步失败: ${pbxprojResult.error}`);
|
|
76
|
-
}
|
|
77
|
-
deps.log('步骤 2: 修改 Info.plist 配置');
|
|
78
|
-
const infoPlistPath = deps.join(options.projectPath, projectName, `${projectName}-Info.plist`);
|
|
79
|
-
if (deps.existsSync(infoPlistPath)) {
|
|
80
|
-
try {
|
|
81
|
-
const xmlContent = deps.readFileSync(infoPlistPath, 'utf8');
|
|
82
|
-
const parser = new deps.xmlParser();
|
|
83
|
-
const xmlDoc = parser.parseFromString(xmlContent, 'text/xml');
|
|
84
|
-
if (options.appkey) {
|
|
85
|
-
modifyInfoPlistKeyValue(xmlDoc, 'dcloud_appkey', options.appkey, 'string');
|
|
86
|
-
}
|
|
87
|
-
if (options.bundleId) {
|
|
88
|
-
modifyInfoPlistKeyValue(xmlDoc, 'CFBundleIdentifier', options.bundleId, 'string');
|
|
89
|
-
}
|
|
90
|
-
if (version) {
|
|
91
|
-
modifyInfoPlistKeyValue(xmlDoc, 'CFBundleShortVersionString', version, 'string');
|
|
92
|
-
}
|
|
93
|
-
if (buildNumber) {
|
|
94
|
-
modifyInfoPlistKeyValue(xmlDoc, 'CFBundleVersion', buildNumber, 'string');
|
|
95
|
-
}
|
|
96
|
-
if (options.displayName) {
|
|
97
|
-
modifyInfoPlistKeyValue(xmlDoc, 'CFBundleDisplayName', options.displayName, 'string');
|
|
98
|
-
}
|
|
99
|
-
if (options.enableIDFA) {
|
|
100
|
-
const dictElement = xmlDoc.getElementsByTagName('dict')[0];
|
|
101
|
-
if (dictElement) {
|
|
102
|
-
const keyElements = xmlDoc.getElementsByTagName('key');
|
|
103
|
-
let found = false;
|
|
104
|
-
for (let i = 0; i < keyElements.length; i++) {
|
|
105
|
-
const keyElement = keyElements[i];
|
|
106
|
-
if (keyElement.textContent === 'NSUserTrackingUsageDescription') {
|
|
107
|
-
found = true;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (!found) {
|
|
112
|
-
const keyElement = xmlDoc.createElement('key');
|
|
113
|
-
keyElement.textContent = 'NSUserTrackingUsageDescription';
|
|
114
|
-
const stringElement = xmlDoc.createElement('string');
|
|
115
|
-
stringElement.textContent = '我们需要您的同意以提供更好的广告体验';
|
|
116
|
-
dictElement.appendChild(keyElement);
|
|
117
|
-
dictElement.appendChild(stringElement);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
if (options.buildCustomBase) {
|
|
122
|
-
modifyInfoPlistKeyValue(xmlDoc, 'UIFileSharingEnabled', true, 'true');
|
|
123
|
-
}
|
|
124
|
-
const serializer = new deps.xmlSerializer();
|
|
125
|
-
const newXmlContent = serializer.serializeToString(xmlDoc);
|
|
126
|
-
deps.writeFileSync(infoPlistPath, newXmlContent, 'utf8');
|
|
127
|
-
deps.log('Info.plist 配置完成');
|
|
128
|
-
if (options.enableIDFA) {
|
|
129
|
-
deps.log('IDFA 配置完成');
|
|
130
|
-
}
|
|
131
|
-
if (options.buildCustomBase) {
|
|
132
|
-
deps.log('Application supports iTunes file sharing 配置完成');
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
catch (error) {
|
|
136
|
-
deps.log(`配置 Info.plist 失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
if (options.permissions && options.permissions.length > 0) {
|
|
140
|
-
deps.log('步骤 2.1: 配置 iOS 权限');
|
|
141
|
-
const permissionsResult = await configureIOSPermissions(infoPlistPath, options.permissions, undefined, {
|
|
142
|
-
existsSync: deps.existsSync,
|
|
143
|
-
readFileSync: deps.readFileSync,
|
|
144
|
-
writeFileSync: deps.writeFileSync,
|
|
145
|
-
xmlParser: deps.xmlParser,
|
|
146
|
-
xmlSerializer: deps.xmlSerializer
|
|
147
|
-
});
|
|
148
|
-
if (permissionsResult.success) {
|
|
149
|
-
deps.log('iOS 权限配置完成');
|
|
150
|
-
permissionsResult.logs.forEach(msg => deps.log(msg));
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
deps.log(`iOS 权限配置失败: ${permissionsResult.error}`);
|
|
154
|
-
permissionsResult.logs.forEach(msg => deps.log(msg));
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (options.displayName) {
|
|
158
|
-
deps.log('步骤 2.2: 修改本地化字符串文件');
|
|
159
|
-
const projectDir = deps.join(options.projectPath, projectName);
|
|
160
|
-
const lprojDirs = ['en.lproj', 'zh-Hans.lproj', 'zh-Hant.lproj', 'Base.lproj', 'English.lproj'];
|
|
161
|
-
for (const lprojDir of lprojDirs) {
|
|
162
|
-
const infoPlistStringsPath = deps.join(projectDir, lprojDir, 'InfoPlist.strings');
|
|
163
|
-
if (deps.existsSync(infoPlistStringsPath)) {
|
|
164
|
-
try {
|
|
165
|
-
let content = deps.readFileSync(infoPlistStringsPath, 'utf8');
|
|
166
|
-
const regex = /CFBundleDisplayName\s*=\s*"[^"]*"/;
|
|
167
|
-
if (regex.test(content)) {
|
|
168
|
-
content = content.replace(regex, `CFBundleDisplayName="${options.displayName}"`);
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
content += `\nCFBundleDisplayName="${options.displayName}";\n`;
|
|
172
|
-
}
|
|
173
|
-
deps.writeFileSync(infoPlistStringsPath, content, 'utf8');
|
|
174
|
-
deps.log(`已更新 ${lprojDir}/InfoPlist.strings`);
|
|
175
|
-
}
|
|
176
|
-
catch (error) {
|
|
177
|
-
deps.log(`更新 ${lprojDir}/InfoPlist.strings 失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
if (options.appIconPath) {
|
|
183
|
-
deps.log('步骤 2: 配置 App Icons Source');
|
|
184
|
-
if (!deps.sharp) {
|
|
185
|
-
deps.log('警告: 未提供 sharp 依赖,跳过图标配置。请安装 sharp 并在 deps 中传入。');
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
const appIconResult = await configureAppIconIOS(options.appIconPath, options.projectPath, projectName, {
|
|
189
|
-
existsSync: deps.existsSync,
|
|
190
|
-
readFileSync: deps.readFileSync,
|
|
191
|
-
writeFileSync: deps.writeFileSync,
|
|
192
|
-
mkdirSync: deps.mkdirSync,
|
|
193
|
-
join: deps.join,
|
|
194
|
-
dirname: deps.dirname,
|
|
195
|
-
sharp: deps.sharp
|
|
196
|
-
});
|
|
197
|
-
if (appIconResult.success) {
|
|
198
|
-
deps.log('App Icons Source 配置完成');
|
|
199
|
-
appIconResult.logs.forEach(msg => deps.log(msg));
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
deps.log(`App Icons Source 配置失败: ${appIconResult.error}`);
|
|
203
|
-
appIconResult.logs.forEach(msg => deps.log(msg));
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (options.launchScreenPath) {
|
|
208
|
-
deps.log('步骤 3: 配置 LaunchScreen');
|
|
209
|
-
if (!deps.sharp) {
|
|
210
|
-
deps.log('警告: 未提供 sharp 依赖,跳过启动屏配置。请安装 sharp 并在 deps 中传入。');
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
const launchScreenResult = await configureLaunchScreen(options.launchScreenPath, options.projectPath, projectName, {
|
|
214
|
-
existsSync: deps.existsSync,
|
|
215
|
-
readFileSync: deps.readFileSync,
|
|
216
|
-
writeFileSync: deps.writeFileSync,
|
|
217
|
-
mkdirSync: deps.mkdirSync,
|
|
218
|
-
join: deps.join,
|
|
219
|
-
dirname: deps.dirname,
|
|
220
|
-
sharp: deps.sharp
|
|
221
|
-
});
|
|
222
|
-
if (launchScreenResult.success) {
|
|
223
|
-
deps.log('LaunchScreen 配置完成');
|
|
224
|
-
launchScreenResult.logs.forEach(msg => deps.log(msg));
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
deps.log(`LaunchScreen 配置失败: ${launchScreenResult.error}`);
|
|
228
|
-
launchScreenResult.logs.forEach(msg => deps.log(msg));
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
if (options.buildCustomBase) {
|
|
233
|
-
deps.log('步骤 4: 配置自定义基座(control.xml)');
|
|
234
|
-
const controlXmlPath = deps.join(options.projectPath, projectName, 'control.xml');
|
|
235
|
-
if (deps.existsSync(controlXmlPath)) {
|
|
236
|
-
try {
|
|
237
|
-
const xmlContent = deps.readFileSync(controlXmlPath, 'utf8');
|
|
238
|
-
const parser = new deps.xmlParser();
|
|
239
|
-
const xmlDoc = parser.parseFromString(xmlContent, 'text/xml');
|
|
240
|
-
const hbuilderElements = xmlDoc.getElementsByTagName('HBuilder');
|
|
241
|
-
if (hbuilderElements.length > 0) {
|
|
242
|
-
const hbuilderElement = hbuilderElements[0];
|
|
243
|
-
let hasChanges = false;
|
|
244
|
-
if (hbuilderElement.getAttribute('debug') !== 'true') {
|
|
245
|
-
hbuilderElement.setAttribute('debug', 'true');
|
|
246
|
-
hasChanges = true;
|
|
247
|
-
}
|
|
248
|
-
if (hbuilderElement.getAttribute('syncDebug') !== 'true') {
|
|
249
|
-
hbuilderElement.setAttribute('syncDebug', 'true');
|
|
250
|
-
hasChanges = true;
|
|
251
|
-
}
|
|
252
|
-
if (hasChanges) {
|
|
253
|
-
const serializer = new deps.xmlSerializer();
|
|
254
|
-
const newXmlContent = serializer.serializeToString(xmlDoc);
|
|
255
|
-
deps.writeFileSync(controlXmlPath, newXmlContent, 'utf8');
|
|
256
|
-
deps.log('control.xml 自定义基座配置完成:debug="true" syncDebug="true"');
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
deps.log('control.xml 自定义基座配置已存在,无需修改');
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
deps.log('警告:未找到 HBuilder 根节点,无法添加自定义基座配置');
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
catch (error) {
|
|
267
|
-
deps.log(`配置 control.xml 失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
deps.log('步骤 8: 编译 UniApp 项目并复制到 apps 目录');
|
|
272
|
-
let sourcePath;
|
|
273
|
-
if (options.uniappBuildOutputPath) {
|
|
274
|
-
deps.log('使用提供的 UniApp 编译结果路径');
|
|
275
|
-
sourcePath = options.uniappBuildOutputPath;
|
|
276
|
-
if (!deps.existsSync(sourcePath)) {
|
|
277
|
-
return {
|
|
278
|
-
success: false,
|
|
279
|
-
error: `提供的编译结果路径不存在: ${sourcePath}`,
|
|
280
|
-
logs: []
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
deps.log(`使用编译结果路径: ${sourcePath}`);
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
deps.log('构建 UniApp 项目');
|
|
287
|
-
const buildDeps = {
|
|
288
|
-
exec: deps.exec,
|
|
289
|
-
join: deps.join,
|
|
290
|
-
existsSync: deps.existsSync,
|
|
291
|
-
setTimeout: deps.setTimeout
|
|
292
|
-
};
|
|
293
|
-
const uniBuildResult = await build(options.uniappProjectPath, 'app-plus', buildDeps);
|
|
294
|
-
if (!uniBuildResult.success) {
|
|
295
|
-
return {
|
|
296
|
-
success: false,
|
|
297
|
-
error: `构建失败: ${uniBuildResult.error}`,
|
|
298
|
-
logs: []
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
uniBuildResult.logs.forEach(msg => deps.log(msg));
|
|
302
|
-
sourcePath = deps.join(options.uniappProjectPath, 'dist', 'build', 'app');
|
|
303
|
-
}
|
|
304
|
-
const targetPath = deps.join(options.projectPath, projectName, 'Pandora', 'apps', options.uniAppId, 'www');
|
|
305
|
-
try {
|
|
306
|
-
const targetDir = deps.dirname(targetPath);
|
|
307
|
-
if (!deps.existsSync(targetDir)) {
|
|
308
|
-
deps.mkdirSync(targetDir, { recursive: true });
|
|
309
|
-
}
|
|
310
|
-
await deps.cp(sourcePath, targetPath, { recursive: true, force: true });
|
|
311
|
-
deps.log('应用资源复制完成');
|
|
312
|
-
}
|
|
313
|
-
catch (error) {
|
|
314
|
-
return {
|
|
315
|
-
success: false,
|
|
316
|
-
error: `复制应用资源失败: ${error instanceof Error ? error.message : String(error)}`,
|
|
317
|
-
logs: []
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
const controlXmlPath = deps.join(options.projectPath, projectName, 'control.xml');
|
|
321
|
-
if (deps.existsSync(controlXmlPath)) {
|
|
322
|
-
try {
|
|
323
|
-
const xmlContent = deps.readFileSync(controlXmlPath, 'utf8');
|
|
324
|
-
const parser = new deps.xmlParser();
|
|
325
|
-
const xmlDoc = parser.parseFromString(xmlContent, 'text/xml');
|
|
326
|
-
const appsElements = xmlDoc.getElementsByTagName('apps');
|
|
327
|
-
if (appsElements.length > 0) {
|
|
328
|
-
const appsElement = appsElements[0];
|
|
329
|
-
const existingAppElements = appsElement.getElementsByTagName('app');
|
|
330
|
-
let appExists = false;
|
|
331
|
-
let hasChanges = false;
|
|
332
|
-
for (let i = 0; i < existingAppElements.length; i++) {
|
|
333
|
-
const appElement = existingAppElements[i];
|
|
334
|
-
if (appElement.getAttribute('appid') === options.uniAppId) {
|
|
335
|
-
appExists = true;
|
|
336
|
-
if (appElement.getAttribute('appver') !== '') {
|
|
337
|
-
appElement.setAttribute('appver', '');
|
|
338
|
-
hasChanges = true;
|
|
339
|
-
}
|
|
340
|
-
if (options.appkey && appElement.getAttribute('appkey') !== options.appkey) {
|
|
341
|
-
appElement.setAttribute('appkey', options.appkey);
|
|
342
|
-
hasChanges = true;
|
|
343
|
-
deps.log(`更新 appkey: ${options.appkey}`);
|
|
344
|
-
}
|
|
345
|
-
if (hasChanges) {
|
|
346
|
-
deps.log(`更新现有 app 元素,appid: ${options.uniAppId}`);
|
|
347
|
-
}
|
|
348
|
-
else {
|
|
349
|
-
deps.log(`app 元素已存在且配置正确,appid: ${options.uniAppId}`);
|
|
350
|
-
}
|
|
351
|
-
break;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
if (!appExists) {
|
|
355
|
-
while (existingAppElements.length > 0) {
|
|
356
|
-
appsElement.removeChild(existingAppElements[0]);
|
|
357
|
-
}
|
|
358
|
-
deps.log('已删除所有现有的 app 元素');
|
|
359
|
-
const newAppElement = xmlDoc.createElement('app');
|
|
360
|
-
newAppElement.setAttribute('appid', options.uniAppId);
|
|
361
|
-
newAppElement.setAttribute('appver', '');
|
|
362
|
-
if (options.appkey) {
|
|
363
|
-
newAppElement.setAttribute('appkey', options.appkey);
|
|
364
|
-
deps.log(`设置 appkey: ${options.appkey}`);
|
|
365
|
-
}
|
|
366
|
-
appsElement.appendChild(newAppElement);
|
|
367
|
-
deps.log(`添加新的 app 元素,appid: ${options.uniAppId}`);
|
|
368
|
-
hasChanges = true;
|
|
369
|
-
}
|
|
370
|
-
if (hasChanges || !appExists) {
|
|
371
|
-
const serializer = new deps.xmlSerializer();
|
|
372
|
-
const newXmlContent = serializer.serializeToString(xmlDoc);
|
|
373
|
-
deps.writeFileSync(controlXmlPath, newXmlContent, 'utf8');
|
|
374
|
-
deps.log(`control.xml appid 配置完成,appid: ${options.uniAppId}`);
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
deps.log(`control.xml appid 配置已存在,无需修改`);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
else {
|
|
381
|
-
deps.log('control.xml 中未找到 apps 元素');
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
catch (error) {
|
|
385
|
-
deps.log(`配置 control.xml appid 失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
if (options.appkey && options.sourceDirectoryName) {
|
|
389
|
-
const pluginInfoPlistPath = deps.join(options.projectPath, options.sourceDirectoryName, 'HBuilder-uniPlugin-Info.plist');
|
|
390
|
-
if (deps.existsSync(pluginInfoPlistPath)) {
|
|
391
|
-
try {
|
|
392
|
-
deps.log('配置插件项目 Info.plist (HBuilder-uniPlugin-Info.plist)');
|
|
393
|
-
const plistContent = deps.readFileSync(pluginInfoPlistPath, 'utf8');
|
|
394
|
-
const parser = new deps.xmlParser();
|
|
395
|
-
const xmlDoc = parser.parseFromString(plistContent, 'text/xml');
|
|
396
|
-
const modified = modifyInfoPlistKeyValue(xmlDoc, 'dcloud_appkey', options.appkey, 'string');
|
|
397
|
-
if (modified) {
|
|
398
|
-
const serializer = new deps.xmlSerializer();
|
|
399
|
-
const newPlistContent = serializer.serializeToString(xmlDoc);
|
|
400
|
-
deps.writeFileSync(pluginInfoPlistPath, newPlistContent, 'utf8');
|
|
401
|
-
deps.log(`HBuilder-uniPlugin-Info.plist dcloud_appkey 配置完成: ${options.appkey}`);
|
|
402
|
-
}
|
|
403
|
-
else {
|
|
404
|
-
deps.log(`HBuilder-uniPlugin-Info.plist dcloud_appkey 配置失败(未找到或无法修改)`);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
catch (error) {
|
|
408
|
-
deps.log(`配置 HBuilder-uniPlugin-Info.plist 失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
else {
|
|
412
|
-
deps.log(`HBuilder-uniPlugin-Info.plist 文件不存在: ${pluginInfoPlistPath}`);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
const bundleId = options.bundleId || 'io.dcloud.HBuilder';
|
|
416
|
-
if (options.wechatShare && bundleId) {
|
|
417
|
-
deps.log('集成微信分享模块');
|
|
418
|
-
const wechatShareResult = await integrateWechatShareIOS(options.projectPath, projectName, bundleId, {
|
|
419
|
-
appId: options.wechatShare.appId,
|
|
420
|
-
universalLinks: options.wechatShare.universalLinks,
|
|
421
|
-
liblibSharePath: options.wechatShare.liblibSharePath,
|
|
422
|
-
libweixinSharePath: options.wechatShare.libweixinSharePath,
|
|
423
|
-
libWeChatSDKPath: options.wechatShare.libWeChatSDKPath
|
|
424
|
-
}, {
|
|
425
|
-
existsSync: deps.existsSync,
|
|
426
|
-
readFileSync: deps.readFileSync,
|
|
427
|
-
writeFileSync: deps.writeFileSync,
|
|
428
|
-
copyFileSync: deps.copyFileSync,
|
|
429
|
-
statSync: deps.statSync,
|
|
430
|
-
mkdirSync: deps.mkdirSync,
|
|
431
|
-
readdirSync: deps.readdirSync,
|
|
432
|
-
cp: deps.cp,
|
|
433
|
-
join: deps.join,
|
|
434
|
-
dirname: deps.dirname,
|
|
435
|
-
basename: deps.basename,
|
|
436
|
-
xmlParser: deps.xmlParser,
|
|
437
|
-
xmlSerializer: deps.xmlSerializer,
|
|
438
|
-
xpath: deps.xpath
|
|
439
|
-
});
|
|
440
|
-
if (wechatShareResult.success) {
|
|
441
|
-
deps.log('微信分享模块集成完成');
|
|
442
|
-
wechatShareResult.logs.forEach(msg => deps.log(msg));
|
|
443
|
-
}
|
|
444
|
-
else {
|
|
445
|
-
deps.log(`微信分享模块集成失败: ${wechatShareResult.error}`);
|
|
446
|
-
wechatShareResult.logs.forEach(msg => deps.log(msg));
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
if (options.wechatOauth && bundleId) {
|
|
450
|
-
deps.log('集成微信登录模块');
|
|
451
|
-
const wechatOauthResult = await integrateWechatOauthIOS(options.projectPath, projectName, bundleId, {
|
|
452
|
-
appId: options.wechatOauth.appId,
|
|
453
|
-
universalLinks: options.wechatOauth.universalLinks,
|
|
454
|
-
liblibOauthPath: options.wechatOauth.liblibOauthPath,
|
|
455
|
-
libWXOauthPath: options.wechatOauth.libWXOauthPath,
|
|
456
|
-
libWeChatSDKPath: options.wechatOauth.libWeChatSDKPath
|
|
457
|
-
}, {
|
|
458
|
-
existsSync: deps.existsSync,
|
|
459
|
-
readFileSync: deps.readFileSync,
|
|
460
|
-
writeFileSync: deps.writeFileSync,
|
|
461
|
-
copyFileSync: deps.copyFileSync,
|
|
462
|
-
statSync: deps.statSync,
|
|
463
|
-
mkdirSync: deps.mkdirSync,
|
|
464
|
-
readdirSync: deps.readdirSync,
|
|
465
|
-
cp: deps.cp,
|
|
466
|
-
join: deps.join,
|
|
467
|
-
dirname: deps.dirname,
|
|
468
|
-
basename: deps.basename,
|
|
469
|
-
xmlParser: deps.xmlParser,
|
|
470
|
-
xmlSerializer: deps.xmlSerializer,
|
|
471
|
-
xpath: deps.xpath
|
|
472
|
-
});
|
|
473
|
-
if (wechatOauthResult.success) {
|
|
474
|
-
deps.log('微信登录模块集成完成');
|
|
475
|
-
wechatOauthResult.logs.forEach(msg => deps.log(msg));
|
|
476
|
-
}
|
|
477
|
-
else {
|
|
478
|
-
deps.log(`微信登录模块集成失败: ${wechatOauthResult.error}`);
|
|
479
|
-
wechatOauthResult.logs.forEach(msg => deps.log(msg));
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
if (options.qqShare && bundleId) {
|
|
483
|
-
deps.log('集成QQ分享模块');
|
|
484
|
-
const qqShareResult = await integrateQQShareIOS(options.projectPath, projectName, bundleId, {
|
|
485
|
-
appId: options.qqShare.appId,
|
|
486
|
-
universalLinks: options.qqShare.universalLinks,
|
|
487
|
-
liblibSharePath: options.qqShare.liblibSharePath,
|
|
488
|
-
libQQSharePath: options.qqShare.libQQSharePath,
|
|
489
|
-
tencentOpenAPIPath: options.qqShare.tencentOpenAPIPath
|
|
490
|
-
}, {
|
|
491
|
-
existsSync: deps.existsSync,
|
|
492
|
-
readFileSync: deps.readFileSync,
|
|
493
|
-
writeFileSync: deps.writeFileSync,
|
|
494
|
-
copyFileSync: deps.copyFileSync,
|
|
495
|
-
statSync: deps.statSync,
|
|
496
|
-
mkdirSync: deps.mkdirSync,
|
|
497
|
-
readdirSync: deps.readdirSync,
|
|
498
|
-
cp: deps.cp,
|
|
499
|
-
join: deps.join,
|
|
500
|
-
dirname: deps.dirname,
|
|
501
|
-
basename: deps.basename,
|
|
502
|
-
xmlParser: deps.xmlParser,
|
|
503
|
-
xmlSerializer: deps.xmlSerializer,
|
|
504
|
-
xpath: deps.xpath
|
|
505
|
-
});
|
|
506
|
-
if (qqShareResult.success) {
|
|
507
|
-
deps.log('QQ分享模块集成完成');
|
|
508
|
-
qqShareResult.logs.forEach(msg => deps.log(msg));
|
|
509
|
-
}
|
|
510
|
-
else {
|
|
511
|
-
deps.log(`QQ分享模块集成失败: ${qqShareResult.error}`);
|
|
512
|
-
qqShareResult.logs.forEach(msg => deps.log(msg));
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
if (options.sinaShare && bundleId) {
|
|
516
|
-
deps.log('集成新浪微博分享模块');
|
|
517
|
-
const sinaShareResult = await integrateSinaShareIOS(options.projectPath, projectName, bundleId, {
|
|
518
|
-
appKey: options.sinaShare.appKey,
|
|
519
|
-
appSecret: options.sinaShare.appSecret,
|
|
520
|
-
redirectUri: options.sinaShare.redirectUri,
|
|
521
|
-
liblibSharePath: options.sinaShare.liblibSharePath,
|
|
522
|
-
libSinaSharePath: options.sinaShare.libSinaSharePath,
|
|
523
|
-
libWeiboSDKPath: options.sinaShare.libWeiboSDKPath,
|
|
524
|
-
weiboSDKBundlePath: options.sinaShare.weiboSDKBundlePath
|
|
525
|
-
}, {
|
|
526
|
-
existsSync: deps.existsSync,
|
|
527
|
-
readFileSync: deps.readFileSync,
|
|
528
|
-
writeFileSync: deps.writeFileSync,
|
|
529
|
-
copyFileSync: deps.copyFileSync,
|
|
530
|
-
statSync: deps.statSync,
|
|
531
|
-
mkdirSync: deps.mkdirSync,
|
|
532
|
-
readdirSync: deps.readdirSync,
|
|
533
|
-
cp: deps.cp,
|
|
534
|
-
join: deps.join,
|
|
535
|
-
dirname: deps.dirname,
|
|
536
|
-
basename: deps.basename,
|
|
537
|
-
xmlParser: deps.xmlParser,
|
|
538
|
-
xmlSerializer: deps.xmlSerializer,
|
|
539
|
-
xpath: deps.xpath
|
|
540
|
-
});
|
|
541
|
-
if (sinaShareResult.success) {
|
|
542
|
-
deps.log('新浪微博分享模块集成完成');
|
|
543
|
-
sinaShareResult.logs.forEach(msg => deps.log(msg));
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
deps.log(`新浪微博分享模块集成失败: ${sinaShareResult.error}`);
|
|
547
|
-
sinaShareResult.logs.forEach(msg => deps.log(msg));
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
if (options.nativePlugins && options.nativePlugins.length > 0) {
|
|
551
|
-
deps.log('集成 UniApp 原生插件');
|
|
552
|
-
for (const pluginConfig of options.nativePlugins) {
|
|
553
|
-
const pluginResult = await integrateNativePluginIOS(options.projectPath, projectName, pluginConfig.pluginPath, {
|
|
554
|
-
existsSync: deps.existsSync,
|
|
555
|
-
readFileSync: deps.readFileSync,
|
|
556
|
-
writeFileSync: deps.writeFileSync,
|
|
557
|
-
copyFileSync: deps.copyFileSync,
|
|
558
|
-
statSync: deps.statSync,
|
|
559
|
-
mkdirSync: deps.mkdirSync,
|
|
560
|
-
readdirSync: deps.readdirSync,
|
|
561
|
-
cp: deps.cp,
|
|
562
|
-
join: deps.join,
|
|
563
|
-
dirname: deps.dirname,
|
|
564
|
-
basename: deps.basename,
|
|
565
|
-
exec: deps.exec,
|
|
566
|
-
parse: deps.parse,
|
|
567
|
-
xmlParser: deps.xmlParser,
|
|
568
|
-
xmlSerializer: deps.xmlSerializer,
|
|
569
|
-
setTimeout: deps.setTimeout,
|
|
570
|
-
clearTimeout: deps.clearTimeout,
|
|
571
|
-
log: deps.log,
|
|
572
|
-
}, pluginConfig.parameters);
|
|
573
|
-
if (pluginResult.success) {
|
|
574
|
-
deps.log(`原生插件集成完成: ${pluginConfig.pluginPath}`);
|
|
575
|
-
pluginResult.logs.forEach(msg => deps.log(msg));
|
|
576
|
-
}
|
|
577
|
-
else {
|
|
578
|
-
deps.log(`原生插件集成失败: ${pluginResult.error}`);
|
|
579
|
-
pluginResult.logs.forEach(msg => deps.log(msg));
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
deps.log('步骤 9: 编译 iOS 应用');
|
|
584
|
-
const configuration = options.configuration || 'Release';
|
|
585
|
-
const scheme = options.scheme || projectName;
|
|
586
|
-
if (options.signing?.teamId) {
|
|
587
|
-
deps.log(`签名配置: 开发团队 ID ${options.signing.teamId} 已自动配置到 project.pbxproj`);
|
|
588
|
-
}
|
|
589
|
-
const buildCommand = `cd "${options.projectPath}" && xcodebuild -project "${projectFile}" -scheme "${scheme}" -configuration "${configuration}" -destination "generic/platform=iOS" -allowProvisioningUpdates -archivePath "${deps.join(options.outputPath || options.projectPath, 'build', `${projectName}.xcarchive`)}" archive`;
|
|
590
|
-
if (options.clean) {
|
|
591
|
-
deps.log('清理构建目录');
|
|
592
|
-
const cleanCommand = `cd "${options.projectPath}" && xcodebuild -project "${projectFile}" -scheme "${scheme}" -destination "generic/platform=iOS" clean`;
|
|
593
|
-
await new Promise((resolve) => {
|
|
594
|
-
deps.exec(cleanCommand, (error, stdout, stderr) => {
|
|
595
|
-
if (error) {
|
|
596
|
-
deps.log(`清理警告: ${error.message}`);
|
|
597
|
-
}
|
|
598
|
-
if (stdout)
|
|
599
|
-
deps.log(`清理输出: ${stdout}`);
|
|
600
|
-
resolve();
|
|
601
|
-
});
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
deps.log(`执行构建命令: ${buildCommand}`);
|
|
605
|
-
deps.log(`提示: iOS 构建可能需要较长时间,请耐心等待...`);
|
|
606
|
-
deps.log(`提示: 如果超过 10 分钟没有输出,构建可能会被取消`);
|
|
607
|
-
let resolved = false;
|
|
608
|
-
const buildResult = await new Promise((resolve) => {
|
|
609
|
-
const child = deps.exec(buildCommand, (error, stdout, stderr) => {
|
|
610
|
-
if (resolved)
|
|
611
|
-
return;
|
|
612
|
-
resolved = true;
|
|
613
|
-
deps.clearTimeout(timeout);
|
|
614
|
-
const allOutput = stdout + (stderr ? '\n' + stderr : '');
|
|
615
|
-
if (error) {
|
|
616
|
-
deps.log(`构建错误: ${error.message}`);
|
|
617
|
-
if (stdout)
|
|
618
|
-
deps.log(`标准输出:\n${stdout}`);
|
|
619
|
-
if (stderr)
|
|
620
|
-
deps.log(`错误输出:\n${stderr}`);
|
|
621
|
-
const errorDetails = allOutput.includes('error:')
|
|
622
|
-
? allOutput.split('error:').slice(1).join('error:').split('\n').slice(0, 5).join('\n')
|
|
623
|
-
: (stderr || stdout || error.message);
|
|
624
|
-
resolve({
|
|
625
|
-
success: false,
|
|
626
|
-
error: error.message,
|
|
627
|
-
details: errorDetails
|
|
628
|
-
});
|
|
629
|
-
return;
|
|
630
|
-
}
|
|
631
|
-
if (stdout)
|
|
632
|
-
deps.log(`构建输出:\n${stdout}`);
|
|
633
|
-
if (stderr)
|
|
634
|
-
deps.log(`警告信息:\n${stderr}`);
|
|
635
|
-
resolve({ success: true });
|
|
636
|
-
});
|
|
637
|
-
const timeout = deps.setTimeout(() => {
|
|
638
|
-
if (resolved)
|
|
639
|
-
return;
|
|
640
|
-
resolved = true;
|
|
641
|
-
deps.log(`警告: 构建超时(10分钟),正在终止进程...`);
|
|
642
|
-
child.kill();
|
|
643
|
-
resolve({ success: false, error: '构建超时(10分钟)' });
|
|
644
|
-
}, 600000);
|
|
645
|
-
});
|
|
646
|
-
if (!buildResult.success) {
|
|
647
|
-
const errorMessage = buildResult.details
|
|
648
|
-
? `编译失败: ${buildResult.error}\n详细信息:\n${buildResult.details}`
|
|
649
|
-
: `编译失败: ${buildResult.error}`;
|
|
650
|
-
return {
|
|
651
|
-
success: false,
|
|
652
|
-
error: errorMessage,
|
|
653
|
-
logs: []
|
|
654
|
-
};
|
|
655
|
-
}
|
|
656
|
-
const shouldExportIPA = options.exportIPA !== false;
|
|
657
|
-
const buildBasePath = deps.join(options.outputPath || options.projectPath, 'build');
|
|
658
|
-
const archivePath = deps.join(buildBasePath, `${projectName}.xcarchive`);
|
|
659
|
-
if (!deps.existsSync(archivePath)) {
|
|
660
|
-
const errorMessage = `Archive 文件不存在: ${archivePath}`;
|
|
661
|
-
deps.log(errorMessage);
|
|
662
|
-
return {
|
|
663
|
-
success: false,
|
|
664
|
-
error: errorMessage,
|
|
665
|
-
logs: []
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
deps.log(`Archive 文件已找到: ${archivePath}`);
|
|
669
|
-
if (!shouldExportIPA) {
|
|
670
|
-
deps.log('iOS 插件项目编译完成(跳过 IPA 导出)');
|
|
671
|
-
deps.log(`Archive 文件: ${archivePath}`);
|
|
672
|
-
deps.log('\n💡 提示: 插件开发构建已完成,可以在 Xcode 中运行项目进行调试');
|
|
673
|
-
deps.log('💡 如需导出 IPA,请设置 exportIPA: true');
|
|
674
|
-
return {
|
|
675
|
-
success: true,
|
|
676
|
-
outputPath: archivePath,
|
|
677
|
-
logs: []
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
const exportBasePath = deps.join(buildBasePath, 'export');
|
|
681
|
-
if (!deps.existsSync(exportBasePath)) {
|
|
682
|
-
deps.mkdirSync(exportBasePath, { recursive: true });
|
|
683
|
-
deps.log(`创建导出目录: ${exportBasePath}`);
|
|
684
|
-
}
|
|
685
|
-
const exportOptionsPlistPath = deps.join(exportBasePath, 'ExportOptions.plist');
|
|
686
|
-
const method = 'development';
|
|
687
|
-
const teamId = options.signing?.teamId;
|
|
688
|
-
const exportOptionsPlistContentLines = [
|
|
689
|
-
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
690
|
-
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
|
|
691
|
-
'<plist version="1.0">',
|
|
692
|
-
'<dict>',
|
|
693
|
-
' <key>method</key>',
|
|
694
|
-
` <string>${method}</string>`,
|
|
695
|
-
' <key>signingStyle</key>',
|
|
696
|
-
' <string>automatic</string>'
|
|
697
|
-
];
|
|
698
|
-
if (teamId) {
|
|
699
|
-
exportOptionsPlistContentLines.push(' <key>teamID</key>');
|
|
700
|
-
exportOptionsPlistContentLines.push(` <string>${teamId}</string>`);
|
|
701
|
-
}
|
|
702
|
-
exportOptionsPlistContentLines.push('</dict>');
|
|
703
|
-
exportOptionsPlistContentLines.push('</plist>');
|
|
704
|
-
const exportOptionsPlistContent = exportOptionsPlistContentLines.join('\n');
|
|
705
|
-
deps.writeFileSync(exportOptionsPlistPath, exportOptionsPlistContent, 'utf8');
|
|
706
|
-
if (!deps.existsSync(exportOptionsPlistPath)) {
|
|
707
|
-
const errorMessage = `ExportOptions.plist 文件创建失败: ${exportOptionsPlistPath}`;
|
|
708
|
-
deps.log(errorMessage);
|
|
709
|
-
return {
|
|
710
|
-
success: false,
|
|
711
|
-
error: errorMessage,
|
|
712
|
-
logs: []
|
|
713
|
-
};
|
|
714
|
-
}
|
|
715
|
-
deps.log(`ExportOptions.plist 文件已创建: ${exportOptionsPlistPath}`);
|
|
716
|
-
deps.log('开始导出 IPA');
|
|
717
|
-
deps.log(`Archive 路径: ${archivePath}`);
|
|
718
|
-
deps.log(`导出路径: ${exportBasePath}`);
|
|
719
|
-
deps.log(`ExportOptions.plist 路径: ${exportOptionsPlistPath}`);
|
|
720
|
-
deps.log(`ExportOptions.plist 内容:\n${exportOptionsPlistContent}`);
|
|
721
|
-
const exportCommand = `xcodebuild -exportArchive -archivePath "${archivePath}" -exportPath "${exportBasePath}" -exportOptionsPlist "${exportOptionsPlistPath}"`;
|
|
722
|
-
deps.log(`执行导出命令: ${exportCommand}`);
|
|
723
|
-
deps.log('注意:如果导出失败,请检查上面的日志输出,特别是 "导出标准输出" 和 "导出错误/警告输出" 部分');
|
|
724
|
-
const exportResult = await new Promise((resolve) => {
|
|
725
|
-
const child = deps.exec(exportCommand, (error, stdout, stderr) => {
|
|
726
|
-
const allOutput = stdout + (stderr ? '\n' + stderr : '');
|
|
727
|
-
if (stdout) {
|
|
728
|
-
deps.log(`导出标准输出:\n${stdout}`);
|
|
729
|
-
}
|
|
730
|
-
if (stderr) {
|
|
731
|
-
deps.log(`导出错误/警告输出:\n${stderr}`);
|
|
732
|
-
}
|
|
733
|
-
const hasError = allOutput.toLowerCase().includes('error:') ||
|
|
734
|
-
allOutput.toLowerCase().includes('failed') ||
|
|
735
|
-
allOutput.toLowerCase().includes('failure');
|
|
736
|
-
const hasSuccess = allOutput.includes('** EXPORT SUCCEEDED **') ||
|
|
737
|
-
allOutput.toLowerCase().includes('export succeeded') ||
|
|
738
|
-
allOutput.toLowerCase().includes('exportarchive succeeded');
|
|
739
|
-
if (error) {
|
|
740
|
-
deps.log(`导出命令执行错误: ${error.message}`);
|
|
741
|
-
const errorDetails = hasError
|
|
742
|
-
? allOutput.split(/error:/i).slice(1).join('error:').split('\n').slice(0, 10).join('\n')
|
|
743
|
-
: (stderr || stdout || error.message);
|
|
744
|
-
resolve({
|
|
745
|
-
success: false,
|
|
746
|
-
error: error.message,
|
|
747
|
-
details: errorDetails
|
|
748
|
-
});
|
|
749
|
-
return;
|
|
750
|
-
}
|
|
751
|
-
if (hasError && !hasSuccess) {
|
|
752
|
-
const errorDetails = allOutput.split(/error:/i).slice(1).join('error:').split('\n').slice(0, 10).join('\n');
|
|
753
|
-
resolve({
|
|
754
|
-
success: false,
|
|
755
|
-
error: '导出过程中检测到错误',
|
|
756
|
-
details: errorDetails
|
|
757
|
-
});
|
|
758
|
-
return;
|
|
759
|
-
}
|
|
760
|
-
if (hasSuccess) {
|
|
761
|
-
deps.log('导出命令执行成功(检测到成功标志)');
|
|
762
|
-
resolve({ success: true });
|
|
763
|
-
}
|
|
764
|
-
else if (!hasError && allOutput.trim().length > 0) {
|
|
765
|
-
deps.log('导出命令执行完成(未检测到错误,假设成功)');
|
|
766
|
-
resolve({ success: true });
|
|
767
|
-
}
|
|
768
|
-
else if (!hasError) {
|
|
769
|
-
deps.log('导出命令执行完成(无错误无输出,假设成功)');
|
|
770
|
-
resolve({ success: true });
|
|
771
|
-
}
|
|
772
|
-
else {
|
|
773
|
-
resolve({
|
|
774
|
-
success: false,
|
|
775
|
-
error: '导出结果不明确',
|
|
776
|
-
details: allOutput || '无输出信息'
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
});
|
|
780
|
-
deps.setTimeout(() => {
|
|
781
|
-
child.kill();
|
|
782
|
-
resolve({ success: false, error: '导出 IPA 超时' });
|
|
783
|
-
}, 300000);
|
|
784
|
-
});
|
|
785
|
-
if (!exportResult.success) {
|
|
786
|
-
const errorMessage = exportResult.details
|
|
787
|
-
? `导出 IPA 失败: ${exportResult.error}\n详细信息:\n${exportResult.details}`
|
|
788
|
-
: `导出 IPA 失败: ${exportResult.error}`;
|
|
789
|
-
return {
|
|
790
|
-
success: false,
|
|
791
|
-
error: errorMessage,
|
|
792
|
-
logs: []
|
|
793
|
-
};
|
|
794
|
-
}
|
|
795
|
-
let ipaPath;
|
|
796
|
-
try {
|
|
797
|
-
if (deps.existsSync(exportBasePath)) {
|
|
798
|
-
const topLevelFiles = deps.readdirSync(exportBasePath);
|
|
799
|
-
deps.log(`导出目录内容: ${topLevelFiles.join(', ')}`);
|
|
800
|
-
}
|
|
801
|
-
else {
|
|
802
|
-
deps.log(`警告: 导出目录不存在: ${exportBasePath}`);
|
|
803
|
-
}
|
|
804
|
-
const findIpaFile = (dir, depth = 0) => {
|
|
805
|
-
if (depth > 3) {
|
|
806
|
-
return undefined;
|
|
807
|
-
}
|
|
808
|
-
if (!deps.existsSync(dir)) {
|
|
809
|
-
return undefined;
|
|
810
|
-
}
|
|
811
|
-
const files = deps.readdirSync(dir);
|
|
812
|
-
deps.log(`搜索目录 (深度 ${depth}): ${dir}, 文件数: ${files.length}`);
|
|
813
|
-
const ipaFile = files.find(f => f.toLowerCase().endsWith('.ipa'));
|
|
814
|
-
if (ipaFile) {
|
|
815
|
-
const foundPath = deps.join(dir, ipaFile);
|
|
816
|
-
deps.log(`找到 IPA 文件: ${foundPath}`);
|
|
817
|
-
return foundPath;
|
|
818
|
-
}
|
|
819
|
-
for (const file of files) {
|
|
820
|
-
const fullPath = deps.join(dir, file);
|
|
821
|
-
try {
|
|
822
|
-
const stat = deps.statSync(fullPath);
|
|
823
|
-
if (stat.isDirectory()) {
|
|
824
|
-
const found = findIpaFile(fullPath, depth + 1);
|
|
825
|
-
if (found) {
|
|
826
|
-
return found;
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
catch (err) {
|
|
831
|
-
continue;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
return undefined;
|
|
835
|
-
};
|
|
836
|
-
ipaPath = findIpaFile(exportBasePath);
|
|
837
|
-
}
|
|
838
|
-
catch (error) {
|
|
839
|
-
deps.log(`查找 IPA 文件时出错: ${error instanceof Error ? error.message : String(error)}`);
|
|
840
|
-
}
|
|
841
|
-
if (!ipaPath) {
|
|
842
|
-
const listDirectory = (dir, prefix = '') => {
|
|
843
|
-
const lines = [];
|
|
844
|
-
try {
|
|
845
|
-
if (!deps.existsSync(dir)) {
|
|
846
|
-
return [`${prefix}[目录不存在]`];
|
|
847
|
-
}
|
|
848
|
-
const files = deps.readdirSync(dir);
|
|
849
|
-
for (const file of files) {
|
|
850
|
-
const fullPath = deps.join(dir, file);
|
|
851
|
-
try {
|
|
852
|
-
const stat = deps.statSync(fullPath);
|
|
853
|
-
if (stat.isDirectory()) {
|
|
854
|
-
lines.push(`${prefix}${file}/`);
|
|
855
|
-
lines.push(...listDirectory(fullPath, prefix + ' '));
|
|
856
|
-
}
|
|
857
|
-
else {
|
|
858
|
-
lines.push(`${prefix}${file}`);
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
catch {
|
|
862
|
-
lines.push(`${prefix}${file} [无法访问]`);
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
catch {
|
|
867
|
-
lines.push(`${prefix}[无法读取目录]`);
|
|
868
|
-
}
|
|
869
|
-
return lines;
|
|
870
|
-
};
|
|
871
|
-
const dirStructure = listDirectory(exportBasePath);
|
|
872
|
-
const errorMessage = `导出成功但未找到 IPA 文件,导出路径: ${exportBasePath}`;
|
|
873
|
-
deps.log(errorMessage);
|
|
874
|
-
deps.log('导出目录结构:');
|
|
875
|
-
dirStructure.forEach(msg => deps.log(msg));
|
|
876
|
-
deps.log('请检查 xcodebuild 导出日志,确认是否有错误');
|
|
877
|
-
return {
|
|
878
|
-
success: false,
|
|
879
|
-
error: errorMessage,
|
|
880
|
-
logs: []
|
|
881
|
-
};
|
|
882
|
-
}
|
|
883
|
-
deps.log('iOS 离线打包完成');
|
|
884
|
-
deps.log(`IPA 文件已生成: ${ipaPath}`);
|
|
885
|
-
return {
|
|
886
|
-
success: true,
|
|
887
|
-
outputPath: ipaPath,
|
|
888
|
-
logs: []
|
|
889
|
-
};
|
|
890
|
-
}
|
|
891
|
-
catch (error) {
|
|
892
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
893
|
-
return {
|
|
894
|
-
success: false,
|
|
895
|
-
error: `打包过程中发生异常: ${errorMessage}`,
|
|
896
|
-
logs: []
|
|
897
|
-
};
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
//# sourceMappingURL=buildIOSApp.js.map
|