create-lumen 1.1.3 → 1.2.0-beta.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/README.md +43 -35
- package/package.json +8 -2
- package/src/configure.js +29 -15
- package/src/css.js +73 -14
- package/src/dependencies.js +8 -3
- package/src/format.js +28 -0
- package/src/injector.js +131 -28
- package/src/main.js +17 -1
- package/src/readme.js +65 -22
- package/templates/architectures/component-based/main.tsx +1 -1
- package/templates/architectures/component-based/src/App.jsx +6 -4
- package/templates/architectures/component-based/src/App.tsx +6 -4
- package/templates/architectures/component-based/src/components/common/Button.jsx +5 -4
- package/templates/architectures/component-based/src/components/common/Button.tsx +5 -4
- package/templates/architectures/component-based/src/hooks/useApp.js +10 -0
- package/templates/architectures/component-based/src/hooks/useApp.ts +10 -0
- package/templates/architectures/component-based/src/hooks/useLocalStorage.ts +5 -5
- package/templates/architectures/component-based/src/layouts/MainLayout.jsx +12 -6
- package/templates/architectures/component-based/src/layouts/MainLayout.tsx +12 -6
- package/templates/architectures/component-based/src/pages/Home/Home.jsx +6 -2
- package/templates/architectures/component-based/src/pages/Home/Home.tsx +6 -2
- package/templates/architectures/component-based/src/providers/AppProvider.jsx +20 -0
- package/templates/architectures/component-based/src/providers/AppProvider.tsx +24 -0
- package/templates/architectures/component-based/src/providers/appcontext.js +3 -0
- package/templates/architectures/component-based/src/providers/appcontext.ts +8 -0
- package/templates/architectures/{feature-based → component-based}/src/types/index.js +7 -0
- package/templates/architectures/{feature-based → component-based}/src/types/index.ts +5 -0
- package/templates/architectures/component-based/src/utils/cn.ts +3 -1
- package/templates/architectures/feature-based/main.jsx +1 -1
- package/templates/architectures/feature-based/main.tsx +2 -2
- package/templates/architectures/feature-based/scripts/create-feature.mjs +2 -2
- package/templates/architectures/feature-based/src/app/App.jsx +15 -5
- package/templates/architectures/feature-based/src/app/App.tsx +15 -5
- package/templates/architectures/feature-based/src/app/contexts/themecontext.js +3 -0
- package/templates/architectures/feature-based/src/app/contexts/themecontext.ts +8 -0
- package/templates/architectures/feature-based/src/app/hooks/useTheme.js +10 -0
- package/templates/architectures/feature-based/src/app/hooks/useTheme.ts +10 -0
- package/templates/architectures/feature-based/src/app/providers/ThemeProvider.jsx +17 -2
- package/templates/architectures/feature-based/src/app/providers/ThemeProvider.tsx +20 -3
- package/templates/architectures/feature-based/src/features/home/pages/HomePage.jsx +18 -5
- package/templates/architectures/feature-based/src/features/home/pages/HomePage.tsx +18 -5
- package/templates/architectures/feature-based/src/shared/components/ui/Button.jsx +31 -0
- package/templates/architectures/feature-based/src/shared/components/ui/Button.tsx +36 -0
- package/templates/architectures/feature-based/src/{hooks → shared/hooks}/useLocalStorage.ts +5 -5
- package/templates/architectures/feature-based/src/shared/layouts/.gitkeep +0 -0
- package/templates/architectures/feature-based/src/shared/stores/.gitkeep +0 -0
- package/templates/architectures/feature-based/src/shared/styles/.gitkeep +0 -0
- package/templates/architectures/feature-based/src/shared/types/index.js +20 -0
- package/templates/architectures/feature-based/src/shared/types/index.ts +16 -0
- package/templates/architectures/feature-based/src/shared/utils/cn.ts +5 -0
- package/templates/conditional/axios/component-based/src/config/axios.config.js +7 -0
- package/templates/conditional/axios/component-based/src/config/axios.config.ts +7 -0
- package/templates/conditional/axios/component-based/src/services/axios.client.js +24 -0
- package/templates/conditional/axios/component-based/src/services/axios.client.ts +24 -0
- package/templates/conditional/axios/component-based/src/services/user.service.js +33 -0
- package/templates/conditional/axios/component-based/src/services/user.service.ts +29 -0
- package/templates/conditional/axios/feature-based/src/features/home/services/user.service.js +33 -0
- package/templates/conditional/axios/feature-based/src/features/home/services/user.service.ts +29 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/api.client.js +24 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/api.client.ts +24 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/api.config.js +7 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/api.config.ts +7 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/index.js +1 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/index.ts +1 -0
- package/templates/conditional/fetch/component-based/src/config/api.config.js +7 -0
- package/templates/conditional/fetch/component-based/src/config/api.config.ts +7 -0
- package/templates/conditional/fetch/component-based/src/services/api.client.js +51 -0
- package/templates/conditional/fetch/component-based/src/services/api.client.ts +55 -0
- package/templates/conditional/fetch/component-based/src/services/user.service.js +33 -0
- package/templates/conditional/fetch/component-based/src/services/user.service.ts +29 -0
- package/templates/conditional/fetch/feature-based/src/features/home/services/user.service.js +33 -0
- package/templates/conditional/fetch/feature-based/src/features/home/services/user.service.ts +29 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/api.client.js +51 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/api.client.ts +55 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/api.config.js +7 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/api.config.ts +7 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/index.js +1 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/index.ts +1 -0
- package/templates/conditional/formatter/oxfmt/.oxfmtrc.json +1 -1
- package/templates/conditional/formatter/prettier/.prettierrc +2 -2
- package/templates/conditional/icons/huge/component-based/bootstrap/src/pages/Home/Home.jsx +20 -0
- package/templates/conditional/icons/huge/component-based/bootstrap/src/pages/Home/Home.tsx +20 -0
- package/templates/conditional/icons/huge/component-based/src/pages/Home/Home.jsx +26 -10
- package/templates/conditional/icons/huge/component-based/src/pages/Home/Home.tsx +26 -10
- package/templates/conditional/icons/huge/component-based/tailwind/src/pages/Home/Home.jsx +20 -0
- package/templates/conditional/icons/huge/component-based/tailwind/src/pages/Home/Home.tsx +20 -0
- package/templates/conditional/icons/huge/feature-based/bootstrap/src/features/home/pages/HomePage.jsx +20 -0
- package/templates/conditional/icons/huge/feature-based/bootstrap/src/features/home/pages/HomePage.tsx +20 -0
- package/templates/conditional/icons/huge/feature-based/src/features/home/pages/HomePage.jsx +27 -11
- package/templates/conditional/icons/huge/feature-based/src/features/home/pages/HomePage.tsx +27 -11
- package/templates/conditional/icons/huge/feature-based/tailwind/src/features/home/pages/HomePage.jsx +20 -0
- package/templates/conditional/icons/huge/feature-based/tailwind/src/features/home/pages/HomePage.tsx +20 -0
- package/templates/conditional/icons/lucide/component-based/bootstrap/src/pages/Home/Home.jsx +19 -0
- package/templates/conditional/icons/lucide/component-based/bootstrap/src/pages/Home/Home.tsx +19 -0
- package/templates/conditional/icons/lucide/component-based/src/pages/Home/Home.jsx +25 -10
- package/templates/conditional/icons/lucide/component-based/src/pages/Home/Home.tsx +25 -10
- package/templates/conditional/icons/lucide/component-based/tailwind/src/pages/Home/Home.jsx +19 -0
- package/templates/conditional/icons/lucide/component-based/tailwind/src/pages/Home/Home.tsx +19 -0
- package/templates/conditional/icons/lucide/feature-based/bootstrap/src/features/home/pages/HomePage.jsx +19 -0
- package/templates/conditional/icons/lucide/feature-based/bootstrap/src/features/home/pages/HomePage.tsx +19 -0
- package/templates/conditional/icons/lucide/feature-based/src/features/home/pages/HomePage.jsx +26 -11
- package/templates/conditional/icons/lucide/feature-based/src/features/home/pages/HomePage.tsx +26 -11
- package/templates/conditional/icons/lucide/feature-based/tailwind/src/features/home/pages/HomePage.jsx +19 -0
- package/templates/conditional/icons/lucide/feature-based/tailwind/src/features/home/pages/HomePage.tsx +19 -0
- package/templates/conditional/linting/eslint/eslint.config.js +24 -2
- package/templates/conditional/linting/eslint/eslint.config.ts +25 -2
- package/templates/conditional/router/component-based/bootstrap/src/layouts/MainLayout.jsx +17 -0
- package/templates/conditional/router/component-based/bootstrap/src/layouts/MainLayout.tsx +17 -0
- package/templates/conditional/router/component-based/src/App.jsx +4 -5
- package/templates/conditional/router/component-based/src/App.tsx +4 -5
- package/templates/conditional/router/component-based/src/layouts/MainLayout.jsx +39 -0
- package/templates/conditional/router/component-based/src/layouts/MainLayout.tsx +39 -0
- package/templates/conditional/router/component-based/src/router/guards/AuthGuard.jsx +8 -0
- package/templates/conditional/router/component-based/src/router/guards/AuthGuard.tsx +14 -0
- package/templates/conditional/router/component-based/src/router/guards/GuestGuard.jsx +8 -0
- package/templates/conditional/router/component-based/src/router/guards/GuestGuard.tsx +14 -0
- package/templates/conditional/router/component-based/src/router/index.jsx +44 -0
- package/templates/conditional/router/component-based/src/router/index.tsx +44 -0
- package/templates/conditional/router/component-based/tailwind/src/layouts/MainLayout.jsx +17 -0
- package/templates/conditional/router/component-based/tailwind/src/layouts/MainLayout.tsx +17 -0
- package/templates/conditional/router/feature-based/bootstrap/src/shared/layouts/RootLayout.jsx +9 -0
- package/templates/conditional/router/feature-based/bootstrap/src/shared/layouts/RootLayout.tsx +9 -0
- package/templates/conditional/router/feature-based/src/app/App.jsx +6 -2
- package/templates/conditional/router/feature-based/src/app/App.tsx +6 -2
- package/templates/conditional/router/feature-based/src/app/router/guards/AuthGuard.jsx +8 -0
- package/templates/conditional/router/feature-based/src/app/router/guards/AuthGuard.tsx +14 -0
- package/templates/conditional/router/feature-based/src/app/router/guards/RoleGuard.jsx +8 -0
- package/templates/conditional/router/feature-based/src/app/router/guards/RoleGuard.tsx +15 -0
- package/templates/conditional/router/feature-based/src/app/router/index.jsx +16 -0
- package/templates/conditional/router/feature-based/src/app/router/index.tsx +16 -0
- package/templates/conditional/router/feature-based/src/app/router/routes/auth.routes.jsx +18 -0
- package/templates/conditional/router/feature-based/src/app/router/routes/auth.routes.tsx +18 -0
- package/templates/conditional/router/feature-based/src/app/router/routes/home.routes.jsx +8 -0
- package/templates/conditional/router/feature-based/src/app/router/routes/home.routes.tsx +8 -0
- package/templates/conditional/router/feature-based/src/shared/layouts/RootLayout.jsx +17 -0
- package/templates/conditional/router/feature-based/src/shared/layouts/RootLayout.tsx +17 -0
- package/templates/conditional/router/feature-based/tailwind/src/shared/layouts/RootLayout.jsx +9 -0
- package/templates/conditional/router/feature-based/tailwind/src/shared/layouts/RootLayout.tsx +9 -0
- package/templates/conditional/state/redux/component-based/src/pages/Home/counterSlice.ts +9 -3
- package/templates/conditional/state/redux/component-based/src/{context → providers}/StoreProvider.jsx +0 -1
- package/templates/conditional/state/redux/component-based/src/{context → providers}/StoreProvider.tsx +2 -2
- package/templates/conditional/state/redux/component-based/src/store/hooks.ts +4 -2
- package/templates/conditional/state/redux/component-based/src/store/index.ts +2 -2
- package/templates/conditional/state/redux/feature-based/src/app/providers/StoreProvider.jsx +1 -2
- package/templates/conditional/state/redux/feature-based/src/app/providers/StoreProvider.tsx +3 -3
- package/templates/conditional/state/redux/feature-based/src/features/home/store/counterSlice.ts +9 -3
- package/templates/conditional/state/redux/feature-based/src/shared/stores/hooks.ts +6 -0
- package/templates/conditional/state/redux/feature-based/src/{stores → shared/stores}/index.ts +2 -2
- package/templates/conditional/state/zustand/component-based/src/store/useCounterStore.ts +8 -1
- package/templates/conditional/state/zustand/feature-based/src/stores/useCounterStore.ts +8 -1
- package/templates/conditional/testing/jest/babel.config.cjs +7 -0
- package/templates/conditional/testing/jest/component-based/src/__tests__/App.test.jsx +10 -0
- package/templates/conditional/testing/jest/component-based/src/__tests__/App.test.tsx +11 -0
- package/templates/conditional/testing/jest/{src → feature-based/src}/__tests__/App.test.jsx +2 -1
- package/templates/conditional/testing/jest/feature-based/src/__tests__/App.test.tsx +11 -0
- package/templates/conditional/testing/jest/jest.config.js +2 -3
- package/templates/conditional/testing/jest/jest.config.ts +6 -4
- package/templates/conditional/testing/jest/jest.setup.js +6 -0
- package/templates/conditional/testing/jest/jest.setup.ts +6 -0
- package/templates/conditional/testing/vitest/component-based/src/__tests__/App.test.jsx +10 -0
- package/templates/conditional/testing/{jest → vitest/component-based}/src/__tests__/App.test.tsx +2 -1
- package/templates/css/bootstrap/src/themes.css +14 -0
- package/templates/css/component-styles/bootstrap/component-based/src/components/common/Button.jsx +17 -0
- package/templates/css/component-styles/bootstrap/component-based/src/components/common/Button.tsx +22 -0
- package/templates/css/component-styles/bootstrap/component-based/src/layouts/MainLayout.jsx +15 -0
- package/templates/css/component-styles/bootstrap/component-based/src/layouts/MainLayout.tsx +19 -0
- package/templates/css/component-styles/bootstrap/component-based/src/pages/Home/Home.jsx +13 -0
- package/templates/css/component-styles/bootstrap/component-based/src/pages/Home/Home.tsx +13 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/app/App.jsx +9 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/app/App.tsx +9 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/features/home/pages/HomePage.jsx +13 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/features/home/pages/HomePage.tsx +13 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/shared/components/ui/Button.jsx +17 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/shared/components/ui/Button.tsx +22 -0
- package/templates/{architectures/feature-based/src/components/ui → css/component-styles/tailwind/component-based/src/components/common}/Button.jsx +1 -3
- package/templates/{architectures/feature-based/src/components/ui → css/component-styles/tailwind/component-based/src/components/common}/Button.tsx +1 -3
- package/templates/css/component-styles/tailwind/component-based/src/layouts/MainLayout.jsx +15 -0
- package/templates/css/component-styles/tailwind/component-based/src/layouts/MainLayout.tsx +19 -0
- package/templates/css/component-styles/tailwind/component-based/src/pages/Home/Home.jsx +13 -0
- package/templates/css/component-styles/tailwind/component-based/src/pages/Home/Home.tsx +13 -0
- package/templates/css/component-styles/tailwind/feature-based/src/app/App.jsx +9 -0
- package/templates/css/component-styles/tailwind/feature-based/src/app/App.tsx +9 -0
- package/templates/css/component-styles/tailwind/feature-based/src/features/home/pages/HomePage.jsx +13 -0
- package/templates/css/component-styles/tailwind/feature-based/src/features/home/pages/HomePage.tsx +13 -0
- package/templates/css/component-styles/tailwind/feature-based/src/shared/components/ui/Button.jsx +21 -0
- package/templates/css/component-styles/tailwind/feature-based/src/shared/components/ui/Button.tsx +26 -0
- package/templates/css/none/src/{index.css → main.css} +2 -0
- package/templates/css/none/src/themes.css +19 -0
- package/templates/css/tailwind/src/themes.css +9 -0
- package/templates/architectures/component-based/src/config/constants.js +0 -2
- package/templates/architectures/component-based/src/config/constants.ts +0 -2
- package/templates/architectures/component-based/src/config/routes.js +0 -7
- package/templates/architectures/component-based/src/config/routes.ts +0 -7
- package/templates/architectures/component-based/src/context/AppContext.jsx +0 -13
- package/templates/architectures/component-based/src/context/AppContext.tsx +0 -13
- package/templates/architectures/component-based/src/hooks/index.js +0 -1
- package/templates/architectures/component-based/src/hooks/index.ts +0 -1
- package/templates/architectures/component-based/src/layouts/index.js +0 -1
- package/templates/architectures/component-based/src/layouts/index.ts +0 -1
- package/templates/architectures/component-based/src/routes/index.jsx +0 -11
- package/templates/architectures/component-based/src/routes/index.tsx +0 -11
- package/templates/architectures/component-based/src/styles/globals.css +0 -7
- package/templates/architectures/component-based/src/utils/index.js +0 -1
- package/templates/architectures/component-based/src/utils/index.ts +0 -1
- package/templates/architectures/feature-based/src/config/constants.js +0 -2
- package/templates/architectures/feature-based/src/config/constants.ts +0 -2
- package/templates/architectures/feature-based/src/hooks/index.js +0 -1
- package/templates/architectures/feature-based/src/hooks/index.ts +0 -1
- package/templates/architectures/feature-based/src/utils/cn.ts +0 -6
- package/templates/architectures/feature-based/src/utils/index.js +0 -1
- package/templates/architectures/feature-based/src/utils/index.ts +0 -1
- package/templates/conditional/axios/component-based/src/services/axios.jsx +0 -19
- package/templates/conditional/axios/component-based/src/services/axios.ts +0 -19
- package/templates/conditional/axios/component-based/src/services/index.js +0 -1
- package/templates/conditional/axios/component-based/src/services/index.ts +0 -1
- package/templates/conditional/axios/feature-based/src/lib/axios.jsx +0 -19
- package/templates/conditional/axios/feature-based/src/lib/axios.ts +0 -19
- package/templates/conditional/axios/feature-based/src/lib/index.js +0 -1
- package/templates/conditional/axios/feature-based/src/lib/index.ts +0 -1
- package/templates/conditional/fetch/component-based/src/services/api.jsx +0 -27
- package/templates/conditional/fetch/component-based/src/services/api.ts +0 -27
- package/templates/conditional/fetch/component-based/src/services/index.js +0 -1
- package/templates/conditional/fetch/component-based/src/services/index.ts +0 -1
- package/templates/conditional/fetch/feature-based/src/lib/api.jsx +0 -27
- package/templates/conditional/fetch/feature-based/src/lib/api.ts +0 -27
- package/templates/conditional/fetch/feature-based/src/lib/index.js +0 -1
- package/templates/conditional/fetch/feature-based/src/lib/index.ts +0 -1
- package/templates/conditional/router/component-based/src/routes/index.jsx +0 -13
- package/templates/conditional/router/component-based/src/routes/index.tsx +0 -13
- package/templates/conditional/router/feature-based/src/app/router.jsx +0 -13
- package/templates/conditional/router/feature-based/src/app/router.tsx +0 -13
- package/templates/conditional/state/redux/feature-based/src/stores/hooks.ts +0 -4
- package/templates/css/tailwind/src/index.css +0 -1
- /package/templates/architectures/component-based/src/{components/layout → config}/.gitkeep +0 -0
- /package/templates/architectures/{feature-based/src/features/home/interfaces → component-based/src/providers}/.gitkeep +0 -0
- /package/templates/architectures/{feature-based/src/lib → component-based/src/styles}/.gitkeep +0 -0
- /package/templates/architectures/feature-based/src/{stores → features/home/types}/.gitkeep +0 -0
- /package/templates/architectures/feature-based/src/{components → shared/components}/ui/index.js +0 -0
- /package/templates/architectures/feature-based/src/{components → shared/components}/ui/index.ts +0 -0
- /package/templates/architectures/feature-based/src/{hooks → shared/hooks}/useLocalStorage.jsx +0 -0
- /package/templates/architectures/feature-based/src/{utils → shared/utils}/cn.jsx +0 -0
- /package/templates/conditional/state/redux/feature-based/src/{stores → shared/stores}/hooks.js +0 -0
- /package/templates/conditional/state/redux/feature-based/src/{stores → shared/stores}/index.js +0 -0
- /package/templates/conditional/testing/vitest/{src → feature-based/src}/__tests__/App.test.jsx +0 -0
- /package/templates/conditional/testing/vitest/{src → feature-based/src}/__tests__/App.test.tsx +0 -0
- /package/templates/css/bootstrap/src/{index.css → globals.css} +0 -0
- /package/templates/{architectures/feature-based/src/styles → css/tailwind/src}/globals.css +0 -0
package/templates/conditional/state/redux/feature-based/src/features/home/store/counterSlice.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { createSlice } from "@reduxjs/toolkit";
|
|
1
|
+
import { createSlice, type PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
+
|
|
3
|
+
interface CounterState {
|
|
4
|
+
value: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const initialState: CounterState = { value: 0 };
|
|
2
8
|
|
|
3
9
|
const counterSlice = createSlice({
|
|
4
10
|
name: "counter",
|
|
5
|
-
initialState
|
|
11
|
+
initialState,
|
|
6
12
|
reducers: {
|
|
7
13
|
increment: (state) => {
|
|
8
14
|
state.value += 1;
|
|
@@ -10,7 +16,7 @@ const counterSlice = createSlice({
|
|
|
10
16
|
decrement: (state) => {
|
|
11
17
|
state.value -= 1;
|
|
12
18
|
},
|
|
13
|
-
incrementByAmount: (state, action) => {
|
|
19
|
+
incrementByAmount: (state, action: PayloadAction<number>) => {
|
|
14
20
|
state.value += action.payload;
|
|
15
21
|
},
|
|
16
22
|
},
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
2
|
+
import type { TypedUseSelectorHook } from "react-redux";
|
|
3
|
+
import type { RootState, AppDispatch } from "./index";
|
|
4
|
+
|
|
5
|
+
export const useAppDispatch: () => AppDispatch = useDispatch;
|
|
6
|
+
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { create } from "zustand";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface CounterState {
|
|
4
|
+
count: number;
|
|
5
|
+
increment: () => void;
|
|
6
|
+
decrement: () => void;
|
|
7
|
+
incrementByAmount: (amount: number) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const useCounterStore = create<CounterState>()((set) => ({
|
|
4
11
|
count: 0,
|
|
5
12
|
increment: () => set((state) => ({ count: state.count + 1 })),
|
|
6
13
|
decrement: () => set((state) => ({ count: state.count - 1 })),
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { create } from "zustand";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface CounterState {
|
|
4
|
+
count: number;
|
|
5
|
+
increment: () => void;
|
|
6
|
+
decrement: () => void;
|
|
7
|
+
incrementByAmount: (amount: number) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const useCounterStore = create<CounterState>()((set) => ({
|
|
4
11
|
count: 0,
|
|
5
12
|
increment: () => set((state) => ({ count: state.count + 1 })),
|
|
6
13
|
decrement: () => set((state) => ({ count: state.count - 1 })),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { describe, it, expect } from "@jest/globals";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import App from "@/App";
|
|
4
|
+
|
|
5
|
+
describe("App", () => {
|
|
6
|
+
it("renders without crashing", () => {
|
|
7
|
+
render(<App />);
|
|
8
|
+
expect(screen.getByText(/Welcome/i)).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { describe, it, expect } from "@jest/globals";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom/jest-globals";
|
|
4
|
+
import App from "@/App";
|
|
5
|
+
|
|
6
|
+
describe("App", () => {
|
|
7
|
+
it("renders without crashing", () => {
|
|
8
|
+
render(<App />);
|
|
9
|
+
expect(screen.getByText(/Welcome/i)).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, it, expect } from "@jest/globals";
|
|
1
2
|
import { render, screen } from "@testing-library/react";
|
|
2
3
|
import App from "@/app/App";
|
|
3
4
|
|
|
@@ -6,4 +7,4 @@ describe("App", () => {
|
|
|
6
7
|
render(<App />);
|
|
7
8
|
expect(screen.getByText(/Welcome/i)).toBeInTheDocument();
|
|
8
9
|
});
|
|
9
|
-
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { describe, it, expect } from "@jest/globals";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom/jest-globals";
|
|
4
|
+
import App from "@/app/App";
|
|
5
|
+
|
|
6
|
+
describe("App", () => {
|
|
7
|
+
it("renders without crashing", () => {
|
|
8
|
+
render(<App />);
|
|
9
|
+
expect(screen.getByText(/Welcome/i)).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports = {
|
|
1
|
+
export default {
|
|
3
2
|
testEnvironment: "jsdom",
|
|
4
3
|
roots: ["<rootDir>/src"],
|
|
5
4
|
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
|
|
@@ -9,4 +8,4 @@ module.exports = {
|
|
|
9
8
|
transform: {
|
|
10
9
|
"^.+\\.jsx?$": "babel-jest",
|
|
11
10
|
},
|
|
12
|
-
};
|
|
11
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { Config } from "jest";
|
|
2
|
+
|
|
3
|
+
const config: Config = {
|
|
4
4
|
testEnvironment: "jsdom",
|
|
5
5
|
roots: ["<rootDir>/src"],
|
|
6
6
|
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
|
|
@@ -8,6 +8,8 @@ module.exports = {
|
|
|
8
8
|
"^@/(.*)$": "<rootDir>/src/$1",
|
|
9
9
|
},
|
|
10
10
|
transform: {
|
|
11
|
-
"^.+\\.tsx?$": "
|
|
11
|
+
"^.+\\.tsx?$": "babel-jest",
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
|
+
|
|
15
|
+
export default config;
|
|
@@ -1 +1,7 @@
|
|
|
1
1
|
import "@testing-library/jest-dom";
|
|
2
|
+
import { TextDecoder, TextEncoder } from "node:util";
|
|
3
|
+
|
|
4
|
+
// react-router (and other modern libs) reference TextEncoder/TextDecoder at
|
|
5
|
+
// module scope; jest's jsdom runner does not expose Node's globals by default.
|
|
6
|
+
globalThis.TextEncoder = TextEncoder;
|
|
7
|
+
globalThis.TextDecoder = TextDecoder;
|
|
@@ -1 +1,7 @@
|
|
|
1
1
|
import "@testing-library/jest-dom";
|
|
2
|
+
import { TextDecoder, TextEncoder } from "node:util";
|
|
3
|
+
|
|
4
|
+
// react-router (and other modern libs) reference TextEncoder/TextDecoder at
|
|
5
|
+
// module scope; jest's jsdom runner does not expose Node's globals by default.
|
|
6
|
+
globalThis.TextEncoder = TextEncoder;
|
|
7
|
+
globalThis.TextDecoder = TextDecoder;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react";
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
import App from "@/App";
|
|
4
|
+
|
|
5
|
+
describe("App", () => {
|
|
6
|
+
it("renders without crashing", () => {
|
|
7
|
+
render(<App />);
|
|
8
|
+
expect(screen.getByText(/Welcome/i)).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* themes.css — Bootstrap 5.3+ theme overrides
|
|
2
|
+
* Bootstrap 5.3+ reads data-bs-theme on a parent element to switch between
|
|
3
|
+
* light/dark variants. The themes here customize the default tokens; the
|
|
4
|
+
* data-bs-theme attribute is applied externally.
|
|
5
|
+
*/
|
|
6
|
+
:root[data-bs-theme="light"] {
|
|
7
|
+
--bs-primary: #6366f1;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:root[data-bs-theme="dark"] {
|
|
11
|
+
--bs-body-bg: #111827;
|
|
12
|
+
--bs-body-color: #f9fafb;
|
|
13
|
+
--bs-primary: #818cf8;
|
|
14
|
+
}
|
package/templates/css/component-styles/bootstrap/component-based/src/components/common/Button.jsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function Button({
|
|
2
|
+
variant = "primary",
|
|
3
|
+
children,
|
|
4
|
+
className,
|
|
5
|
+
...props
|
|
6
|
+
}) {
|
|
7
|
+
const variants = {
|
|
8
|
+
primary: "btn btn-primary",
|
|
9
|
+
secondary: "btn btn-secondary",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<button className={`${variants[variant]} ${className ?? ""}`} {...props}>
|
|
14
|
+
{children}
|
|
15
|
+
</button>
|
|
16
|
+
);
|
|
17
|
+
}
|
package/templates/css/component-styles/bootstrap/component-based/src/components/common/Button.tsx
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
+
variant?: "primary" | "secondary";
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function Button({
|
|
7
|
+
variant = "primary",
|
|
8
|
+
children,
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: ButtonProps) {
|
|
12
|
+
const variants = {
|
|
13
|
+
primary: "btn btn-primary",
|
|
14
|
+
secondary: "btn btn-secondary",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<button className={`${variants[variant]} ${className ?? ""}`} {...props}>
|
|
19
|
+
{children}
|
|
20
|
+
</button>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function MainLayout({ children }) {
|
|
2
|
+
return (
|
|
3
|
+
<div className="min-vh-100 d-flex flex-column">
|
|
4
|
+
<header className="px-4 py-3 border-bottom">
|
|
5
|
+
<h2 className="h5 fw-semibold mb-0">Lumen</h2>
|
|
6
|
+
</header>
|
|
7
|
+
<main className="flex-grow-1 p-4 d-flex align-items-center justify-content-center">
|
|
8
|
+
{children}
|
|
9
|
+
</main>
|
|
10
|
+
<footer className="px-4 py-3 border-top text-center text-muted">
|
|
11
|
+
<p className="mb-0">Built with Lumen</p>
|
|
12
|
+
</footer>
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface MainLayoutProps {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function MainLayout({ children }: MainLayoutProps) {
|
|
6
|
+
return (
|
|
7
|
+
<div className="min-vh-100 d-flex flex-column">
|
|
8
|
+
<header className="px-4 py-3 border-bottom">
|
|
9
|
+
<h2 className="h5 fw-semibold mb-0">Lumen</h2>
|
|
10
|
+
</header>
|
|
11
|
+
<main className="flex-grow-1 p-4 d-flex align-items-center justify-content-center">
|
|
12
|
+
{children}
|
|
13
|
+
</main>
|
|
14
|
+
<footer className="px-4 py-3 border-top text-center text-muted">
|
|
15
|
+
<p className="mb-0">Built with Lumen</p>
|
|
16
|
+
</footer>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button } from "@/components/common";
|
|
2
|
+
|
|
3
|
+
export function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="text-center">
|
|
6
|
+
<h1 className="h1 fw-bold text-dark mb-4">Welcome to Lumen</h1>
|
|
7
|
+
<p className="text-muted mb-5">
|
|
8
|
+
Your React + Vite project is ready. Start building!
|
|
9
|
+
</p>
|
|
10
|
+
<Button>Get Started</Button>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button } from "@/components/common";
|
|
2
|
+
|
|
3
|
+
export function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="text-center">
|
|
6
|
+
<h1 className="h1 fw-bold text-dark mb-4">Welcome to Lumen</h1>
|
|
7
|
+
<p className="text-muted mb-5">
|
|
8
|
+
Your React + Vite project is ready. Start building!
|
|
9
|
+
</p>
|
|
10
|
+
<Button>Get Started</Button>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
package/templates/css/component-styles/bootstrap/feature-based/src/features/home/pages/HomePage.jsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button } from "@/shared/components/ui";
|
|
2
|
+
|
|
3
|
+
export function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="text-center">
|
|
6
|
+
<h1 className="h1 fw-bold text-dark mb-4">Welcome to Lumen</h1>
|
|
7
|
+
<p className="text-muted mb-5">
|
|
8
|
+
Your React + Vite project is ready. Start building!
|
|
9
|
+
</p>
|
|
10
|
+
<Button>Get Started</Button>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
package/templates/css/component-styles/bootstrap/feature-based/src/features/home/pages/HomePage.tsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button } from "@/shared/components/ui";
|
|
2
|
+
|
|
3
|
+
export function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="text-center">
|
|
6
|
+
<h1 className="h1 fw-bold text-dark mb-4">Welcome to Lumen</h1>
|
|
7
|
+
<p className="text-muted mb-5">
|
|
8
|
+
Your React + Vite project is ready. Start building!
|
|
9
|
+
</p>
|
|
10
|
+
<Button>Get Started</Button>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
package/templates/css/component-styles/bootstrap/feature-based/src/shared/components/ui/Button.jsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function Button({
|
|
2
|
+
variant = "primary",
|
|
3
|
+
children,
|
|
4
|
+
className,
|
|
5
|
+
...props
|
|
6
|
+
}) {
|
|
7
|
+
const variants = {
|
|
8
|
+
primary: "btn btn-primary",
|
|
9
|
+
secondary: "btn btn-secondary",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<button className={`${variants[variant]} ${className ?? ""}`} {...props}>
|
|
14
|
+
{children}
|
|
15
|
+
</button>
|
|
16
|
+
);
|
|
17
|
+
}
|
package/templates/css/component-styles/bootstrap/feature-based/src/shared/components/ui/Button.tsx
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
+
variant?: "primary" | "secondary";
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function Button({
|
|
7
|
+
variant = "primary",
|
|
8
|
+
children,
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: ButtonProps) {
|
|
12
|
+
const variants = {
|
|
13
|
+
primary: "btn btn-primary",
|
|
14
|
+
secondary: "btn btn-secondary",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<button className={`${variants[variant]} ${className ?? ""}`} {...props}>
|
|
19
|
+
{children}
|
|
20
|
+
</button>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
1
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
2
|
variant?: "primary" | "secondary";
|
|
5
3
|
children: React.ReactNode;
|
|
@@ -25,4 +23,4 @@ export function Button({
|
|
|
25
23
|
{children}
|
|
26
24
|
</button>
|
|
27
25
|
);
|
|
28
|
-
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function MainLayout({ children }) {
|
|
2
|
+
return (
|
|
3
|
+
<div className="min-h-screen flex flex-col">
|
|
4
|
+
<header className="px-6 py-4 border-b">
|
|
5
|
+
<h2 className="text-xl font-semibold">Lumen</h2>
|
|
6
|
+
</header>
|
|
7
|
+
<main className="flex-1 p-6 flex items-center justify-center">
|
|
8
|
+
{children}
|
|
9
|
+
</main>
|
|
10
|
+
<footer className="px-6 py-4 border-t text-center text-gray-500">
|
|
11
|
+
<p>Built with Lumen</p>
|
|
12
|
+
</footer>
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface MainLayoutProps {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function MainLayout({ children }: MainLayoutProps) {
|
|
6
|
+
return (
|
|
7
|
+
<div className="min-h-screen flex flex-col">
|
|
8
|
+
<header className="px-6 py-4 border-b">
|
|
9
|
+
<h2 className="text-xl font-semibold">Lumen</h2>
|
|
10
|
+
</header>
|
|
11
|
+
<main className="flex-1 p-6 flex items-center justify-center">
|
|
12
|
+
{children}
|
|
13
|
+
</main>
|
|
14
|
+
<footer className="px-6 py-4 border-t text-center text-gray-500">
|
|
15
|
+
<p>Built with Lumen</p>
|
|
16
|
+
</footer>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button } from "@/components/common";
|
|
2
|
+
|
|
3
|
+
export function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="text-center">
|
|
6
|
+
<h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
|
|
7
|
+
<p className="text-gray-600 mb-8">
|
|
8
|
+
Your React + Vite project is ready. Start building!
|
|
9
|
+
</p>
|
|
10
|
+
<Button>Get Started</Button>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button } from "@/components/common";
|
|
2
|
+
|
|
3
|
+
export function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="text-center">
|
|
6
|
+
<h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
|
|
7
|
+
<p className="text-gray-600 mb-8">
|
|
8
|
+
Your React + Vite project is ready. Start building!
|
|
9
|
+
</p>
|
|
10
|
+
<Button>Get Started</Button>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
package/templates/css/component-styles/tailwind/feature-based/src/features/home/pages/HomePage.jsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button } from "@/shared/components/ui";
|
|
2
|
+
|
|
3
|
+
export function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="text-center">
|
|
6
|
+
<h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
|
|
7
|
+
<p className="text-gray-600 mb-8">
|
|
8
|
+
Your React + Vite project is ready. Start building!
|
|
9
|
+
</p>
|
|
10
|
+
<Button>Get Started</Button>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
package/templates/css/component-styles/tailwind/feature-based/src/features/home/pages/HomePage.tsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button } from "@/shared/components/ui";
|
|
2
|
+
|
|
3
|
+
export function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="text-center">
|
|
6
|
+
<h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
|
|
7
|
+
<p className="text-gray-600 mb-8">
|
|
8
|
+
Your React + Vite project is ready. Start building!
|
|
9
|
+
</p>
|
|
10
|
+
<Button>Get Started</Button>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
package/templates/css/component-styles/tailwind/feature-based/src/shared/components/ui/Button.jsx
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function Button({
|
|
2
|
+
variant = "primary",
|
|
3
|
+
children,
|
|
4
|
+
className,
|
|
5
|
+
...props
|
|
6
|
+
}) {
|
|
7
|
+
const base = "px-4 py-2 rounded-lg font-medium transition-colors";
|
|
8
|
+
const variants = {
|
|
9
|
+
primary: "bg-blue-600 text-white hover:bg-blue-700",
|
|
10
|
+
secondary: "bg-gray-200 text-gray-800 hover:bg-gray-300",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<button
|
|
15
|
+
className={`${base} ${variants[variant]} ${className ?? ""}`}
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
18
|
+
{children}
|
|
19
|
+
</button>
|
|
20
|
+
);
|
|
21
|
+
}
|
package/templates/css/component-styles/tailwind/feature-based/src/shared/components/ui/Button.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
+
variant?: "primary" | "secondary";
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function Button({
|
|
7
|
+
variant = "primary",
|
|
8
|
+
children,
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: ButtonProps) {
|
|
12
|
+
const base = "px-4 py-2 rounded-lg font-medium transition-colors";
|
|
13
|
+
const variants = {
|
|
14
|
+
primary: "bg-blue-600 text-white hover:bg-blue-700",
|
|
15
|
+
secondary: "bg-gray-200 text-gray-800 hover:bg-gray-300",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<button
|
|
20
|
+
className={`${base} ${variants[variant]} ${className ?? ""}`}
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</button>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* themes.css — vanilla CSS theme tokens
|
|
2
|
+
* Driven by the ThemeProvider (feat) / AppProvider (comp) via
|
|
3
|
+
* document.documentElement.dataset.theme.
|
|
4
|
+
*/
|
|
5
|
+
:root {
|
|
6
|
+
--color-bg: #ffffff;
|
|
7
|
+
--color-fg: #111827;
|
|
8
|
+
--color-muted: #6b7280;
|
|
9
|
+
--color-primary: #6366f1;
|
|
10
|
+
--color-border: #e5e7eb;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:root[data-theme="dark"] {
|
|
14
|
+
--color-bg: #111827;
|
|
15
|
+
--color-fg: #f9fafb;
|
|
16
|
+
--color-muted: #9ca3af;
|
|
17
|
+
--color-primary: #818cf8;
|
|
18
|
+
--color-border: #374151;
|
|
19
|
+
}
|