@momo-kits/native-kits 0.0.1-beta.4 → 0.0.2-alpha.1
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/CLAUDE.md +99 -0
- package/PUBLISH_GUIDE.md +675 -0
- package/README.md +184 -5
- package/ios/Application/ApplicationEnvironment.swift +71 -0
- package/ios/Application/Components.swift +270 -0
- package/ios/Application/ComposeApi.swift +22 -0
- package/ios/Application/FloatingButton.swift +174 -0
- package/ios/Application/HeaderRight.swift +306 -0
- package/ios/Application/LanguageSource.swift +93 -0
- package/ios/Application/Localize.swift +378 -0
- package/ios/Application/LocalizeModifier.swift +30 -0
- package/ios/Application/MaxApi.swift +18 -0
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +104 -0
- package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +215 -0
- package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +65 -0
- package/ios/Application/Navigation/HeaderBackProps.swift +66 -0
- package/ios/Application/Navigation/HeaderTitle.swift +57 -0
- package/ios/Application/Navigation/HeaderUser.swift +209 -0
- package/ios/Application/Navigation/NavigationContainer.swift +213 -0
- package/ios/Application/Navigation/NavigationOptions.swift +109 -0
- package/ios/Application/Navigation/Navigator.swift +453 -0
- package/ios/Application/Navigation/NavigatorManager.swift +22 -0
- package/ios/Application/Navigation/Overplay/BottomSheet.swift +256 -0
- package/ios/Application/Navigation/Overplay/ModalScreen.swift +74 -0
- package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
- package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
- package/ios/Application/Navigation/component/Header.swift +178 -0
- package/ios/Application/Navigation/component/HeaderBackground.swift +83 -0
- package/ios/Application/Navigation/component/HeaderColor.swift +65 -0
- package/ios/Application/Navigation/component/HeaderRightWidthKey.swift +11 -0
- package/ios/Application/Navigation/component/NavigationFooter.swift +90 -0
- package/ios/Application/Navigation/component/NavigationHeaderRight.swift +196 -0
- package/ios/Application/Screen.swift +250 -0
- package/ios/Application/StackScreen.swift +492 -0
- package/ios/Avatar/Avatar.swift +193 -0
- package/ios/Badge/Badge.swift +84 -0
- package/ios/Badge/BadgeDot.swift +31 -0
- package/ios/Badge/BadgeRibbon.swift +319 -0
- package/ios/BaselineView/BaselineView.swift +163 -0
- package/ios/Button/Button.swift +232 -84
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
- package/ios/Carousel/Carousel.swift +196 -0
- package/ios/Checkbox/Checkbox.swift +77 -0
- package/ios/Chip/Chip.swift +120 -0
- package/ios/Collapse/Collapse.swift +192 -0
- package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Colors.swift +42 -37
- package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
- package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Spacing.swift +3 -1
- package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
- package/ios/DateTimePicker/DateTimePicker.swift +212 -0
- package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
- package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
- package/ios/DateTimePicker/WheelPicker.swift +165 -0
- package/ios/Divider/Divider.swift +16 -0
- package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
- package/ios/Extensions/Color++.swift +32 -0
- package/ios/Icon/Icon.swift +69 -0
- package/ios/IconButton/IconButton.swift +140 -0
- package/ios/Image/Image.swift +87 -0
- package/ios/Information/Information.swift +156 -0
- package/ios/Input/ErrorView.swift +58 -0
- package/ios/Input/Input.swift +461 -77
- package/ios/Input/InputPhoneNumber.swift +192 -0
- package/ios/Input/InputSearch.swift +301 -0
- package/ios/Input/InputTextArea.swift +318 -0
- package/ios/InputDropDown/InputDropDown.swift +201 -0
- package/ios/InputMoney/InputMoney.swift +405 -0
- package/ios/InputOTP/InputOTP.swift +211 -0
- package/ios/Layout/GridContext.swift +30 -0
- package/ios/Layout/Item.swift +42 -0
- package/ios/Layout/Section.swift +134 -0
- package/ios/Loader/Loader.swift +113 -0
- package/ios/Lottie/LottieView.swift +86 -0
- package/ios/MoMoUIKits.podspec +5 -0
- package/ios/OTPKeyboard/KeyboardButton.swift +13 -5
- package/ios/OTPKeyboard/OTPKeyboard.swift +1 -1
- package/ios/Pagination/PaginationDot.swift +61 -0
- package/ios/Pagination/PaginationNumber.swift +35 -0
- package/ios/Pagination/PaginationScroll.swift +101 -0
- package/ios/Pagination/PaginationWhiteDot.swift +37 -0
- package/ios/Popup/PopupDisplay.swift +279 -0
- package/ios/Popup/PopupInput.swift +92 -0
- package/ios/Popup/PopupNotify.swift +219 -0
- package/ios/Popup/PopupPromotion.swift +74 -0
- package/ios/PopupView/FullscreenPopup.swift +251 -0
- package/ios/{Popup → PopupView}/Modifiers.swift +6 -20
- package/ios/{Popup → PopupView}/PopupView.swift +38 -146
- package/ios/PopupView/Utils++.swift +281 -0
- package/ios/ProgressInfo/ProgressInfo.swift +297 -0
- package/ios/Radio/Radio.swift +69 -0
- package/ios/Rating/Rating.swift +83 -0
- package/{example/ios/Example/Preview Content/Preview Assets.xcassets/Contents.json → ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json} +5 -0
- package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Text.colorset/Contents.json +3 -3
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +9 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +38 -0
- package/ios/ScrollIndicator/ScrollIndicator.swift +110 -0
- package/ios/Skeleton/Skeleton.swift +99 -0
- package/ios/Slider/Slider.swift +237 -0
- package/ios/StatusBarTap/StatusBarTap.h +13 -0
- package/ios/StatusBarTap/StatusBarTap.m +75 -0
- package/ios/Stepper/Stepper.swift +221 -0
- package/ios/Steps/Steps.swift +467 -0
- package/ios/SuggestAction/SuggestAction.swift +100 -0
- package/ios/Swipeable/SwipeCell.swift +226 -31
- package/ios/Swipeable/SwipeCellModel.swift +21 -0
- package/ios/Switch/Switch.swift +69 -0
- package/ios/TabView/TabView.swift +534 -0
- package/ios/Tag/Tag.swift +99 -0
- package/ios/Template/Logo/Logo.swift +75 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +123 -0
- package/ios/Title/Title.swift +270 -0
- package/ios/Tooltip/Tooltip.swift +486 -0
- package/ios/Typography/FontScale.swift +103 -0
- package/ios/Typography/FontScaleStore.swift +58 -0
- package/ios/Typography/KitDesignSystem.swift +17 -0
- package/ios/Typography/Text.swift +262 -0
- package/ios/Typography/Typography.swift +80 -23
- package/ios/Uploader/Uploader.swift +174 -0
- package/ios/native-kits.podspec +73 -13
- package/ios-demo/MoMoUIKitsDemo.podspec +20 -0
- package/ios-demo/Resources/dot_loading.json +558 -0
- package/ios-demo/Resources/icon.json +4052 -0
- package/ios-demo/Resources/lottie_circle_loader.json +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +24 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +75 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +108 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +96 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +60 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +76 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +102 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +100 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DemoScreen.swift +420 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +56 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +276 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconDemo.swift +81 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +65 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +96 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +117 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +94 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +94 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +88 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +120 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +85 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +87 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +73 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +235 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +241 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +68 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PlaygroundData.swift +76 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +95 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +67 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +101 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +64 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +68 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SectionDemo.swift +83 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +61 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +90 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +82 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +114 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +90 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +58 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +114 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +86 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +181 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +104 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +118 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +85 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +53 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
- package/package.json +6 -6
- package/publish.sh +554 -20
- package/scripts/gen-ios-color.mjs +136 -0
- package/CODE_OF_CONDUCT.md +0 -133
- package/CONTRIBUTING.md +0 -114
- package/LICENSE +0 -20
- package/android/build.gradle +0 -82
- package/android/gradle.properties +0 -5
- package/android/src/main/AndroidManifest.xml +0 -4
- package/android/src/main/java/com/momoplatform/nativekits/NativeKitsPackage.kt +0 -17
- package/android/src/main/java/com/momoplatform/nativekits/NativeKitsViewManager.kt +0 -20
- package/example/ios/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -63
- package/example/ios/Example/ComponentDetail.swift +0 -35
- package/example/ios/Example/ComponentItem.swift +0 -24
- package/example/ios/Example/ComponentModel.swift +0 -33
- package/example/ios/Example/ContentView.swift +0 -53
- package/example/ios/Example/Example.entitlements +0 -10
- package/example/ios/Example/Foundation/ButtonDemo.swift +0 -80
- package/example/ios/Example/Foundation/Popup/ActionSheets.swift +0 -136
- package/example/ios/Example/Foundation/Popup/Floats.swift +0 -127
- package/example/ios/Example/Foundation/Popup/Popups.swift +0 -101
- package/example/ios/Example/Foundation/PopupDemo.swift +0 -366
- package/example/ios/Example/Foundation/TextInputDemo.swift +0 -31
- package/example/ios/Example/Foundation/TypographyDemo.swift +0 -53
- package/example/ios/Example/Foundation.swift +0 -26
- package/example/ios/Example/Info.plist +0 -18
- package/example/ios/Example/Library/SwipeableDemo.swift +0 -105
- package/example/ios/Example/Library.swift +0 -26
- package/example/ios/Example/Main.swift +0 -11
- package/example/ios/Example/Overview.swift +0 -20
- package/example/ios/Example/Resource/SFProText-Black.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Bold.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Heavy.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Light.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Medium.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Regular.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Semibold.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Thin.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Ultralight.ttf +0 -0
- package/example/ios/Example/Resource/foundation.json +0 -33
- package/example/ios/Example/Resource/library.json +0 -8
- package/example/ios/Example/Utils.swift +0 -30
- package/example/ios/Example/ViewModifier/DarkViewModifier.swift +0 -22
- package/example/ios/Example.xcodeproj/project.pbxproj +0 -570
- package/example/ios/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/example/ios/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/example/ios/Example.xcodeproj/project.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/example/ios/Example.xcworkspace/contents.xcworkspacedata +0 -10
- package/example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
- package/example/ios/Podfile +0 -6
- package/example/ios/Podfile.lock +0 -16
- package/example/ios/Pods/Local Podspecs/MoMoUIKits.podspec.json +0 -29
- package/example/ios/Pods/Manifest.lock +0 -16
- package/example/ios/Pods/Pods.xcodeproj/project.pbxproj +0 -661
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -25
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-dummy.m +0 -5
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-prefix.pch +0 -12
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-umbrella.h +0 -16
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.debug.xcconfig +0 -12
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.modulemap +0 -6
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.release.xcconfig +0 -12
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown +0 -3
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist +0 -29
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-dummy.m +0 -5
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-umbrella.h +0 -16
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig +0 -14
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.modulemap +0 -6
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig +0 -14
- package/ios/Colors+Spacing/Radius.swift +0 -11
- package/ios/Popup/Utils++.swift +0 -163
- package/ios/Theme.md +0 -18
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Background.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Border.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Card.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Error.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Primary.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/PrimaryDark.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/PrimaryLight.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Secondary.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Success.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/TextSecondary.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Warning.colorset/Contents.json +0 -0
package/publish.sh
CHANGED
|
@@ -1,28 +1,562 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
rm -rf dist
|
|
3
|
-
mkdir dist
|
|
1
|
+
#!/usr/bin/env bash
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
set -e # Exit on error
|
|
6
4
|
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
# ============================================================================
|
|
6
|
+
# UNIVERSAL PUBLISH SCRIPT
|
|
7
|
+
# ============================================================================
|
|
8
|
+
# Usage:
|
|
9
|
+
# sh publish.sh beta # Run all phases for beta
|
|
10
|
+
# sh publish.sh release # Run all phases for release
|
|
11
|
+
# sh publish.sh beta check # Phase 1 only: Check version (beta)
|
|
12
|
+
# sh publish.sh beta maven # Phase 2 only: Publish to Maven (beta)
|
|
13
|
+
# sh publish.sh beta npm # Phase 3 only: Publish to NPM (beta)
|
|
14
|
+
# sh publish.sh release check # Phase 1 only: Check version (release)
|
|
15
|
+
# sh publish.sh release maven # Phase 2 only: Publish to Maven (release)
|
|
16
|
+
# sh publish.sh release npm # Phase 3 only: Publish to NPM (release)
|
|
17
|
+
#
|
|
18
|
+
# Release bump (RELEASE mode only):
|
|
19
|
+
# sh publish.sh release # default: auto-increment PATCH (0.161.0 -> 0.161.1)
|
|
20
|
+
# sh publish.sh release --bump # bump MINOR, reset patch to 0 (0.161.0 -> 0.162.0)
|
|
21
|
+
# BUMP=1 sh publish.sh release # same as --bump, via env var (handy for CI variables)
|
|
22
|
+
# ============================================================================
|
|
11
23
|
|
|
12
|
-
|
|
24
|
+
# ----------------------------------------------------------------------------
|
|
25
|
+
# Argument parsing
|
|
26
|
+
# Positional: MODE (beta|release), PHASE (check|maven|npm|all, default all)
|
|
27
|
+
# Flag: --bump (no value) -> RELEASE bumps the MINOR (reset patch to 0).
|
|
28
|
+
# Without --bump, release auto-increments PATCH.
|
|
29
|
+
# Env var BUMP=<non-empty/1/true/yes/minor> works as a fallback for --bump.
|
|
30
|
+
# ----------------------------------------------------------------------------
|
|
31
|
+
# Minor bump can be pre-enabled via the BUMP env var (e.g. a GitLab CI variable)
|
|
32
|
+
BUMP_MINOR=false
|
|
33
|
+
case "${BUMP:-}" in
|
|
34
|
+
1|true|yes|minor) BUMP_MINOR=true ;;
|
|
35
|
+
esac
|
|
13
36
|
|
|
14
|
-
|
|
15
|
-
|
|
37
|
+
_ARGS=""
|
|
38
|
+
while [ $# -gt 0 ]; do
|
|
39
|
+
case "$1" in
|
|
40
|
+
--bump)
|
|
41
|
+
BUMP_MINOR=true
|
|
42
|
+
shift
|
|
43
|
+
;;
|
|
44
|
+
*)
|
|
45
|
+
_ARGS="$_ARGS $1"
|
|
46
|
+
shift
|
|
47
|
+
;;
|
|
48
|
+
esac
|
|
49
|
+
done
|
|
50
|
+
# Re-establish positional parameters without the consumed flags
|
|
51
|
+
# shellcheck disable=SC2086
|
|
52
|
+
set -- $_ARGS
|
|
16
53
|
|
|
17
|
-
|
|
18
|
-
|
|
54
|
+
MODE="${1:-}"
|
|
55
|
+
PHASE="${2:-all}"
|
|
19
56
|
|
|
57
|
+
# Validate MODE
|
|
58
|
+
if [ -z "$MODE" ]; then
|
|
59
|
+
echo "❌ Error: MODE is required"
|
|
60
|
+
echo ""
|
|
61
|
+
echo "Usage:"
|
|
62
|
+
echo " sh publish.sh beta [phase] # Beta publishing"
|
|
63
|
+
echo " sh publish.sh release [phase] # Release publishing"
|
|
64
|
+
echo ""
|
|
65
|
+
echo "Phases: check | maven | npm | all (default: all)"
|
|
66
|
+
echo "Bump (release only): --bump # bump MINOR instead of PATCH (or env BUMP=1)"
|
|
67
|
+
exit 1
|
|
68
|
+
fi
|
|
20
69
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
cd ..
|
|
26
|
-
rm -rf dist
|
|
70
|
+
if [ "$MODE" != "beta" ] && [ "$MODE" != "release" ]; then
|
|
71
|
+
echo "❌ Error: Invalid MODE '$MODE'. Must be 'beta' or 'release'"
|
|
72
|
+
exit 1
|
|
73
|
+
fi
|
|
27
74
|
|
|
28
|
-
|
|
75
|
+
if [ "$MODE" == "beta" ] && [ "$BUMP_MINOR" = true ]; then
|
|
76
|
+
echo "⚠️ Note: --bump is ignored in beta mode (beta version comes from package.json)."
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
PODSPEC_VERSION_FILES=(
|
|
80
|
+
"ios/native-kits.podspec"
|
|
81
|
+
"ios-demo/MoMoUIKitsDemo.podspec"
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
PODSPEC_DEBUG_VERSION_FILES=(
|
|
85
|
+
"compose/compose.podspec"
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
update_podspec_file_version() {
|
|
89
|
+
local PODSPEC_FILE="$1"
|
|
90
|
+
local PODSPEC_VERSION="$2"
|
|
91
|
+
|
|
92
|
+
if [ ! -f "$PODSPEC_FILE" ]; then
|
|
93
|
+
echo " ⚠️ Skipped missing podspec: $PODSPEC_FILE"
|
|
94
|
+
return
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
CURRENT_PODSPEC_VERSION=$(grep -E "^[[:space:]]*[A-Za-z_]+\.version[[:space:]]*=" "$PODSPEC_FILE" | head -n 1 | sed -E "s/.*['\"]([^'\"]+)['\"].*/\1/")
|
|
98
|
+
|
|
99
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
100
|
+
sed -i '' -E "s/^([[:space:]]*[A-Za-z_]+\.version[[:space:]]*=[[:space:]]*)['\"][^'\"]+['\"]/\1'$PODSPEC_VERSION'/" "$PODSPEC_FILE"
|
|
101
|
+
else
|
|
102
|
+
sed -i -E "s/^([[:space:]]*[A-Za-z_]+\.version[[:space:]]*=[[:space:]]*)['\"][^'\"]+['\"]/\1'$PODSPEC_VERSION'/" "$PODSPEC_FILE"
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
UPDATED_PODSPEC_VERSION=$(grep -E "^[[:space:]]*[A-Za-z_]+\.version[[:space:]]*=" "$PODSPEC_FILE" | head -n 1 | sed -E "s/.*['\"]([^'\"]+)['\"].*/\1/")
|
|
106
|
+
|
|
107
|
+
if [ "$UPDATED_PODSPEC_VERSION" != "$PODSPEC_VERSION" ]; then
|
|
108
|
+
echo "❌ Error: Failed to update $PODSPEC_FILE to version $PODSPEC_VERSION"
|
|
109
|
+
exit 1
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
echo " $PODSPEC_FILE version updated: $CURRENT_PODSPEC_VERSION → $UPDATED_PODSPEC_VERSION"
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
update_podspec_versions() {
|
|
116
|
+
echo "📝 Updating podspec versions..."
|
|
117
|
+
|
|
118
|
+
for PODSPEC_FILE in "${PODSPEC_VERSION_FILES[@]}"; do
|
|
119
|
+
update_podspec_file_version "$PODSPEC_FILE" "$VERSION"
|
|
120
|
+
done
|
|
121
|
+
|
|
122
|
+
for PODSPEC_FILE in "${PODSPEC_DEBUG_VERSION_FILES[@]}"; do
|
|
123
|
+
update_podspec_file_version "$PODSPEC_FILE" "${VERSION}-debug"
|
|
124
|
+
done
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
# ============================================================================
|
|
128
|
+
# PHASE 1: CHECK AND UPDATE VERSION
|
|
129
|
+
# ============================================================================
|
|
130
|
+
phase_check_version() {
|
|
131
|
+
echo ""
|
|
132
|
+
echo "==============================================="
|
|
133
|
+
echo "📋 PHASE 1: CHECK AND UPDATE VERSION ($MODE)"
|
|
134
|
+
echo "==============================================="
|
|
135
|
+
|
|
136
|
+
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
|
137
|
+
|
|
138
|
+
# ==============================================================
|
|
139
|
+
# BETA MODE: Check format for tag, fail if exists
|
|
140
|
+
# ==============================================================
|
|
141
|
+
if [ "$MODE" == "beta" ]; then
|
|
142
|
+
echo "🔍 Reading version from package.json..."
|
|
143
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
144
|
+
|
|
145
|
+
if [ -z "$VERSION" ]; then
|
|
146
|
+
echo "❌ Error: Could not read version from package.json"
|
|
147
|
+
exit 1
|
|
148
|
+
fi
|
|
149
|
+
|
|
150
|
+
echo "📦 Version from package.json: $VERSION"
|
|
151
|
+
|
|
152
|
+
# Detect tag based on version format
|
|
153
|
+
# Has "beta" in version → tag beta
|
|
154
|
+
# No "beta" in version → tag alpha
|
|
155
|
+
|
|
156
|
+
if [[ "$VERSION" == *"beta"* ]]; then
|
|
157
|
+
NPM_TAG="beta"
|
|
158
|
+
echo "🏷️ Detected: Version contains 'beta' → tag: beta"
|
|
159
|
+
else
|
|
160
|
+
NPM_TAG="alpha"
|
|
161
|
+
echo "🏷️ Detected: Version does not contain 'beta' → tag: alpha"
|
|
162
|
+
fi
|
|
163
|
+
|
|
164
|
+
# Check if version exists on npm
|
|
165
|
+
echo "🔎 Checking if version $VERSION exists on npm..."
|
|
166
|
+
NPM_VERSION_INFO=$(npm view "$PACKAGE_NAME@$VERSION" version 2>/dev/null || echo "")
|
|
167
|
+
|
|
168
|
+
if [ -n "$NPM_VERSION_INFO" ]; then
|
|
169
|
+
echo ""
|
|
170
|
+
echo "❌ ERROR: Version $VERSION already exists on npm!"
|
|
171
|
+
echo ""
|
|
172
|
+
echo "Please update the version in package.json before publishing."
|
|
173
|
+
echo ""
|
|
174
|
+
exit 1
|
|
175
|
+
fi
|
|
176
|
+
|
|
177
|
+
echo "✅ Version $VERSION does not exist on npm. Safe to publish."
|
|
178
|
+
fi
|
|
179
|
+
|
|
180
|
+
# ==============================================================
|
|
181
|
+
# RELEASE MODE: Read from npm@latest and auto-increment
|
|
182
|
+
# ==============================================================
|
|
183
|
+
if [ "$MODE" == "release" ]; then
|
|
184
|
+
echo "🔍 Reading latest version from npm@latest (NOT from package.json)..."
|
|
185
|
+
|
|
186
|
+
# Read version from npm@latest
|
|
187
|
+
LATEST_VERSION=$(npm view "$PACKAGE_NAME@latest" version 2>/dev/null || echo "")
|
|
188
|
+
|
|
189
|
+
if [ -z "$LATEST_VERSION" ]; then
|
|
190
|
+
echo "❌ Error: Could not read version from npm@latest"
|
|
191
|
+
echo "Package may not exist on npm yet."
|
|
192
|
+
exit 1
|
|
193
|
+
fi
|
|
194
|
+
|
|
195
|
+
echo "📦 Current @latest version on npm: $LATEST_VERSION"
|
|
196
|
+
|
|
197
|
+
# Parse major.minor.patch (handle versions like 0.156.2 or 0.156.2-beta.1)
|
|
198
|
+
MAJOR=$(echo "$LATEST_VERSION" | cut -d'.' -f1)
|
|
199
|
+
MINOR=$(echo "$LATEST_VERSION" | cut -d'.' -f2)
|
|
200
|
+
PATCH=$(echo "$LATEST_VERSION" | cut -d'.' -f3 | cut -d'-' -f1)
|
|
201
|
+
|
|
202
|
+
# Compute next version:
|
|
203
|
+
# --bump -> bump MINOR, reset patch to 0 (0.161.0 -> 0.162.0)
|
|
204
|
+
# default -> auto-increment PATCH (0.161.0 -> 0.161.1)
|
|
205
|
+
if [ "$BUMP_MINOR" = true ]; then
|
|
206
|
+
MINOR=$((MINOR + 1))
|
|
207
|
+
NEW_PATCH=0
|
|
208
|
+
echo "🔼 Bump: MINOR (--bump)"
|
|
209
|
+
else
|
|
210
|
+
NEW_PATCH=$((PATCH + 1))
|
|
211
|
+
echo "🔼 Bump: PATCH (default)"
|
|
212
|
+
fi
|
|
213
|
+
VERSION="$MAJOR.$MINOR.$NEW_PATCH"
|
|
214
|
+
|
|
215
|
+
echo "🔼 Computed next version: $LATEST_VERSION → $VERSION"
|
|
216
|
+
|
|
217
|
+
# Find the next publishable patch within this major.minor line.
|
|
218
|
+
# A version is "taken" if EITHER the normal OR the "-debug" variant
|
|
219
|
+
# already exists on npm (phase 3 publishes both, so both must be free).
|
|
220
|
+
# Keeps incrementing the patch (e.g. 0.161.0 -> 0.161.1 -> 0.161.2 ...)
|
|
221
|
+
# until a fully-free version is found, or until a safety cap is hit.
|
|
222
|
+
echo "🔎 Finding a publishable version starting at $VERSION..."
|
|
223
|
+
MAX_TRIES=100
|
|
224
|
+
TRIES=0
|
|
225
|
+
while true; do
|
|
226
|
+
EXISTING=$(npm view "$PACKAGE_NAME@$VERSION" version 2>/dev/null || echo "")
|
|
227
|
+
EXISTING_DEBUG=$(npm view "$PACKAGE_NAME@$VERSION-debug" version 2>/dev/null || echo "")
|
|
228
|
+
|
|
229
|
+
if [ -z "$EXISTING" ] && [ -z "$EXISTING_DEBUG" ]; then
|
|
230
|
+
echo "✅ $VERSION is free (normal + debug). Using this version."
|
|
231
|
+
break
|
|
232
|
+
fi
|
|
233
|
+
|
|
234
|
+
echo "⚠️ $VERSION is taken (normal: ${EXISTING:-free}, debug: ${EXISTING_DEBUG:-free}). Incrementing patch..."
|
|
235
|
+
TRIES=$((TRIES + 1))
|
|
236
|
+
if [ "$TRIES" -ge "$MAX_TRIES" ]; then
|
|
237
|
+
echo "❌ Error: Could not find a free version after $MAX_TRIES tries (stuck near $VERSION)."
|
|
238
|
+
exit 1
|
|
239
|
+
fi
|
|
240
|
+
NEW_PATCH=$((NEW_PATCH + 1))
|
|
241
|
+
VERSION="$MAJOR.$MINOR.$NEW_PATCH"
|
|
242
|
+
echo " → trying $VERSION"
|
|
243
|
+
done
|
|
244
|
+
|
|
245
|
+
# Update package.json with new version
|
|
246
|
+
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
247
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
248
|
+
sed -i '' "s/\"version\": \"$CURRENT_VERSION\"/\"version\": \"$VERSION\"/" package.json
|
|
249
|
+
else
|
|
250
|
+
sed -i "s/\"version\": \"$CURRENT_VERSION\"/\"version\": \"$VERSION\"/" package.json
|
|
251
|
+
fi
|
|
252
|
+
echo "📝 Updated package.json: $CURRENT_VERSION → $VERSION"
|
|
253
|
+
|
|
254
|
+
# Set NPM tag to latest
|
|
255
|
+
NPM_TAG="latest"
|
|
256
|
+
fi
|
|
257
|
+
|
|
258
|
+
# Update gradle.properties with the same version
|
|
259
|
+
echo "📝 Updating gradle.properties..."
|
|
260
|
+
CURRENT_GRADLE_VERSION=$(grep "^version=" gradle.properties | cut -d'=' -f2 | tr -d '"')
|
|
261
|
+
|
|
262
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
263
|
+
sed -i '' "s/^version=.*/version=$VERSION/" gradle.properties
|
|
264
|
+
else
|
|
265
|
+
sed -i "s/^version=.*/version=$VERSION/" gradle.properties
|
|
266
|
+
fi
|
|
267
|
+
|
|
268
|
+
echo " Gradle version updated: $CURRENT_GRADLE_VERSION → $VERSION"
|
|
269
|
+
|
|
270
|
+
update_podspec_versions
|
|
271
|
+
|
|
272
|
+
export VERSION="$VERSION"
|
|
273
|
+
export NPM_TAG="$NPM_TAG"
|
|
274
|
+
|
|
275
|
+
echo "✅ Using version: $VERSION"
|
|
276
|
+
echo "✅ NPM tag: $NPM_TAG"
|
|
277
|
+
echo "✅ PHASE 1 COMPLETED"
|
|
278
|
+
echo ""
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
# ============================================================================
|
|
282
|
+
# PHASE 2: PUBLISH TO MAVEN
|
|
283
|
+
# ============================================================================
|
|
284
|
+
phase_publish_maven() {
|
|
285
|
+
echo ""
|
|
286
|
+
echo "==============================================="
|
|
287
|
+
echo "🔧 PHASE 2: PUBLISH TO MAVEN ($MODE)"
|
|
288
|
+
echo "==============================================="
|
|
289
|
+
|
|
290
|
+
# Get version from package.json
|
|
291
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
292
|
+
export VERSION="$VERSION"
|
|
293
|
+
|
|
294
|
+
echo "📦 Publishing KMP artifacts to Maven (version ${VERSION})..."
|
|
295
|
+
|
|
296
|
+
./gradlew :compose:publishAllPublicationsToGitLabPackagesRepository
|
|
297
|
+
|
|
298
|
+
echo "✅ compose Maven publishing completed successfully!"
|
|
299
|
+
|
|
300
|
+
echo "📦 Publishing sample/shared KMP artifacts to Maven (version ${VERSION})..."
|
|
301
|
+
|
|
302
|
+
# Temporarily remove composeResources and compose { resources { ... } } block
|
|
303
|
+
echo "📦 Backing up sample/shared composeResources and build.gradle.kts..."
|
|
304
|
+
# mv into an existing dir nests instead of renaming, so a backup left behind by a
|
|
305
|
+
# crashed run must be cleared first or the restore below puts back the wrong tree.
|
|
306
|
+
rm -rf sample/shared/src/commonMain/composeResources.backup
|
|
307
|
+
if [ -d "sample/shared/src/commonMain/composeResources" ]; then
|
|
308
|
+
mv sample/shared/src/commonMain/composeResources sample/shared/src/commonMain/composeResources.backup
|
|
309
|
+
fi
|
|
310
|
+
cp sample/shared/build.gradle.kts sample/shared/build.gradle.kts.backup
|
|
311
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
312
|
+
sed -i '' '/^compose {$/,/^}$/d' sample/shared/build.gradle.kts
|
|
313
|
+
else
|
|
314
|
+
sed -i '/^compose {$/,/^}$/d' sample/shared/build.gradle.kts
|
|
315
|
+
fi
|
|
316
|
+
|
|
317
|
+
./gradlew :sample:shared:publishAllPublicationsToGitLabPackagesRepository
|
|
318
|
+
|
|
319
|
+
# Restore composeResources and build.gradle.kts
|
|
320
|
+
echo "📦 Restoring sample/shared composeResources and build.gradle.kts..."
|
|
321
|
+
mv sample/shared/build.gradle.kts.backup sample/shared/build.gradle.kts
|
|
322
|
+
if [ -d "sample/shared/src/commonMain/composeResources.backup" ]; then
|
|
323
|
+
mv sample/shared/src/commonMain/composeResources.backup sample/shared/src/commonMain/composeResources
|
|
324
|
+
fi
|
|
325
|
+
|
|
326
|
+
echo "✅ sample/shared Maven publishing completed successfully!"
|
|
327
|
+
echo "✅ PHASE 2 COMPLETED"
|
|
328
|
+
echo ""
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
# ============================================================================
|
|
332
|
+
# PHASE 3: PUBLISH TO NPM
|
|
333
|
+
# ============================================================================
|
|
334
|
+
phase_publish_npm() {
|
|
335
|
+
echo ""
|
|
336
|
+
echo "==============================================="
|
|
337
|
+
echo "📦 PHASE 3: PUBLISH TO NPM ($MODE)"
|
|
338
|
+
echo "==============================================="
|
|
339
|
+
|
|
340
|
+
# Get version from package.json
|
|
341
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
342
|
+
export VERSION="$VERSION"
|
|
343
|
+
|
|
344
|
+
echo "📦 Version from package.json: $VERSION"
|
|
345
|
+
|
|
346
|
+
# Determine NPM tag (should already be set from phase 1, but fallback just in case)
|
|
347
|
+
if [ -z "$NPM_TAG" ]; then
|
|
348
|
+
echo "⚠️ NPM_TAG not set, re-detecting..."
|
|
349
|
+
if [ "$MODE" == "beta" ]; then
|
|
350
|
+
# Re-detect based on version format
|
|
351
|
+
if [[ "$VERSION" == *"beta"* ]]; then
|
|
352
|
+
NPM_TAG="beta"
|
|
353
|
+
echo "🏷️ Detected: Version contains 'beta' → tag: beta"
|
|
354
|
+
else
|
|
355
|
+
NPM_TAG="alpha"
|
|
356
|
+
echo "🏷️ Detected: Version does not contain 'beta' → tag: alpha"
|
|
357
|
+
fi
|
|
358
|
+
else
|
|
359
|
+
NPM_TAG="latest"
|
|
360
|
+
echo "🏷️ Release mode → tag: latest"
|
|
361
|
+
fi
|
|
362
|
+
else
|
|
363
|
+
echo "✅ NPM_TAG already set: $NPM_TAG"
|
|
364
|
+
fi
|
|
365
|
+
|
|
366
|
+
echo "📦 Publishing version: $VERSION"
|
|
367
|
+
echo "🏷️ NPM tag: $NPM_TAG"
|
|
368
|
+
|
|
369
|
+
./gradlew clean
|
|
370
|
+
|
|
371
|
+
# ============================================================
|
|
372
|
+
# FIRST PUBLISH: DEBUG VERSION (with compose kits included)
|
|
373
|
+
# ============================================================
|
|
374
|
+
echo ""
|
|
375
|
+
# A bad token surfaces as a 404 on the PUT, after the working tree was already rewritten
|
|
376
|
+
# below — so verify auth first, before anything is touched.
|
|
377
|
+
if ! npm whoami --registry https://registry.npmjs.org >/dev/null 2>&1; then
|
|
378
|
+
echo "❌ Error: npm auth failed (npm whoami). Renew the token in .npmrc / ~/.npmrc and retry."
|
|
379
|
+
exit 1
|
|
380
|
+
fi
|
|
381
|
+
|
|
382
|
+
echo "🔧 Preparing debug version with compose kits..."
|
|
383
|
+
|
|
384
|
+
# Create debug version
|
|
385
|
+
DEBUG_VERSION="${VERSION}-debug"
|
|
386
|
+
|
|
387
|
+
# set -e aborts mid-phase on any failure; put the tree back no matter where it stopped.
|
|
388
|
+
# Idempotent: the happy path already moved the backups away and reset the version.
|
|
389
|
+
restore_npm_workspace() {
|
|
390
|
+
[ -f .npmignore.backup ] && mv .npmignore.backup .npmignore
|
|
391
|
+
[ -f compose/build.gradle.kts.backup ] && mv compose/build.gradle.kts.backup compose/build.gradle.kts
|
|
392
|
+
local pkg_version
|
|
393
|
+
pkg_version=$(node -p "require('./package.json').version")
|
|
394
|
+
if [ "$pkg_version" != "$VERSION" ]; then
|
|
395
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
396
|
+
sed -i '' "s/\"version\": \"$pkg_version\"/\"version\": \"$VERSION\"/" package.json
|
|
397
|
+
else
|
|
398
|
+
sed -i "s/\"version\": \"$pkg_version\"/\"version\": \"$VERSION\"/" package.json
|
|
399
|
+
fi
|
|
400
|
+
fi
|
|
401
|
+
}
|
|
402
|
+
trap restore_npm_workspace EXIT
|
|
403
|
+
echo "📦 Debug version: $DEBUG_VERSION"
|
|
404
|
+
|
|
405
|
+
# Get current version from package.json (in case it's different from $VERSION)
|
|
406
|
+
CURRENT_PKG_VERSION=$(node -p "require('./package.json').version")
|
|
407
|
+
|
|
408
|
+
# Update package.json version to debug version
|
|
409
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
410
|
+
sed -i '' "s/\"version\": \"$CURRENT_PKG_VERSION\"/\"version\": \"$DEBUG_VERSION\"/" package.json
|
|
411
|
+
else
|
|
412
|
+
sed -i "s/\"version\": \"$CURRENT_PKG_VERSION\"/\"version\": \"$DEBUG_VERSION\"/" package.json
|
|
413
|
+
fi
|
|
414
|
+
|
|
415
|
+
# Backup compose/build.gradle.kts
|
|
416
|
+
echo "📦 Backing up compose/build.gradle.kts..."
|
|
417
|
+
cp compose/build.gradle.kts compose/build.gradle.kts.backup
|
|
418
|
+
|
|
419
|
+
# Comment out maven publish in compose/build.gradle.kts
|
|
420
|
+
echo "💬 Commenting out maven publish in compose/build.gradle.kts..."
|
|
421
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
422
|
+
sed -i '' 's/^import com\.vanniktech\.maven\.publish\.JavadocJar$/\/\/ &/' compose/build.gradle.kts
|
|
423
|
+
sed -i '' 's/^import com\.vanniktech\.maven\.publish\.KotlinMultiplatform$/\/\/ &/' compose/build.gradle.kts
|
|
424
|
+
sed -i '' 's/^ alias(libs\.plugins\.vanniktech\.mavenPublish)$/\/\/ &/' compose/build.gradle.kts
|
|
425
|
+
sed -i '' '/^publishing {$/,/^}$/s/^/\/\/ /' compose/build.gradle.kts
|
|
426
|
+
sed -i '' '/^mavenPublishing {$/,/^}$/s/^/\/\/ /' compose/build.gradle.kts
|
|
427
|
+
else
|
|
428
|
+
sed -i 's/^import com\.vanniktech\.maven\.publish\.JavadocJar$/\/\/ &/' compose/build.gradle.kts
|
|
429
|
+
sed -i 's/^import com\.vanniktech\.maven\.publish\.KotlinMultiplatform$/\/\/ &/' compose/build.gradle.kts
|
|
430
|
+
sed -i 's/^ alias(libs\.plugins\.vanniktech\.mavenPublish)$/\/\/ &/' compose/build.gradle.kts
|
|
431
|
+
sed -i '/^publishing {$/,/^}$/s/^/\/\/ /' compose/build.gradle.kts
|
|
432
|
+
sed -i '/^mavenPublishing {$/,/^}$/s/^/\/\/ /' compose/build.gradle.kts
|
|
433
|
+
fi
|
|
434
|
+
|
|
435
|
+
# Modify android configuration for debug version
|
|
436
|
+
echo "🔧 Modifying android configuration for debug version..."
|
|
437
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
438
|
+
sed -i '' 's/namespace = "\$gitlabGroup\.\$gitlabArtifactId"/namespace = "vn.momo.kits.kits"/' compose/build.gradle.kts
|
|
439
|
+
sed -i '' 's/compileSdk = libs\.versions\.android\.compileSdk\.get()\.toInt()/compileSdk = 35/' compose/build.gradle.kts
|
|
440
|
+
sed -i '' 's/minSdk = libs\.versions\.android\.minSdk\.get()\.toInt()/minSdk = 24/' compose/build.gradle.kts
|
|
441
|
+
sed -i '' "s/version = gitlabVersion/version = \"$DEBUG_VERSION\"/" compose/build.gradle.kts
|
|
442
|
+
else
|
|
443
|
+
sed -i 's/namespace = "\$gitlabGroup\.\$gitlabArtifactId"/namespace = "vn.momo.kits.kits"/' compose/build.gradle.kts
|
|
444
|
+
sed -i 's/compileSdk = libs\.versions\.android\.compileSdk\.get()\.toInt()/compileSdk = 35/' compose/build.gradle.kts
|
|
445
|
+
sed -i 's/minSdk = libs\.versions\.android\.minSdk\.get()\.toInt()/minSdk = 24/' compose/build.gradle.kts
|
|
446
|
+
sed -i "s/version = gitlabVersion/version = \"$DEBUG_VERSION\"/" compose/build.gradle.kts
|
|
447
|
+
fi
|
|
448
|
+
|
|
449
|
+
# Backup .npmignore
|
|
450
|
+
cp .npmignore .npmignore.backup
|
|
451
|
+
|
|
452
|
+
# Create minimal .npmignore for debug version
|
|
453
|
+
cat > .npmignore << 'EOF'
|
|
454
|
+
sample/
|
|
455
|
+
build/
|
|
456
|
+
|
|
457
|
+
.fleet
|
|
458
|
+
.gradle
|
|
459
|
+
.idea
|
|
460
|
+
.kotlin
|
|
461
|
+
.run
|
|
462
|
+
|
|
463
|
+
.gitattributes
|
|
464
|
+
.gitlab-ci.yml
|
|
465
|
+
.npmignore.backup
|
|
466
|
+
EOF
|
|
467
|
+
|
|
468
|
+
echo "📤 Publishing debug version (with compose)..."
|
|
469
|
+
npm publish --tag $NPM_TAG --access=public
|
|
470
|
+
|
|
471
|
+
echo "✅ Debug version published successfully!"
|
|
472
|
+
|
|
473
|
+
# Restore .npmignore
|
|
474
|
+
mv .npmignore.backup .npmignore
|
|
475
|
+
echo "✅ .npmignore restored"
|
|
476
|
+
|
|
477
|
+
# Restore compose/build.gradle.kts
|
|
478
|
+
mv compose/build.gradle.kts.backup compose/build.gradle.kts
|
|
479
|
+
echo "✅ compose/build.gradle.kts restored"
|
|
480
|
+
|
|
481
|
+
# Restore package.json version to original
|
|
482
|
+
# Verify current version is debug version before restoring
|
|
483
|
+
CURRENT_VERSION_CHECK=$(node -p "require('./package.json').version")
|
|
484
|
+
if [ "$CURRENT_VERSION_CHECK" == "$DEBUG_VERSION" ]; then
|
|
485
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
486
|
+
sed -i '' "s/\"version\": \"$DEBUG_VERSION\"/\"version\": \"$VERSION\"/" package.json
|
|
487
|
+
else
|
|
488
|
+
sed -i "s/\"version\": \"$DEBUG_VERSION\"/\"version\": \"$VERSION\"/" package.json
|
|
489
|
+
fi
|
|
490
|
+
echo "✅ package.json version restored: $DEBUG_VERSION → $VERSION"
|
|
491
|
+
else
|
|
492
|
+
echo "⚠️ Warning: package.json version is $CURRENT_VERSION_CHECK, expected $DEBUG_VERSION"
|
|
493
|
+
echo " Restoring to $VERSION anyway..."
|
|
494
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
495
|
+
sed -i '' "s/\"version\": \"$CURRENT_VERSION_CHECK\"/\"version\": \"$VERSION\"/" package.json
|
|
496
|
+
else
|
|
497
|
+
sed -i "s/\"version\": \"$CURRENT_VERSION_CHECK\"/\"version\": \"$VERSION\"/" package.json
|
|
498
|
+
fi
|
|
499
|
+
fi
|
|
500
|
+
|
|
501
|
+
# ============================================================
|
|
502
|
+
# SECOND PUBLISH: NORMAL VERSION (without compose)
|
|
503
|
+
# ============================================================
|
|
504
|
+
echo ""
|
|
505
|
+
echo "📤 Publishing normal version (without compose)..."
|
|
506
|
+
npm publish --tag $NPM_TAG --access=public
|
|
507
|
+
|
|
508
|
+
echo "✅ Normal version published successfully!"
|
|
509
|
+
trap - EXIT
|
|
510
|
+
|
|
511
|
+
echo ""
|
|
512
|
+
echo "✅ PHASE 3 COMPLETED"
|
|
513
|
+
echo " 🐛 Debug version: $DEBUG_VERSION (with compose) - Published first"
|
|
514
|
+
echo " 📦 Normal version: $VERSION (without compose) - Published second"
|
|
515
|
+
echo " 🏷️ NPM Tag: $NPM_TAG"
|
|
516
|
+
echo ""
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
# ============================================================================
|
|
520
|
+
# MAIN EXECUTION
|
|
521
|
+
# ============================================================================
|
|
522
|
+
|
|
523
|
+
echo ""
|
|
524
|
+
echo "🚀 PUBLISH SCRIPT - MODE: $(echo $MODE | tr '[:lower:]' '[:upper:]')"
|
|
525
|
+
if [ "$MODE" == "release" ]; then
|
|
526
|
+
if [ "$BUMP_MINOR" = true ]; then echo " Bump: MINOR (--bump)"; else echo " Bump: PATCH (default)"; fi
|
|
527
|
+
fi
|
|
528
|
+
echo "================================================="
|
|
529
|
+
|
|
530
|
+
case "$PHASE" in
|
|
531
|
+
"check")
|
|
532
|
+
echo "Running PHASE 1 only: Check and update version"
|
|
533
|
+
phase_check_version
|
|
534
|
+
;;
|
|
535
|
+
"maven")
|
|
536
|
+
echo "Running PHASE 2 only: Publish to Maven"
|
|
537
|
+
phase_publish_maven
|
|
538
|
+
;;
|
|
539
|
+
"npm")
|
|
540
|
+
echo "Running PHASE 3 only: Publish to NPM"
|
|
541
|
+
phase_publish_npm
|
|
542
|
+
;;
|
|
543
|
+
"all")
|
|
544
|
+
echo "Running ALL PHASES"
|
|
545
|
+
phase_check_version
|
|
546
|
+
phase_publish_maven
|
|
547
|
+
phase_publish_npm
|
|
548
|
+
echo ""
|
|
549
|
+
echo "🎉 ALL PHASES COMPLETED SUCCESSFULLY!"
|
|
550
|
+
echo "================================================="
|
|
551
|
+
;;
|
|
552
|
+
*)
|
|
553
|
+
echo "❌ Error: Invalid phase '$PHASE'"
|
|
554
|
+
echo ""
|
|
555
|
+
echo "Usage:"
|
|
556
|
+
echo " sh publish.sh $MODE # Run all phases"
|
|
557
|
+
echo " sh publish.sh $MODE check # Phase 1: Check and update version"
|
|
558
|
+
echo " sh publish.sh $MODE maven # Phase 2: Publish to Maven"
|
|
559
|
+
echo " sh publish.sh $MODE npm # Phase 3: Publish to NPM"
|
|
560
|
+
exit 1
|
|
561
|
+
;;
|
|
562
|
+
esac
|