create-fe-boilerplate 0.1.0 → 0.3.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/bin/index.js +64 -18
- package/package.json +11 -3
- package/templates/next/ts/tailwind/axios/README.md +36 -0
- package/templates/next/ts/tailwind/axios/eslint.config.mjs +18 -0
- package/templates/next/ts/tailwind/axios/next.config.ts +7 -0
- package/templates/next/ts/tailwind/axios/package-lock.json +6626 -0
- package/templates/next/ts/tailwind/axios/package.json +27 -0
- package/templates/next/ts/tailwind/axios/postcss.config.mjs +7 -0
- package/templates/next/ts/tailwind/axios/public/file.svg +1 -0
- package/templates/next/ts/tailwind/axios/public/globe.svg +1 -0
- package/templates/next/ts/tailwind/axios/public/next.svg +1 -0
- package/templates/next/ts/tailwind/axios/public/vercel.svg +1 -0
- package/templates/next/ts/tailwind/axios/public/window.svg +1 -0
- package/templates/next/ts/tailwind/axios/src/api/auth.ts +10 -0
- package/templates/next/ts/tailwind/axios/src/api/axios.ts +17 -0
- package/templates/next/ts/tailwind/axios/src/app/dashboard/page.tsx +32 -0
- package/templates/next/ts/tailwind/axios/src/app/favicon.ico +0 -0
- package/templates/next/ts/tailwind/axios/src/app/globals.css +26 -0
- package/templates/next/ts/tailwind/axios/src/app/layout.tsx +34 -0
- package/templates/next/ts/tailwind/axios/src/app/login/page.tsx +71 -0
- package/templates/next/ts/tailwind/axios/src/app/page.tsx +5 -0
- package/templates/next/ts/tailwind/axios/src/app/signup/page.tsx +56 -0
- package/templates/next/ts/tailwind/axios/src/components/AuthGuard.tsx +35 -0
- package/templates/next/ts/tailwind/axios/src/components/VerifyOtpModal.tsx +58 -0
- package/templates/next/ts/tailwind/axios/tsconfig.json +36 -0
- package/templates/react/js/tailwind/axios/vite.config.js +1 -1
- package/templates/react/js/tailwind/rtk/README.md +73 -0
- package/templates/react/js/tailwind/rtk/eslint.config.js +23 -0
- package/templates/react/js/tailwind/rtk/index.html +13 -0
- package/templates/react/js/tailwind/rtk/package-lock.json +4597 -0
- package/templates/react/js/tailwind/rtk/package.json +37 -0
- package/templates/react/js/tailwind/rtk/postcss.config.js +6 -0
- package/templates/react/js/tailwind/rtk/public/vite.svg +1 -0
- package/templates/react/js/tailwind/rtk/react-ts-tailwind-axios/.env.example +1 -0
- package/templates/react/js/tailwind/rtk/src/App.css +0 -0
- package/templates/react/js/tailwind/rtk/src/App.jsx +14 -0
- package/templates/react/js/tailwind/rtk/src/api/axios.ts +236 -0
- package/templates/react/js/tailwind/rtk/src/component/auth/VerifyOtpModal.jsx +60 -0
- package/templates/react/js/tailwind/rtk/src/component/common/ui/Toast/Toast.js +59 -0
- package/templates/react/js/tailwind/rtk/src/contants/constants.js +45 -0
- package/templates/react/js/tailwind/rtk/src/index.css +4 -0
- package/templates/react/js/tailwind/rtk/src/main.jsx +14 -0
- package/templates/react/js/tailwind/rtk/src/pages/Dashboard.jsx +10 -0
- package/templates/react/js/tailwind/rtk/src/pages/Login.jsx +69 -0
- package/templates/react/js/tailwind/rtk/src/pages/Signup.jsx +75 -0
- package/templates/react/js/tailwind/rtk/src/router/AppRoutes.jsx +19 -0
- package/templates/react/js/tailwind/rtk/src/store/index.js +10 -0
- package/templates/react/js/tailwind/rtk/src/store/services/api.js +34 -0
- package/templates/react/js/tailwind/rtk/src/utils/utils.ts +59 -0
- package/templates/react/js/tailwind/rtk/tailwind.config.js +8 -0
- package/templates/react/js/tailwind/rtk/vite.config.js +7 -0
- package/templates/react/ts/tailwind/rtk/README.md +73 -0
- package/templates/react/ts/tailwind/rtk/eslint.config.js +23 -0
- package/templates/react/ts/tailwind/rtk/index.html +13 -0
- package/templates/react/ts/tailwind/rtk/package-lock.json +4607 -0
- package/templates/react/ts/tailwind/rtk/package.json +40 -0
- package/templates/react/ts/tailwind/rtk/postcss.config.js +6 -0
- package/templates/react/ts/tailwind/rtk/public/vite.svg +1 -0
- package/templates/react/ts/tailwind/rtk/react-ts-tailwind-axios/.env.example +1 -0
- package/templates/react/ts/tailwind/rtk/src/App.css +0 -0
- package/templates/react/ts/tailwind/rtk/src/App.tsx +14 -0
- package/templates/react/ts/tailwind/rtk/src/api/axios.ts +236 -0
- package/templates/react/ts/tailwind/rtk/src/component/auth/VerifyOtpModal.tsx +70 -0
- package/templates/react/ts/tailwind/rtk/src/component/common/ui/Toast/Toast.ts +58 -0
- package/templates/react/ts/tailwind/rtk/src/contants/constants.ts +45 -0
- package/templates/react/ts/tailwind/rtk/src/index.css +4 -0
- package/templates/react/ts/tailwind/rtk/src/main.tsx +13 -0
- package/templates/react/ts/tailwind/rtk/src/pages/Dashboard.tsx +10 -0
- package/templates/react/ts/tailwind/rtk/src/pages/Login.tsx +69 -0
- package/templates/react/ts/tailwind/rtk/src/pages/Signup.tsx +75 -0
- package/templates/react/ts/tailwind/rtk/src/router/AppRoutes.tsx +19 -0
- package/templates/react/ts/tailwind/rtk/src/store/index.ts +13 -0
- package/templates/react/ts/tailwind/rtk/src/store/services/api.ts +37 -0
- package/templates/react/ts/tailwind/rtk/src/utils/utils.ts +59 -0
- package/templates/react/ts/tailwind/rtk/tailwind.config.js +8 -0
- package/templates/react/ts/tailwind/rtk/tsconfig.app.json +28 -0
- package/templates/react/ts/tailwind/rtk/tsconfig.json +12 -0
- package/templates/react/ts/tailwind/rtk/tsconfig.node.json +26 -0
- package/templates/react/ts/tailwind/rtk/vite.config.ts +7 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { configureStore } from "@reduxjs/toolkit";
|
|
2
|
+
import { api } from "./services/api";
|
|
3
|
+
|
|
4
|
+
export const store = configureStore({
|
|
5
|
+
reducer: {
|
|
6
|
+
[api.reducerPath]: api.reducer
|
|
7
|
+
},
|
|
8
|
+
middleware: (getDefaultMiddleware) =>
|
|
9
|
+
getDefaultMiddleware().concat(api.middleware)
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type RootState = ReturnType<typeof store.getState>;
|
|
13
|
+
export type AppDispatch = typeof store.dispatch;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
|
|
2
|
+
|
|
3
|
+
export const api = createApi({
|
|
4
|
+
reducerPath: "api",
|
|
5
|
+
baseQuery: fetchBaseQuery({
|
|
6
|
+
baseUrl: import.meta.env.VITE_API_HOST
|
|
7
|
+
}),
|
|
8
|
+
endpoints: (builder) => ({
|
|
9
|
+
login: builder.mutation({
|
|
10
|
+
query: (body) => ({
|
|
11
|
+
url: "/auth/login",
|
|
12
|
+
method: "POST",
|
|
13
|
+
body
|
|
14
|
+
})
|
|
15
|
+
}),
|
|
16
|
+
signup: builder.mutation({
|
|
17
|
+
query: (body) => ({
|
|
18
|
+
url: "/auth/signup",
|
|
19
|
+
method: "POST",
|
|
20
|
+
body
|
|
21
|
+
})
|
|
22
|
+
}),
|
|
23
|
+
verifyOtp: builder.mutation({
|
|
24
|
+
query: (body) => ({
|
|
25
|
+
url: "/auth/verify-otp",
|
|
26
|
+
method: "POST",
|
|
27
|
+
body
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const {
|
|
34
|
+
useLoginMutation,
|
|
35
|
+
useSignupMutation,
|
|
36
|
+
useVerifyOtpMutation
|
|
37
|
+
} = api;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as CryptoJS from "crypto-js";
|
|
2
|
+
import ENVIRONMENT from "../contants/constants";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Function to get prime numbers in range (start, end)
|
|
6
|
+
*/
|
|
7
|
+
function getPrimeNumbersInRange(start: number, end: number): number[] {
|
|
8
|
+
const isPrime = (num: number) => {
|
|
9
|
+
for (let i = 2, s = Math.sqrt(num); i <= s; i++) {
|
|
10
|
+
if (num % i === 0) return false;
|
|
11
|
+
}
|
|
12
|
+
return num > 1;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const primes = [];
|
|
16
|
+
for (let i = start; i <= end; i++) {
|
|
17
|
+
if (isPrime(i)) primes.push(i);
|
|
18
|
+
}
|
|
19
|
+
return primes;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getKey(value: number): string {
|
|
23
|
+
const key = ENVIRONMENT.STRING || "asdfasdfasd";
|
|
24
|
+
|
|
25
|
+
// Function to get prime numbers in range (1, value)
|
|
26
|
+
const primeNumbers = getPrimeNumbersInRange(1, value);
|
|
27
|
+
|
|
28
|
+
// Get the string according to the prime numbers
|
|
29
|
+
const resultString = primeNumbers
|
|
30
|
+
.map((num) => key[num % key.length])
|
|
31
|
+
.join("");
|
|
32
|
+
|
|
33
|
+
return resultString;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const key = getKey(50);
|
|
37
|
+
|
|
38
|
+
const encryptData = (data: any) => {
|
|
39
|
+
if (data) {
|
|
40
|
+
const stringData = JSON.stringify(data);
|
|
41
|
+
const encrypted = CryptoJS.AES.encrypt(stringData, key).toString();
|
|
42
|
+
return encrypted;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const decryptData = (data: any) => {
|
|
47
|
+
if (data) {
|
|
48
|
+
const decrypted = CryptoJS.AES.decrypt(data, key);
|
|
49
|
+
const stringData = decrypted.toString(CryptoJS.enc.Utf8);
|
|
50
|
+
try {
|
|
51
|
+
return JSON.parse(stringData);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
console.error("Failed to parse decrypted data", e);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { encryptData, decryptData };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"types": ["vite/client"],
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
|
|
11
|
+
/* Bundler mode */
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"moduleDetection": "force",
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"jsx": "react-jsx",
|
|
18
|
+
|
|
19
|
+
/* Linting */
|
|
20
|
+
"strict": true,
|
|
21
|
+
"noUnusedLocals": true,
|
|
22
|
+
"noUnusedParameters": true,
|
|
23
|
+
"erasableSyntaxOnly": true,
|
|
24
|
+
"noFallthroughCasesInSwitch": true,
|
|
25
|
+
"noUncheckedSideEffectImports": true
|
|
26
|
+
},
|
|
27
|
+
"include": ["src"]
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"erasableSyntaxOnly": true,
|
|
22
|
+
"noFallthroughCasesInSwitch": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true
|
|
24
|
+
},
|
|
25
|
+
"include": ["vite.config.ts"]
|
|
26
|
+
}
|