@effijs/templates 0.0.0-stage → 1.0.0-alpha.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/CONTRIBUTING.md +27 -0
- package/LICENSE +22 -0
- package/README.md +32 -2
- package/ai/SETUP.md +5 -0
- package/docs/catalog.md +85 -0
- package/forge.manifest.js +75 -0
- package/lib/compat.js +40 -0
- package/lib/docs/build.js +146 -0
- package/lib/install.js +51 -0
- package/lib/journal.js +40 -0
- package/lib/jsonConfig.js +33 -0
- package/lib/migration.js +35 -0
- package/lib/names.js +42 -0
- package/lib/patch.js +62 -0
- package/lib/paths.js +12 -0
- package/lib/project.js +48 -0
- package/lib/registry.js +99 -0
- package/package.json +46 -4
- package/platforms/react-native/CATALOG.md +391 -0
- package/platforms/react-native/ORIGIN.md +42 -0
- package/platforms/react-native/README.md +78 -0
- package/platforms/react-native/ai/AGENTS.md.hbs +36 -0
- package/platforms/react-native/ai/SETUP.md +89 -0
- package/platforms/react-native/compat/matrix.js +150 -0
- package/platforms/react-native/configs/babel.js +63 -0
- package/platforms/react-native/configs/forgeConfig.js +35 -0
- package/platforms/react-native/configs/jsConfigs.js +96 -0
- package/platforms/react-native/configs/metro.js +86 -0
- package/platforms/react-native/generators/add/generator.js +12 -0
- package/platforms/react-native/generators/add/run.js +64 -0
- package/platforms/react-native/generators/component/generator.js +75 -0
- package/platforms/react-native/generators/component/render.js +69 -0
- package/platforms/react-native/generators/component/templates/Common.tsx.hbs +13 -0
- package/platforms/react-native/generators/component/templates/index.ts.hbs +13 -0
- package/platforms/react-native/generators/component/templates/pm.ts.hbs +7 -0
- package/platforms/react-native/generators/component/templates/types.ts.hbs +3 -0
- package/platforms/react-native/generators/demo/files/api/app.http +8 -0
- package/platforms/react-native/generators/demo/files/api/environment/http-client.env.json +5 -0
- package/platforms/react-native/generators/demo/files/entity/category/category.api.ts +18 -0
- package/platforms/react-native/generators/demo/files/entity/category/category.dto.ts +15 -0
- package/platforms/react-native/generators/demo/files/entity/category/category.service.ts +42 -0
- package/platforms/react-native/generators/demo/files/entity/category/category.store.ts +26 -0
- package/platforms/react-native/generators/demo/files/entity/category/index.ts +2 -0
- package/platforms/react-native/generators/demo/files/entity/product/index.ts +2 -0
- package/platforms/react-native/generators/demo/files/entity/product/product.api.ts +49 -0
- package/platforms/react-native/generators/demo/files/entity/product/product.dto.ts +120 -0
- package/platforms/react-native/generators/demo/files/entity/product/product.service.ts +139 -0
- package/platforms/react-native/generators/demo/files/entity/product/product.store.ts +37 -0
- package/platforms/react-native/generators/demo/files/feature/product/components/Product.CategorySelect.tsx +36 -0
- package/platforms/react-native/generators/demo/files/feature/product/detail/Product.Detail.Screen.tsx +100 -0
- package/platforms/react-native/generators/demo/files/feature/product/detail/product.detail.service.ts +33 -0
- package/platforms/react-native/generators/demo/files/feature/product/filter/Product.Filter.Screen.tsx +59 -0
- package/platforms/react-native/generators/demo/files/feature/product/filter/product.filter.service.ts +78 -0
- package/platforms/react-native/generators/demo/files/feature/product/form/Product.Form.Screen.tsx +71 -0
- package/platforms/react-native/generators/demo/files/feature/product/form/product.form.service.ts +142 -0
- package/platforms/react-native/generators/demo/files/feature/product/index.ts +7 -0
- package/platforms/react-native/generators/demo/files/feature/product/list/Product.List.Item.tsx +34 -0
- package/platforms/react-native/generators/demo/files/feature/product/list/Product.List.Screen.tsx +106 -0
- package/platforms/react-native/generators/demo/files/feature/product/list/product.list.service.ts +47 -0
- package/platforms/react-native/generators/demo/files/feature/product/product.feature.ts +29 -0
- package/platforms/react-native/generators/demo/files/feature/product/product.hooks.ts +7 -0
- package/platforms/react-native/generators/demo/files/feature/product/search/Product.Search.Screen.tsx +82 -0
- package/platforms/react-native/generators/demo/files/feature/product/search/product.search.service.ts +97 -0
- package/platforms/react-native/generators/demo/files/navigation/navigation.product.ts +46 -0
- package/platforms/react-native/generators/demo/generator.js +93 -0
- package/platforms/react-native/generators/entity/generator.js +68 -0
- package/platforms/react-native/generators/feature/generator.js +224 -0
- package/platforms/react-native/generators/feature/render.js +163 -0
- package/platforms/react-native/generators/feature/templates/detail.screen.tsx.hbs +25 -0
- package/platforms/react-native/generators/feature/templates/detail.service.ts.hbs +14 -0
- package/platforms/react-native/generators/feature/templates/feature.ts.hbs +18 -0
- package/platforms/react-native/generators/feature/templates/filter.screen.tsx.hbs +17 -0
- package/platforms/react-native/generators/feature/templates/filter.service.ts.hbs +14 -0
- package/platforms/react-native/generators/feature/templates/form.screen.tsx.hbs +21 -0
- package/platforms/react-native/generators/feature/templates/form.service.ts.hbs +37 -0
- package/platforms/react-native/generators/feature/templates/hooks.ts.hbs +7 -0
- package/platforms/react-native/generators/feature/templates/index.ts.hbs +2 -0
- package/platforms/react-native/generators/feature/templates/list.item.tsx.hbs +16 -0
- package/platforms/react-native/generators/feature/templates/list.screen.tsx.hbs +34 -0
- package/platforms/react-native/generators/feature/templates/list.service.ts.hbs +15 -0
- package/platforms/react-native/generators/feature/templates/navigation.ts.hbs +12 -0
- package/platforms/react-native/generators/feature/templates/search.screen.tsx.hbs +24 -0
- package/platforms/react-native/generators/feature/templates/search.service.ts.hbs +13 -0
- package/platforms/react-native/generators/feature/templates/tab.tsx.hbs +8 -0
- package/platforms/react-native/generators/init/files/app/app.controller.ts +41 -0
- package/platforms/react-native/generators/init/files/app/app.error.ts +1 -0
- package/platforms/react-native/generators/init/files/app/app.store.ts +12 -0
- package/platforms/react-native/generators/init/files/app/index.ts +19 -0
- package/platforms/react-native/generators/init/files/app/splash/Onboarding.Screen.tsx +31 -0
- package/platforms/react-native/generators/init/files/app/splash/Splash.Screen.tsx +14 -0
- package/platforms/react-native/generators/init/files/app/tabs/home/Home.tab.tsx +24 -0
- package/platforms/react-native/generators/init/files/app/tabs/profile/Profile.tab.tsx +1 -0
- package/platforms/react-native/generators/init/files/configs/dev.ts.hbs +5 -0
- package/platforms/react-native/generators/init/files/configs/index.ts +4 -0
- package/platforms/react-native/generators/init/files/configs/prod.ts.hbs +5 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.api.ts +36 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.dto.ts +26 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.service.ts +94 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.session.store.ts +14 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.store.ts +20 -0
- package/platforms/react-native/generators/init/files/entity/auth/index.ts +2 -0
- package/platforms/react-native/generators/init/files/entity/index.ts +2 -0
- package/platforms/react-native/generators/init/files/feature/auth/auth.feature.ts +10 -0
- package/platforms/react-native/generators/init/files/feature/auth/auth.hooks.ts +7 -0
- package/platforms/react-native/generators/init/files/feature/auth/index.ts +1 -0
- package/platforms/react-native/generators/init/files/feature/auth/sign-in/SignIn.Screen.tsx +39 -0
- package/platforms/react-native/generators/init/files/feature/auth/sign-in/signIn.service.ts +54 -0
- package/platforms/react-native/generators/init/files/feature/auth/sign-up/SignUp.Screen.tsx +64 -0
- package/platforms/react-native/generators/init/files/feature/auth/sign-up/signUp.service.ts +73 -0
- package/platforms/react-native/generators/init/files/feature/feature.hooks.ts +15 -0
- package/platforms/react-native/generators/init/files/feature/index.ts +3 -0
- package/platforms/react-native/generators/init/files/feature/profile/Profile.Screen.tsx +52 -0
- package/platforms/react-native/generators/init/files/feature/profile/index.ts +1 -0
- package/platforms/react-native/generators/init/files/feature/profile/profile.feature.ts +18 -0
- package/platforms/react-native/generators/init/files/feature/profile/profile.hooks.ts +7 -0
- package/platforms/react-native/generators/init/files/index.ts +16 -0
- package/platforms/react-native/generators/init/files/navigation/index.ts +18 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.app.ts +58 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.features.ts +9 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.hooks.ts +5 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.tabs.ts +55 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.widgets.ts +23 -0
- package/platforms/react-native/generators/init/files/services/http/http.base.ts +69 -0
- package/platforms/react-native/generators/init/files/services/http/http.error.ts +10 -0
- package/platforms/react-native/generators/init/files/services/http/http.service.ts +24 -0
- package/platforms/react-native/generators/init/files/services/http/middleware/index.ts +12 -0
- package/platforms/react-native/generators/init/files/services/http/middleware/middleware.error.ts +36 -0
- package/platforms/react-native/generators/init/files/services/http/middleware/middleware.registry.ts +3 -0
- package/platforms/react-native/generators/init/files/services/http/middleware/middleware.token.ts +97 -0
- package/platforms/react-native/generators/init/files/services/index.ts +15 -0
- package/platforms/react-native/generators/init/files/ui/components/Box/Common.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Box/box.pm.ts +111 -0
- package/platforms/react-native/generators/init/files/ui/components/Box/box.types.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/components/Box/index.ts +13 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/Common.tsx +50 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/Touchable.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/button.pm.ts +197 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/button.types.ts +22 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/button.utils.ts +16 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/index.ts +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Colours.tsx +50 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Common.tsx +38 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/ErrorText.tsx +11 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Input.tsx +115 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/InputArea.tsx +70 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Label.tsx +18 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Select.tsx +86 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/components/SecureTextEntry.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/form.error.ts +18 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/form.pm.ts +134 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/form.types.ts +59 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/index.ts +67 -0
- package/platforms/react-native/generators/init/files/ui/components/Grid/Common.tsx +11 -0
- package/platforms/react-native/generators/init/files/ui/components/Grid/grid.pm.ts +93 -0
- package/platforms/react-native/generators/init/files/ui/components/Grid/grid.types.ts +79 -0
- package/platforms/react-native/generators/init/files/ui/components/Grid/index.ts +13 -0
- package/platforms/react-native/generators/init/files/ui/components/Icon/Common.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Icon/icons.pm.ts +74 -0
- package/platforms/react-native/generators/init/files/ui/components/Icon/icons.types.ts +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Icon/index.ts +3 -0
- package/platforms/react-native/generators/init/files/ui/components/Loading/Loading.tsx +10 -0
- package/platforms/react-native/generators/init/files/ui/components/Loading/loading.hook.ts +5 -0
- package/platforms/react-native/generators/init/files/ui/components/Loading/loading.service.ts +22 -0
- package/platforms/react-native/generators/init/files/ui/components/Loading/loading.store.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/Common.tsx +87 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/Content.tsx +77 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/Header.tsx +80 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/HeaderTab.tsx +17 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/SafeAreaHOC.tsx +9 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/index.ts +22 -0
- package/platforms/react-native/generators/init/files/ui/components/Text/Common.tsx +20 -0
- package/platforms/react-native/generators/init/files/ui/components/Text/index.ts +13 -0
- package/platforms/react-native/generators/init/files/ui/components/Text/text.pm.ts +55 -0
- package/platforms/react-native/generators/init/files/ui/components/Text/text.types.ts +27 -0
- package/platforms/react-native/generators/init/files/ui/components/TextInput/Common.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/TextInput/index.ts +15 -0
- package/platforms/react-native/generators/init/files/ui/components/TextInput/textInput.pm.ts +65 -0
- package/platforms/react-native/generators/init/files/ui/components/TextInput/textInput.types.ts +16 -0
- package/platforms/react-native/generators/init/files/ui/components/ThemePicker/ThemePicker.tsx +92 -0
- package/platforms/react-native/generators/init/files/ui/components/ThemePicker/index.ts +1 -0
- package/platforms/react-native/generators/init/files/ui/components/index.ts +27 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/color.ts +19 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/index.ts +3 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/useLoading.hook.spec.tsx +202 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/useLoading.hook.ts +172 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/useStore.ts +34 -0
- package/platforms/react-native/generators/init/files/ui/fonts/font-icons.ttf +0 -0
- package/platforms/react-native/generators/init/files/ui/icons/font-icons.json +53 -0
- package/platforms/react-native/generators/init/files/ui/icons/logo.png +0 -0
- package/platforms/react-native/generators/init/files/ui/icons/logo.svg +304 -0
- package/platforms/react-native/generators/init/files/ui/icons/tabs/icon-1.png +0 -0
- package/platforms/react-native/generators/init/files/ui/icons/tabs/icon-2.png +0 -0
- package/platforms/react-native/generators/init/files/ui/theme/black/black.color.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/black/index.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/blue/blue.color.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/blue/index.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/green/green.color.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/green/index.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/index.ts +11 -0
- package/platforms/react-native/generators/init/files/ui/theme/pink/index.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/pink/pink.color.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/index.ts +23 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.color.ts +139 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.radius.ts +21 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.spacing.ts +24 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.ts +25 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.typography.ts +98 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/index.ts +4 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/shared.color.base.ts +79 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/shared.radius.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/shared.spacing.ts +9 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/shared.typography.ts +105 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.hooks.ts +7 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.meta.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.provider.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.service.ts +36 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.ts +27 -0
- package/platforms/react-native/generators/init/files/ui/widgets/index.ts +1 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/Toast.Item.tsx +175 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/Toast.Overlay.tsx +46 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/Toast.Stack.tsx +75 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/index.ts +7 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.hooks.ts +18 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.service.ts +39 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.store.ts +59 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.types.ts +18 -0
- package/platforms/react-native/generators/init/files/ui/widgets/widgets.feature.ts +14 -0
- package/platforms/react-native/generators/init/files/utils/date.ts +11 -0
- package/platforms/react-native/generators/init/files/utils/index.ts +12 -0
- package/platforms/react-native/generators/init/files/utils/store.persistent.ts +103 -0
- package/platforms/react-native/generators/init/files/utils/store.registry.ts +14 -0
- package/platforms/react-native/generators/init/files/utils/string.ts +100 -0
- package/platforms/react-native/generators/init/generator.js +86 -0
- package/platforms/react-native/generators/init/kit.js +23 -0
- package/platforms/react-native/generators/init/navigators/expo-router/index.ts +18 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.app.ts +8 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.features.ts +9 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.hooks.ts +5 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.tabs.ts +7 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.widgets.ts +5 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/index.ts +18 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.app.ts +8 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.features.ts +9 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.hooks.ts +5 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.tabs.ts +7 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.widgets.ts +5 -0
- package/platforms/react-native/generators/setup/generator.js +225 -0
- package/platforms/react-native/generators/util/generator.js +12 -0
- package/platforms/react-native/platform.js +32 -0
- package/platforms/react-native/runtime.js +57 -0
- package/platforms/react-native/solutions/components/BottomSheet/README.md +29 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Common.tsx +120 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Content.tsx +57 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Context.tsx +22 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/FlatList.tsx +50 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Header.tsx +57 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Search.tsx +24 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/bottomSheet.constants.ts +13 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/bottomSheet.types.ts +31 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/index.ts +33 -0
- package/platforms/react-native/solutions/components/BottomSheet/solution.js +38 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/README.md +29 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/files/SelectPicker.tsx +47 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/files/bottomSheet/Content.BottomSheet.tsx +22 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/files/bottomSheet/DateTimePicker.BottomSheet.tsx +74 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/files/bottomSheet/List.BottomSheet.tsx +62 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/solution.js +49 -0
- package/platforms/react-native/solutions/components/Calendar/README.md +29 -0
- package/platforms/react-native/solutions/components/Calendar/files/Common.tsx +16 -0
- package/platforms/react-native/solutions/components/Calendar/files/Context.tsx +466 -0
- package/platforms/react-native/solutions/components/Calendar/files/DayCell.tsx +89 -0
- package/platforms/react-native/solutions/components/Calendar/files/MonthView.tsx +41 -0
- package/platforms/react-native/solutions/components/Calendar/files/MonthYearOverlay.tsx +51 -0
- package/platforms/react-native/solutions/components/Calendar/files/SwipeablePeriod.tsx +44 -0
- package/platforms/react-native/solutions/components/Calendar/files/WeekDayTitles.tsx +31 -0
- package/platforms/react-native/solutions/components/Calendar/files/WeekView.tsx +40 -0
- package/platforms/react-native/solutions/components/Calendar/files/calendar.styles.ts +142 -0
- package/platforms/react-native/solutions/components/Calendar/files/calendar.types.ts +126 -0
- package/platforms/react-native/solutions/components/Calendar/files/calendar.utils.ts +143 -0
- package/platforms/react-native/solutions/components/Calendar/files/index.ts +40 -0
- package/platforms/react-native/solutions/components/Calendar/solution.js +38 -0
- package/platforms/react-native/solutions/components/Chart/README.md +29 -0
- package/platforms/react-native/solutions/components/Chart/files/Cilcular.tsx +140 -0
- package/platforms/react-native/solutions/components/Chart/files/index.ts +3 -0
- package/platforms/react-native/solutions/components/Chart/solution.js +38 -0
- package/platforms/react-native/solutions/components/CheckBox/README.md +29 -0
- package/platforms/react-native/solutions/components/CheckBox/files/Common.tsx +55 -0
- package/platforms/react-native/solutions/components/CheckBox/files/checkbox.pm.ts +71 -0
- package/platforms/react-native/solutions/components/CheckBox/files/index.ts +9 -0
- package/platforms/react-native/solutions/components/CheckBox/form/Checkbox.tsx +22 -0
- package/platforms/react-native/solutions/components/CheckBox/solution.js +57 -0
- package/platforms/react-native/solutions/components/DateTimePicker/README.md +29 -0
- package/platforms/react-native/solutions/components/DateTimePicker/files/DateTimePicker.tsx +44 -0
- package/platforms/react-native/solutions/components/DateTimePicker/solution.js +45 -0
- package/platforms/react-native/solutions/components/Image/README.md +29 -0
- package/platforms/react-native/solutions/components/Image/files/SVG.tsx +74 -0
- package/platforms/react-native/solutions/components/Image/files/image.pm.ts +25 -0
- package/platforms/react-native/solutions/components/Image/files/image.utils.ts +35 -0
- package/platforms/react-native/solutions/components/Image/files/index.ts +5 -0
- package/platforms/react-native/solutions/components/Image/solution.js +40 -0
- package/platforms/react-native/solutions/components/InputSecurity/README.md +29 -0
- package/platforms/react-native/solutions/components/InputSecurity/files/InputSecurity.ts +142 -0
- package/platforms/react-native/solutions/components/InputSecurity/solution.js +28 -0
- package/platforms/react-native/solutions/components/OTP/README.md +29 -0
- package/platforms/react-native/solutions/components/OTP/files/Item.tsx +16 -0
- package/platforms/react-native/solutions/components/OTP/files/Items.tsx +33 -0
- package/platforms/react-native/solutions/components/OTP/files/index.tsx +120 -0
- package/platforms/react-native/solutions/components/OTP/files/otp.pm.ts +30 -0
- package/platforms/react-native/solutions/components/OTP/solution.js +38 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/README.md +29 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/files/Circular.tsx +154 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/files/Linear.tsx +133 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/files/circular.pm.ts +34 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/files/index.ts +16 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/solution.js +39 -0
- package/platforms/react-native/solutions/components/Ruler/README.md +29 -0
- package/platforms/react-native/solutions/components/Ruler/files/Common.tsx +44 -0
- package/platforms/react-native/solutions/components/Ruler/files/Context.tsx +210 -0
- package/platforms/react-native/solutions/components/Ruler/files/Track.tsx +686 -0
- package/platforms/react-native/solutions/components/Ruler/files/Value.tsx +60 -0
- package/platforms/react-native/solutions/components/Ruler/files/index.ts +23 -0
- package/platforms/react-native/solutions/components/Ruler/files/ruler.constants.ts +70 -0
- package/platforms/react-native/solutions/components/Ruler/files/ruler.types.ts +98 -0
- package/platforms/react-native/solutions/components/Ruler/files/ruler.utils.ts +332 -0
- package/platforms/react-native/solutions/components/Ruler/solution.js +38 -0
- package/platforms/react-native/solutions/components/Section/README.md +29 -0
- package/platforms/react-native/solutions/components/Section/files/Common.tsx +144 -0
- package/platforms/react-native/solutions/components/Section/solution.js +37 -0
- package/platforms/react-native/solutions/components/Slider/README.md +29 -0
- package/platforms/react-native/solutions/components/Slider/files/Container.tsx +5 -0
- package/platforms/react-native/solutions/components/Slider/files/Content.tsx +44 -0
- package/platforms/react-native/solutions/components/Slider/files/Context.tsx +30 -0
- package/platforms/react-native/solutions/components/Slider/files/Pagination.Dot.tsx +61 -0
- package/platforms/react-native/solutions/components/Slider/files/index.ts +22 -0
- package/platforms/react-native/solutions/components/Slider/solution.js +38 -0
- package/platforms/react-native/solutions/components/Switch/README.md +29 -0
- package/platforms/react-native/solutions/components/Switch/files/Common.tsx +38 -0
- package/platforms/react-native/solutions/components/Switch/files/index.ts +9 -0
- package/platforms/react-native/solutions/components/Switch/files/switch.pm.ts +53 -0
- package/platforms/react-native/solutions/components/Switch/solution.js +38 -0
- package/platforms/react-native/solutions/install.js +97 -0
- package/platforms/react-native/solutions/services/firebase-core/README.md +31 -0
- package/platforms/react-native/solutions/services/firebase-core/files/index.ts +5 -0
- package/platforms/react-native/solutions/services/firebase-core/solution.js +39 -0
- package/platforms/react-native/solutions/services/firebase-messaging/README.md +31 -0
- package/platforms/react-native/solutions/services/firebase-messaging/files/index.ts +20 -0
- package/platforms/react-native/solutions/services/firebase-messaging/solution.js +42 -0
- package/platforms/react-native/solutions/utils/permissions/README.md +29 -0
- package/platforms/react-native/solutions/utils/permissions/files/permissions.ts +10 -0
- package/platforms/react-native/solutions/utils/permissions/solution.js +32 -0
- package/presets/react-native-fsd/index.js +25 -0
- package/shared/generators/entity/render.js +88 -0
- package/shared/generators/entity/templates/crud/api.ts.hbs +36 -0
- package/shared/generators/entity/templates/crud/dto.ts.hbs +36 -0
- package/shared/generators/entity/templates/crud/service.ts.hbs +73 -0
- package/shared/generators/entity/templates/crud/store.ts.hbs +27 -0
- package/shared/generators/entity/templates/index.ts.hbs +2 -0
- package/shared/generators/entity/templates/simple/api.ts.hbs +16 -0
- package/shared/generators/entity/templates/simple/dto.ts.hbs +5 -0
- package/shared/generators/entity/templates/simple/service.ts.hbs +26 -0
- package/shared/generators/entity/templates/simple/store.ts.hbs +18 -0
- package/shared/solutions/utils/date/README.md +29 -0
- package/shared/solutions/utils/date/files/date.ts +11 -0
- package/shared/solutions/utils/date/solution.js +27 -0
- package/shared/solutions/utils/string/README.md +29 -0
- package/shared/solutions/utils/string/files/string.ts +100 -0
- package/shared/solutions/utils/string/solution.js +27 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export function capitalize(text?: string): string {
|
|
2
|
+
if (!text?.length) return '';
|
|
3
|
+
|
|
4
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function sanitizeText(input?: string): string {
|
|
8
|
+
if (!input) return '';
|
|
9
|
+
const normalized = input
|
|
10
|
+
.replace(/[\u2018\u2019\u201A\u201B\u2032\u2035]/g, "'")
|
|
11
|
+
.replace(/[\u201C\u201D\u2033\u2036]/g, '"')
|
|
12
|
+
.normalize('NFKD')
|
|
13
|
+
.replace(/[\u0300-\u036f]/g, '');
|
|
14
|
+
// Keep ASCII letters/digits/space and common punctuation . - ' "
|
|
15
|
+
return normalized
|
|
16
|
+
.replace(/[^A-Za-z0-9 .\-'"]/g, '')
|
|
17
|
+
.replace(/\s+/g, ' ')
|
|
18
|
+
.trim();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function sanitizeAndNormalizeText(value: string | undefined | null): string {
|
|
22
|
+
if (!value) return value || '';
|
|
23
|
+
|
|
24
|
+
return value.replace(/[^a-z0-9/\-?:().,'+ ]/gi, '').replace(/([/\-?:().,'+ ])(?=\1)/g, '');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const textTransformers = {
|
|
28
|
+
disableCyrillic: (text: string) => text.replace(/[А-Яа-яЁёЇїІіЄєҐґ]/g, ''),
|
|
29
|
+
sanitize: (text: string) => text.replace(/[^a-z0-9/\-?:().,'+ ]/gi, ''),
|
|
30
|
+
deduplicate: (text: string) => text.replace(/([/\-?:().,'+ ])(?=\1)/g, ''),
|
|
31
|
+
trim: (text: string) => text.trim(),
|
|
32
|
+
noSpaces: (text: string) => text.replace(/\s+/g, ''),
|
|
33
|
+
upperCase: (text: string) => text.toUpperCase(),
|
|
34
|
+
extractNumber: (value: unknown): number => {
|
|
35
|
+
if (typeof value === 'number') {
|
|
36
|
+
return Number.isFinite(value) ? value : 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (typeof value !== 'string') {
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let cleaned = value.replace(/[^0-9.-]/g, '');
|
|
44
|
+
|
|
45
|
+
const isNegative = cleaned.startsWith('-');
|
|
46
|
+
cleaned = cleaned.replace(/-/g, '');
|
|
47
|
+
if (isNegative) cleaned = '-' + cleaned;
|
|
48
|
+
|
|
49
|
+
const firstDotIndex = cleaned.indexOf('.');
|
|
50
|
+
if (firstDotIndex !== -1) {
|
|
51
|
+
cleaned = cleaned.slice(0, firstDotIndex + 1) + cleaned.slice(firstDotIndex + 1).replace(/\./g, '');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const parsed = parseFloat(cleaned);
|
|
55
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export function transform(
|
|
60
|
+
value: string,
|
|
61
|
+
options: {
|
|
62
|
+
prevValue?: string;
|
|
63
|
+
textSkipInjectionValidation?: boolean;
|
|
64
|
+
textRemoveCyrillic?: boolean;
|
|
65
|
+
textSanitize?: boolean;
|
|
66
|
+
textDeduplicate?: boolean;
|
|
67
|
+
textTrim?: boolean;
|
|
68
|
+
textNoSpaces?: boolean;
|
|
69
|
+
textUpperCase?: boolean;
|
|
70
|
+
textCompanyName?: boolean;
|
|
71
|
+
textNumber?: boolean;
|
|
72
|
+
},
|
|
73
|
+
) {
|
|
74
|
+
if (options?.textNumber) return textTransformers.extractNumber(value);
|
|
75
|
+
|
|
76
|
+
if (!value) return '';
|
|
77
|
+
|
|
78
|
+
let result = value;
|
|
79
|
+
|
|
80
|
+
if (options?.textRemoveCyrillic && textTransformers.disableCyrillic) {
|
|
81
|
+
result = textTransformers.disableCyrillic(result);
|
|
82
|
+
}
|
|
83
|
+
if (options?.textSanitize && textTransformers.sanitize) {
|
|
84
|
+
result = textTransformers.sanitize(result);
|
|
85
|
+
}
|
|
86
|
+
if (options?.textDeduplicate && textTransformers.deduplicate) {
|
|
87
|
+
result = textTransformers.deduplicate(result);
|
|
88
|
+
}
|
|
89
|
+
if (options?.textTrim && textTransformers.trim) {
|
|
90
|
+
result = textTransformers.trim(result);
|
|
91
|
+
}
|
|
92
|
+
if (options?.textNoSpaces && textTransformers.noSpaces) {
|
|
93
|
+
result = textTransformers.noSpaces(result);
|
|
94
|
+
}
|
|
95
|
+
if (options?.textUpperCase && textTransformers.upperCase) {
|
|
96
|
+
result = textTransformers.upperCase(result);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { writeSummary } from '../../../../lib/journal.js';
|
|
2
|
+
import { projectRoot } from '../../../../lib/project.js';
|
|
3
|
+
import { isDry } from '../../runtime.js';
|
|
4
|
+
|
|
5
|
+
const NAVIGATORS = ['react-native-navigation', 'react-navigation', 'expo-router'];
|
|
6
|
+
|
|
7
|
+
// CLI --navigator is already on data. Otherwise keep the navigator from forge.config.
|
|
8
|
+
let configNavigator = 'react-native-navigation';
|
|
9
|
+
|
|
10
|
+
function navigatorOf(data) {
|
|
11
|
+
if (data.navigator === undefined || data.navigator === null || data.navigator === '') {
|
|
12
|
+
data.navigator = configNavigator;
|
|
13
|
+
}
|
|
14
|
+
return data.navigator;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
description: 'Copy the React Native FSD src base (auth, profile, app shell, UI kit)',
|
|
19
|
+
prompts(forge) {
|
|
20
|
+
configNavigator = forge.config.navigator ?? 'react-native-navigation';
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
type: 'input',
|
|
24
|
+
name: 'apiUrl',
|
|
25
|
+
message: 'API base URL:',
|
|
26
|
+
default: 'https://api.example.com/',
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
},
|
|
30
|
+
actions: [
|
|
31
|
+
{
|
|
32
|
+
type: 'addMany',
|
|
33
|
+
templateFiles: 'init/files',
|
|
34
|
+
options: {
|
|
35
|
+
ignore: ['**/node_modules/**', '**/.git/**', '**/generator.js', '**/navigation/**'],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: 'addMany',
|
|
40
|
+
templateFiles: 'init/files/navigation',
|
|
41
|
+
destination: 'navigation',
|
|
42
|
+
skip: (data) => navigatorOf(data) !== 'react-native-navigation',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'addMany',
|
|
46
|
+
templateFiles: 'init/navigators/react-navigation',
|
|
47
|
+
destination: 'navigation',
|
|
48
|
+
skip: (data) => navigatorOf(data) !== 'react-navigation',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'addMany',
|
|
52
|
+
templateFiles: 'init/navigators/expo-router',
|
|
53
|
+
destination: 'navigation',
|
|
54
|
+
skip: (data) => navigatorOf(data) !== 'expo-router',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'add',
|
|
58
|
+
path: '../AGENTS.md',
|
|
59
|
+
templateFile: '../ai/AGENTS.md.hbs',
|
|
60
|
+
skip: (data) => !NAVIGATORS.includes(navigatorOf(data)),
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'custom',
|
|
64
|
+
action: async (data, forge) => {
|
|
65
|
+
const navigator = navigatorOf(data);
|
|
66
|
+
if (!NAVIGATORS.includes(navigator)) {
|
|
67
|
+
return { success: false, error: `No navigator stub for ${navigator}` };
|
|
68
|
+
}
|
|
69
|
+
const outputDir = forge.resolveOutputDir('rn-fsd:init');
|
|
70
|
+
const dryRun = isDry(data, forge);
|
|
71
|
+
await writeSummary(projectRoot(forge), {
|
|
72
|
+
generator: 'init',
|
|
73
|
+
lines: [
|
|
74
|
+
`Copied the FSD base into ${outputDir}`,
|
|
75
|
+
`Navigator: ${navigator}`,
|
|
76
|
+
`API_URL: ${data.apiUrl}`,
|
|
77
|
+
'Next: forge g demo, forge g entity, forge g feature, forge g component, forge g add',
|
|
78
|
+
'The project catalog of ready-made pieces is node_modules/@effijs/templates/platforms/react-native/CATALOG.md',
|
|
79
|
+
],
|
|
80
|
+
dryRun,
|
|
81
|
+
});
|
|
82
|
+
return { success: true };
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
platform: 'react-native',
|
|
3
|
+
items: [
|
|
4
|
+
{ type: 'component', name: 'Box', description: 'View with theme color, radius, and shadow props.', path: 'ui/components/Box' },
|
|
5
|
+
{ type: 'component', name: 'Grid', description: 'Layout primitive with spacing and alignment props.', path: 'ui/components/Grid' },
|
|
6
|
+
{ type: 'component', name: 'Text', description: 'Themed text with typography props.', path: 'ui/components/Text' },
|
|
7
|
+
{ type: 'component', name: 'Button', description: 'Pressable button. Loading uses ActivityIndicator.', path: 'ui/components/Button' },
|
|
8
|
+
{ type: 'component', name: 'Screen', description: 'Screen shell with header, content, and safe area. Built for Wix navigation.', path: 'ui/components/Screen' },
|
|
9
|
+
{ type: 'component', name: 'Form', description: 'EffiJS form bindings. DateTimePicker, SelectPicker, and InputSecurity are separate solutions.', path: 'ui/components/Form' },
|
|
10
|
+
{ type: 'component', name: 'TextInput', description: 'Themed text input. OTP is a separate solution.', path: 'ui/components/TextInput' },
|
|
11
|
+
{ type: 'component', name: 'Icon', description: 'Icon font glyph.', path: 'ui/components/Icon' },
|
|
12
|
+
{ type: 'component', name: 'Loading', description: 'Loading overlay driven by a small store.', path: 'ui/components/Loading' },
|
|
13
|
+
{ type: 'component', name: 'ThemePicker', description: 'Switches the active theme scheme.', path: 'ui/components/ThemePicker' },
|
|
14
|
+
{ type: 'widget', name: 'toast', description: 'Toast stack shown through navigation.widgets.showToast.', path: 'ui/widgets/toast' },
|
|
15
|
+
{ type: 'service', name: 'http', description: 'HTTP client with token and error middleware.', path: 'services/http' },
|
|
16
|
+
{ type: 'util', name: 'string', description: 'Text transforms used by form inputs.', path: 'utils/string.ts' },
|
|
17
|
+
{ type: 'util', name: 'date', description: 'Date helpers.', path: 'utils/date.ts' },
|
|
18
|
+
{ type: 'util', name: 'store.persistent', description: 'MMKV-backed persistent store.', path: 'utils/store.persistent.ts' },
|
|
19
|
+
{ type: 'entity', name: 'auth', description: 'Session, sign-in, and sign-up entity.', path: 'entity/auth' },
|
|
20
|
+
{ type: 'feature', name: 'auth', description: 'Sign-in and sign-up screens.', path: 'feature/auth' },
|
|
21
|
+
{ type: 'feature', name: 'profile', description: 'Profile screen and theme picker.', path: 'feature/profile' },
|
|
22
|
+
],
|
|
23
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EffiJS, Entity } from '@effijs/common';
|
|
2
|
+
|
|
3
|
+
import { NavigationApp } from './navigation.app';
|
|
4
|
+
import { NavigationFeatures } from './navigation.features';
|
|
5
|
+
import { NavigationTabs } from './navigation.tabs';
|
|
6
|
+
import { NavigationWidgets } from './navigation.widgets';
|
|
7
|
+
|
|
8
|
+
@Entity.Decorators.Module()
|
|
9
|
+
export class Navigation {
|
|
10
|
+
constructor(
|
|
11
|
+
public app: NavigationApp,
|
|
12
|
+
public features: NavigationFeatures,
|
|
13
|
+
public tabs: NavigationTabs,
|
|
14
|
+
public widgets: NavigationWidgets,
|
|
15
|
+
) {}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
EffiJS.create(Navigation, 'Navigation');
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EffiJS, Entity } from '@effijs/common';
|
|
2
|
+
|
|
3
|
+
import { NavigationApp } from './navigation.app';
|
|
4
|
+
import { NavigationFeatures } from './navigation.features';
|
|
5
|
+
import { NavigationTabs } from './navigation.tabs';
|
|
6
|
+
import { NavigationWidgets } from './navigation.widgets';
|
|
7
|
+
|
|
8
|
+
@Entity.Decorators.Module()
|
|
9
|
+
export class Navigation {
|
|
10
|
+
constructor(
|
|
11
|
+
public app: NavigationApp,
|
|
12
|
+
public features: NavigationFeatures,
|
|
13
|
+
public tabs: NavigationTabs,
|
|
14
|
+
public widgets: NavigationWidgets,
|
|
15
|
+
) {}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
EffiJS.create(Navigation, 'Navigation');
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
import { TSCONFIG_PATHS, patchTsconfig } from '../../../../lib/jsonConfig.js';
|
|
6
|
+
import { detectNavigator, detectPackageManager, detectReactNativeVersion, projectRoot } from '../../../../lib/project.js';
|
|
7
|
+
import { resolveRange } from '../../../../lib/compat.js';
|
|
8
|
+
import { installPackages } from '../../../../lib/install.js';
|
|
9
|
+
import { dependenciesFor } from '../../compat/matrix.js';
|
|
10
|
+
import { renderForgeConfig } from '../../configs/forgeConfig.js';
|
|
11
|
+
import { patchBabel, patchJest, patchPrettier, patchRnConfig } from '../../configs/jsConfigs.js';
|
|
12
|
+
import { patchIndexJs, patchMetro } from '../../configs/metro.js';
|
|
13
|
+
import platform from '../../platform.js';
|
|
14
|
+
import { isDry, patchText, walkText } from '../../runtime.js';
|
|
15
|
+
import { writeSummary } from '../../../../lib/journal.js';
|
|
16
|
+
|
|
17
|
+
const NAVIGATORS = platform.navigators.map((item) => item.id);
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
description: 'Install EffiJS dependencies and patch React Native configs',
|
|
21
|
+
prompts: (forge) => {
|
|
22
|
+
const root = projectRoot(forge);
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
type: 'list',
|
|
26
|
+
name: 'packageManager',
|
|
27
|
+
message: 'Package manager:',
|
|
28
|
+
choices: ['yarn', 'npm', 'pnpm'],
|
|
29
|
+
default: detectPackageManager(root),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: 'list',
|
|
33
|
+
name: 'navigator',
|
|
34
|
+
message: 'Navigation library:',
|
|
35
|
+
choices: platform.navigators.map((item) => ({
|
|
36
|
+
name: item.implemented ? item.title : `${item.title} (stub)`,
|
|
37
|
+
value: item.id,
|
|
38
|
+
})),
|
|
39
|
+
default: detectNavigator(root) ?? 'react-native-navigation',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: 'confirm',
|
|
43
|
+
name: 'moveStarter',
|
|
44
|
+
message: 'Move App.tsx and App.test.tsx into .forge/backup?',
|
|
45
|
+
default: true,
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
},
|
|
49
|
+
actions: [
|
|
50
|
+
{
|
|
51
|
+
type: 'custom',
|
|
52
|
+
action: async (data, forge) => {
|
|
53
|
+
const root = projectRoot(forge);
|
|
54
|
+
if (!NAVIGATORS.includes(data.navigator)) {
|
|
55
|
+
return { success: false, error: `Unknown navigator "${data.navigator}"` };
|
|
56
|
+
}
|
|
57
|
+
const version = detectReactNativeVersion(root);
|
|
58
|
+
if (!version) return { success: false, error: 'react-native was not found in package.json' };
|
|
59
|
+
const resolved = resolveRange(version, platform.matrix);
|
|
60
|
+
data.rnVersion = version;
|
|
61
|
+
data.compat = resolved.entry;
|
|
62
|
+
data.compatWarning = resolved.warning;
|
|
63
|
+
if (resolved.warning) console.warn(resolved.warning);
|
|
64
|
+
return { success: true };
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'custom',
|
|
69
|
+
action: async (data, forge) => {
|
|
70
|
+
const root = projectRoot(forge);
|
|
71
|
+
const dependencies = dependenciesFor(data.compat, data.navigator);
|
|
72
|
+
const result = installPackages({
|
|
73
|
+
root,
|
|
74
|
+
packageManager: data.packageManager,
|
|
75
|
+
dependencies,
|
|
76
|
+
devDependencies: data.compat.devDependencies,
|
|
77
|
+
dryRun: isDry(data, forge),
|
|
78
|
+
});
|
|
79
|
+
data.install = result;
|
|
80
|
+
return { success: true };
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: 'custom',
|
|
85
|
+
action: async (data, forge) => {
|
|
86
|
+
const root = projectRoot(forge);
|
|
87
|
+
const notes = [];
|
|
88
|
+
if (data.compatWarning) notes.push(data.compatWarning);
|
|
89
|
+
if (data.install?.command) notes.push(`Dependencies: ${data.install.command}`);
|
|
90
|
+
if (data.install?.merged) notes.push('Install failed; package.json was updated for a manual install.');
|
|
91
|
+
|
|
92
|
+
const nvm = path.join(root, '.nvmrc');
|
|
93
|
+
const nvmResult = await patchText(forge, nvm, async (content, { exists }) => {
|
|
94
|
+
const current = content.trim();
|
|
95
|
+
if (exists && current !== data.compat.node) {
|
|
96
|
+
notes.push(`.nvmrc ${current} -> ${data.compat.node}`);
|
|
97
|
+
}
|
|
98
|
+
return { ok: true, content: `${data.compat.node}\n` };
|
|
99
|
+
}, { title: 'Update .nvmrc', manual: `Write \`${data.compat.node}\` to .nvmrc.` });
|
|
100
|
+
if (!nvmResult.ok && !nvmResult.migration && !isDry(data, forge)) notes.push(`nvmrc: ${nvmResult.reason}`);
|
|
101
|
+
|
|
102
|
+
await patchConfig(forge, data, notes, 'tsconfig.json', (file, content, ctx) => {
|
|
103
|
+
if (!ctx.exists) return { ok: false, reason: 'tsconfig.json was not found.' };
|
|
104
|
+
return { ok: true, content: patchTsconfig(content, { paths: TSCONFIG_PATHS, types: ['jest'], exclude: ['**/node_modules', '**/Pods', 'backup/**'] }) };
|
|
105
|
+
}, 'Add decorator flags and path aliases to tsconfig.json.');
|
|
106
|
+
|
|
107
|
+
await patchConfig(forge, data, notes, 'babel.config.js', (file, content, ctx) => patchBabel(file, content, { ...ctx, lastPlugin: data.compat.babelPluginLast }), 'Merge decorators, module-resolver, and the worklets or reanimated plugin. The last plugin must stay last.');
|
|
108
|
+
await patchConfig(forge, data, notes, 'jest.config.js', (file, content, ctx) => patchJest(file, content, ctx), 'Set the React Native Jest preset and ignore /backup/.');
|
|
109
|
+
await patchConfig(forge, data, notes, '.prettierrc.js', (file, content, ctx) => patchPrettier(file, content, ctx), 'Merge the EffiJS Prettier defaults.');
|
|
110
|
+
await patchConfig(forge, data, notes, 'react-native.config.js', (file, content, ctx) => patchRnConfig(file, content, ctx), 'Point assets at ./src/ui/fonts/.');
|
|
111
|
+
|
|
112
|
+
if (data.linkLocal) {
|
|
113
|
+
await patchConfig(forge, data, notes, 'metro.config.js', (file, content, ctx) => patchMetro(content, { ...ctx, linkLocal: data.linkLocal }), 'Add watchFolders and extraNodeModules for the local EffiJS checkout.');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
await patchConfig(forge, data, notes, 'index.js', (file, content, ctx) => patchIndexJs(content, ctx), "Replace the AppRegistry bootstrap with `import './src';`.");
|
|
117
|
+
|
|
118
|
+
const forgeFile = path.join(root, 'forge.config.js');
|
|
119
|
+
await patchText(forge, forgeFile, async () => ({
|
|
120
|
+
ok: true,
|
|
121
|
+
content: renderForgeConfig({ packageManager: data.packageManager, navigator: data.navigator }),
|
|
122
|
+
}), {
|
|
123
|
+
title: 'Write forge.config.js',
|
|
124
|
+
manual: 'Write the canonical forge.config.js from the platform setup guide.',
|
|
125
|
+
});
|
|
126
|
+
notes.push('forge.config.js points at the rn-fsd preset with an absolute directory from require.resolve.');
|
|
127
|
+
|
|
128
|
+
if (data.moveStarter) {
|
|
129
|
+
for (const relative of ['App.tsx', '__tests__/App.test.tsx']) {
|
|
130
|
+
const from = path.join(root, relative);
|
|
131
|
+
if (!fs.existsSync(from)) continue;
|
|
132
|
+
const dest = path.join(root, '.forge/backup', path.basename(relative));
|
|
133
|
+
if (!isDry(data, forge)) {
|
|
134
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
135
|
+
fs.renameSync(from, dest);
|
|
136
|
+
}
|
|
137
|
+
notes.push(`Moved ${relative} to .forge/backup/`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (data.navigator === 'react-native-navigation') {
|
|
142
|
+
const linked = await linkWix(root, data.compat, isDry(data, forge));
|
|
143
|
+
if (linked.ok) notes.push('rnn-link passed the native marker check.');
|
|
144
|
+
else {
|
|
145
|
+
notes.push(`Native navigation still needs a manual step: ${(linked.missing ?? []).join(', ') || linked.reason}`);
|
|
146
|
+
if (!isDry(data, forge)) {
|
|
147
|
+
const file = await writeNativeMigration(root, data.compat, linked);
|
|
148
|
+
notes.push(`Migration: ${file}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
notes.push(`${data.navigator} is a stub. init will generate TODO navigation classes.`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
data.summaryNotes = notes;
|
|
156
|
+
const summary = await writeSummary(root, {
|
|
157
|
+
generator: 'setup',
|
|
158
|
+
lines: notes,
|
|
159
|
+
dryRun: isDry(data, forge),
|
|
160
|
+
});
|
|
161
|
+
if (summary) {
|
|
162
|
+
const migrations = path.join(root, '.forge/migrations');
|
|
163
|
+
if (fs.existsSync(migrations) && fs.readdirSync(migrations).length) {
|
|
164
|
+
console.log('Apply `.forge/migrations/<file>.md` following `node_modules/@effijs/templates/platforms/react-native/ai/SETUP.md`.');
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return { success: true };
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
async function patchConfig(forge, data, notes, relative, transform, manual) {
|
|
174
|
+
const file = path.join(projectRoot(forge), relative);
|
|
175
|
+
const result = await patchText(forge, file, async (content, ctx) => transform(file, content, ctx), {
|
|
176
|
+
title: `Update ${relative}`,
|
|
177
|
+
manual,
|
|
178
|
+
});
|
|
179
|
+
if (result.migration) notes.push(`Migration for ${relative}`);
|
|
180
|
+
else if (result.changed) notes.push(`Patched ${relative}`);
|
|
181
|
+
else if (result.ok) notes.push(`${relative} already matched or was left unchanged`);
|
|
182
|
+
return result;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
async function linkWix(root, entry, dryRun) {
|
|
186
|
+
if (dryRun) return { ok: true, dryRun: true };
|
|
187
|
+
try {
|
|
188
|
+
execSync('npx rnn-link', { cwd: root, stdio: 'inherit' });
|
|
189
|
+
} catch (error) {
|
|
190
|
+
return { ok: false, reason: error.message, missing: ['NavigationActivity', 'NavigationApplication', 'RNNAppDelegate'] };
|
|
191
|
+
}
|
|
192
|
+
const android = walkText(path.join(root, 'android'), (name) => name.endsWith('.kt') || name.endsWith('.java'));
|
|
193
|
+
const ios = walkText(path.join(root, 'ios'), (name) => name.endsWith('.swift') || name.endsWith('.mm') || name.endsWith('.m'));
|
|
194
|
+
const missing = [];
|
|
195
|
+
if (!android.includes('NavigationActivity')) missing.push('NavigationActivity');
|
|
196
|
+
if (!android.includes('NavigationApplication')) missing.push('NavigationApplication');
|
|
197
|
+
if (!ios.includes('RNNAppDelegate')) missing.push('RNNAppDelegate');
|
|
198
|
+
return { ok: missing.length === 0, missing, native: entry.native };
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
async function writeNativeMigration(root, entry, linked) {
|
|
202
|
+
const { writeMigration, aiPrompt } = await import('../../../../lib/migration.js');
|
|
203
|
+
return writeMigration(root, {
|
|
204
|
+
title: 'Link React Native Navigation',
|
|
205
|
+
target: 'ios + android',
|
|
206
|
+
reason: linked.reason
|
|
207
|
+
? `npx rnn-link failed: ${linked.reason}`
|
|
208
|
+
: `Native files are missing: ${linked.missing.join(', ')}. Android snippets come from the React Native Navigation install guide and must be checked against this project's Kotlin template. The iOS AppDelegate matches the EffiJS example.`,
|
|
209
|
+
required: [
|
|
210
|
+
'### AppDelegate.swift',
|
|
211
|
+
'```swift',
|
|
212
|
+
entry.native.iosAppDelegate.trim(),
|
|
213
|
+
'```',
|
|
214
|
+
'### MainActivity.kt',
|
|
215
|
+
'```kotlin',
|
|
216
|
+
entry.native.androidMainActivity.trim(),
|
|
217
|
+
'```',
|
|
218
|
+
'### MainApplication.kt',
|
|
219
|
+
'```kotlin',
|
|
220
|
+
entry.native.androidMainApplication.trim(),
|
|
221
|
+
'```',
|
|
222
|
+
].join('\n'),
|
|
223
|
+
prompt: aiPrompt('.forge/migrations/<this-file>'),
|
|
224
|
+
});
|
|
225
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
|
|
4
|
+
import { matrix } from './compat/matrix.js';
|
|
5
|
+
|
|
6
|
+
const root = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
|
|
8
|
+
const platform = {
|
|
9
|
+
id: 'react-native',
|
|
10
|
+
preset: 'rn-fsd',
|
|
11
|
+
root,
|
|
12
|
+
matrix,
|
|
13
|
+
navigators: [
|
|
14
|
+
{ id: 'react-native-navigation', title: 'Wix React Native Navigation', implemented: true },
|
|
15
|
+
{ id: 'react-navigation', title: 'React Navigation', implemented: false },
|
|
16
|
+
{ id: 'expo-router', title: 'Expo Router', implemented: false },
|
|
17
|
+
],
|
|
18
|
+
markers: {
|
|
19
|
+
entity: 'entity',
|
|
20
|
+
feature: 'feature',
|
|
21
|
+
navigationFeaturesImport: 'navigation-features-import',
|
|
22
|
+
navigationFeatures: 'navigation-features',
|
|
23
|
+
navigationTabs: 'navigation-tabs',
|
|
24
|
+
navigationTabsRegister: 'navigation-tabs-register',
|
|
25
|
+
componentsImport: 'components-import',
|
|
26
|
+
componentsExport: 'components-export',
|
|
27
|
+
services: 'services',
|
|
28
|
+
utils: 'utils',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default platform;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { applyTextPatch } from '../../lib/patch.js';
|
|
5
|
+
import { aiPrompt, writeMigration } from '../../lib/migration.js';
|
|
6
|
+
import { projectRoot } from '../../lib/project.js';
|
|
7
|
+
|
|
8
|
+
export function isDry(data, forge) {
|
|
9
|
+
return Boolean(data.dryRun || forge?.runOptions?.dryRun);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function srcDir(forge) {
|
|
13
|
+
return forge.resolveOutputDir('rn-fsd:init');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function patchText(forge, file, transform, { title, manual }) {
|
|
17
|
+
const root = projectRoot(forge);
|
|
18
|
+
const dryRun = Boolean(forge.runOptions?.dryRun);
|
|
19
|
+
const result = await applyTextPatch(root, file, transform, { dryRun });
|
|
20
|
+
if (result.ok) return result;
|
|
21
|
+
if (dryRun) {
|
|
22
|
+
console.log(`[dry-run] Would write a migration for ${file}: ${result.reason}`);
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
const relative = path.relative(root, file);
|
|
26
|
+
const migration = await writeMigration(root, {
|
|
27
|
+
title: title ?? `Update ${relative}`,
|
|
28
|
+
target: relative,
|
|
29
|
+
reason: result.reason,
|
|
30
|
+
required: manual ?? 'See the platform setup guide for the canonical snippet.',
|
|
31
|
+
prompt: aiPrompt(`.forge/migrations/<this-file>`),
|
|
32
|
+
});
|
|
33
|
+
console.warn(`Migration written: ${migration}`);
|
|
34
|
+
return { ...result, migration };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function assertInit(outputDir) {
|
|
38
|
+
const markerFile = path.join(outputDir, 'entity/index.ts');
|
|
39
|
+
if (!fs.existsSync(markerFile)) return false;
|
|
40
|
+
return fs.readFileSync(markerFile, 'utf8').includes('// forge:entity');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function walkText(dir, matcher) {
|
|
44
|
+
if (!fs.existsSync(dir)) return '';
|
|
45
|
+
let blob = '';
|
|
46
|
+
const stack = [dir];
|
|
47
|
+
while (stack.length) {
|
|
48
|
+
const current = stack.pop();
|
|
49
|
+
for (const entry of fs.readdirSync(current, { withFileTypes: true })) {
|
|
50
|
+
if (entry.name === 'node_modules' || entry.name === 'Pods' || entry.name === 'build') continue;
|
|
51
|
+
const next = path.join(current, entry.name);
|
|
52
|
+
if (entry.isDirectory()) stack.push(next);
|
|
53
|
+
else if (matcher(entry.name)) blob += fs.readFileSync(next, 'utf8');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return blob;
|
|
57
|
+
}
|