create-lumen 1.1.2 → 1.1.4
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 +5 -1
- package/package.json +8 -2
- package/src/configure.js +23 -13
- package/src/css.js +15 -3
- package/src/dependencies.js +8 -3
- package/src/format.js +28 -0
- package/src/injector.js +15 -4
- package/src/main.js +17 -1
- package/src/readme.js +1 -0
- package/templates/architectures/component-based/main.tsx +1 -1
- package/templates/architectures/component-based/src/App.jsx +0 -1
- package/templates/architectures/component-based/src/App.tsx +0 -1
- package/templates/architectures/component-based/src/components/common/Button.jsx +0 -2
- package/templates/architectures/component-based/src/components/common/Button.tsx +0 -2
- package/templates/architectures/component-based/src/config/constants.js +0 -1
- package/templates/architectures/component-based/src/config/constants.ts +0 -1
- package/templates/architectures/component-based/src/context/AppContext.jsx +3 -4
- package/templates/architectures/component-based/src/context/AppContext.tsx +11 -6
- package/templates/architectures/component-based/src/context/app-context.js +5 -0
- package/templates/architectures/component-based/src/context/app-context.ts +10 -0
- package/templates/architectures/component-based/src/hooks/useLocalStorage.ts +5 -5
- package/templates/architectures/component-based/src/layouts/MainLayout.jsx +0 -2
- package/templates/architectures/component-based/src/layouts/MainLayout.tsx +0 -2
- package/templates/architectures/component-based/src/pages/Home/Home.jsx +0 -1
- package/templates/architectures/component-based/src/pages/Home/Home.tsx +0 -1
- package/templates/architectures/component-based/src/utils/cn.ts +3 -1
- package/templates/architectures/feature-based/main.tsx +1 -1
- package/templates/architectures/feature-based/src/app/App.jsx +0 -1
- package/templates/architectures/feature-based/src/app/App.tsx +0 -1
- package/templates/architectures/feature-based/src/app/providers/ThemeProvider.jsx +0 -2
- package/templates/architectures/feature-based/src/app/providers/ThemeProvider.tsx +2 -2
- package/templates/architectures/feature-based/src/components/ui/Button.jsx +0 -2
- package/templates/architectures/feature-based/src/components/ui/Button.tsx +0 -2
- package/templates/architectures/feature-based/src/config/constants.js +0 -1
- package/templates/architectures/feature-based/src/config/constants.ts +0 -1
- package/templates/architectures/feature-based/src/features/home/pages/HomePage.jsx +0 -1
- package/templates/architectures/feature-based/src/features/home/pages/HomePage.tsx +0 -1
- package/templates/architectures/feature-based/src/hooks/useLocalStorage.ts +5 -5
- package/templates/architectures/feature-based/src/utils/cn.ts +3 -4
- package/templates/conditional/formatter/oxfmt/.oxfmtrc.json +1 -1
- package/templates/conditional/formatter/prettier/.prettierrc +2 -2
- package/templates/conditional/icons/huge/component-based/src/pages/Home/Home.jsx +5 -5
- package/templates/conditional/icons/huge/component-based/src/pages/Home/Home.tsx +5 -5
- package/templates/conditional/icons/huge/feature-based/src/features/home/pages/HomePage.jsx +5 -5
- package/templates/conditional/icons/huge/feature-based/src/features/home/pages/HomePage.tsx +5 -5
- package/templates/conditional/icons/lucide/component-based/src/pages/Home/Home.jsx +2 -3
- package/templates/conditional/icons/lucide/component-based/src/pages/Home/Home.tsx +2 -3
- package/templates/conditional/icons/lucide/feature-based/src/features/home/pages/HomePage.jsx +2 -3
- package/templates/conditional/icons/lucide/feature-based/src/features/home/pages/HomePage.tsx +2 -3
- 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/src/App.jsx +0 -1
- package/templates/conditional/router/component-based/src/App.tsx +0 -1
- package/templates/conditional/router/component-based/src/routes/index.jsx +0 -1
- package/templates/conditional/router/component-based/src/routes/index.tsx +0 -1
- package/templates/conditional/router/feature-based/src/app/App.jsx +0 -1
- package/templates/conditional/router/feature-based/src/app/App.tsx +0 -1
- package/templates/conditional/state/redux/component-based/src/context/StoreProvider.jsx +0 -1
- package/templates/conditional/state/redux/component-based/src/context/StoreProvider.tsx +2 -2
- package/templates/conditional/state/redux/component-based/src/pages/Home/counterSlice.ts +9 -3
- 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 +0 -1
- package/templates/conditional/state/redux/feature-based/src/app/providers/StoreProvider.tsx +2 -2
- package/templates/conditional/state/redux/feature-based/src/features/home/store/counterSlice.ts +9 -3
- package/templates/conditional/state/redux/feature-based/src/stores/hooks.ts +4 -2
- package/templates/conditional/state/redux/feature-based/src/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/architectures/component-based/src/routes/index.jsx +0 -11
- package/templates/architectures/component-based/src/routes/index.tsx +0 -11
- /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
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { HugeiconsIcon } from "@hugeicons/react";
|
|
2
|
+
import { Sun01Icon, Moon01Icon, Github01Icon } from "@hugeicons/core-free-icons";
|
|
3
3
|
import { Button } from "@/components/common";
|
|
4
4
|
|
|
5
5
|
export function HomePage() {
|
|
6
6
|
return (
|
|
7
7
|
<div className="text-center">
|
|
8
8
|
<div className="flex justify-center gap-4 mb-6">
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
<
|
|
9
|
+
<HugeiconsIcon icon={Sun01Icon} className="w-8 h-8 text-yellow-500" />
|
|
10
|
+
<HugeiconsIcon icon={Moon01Icon} className="w-8 h-8 text-blue-500" />
|
|
11
|
+
<HugeiconsIcon icon={Github01Icon} className="w-8 h-8 text-gray-800" />
|
|
12
12
|
</div>
|
|
13
13
|
<h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
|
|
14
14
|
<p className="text-gray-600 mb-8">
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { HugeiconsIcon } from "@hugeicons/react";
|
|
2
|
+
import { Sun01Icon, Moon01Icon, Github01Icon } from "@hugeicons/core-free-icons";
|
|
3
3
|
import { Button } from "@/components/ui";
|
|
4
4
|
|
|
5
5
|
export function HomePage() {
|
|
6
6
|
return (
|
|
7
7
|
<div className="text-center">
|
|
8
8
|
<div className="flex justify-center gap-4 mb-6">
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
<
|
|
9
|
+
<HugeiconsIcon icon={Sun01Icon} className="w-8 h-8 text-yellow-500" />
|
|
10
|
+
<HugeiconsIcon icon={Moon01Icon} className="w-8 h-8 text-blue-500" />
|
|
11
|
+
<HugeiconsIcon icon={Github01Icon} className="w-8 h-8 text-gray-800" />
|
|
12
12
|
</div>
|
|
13
13
|
<h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
|
|
14
14
|
<p className="text-gray-600 mb-8">
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { HugeiconsIcon } from "@hugeicons/react";
|
|
2
|
+
import { Sun01Icon, Moon01Icon, Github01Icon } from "@hugeicons/core-free-icons";
|
|
3
3
|
import { Button } from "@/components/ui";
|
|
4
4
|
|
|
5
5
|
export function HomePage() {
|
|
6
6
|
return (
|
|
7
7
|
<div className="text-center">
|
|
8
8
|
<div className="flex justify-center gap-4 mb-6">
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
<
|
|
9
|
+
<HugeiconsIcon icon={Sun01Icon} className="w-8 h-8 text-yellow-500" />
|
|
10
|
+
<HugeiconsIcon icon={Moon01Icon} className="w-8 h-8 text-blue-500" />
|
|
11
|
+
<HugeiconsIcon icon={Github01Icon} className="w-8 h-8 text-gray-800" />
|
|
12
12
|
</div>
|
|
13
13
|
<h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
|
|
14
14
|
<p className="text-gray-600 mb-8">
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Sun, Moon, Github } from "lucide-react";
|
|
1
|
+
import { Sun, Moon, GitBranch } from "lucide-react";
|
|
3
2
|
import { Button } from "@/components/common";
|
|
4
3
|
|
|
5
4
|
export function HomePage() {
|
|
@@ -8,7 +7,7 @@ export function HomePage() {
|
|
|
8
7
|
<div className="flex justify-center gap-4 mb-6">
|
|
9
8
|
<Sun className="w-8 h-8 text-yellow-500" />
|
|
10
9
|
<Moon className="w-8 h-8 text-blue-500" />
|
|
11
|
-
<
|
|
10
|
+
<GitBranch className="w-8 h-8 text-gray-800" />
|
|
12
11
|
</div>
|
|
13
12
|
<h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
|
|
14
13
|
<p className="text-gray-600 mb-8">
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Sun, Moon, Github } from "lucide-react";
|
|
1
|
+
import { Sun, Moon, GitBranch } from "lucide-react";
|
|
3
2
|
import { Button } from "@/components/common";
|
|
4
3
|
|
|
5
4
|
export function HomePage() {
|
|
@@ -8,7 +7,7 @@ export function HomePage() {
|
|
|
8
7
|
<div className="flex justify-center gap-4 mb-6">
|
|
9
8
|
<Sun className="w-8 h-8 text-yellow-500" />
|
|
10
9
|
<Moon className="w-8 h-8 text-blue-500" />
|
|
11
|
-
<
|
|
10
|
+
<GitBranch className="w-8 h-8 text-gray-800" />
|
|
12
11
|
</div>
|
|
13
12
|
<h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
|
|
14
13
|
<p className="text-gray-600 mb-8">
|
package/templates/conditional/icons/lucide/feature-based/src/features/home/pages/HomePage.jsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Sun, Moon, Github } from "lucide-react";
|
|
1
|
+
import { Sun, Moon, GitBranch } from "lucide-react";
|
|
3
2
|
import { Button } from "@/components/ui";
|
|
4
3
|
|
|
5
4
|
export function HomePage() {
|
|
@@ -8,7 +7,7 @@ export function HomePage() {
|
|
|
8
7
|
<div className="flex justify-center gap-4 mb-6">
|
|
9
8
|
<Sun className="w-8 h-8 text-yellow-500" />
|
|
10
9
|
<Moon className="w-8 h-8 text-blue-500" />
|
|
11
|
-
<
|
|
10
|
+
<GitBranch className="w-8 h-8 text-gray-800" />
|
|
12
11
|
</div>
|
|
13
12
|
<h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
|
|
14
13
|
<p className="text-gray-600 mb-8">
|
package/templates/conditional/icons/lucide/feature-based/src/features/home/pages/HomePage.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Sun, Moon, Github } from "lucide-react";
|
|
1
|
+
import { Sun, Moon, GitBranch } from "lucide-react";
|
|
3
2
|
import { Button } from "@/components/ui";
|
|
4
3
|
|
|
5
4
|
export function HomePage() {
|
|
@@ -8,7 +7,7 @@ export function HomePage() {
|
|
|
8
7
|
<div className="flex justify-center gap-4 mb-6">
|
|
9
8
|
<Sun className="w-8 h-8 text-yellow-500" />
|
|
10
9
|
<Moon className="w-8 h-8 text-blue-500" />
|
|
11
|
-
<
|
|
10
|
+
<GitBranch className="w-8 h-8 text-gray-800" />
|
|
12
11
|
</div>
|
|
13
12
|
<h1 className="text-4xl font-bold text-gray-900 mb-4">Welcome to Lumen</h1>
|
|
14
13
|
<p className="text-gray-600 mb-8">
|
|
@@ -4,11 +4,12 @@ import reactHooks from "eslint-plugin-react-hooks";
|
|
|
4
4
|
import reactRefresh from "eslint-plugin-react-refresh";
|
|
5
5
|
|
|
6
6
|
export default [
|
|
7
|
+
js.configs.recommended,
|
|
7
8
|
{ ignores: ["dist"] },
|
|
8
9
|
{
|
|
9
10
|
files: ["**/*.{js,jsx}"],
|
|
10
11
|
languageOptions: {
|
|
11
|
-
ecmaVersion:
|
|
12
|
+
ecmaVersion: "latest",
|
|
12
13
|
globals: globals.browser,
|
|
13
14
|
parserOptions: {
|
|
14
15
|
ecmaVersion: "latest",
|
|
@@ -28,4 +29,25 @@ export default [
|
|
|
28
29
|
],
|
|
29
30
|
},
|
|
30
31
|
},
|
|
31
|
-
|
|
32
|
+
{
|
|
33
|
+
// Node-runtime files: Vite/Vitest/Jest/ESLint configs and CLI scripts.
|
|
34
|
+
files: [
|
|
35
|
+
"**/*.config.{js,cjs,mjs}",
|
|
36
|
+
"eslint.config.js",
|
|
37
|
+
"scripts/**/*.{js,mjs}",
|
|
38
|
+
"jest.setup.{js,mjs}",
|
|
39
|
+
],
|
|
40
|
+
languageOptions: {
|
|
41
|
+
ecmaVersion: "latest",
|
|
42
|
+
globals: globals.node,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
// Test files also see Jest globals (Vitest suites import explicitly).
|
|
47
|
+
files: ["**/*.test.{js,jsx}"],
|
|
48
|
+
languageOptions: {
|
|
49
|
+
ecmaVersion: "latest",
|
|
50
|
+
globals: { ...globals.browser, ...globals.jest },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
];
|
|
@@ -10,7 +10,7 @@ export default tseslint.config(
|
|
|
10
10
|
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
11
11
|
files: ["**/*.{ts,tsx}"],
|
|
12
12
|
languageOptions: {
|
|
13
|
-
ecmaVersion:
|
|
13
|
+
ecmaVersion: "latest",
|
|
14
14
|
globals: globals.browser,
|
|
15
15
|
},
|
|
16
16
|
plugins: {
|
|
@@ -24,5 +24,28 @@ export default tseslint.config(
|
|
|
24
24
|
{ allowConstantExport: true },
|
|
25
25
|
],
|
|
26
26
|
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
// Node-runtime files: Vite/Vitest/Jest/ESLint configs and CLI scripts.
|
|
30
|
+
extends: [...tseslint.configs.recommended],
|
|
31
|
+
files: [
|
|
32
|
+
"**/*.config.{ts,mts}",
|
|
33
|
+
"eslint.config.ts",
|
|
34
|
+
"scripts/**/*.{ts,mts}",
|
|
35
|
+
"jest.setup.ts",
|
|
36
|
+
],
|
|
37
|
+
languageOptions: {
|
|
38
|
+
ecmaVersion: "latest",
|
|
39
|
+
globals: globals.node,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
// Test files also see Jest globals (Vitest suites import explicitly).
|
|
44
|
+
extends: [...tseslint.configs.recommended],
|
|
45
|
+
files: ["**/*.test.{ts,tsx}"],
|
|
46
|
+
languageOptions: {
|
|
47
|
+
ecmaVersion: "latest",
|
|
48
|
+
globals: { ...globals.browser, ...globals.jest },
|
|
49
|
+
},
|
|
27
50
|
}
|
|
28
|
-
);
|
|
51
|
+
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
2
|
import { Provider } from "react-redux";
|
|
3
3
|
import { store } from "@/store";
|
|
4
4
|
|
|
5
|
-
export function StoreProvider({ children }) {
|
|
5
|
+
export function StoreProvider({ children }: { children: ReactNode }) {
|
|
6
6
|
return <Provider store={store}>{children}</Provider>;
|
|
7
7
|
}
|
|
@@ -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
|
},
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { useDispatch, useSelector } from "react-redux";
|
|
2
|
+
import type { TypedUseSelectorHook } from "react-redux";
|
|
3
|
+
import type { RootState, AppDispatch } from "./index";
|
|
2
4
|
|
|
3
|
-
export const useAppDispatch = useDispatch;
|
|
4
|
-
export const useAppSelector = useSelector;
|
|
5
|
+
export const useAppDispatch: () => AppDispatch = useDispatch;
|
|
6
|
+
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
2
|
import { Provider } from "react-redux";
|
|
3
3
|
import { store } from "@/stores";
|
|
4
4
|
|
|
5
|
-
export function StoreProvider({ children }) {
|
|
5
|
+
export function StoreProvider({ children }: { children: ReactNode }) {
|
|
6
6
|
return <Provider store={store}>{children}</Provider>;
|
|
7
7
|
}
|
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
|
},
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { useDispatch, useSelector } from "react-redux";
|
|
2
|
+
import type { TypedUseSelectorHook } from "react-redux";
|
|
3
|
+
import type { RootState, AppDispatch } from "./index";
|
|
2
4
|
|
|
3
|
-
export const useAppDispatch = useDispatch;
|
|
4
|
-
export const useAppSelector = useSelector;
|
|
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
|
+
});
|
/package/templates/conditional/testing/vitest/{src → feature-based/src}/__tests__/App.test.jsx
RENAMED
|
File without changes
|
/package/templates/conditional/testing/vitest/{src → feature-based/src}/__tests__/App.test.tsx
RENAMED
|
File without changes
|