create-fe-boilerplate 0.1.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.
Files changed (51) hide show
  1. package/bin/index.js +78 -0
  2. package/package.json +25 -0
  3. package/templates/react/js/tailwind/axios/README.md +73 -0
  4. package/templates/react/js/tailwind/axios/eslint.config.js +23 -0
  5. package/templates/react/js/tailwind/axios/index.html +13 -0
  6. package/templates/react/js/tailwind/axios/package-lock.json +4469 -0
  7. package/templates/react/js/tailwind/axios/package.json +35 -0
  8. package/templates/react/js/tailwind/axios/postcss.config.js +6 -0
  9. package/templates/react/js/tailwind/axios/public/vite.svg +1 -0
  10. package/templates/react/js/tailwind/axios/react-ts-tailwind-axios/.env.example +1 -0
  11. package/templates/react/js/tailwind/axios/src/App.css +0 -0
  12. package/templates/react/js/tailwind/axios/src/App.jsx +14 -0
  13. package/templates/react/js/tailwind/axios/src/api/axios.js +201 -0
  14. package/templates/react/js/tailwind/axios/src/component/auth/VerifyOtpModal.jsx +65 -0
  15. package/templates/react/js/tailwind/axios/src/component/common/ui/Toast/Toast.js +59 -0
  16. package/templates/react/js/tailwind/axios/src/contants/constants.js +45 -0
  17. package/templates/react/js/tailwind/axios/src/index.css +4 -0
  18. package/templates/react/js/tailwind/axios/src/main.jsx +12 -0
  19. package/templates/react/js/tailwind/axios/src/pages/Dashboard.jsx +10 -0
  20. package/templates/react/js/tailwind/axios/src/pages/Login.jsx +70 -0
  21. package/templates/react/js/tailwind/axios/src/pages/Signup.jsx +75 -0
  22. package/templates/react/js/tailwind/axios/src/router/AppRoutes.jsx +19 -0
  23. package/templates/react/js/tailwind/axios/src/utils/utils.js +59 -0
  24. package/templates/react/js/tailwind/axios/tailwind.config.js +8 -0
  25. package/templates/react/js/tailwind/axios/vite.config.js +6 -0
  26. package/templates/react/ts/tailwind/axios/README.md +73 -0
  27. package/templates/react/ts/tailwind/axios/eslint.config.js +23 -0
  28. package/templates/react/ts/tailwind/axios/index.html +13 -0
  29. package/templates/react/ts/tailwind/axios/package-lock.json +4498 -0
  30. package/templates/react/ts/tailwind/axios/package.json +38 -0
  31. package/templates/react/ts/tailwind/axios/postcss.config.js +6 -0
  32. package/templates/react/ts/tailwind/axios/public/vite.svg +1 -0
  33. package/templates/react/ts/tailwind/axios/react-ts-tailwind-axios/.env.example +1 -0
  34. package/templates/react/ts/tailwind/axios/src/App.css +0 -0
  35. package/templates/react/ts/tailwind/axios/src/App.tsx +14 -0
  36. package/templates/react/ts/tailwind/axios/src/api/axios.ts +236 -0
  37. package/templates/react/ts/tailwind/axios/src/component/auth/VerifyOtpModal.tsx +70 -0
  38. package/templates/react/ts/tailwind/axios/src/component/common/ui/Toast/Toast.ts +58 -0
  39. package/templates/react/ts/tailwind/axios/src/contants/constants.ts +45 -0
  40. package/templates/react/ts/tailwind/axios/src/index.css +4 -0
  41. package/templates/react/ts/tailwind/axios/src/main.tsx +10 -0
  42. package/templates/react/ts/tailwind/axios/src/pages/Dashboard.tsx +10 -0
  43. package/templates/react/ts/tailwind/axios/src/pages/Login.tsx +70 -0
  44. package/templates/react/ts/tailwind/axios/src/pages/Signup.tsx +75 -0
  45. package/templates/react/ts/tailwind/axios/src/router/AppRoutes.tsx +19 -0
  46. package/templates/react/ts/tailwind/axios/src/utils/utils.ts +59 -0
  47. package/templates/react/ts/tailwind/axios/tailwind.config.js +8 -0
  48. package/templates/react/ts/tailwind/axios/tsconfig.app.json +28 -0
  49. package/templates/react/ts/tailwind/axios/tsconfig.json +12 -0
  50. package/templates/react/ts/tailwind/axios/tsconfig.node.json +26 -0
  51. package/templates/react/ts/tailwind/axios/vite.config.ts +7 -0
@@ -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, end) {
8
+ const isPrime = (num) => {
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) {
23
+ const key = ENVIRONMENT.STRING || "asdfasdfasd";
24
+
25
+ // Get prime numbers in range (1, value)
26
+ const primeNumbers = getPrimeNumbersInRange(1, value);
27
+
28
+ // Generate key string using prime indices
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) => {
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) => {
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,8 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ export default {
3
+ content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
4
+ theme: {
5
+ extend: {},
6
+ },
7
+ plugins: [],
8
+ };
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ });
@@ -0,0 +1,73 @@
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## React Compiler
11
+
12
+ The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13
+
14
+ ## Expanding the ESLint configuration
15
+
16
+ If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
17
+
18
+ ```js
19
+ export default defineConfig([
20
+ globalIgnores(['dist']),
21
+ {
22
+ files: ['**/*.{ts,tsx}'],
23
+ extends: [
24
+ // Other configs...
25
+
26
+ // Remove tseslint.configs.recommended and replace with this
27
+ tseslint.configs.recommendedTypeChecked,
28
+ // Alternatively, use this for stricter rules
29
+ tseslint.configs.strictTypeChecked,
30
+ // Optionally, add this for stylistic rules
31
+ tseslint.configs.stylisticTypeChecked,
32
+
33
+ // Other configs...
34
+ ],
35
+ languageOptions: {
36
+ parserOptions: {
37
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
+ tsconfigRootDir: import.meta.dirname,
39
+ },
40
+ // other options...
41
+ },
42
+ },
43
+ ])
44
+ ```
45
+
46
+ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
+
48
+ ```js
49
+ // eslint.config.js
50
+ import reactX from 'eslint-plugin-react-x'
51
+ import reactDom from 'eslint-plugin-react-dom'
52
+
53
+ export default defineConfig([
54
+ globalIgnores(['dist']),
55
+ {
56
+ files: ['**/*.{ts,tsx}'],
57
+ extends: [
58
+ // Other configs...
59
+ // Enable lint rules for React
60
+ reactX.configs['recommended-typescript'],
61
+ // Enable lint rules for React DOM
62
+ reactDom.configs.recommended,
63
+ ],
64
+ languageOptions: {
65
+ parserOptions: {
66
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
+ tsconfigRootDir: import.meta.dirname,
68
+ },
69
+ // other options...
70
+ },
71
+ },
72
+ ])
73
+ ```
@@ -0,0 +1,23 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+ import tseslint from 'typescript-eslint'
6
+ import { defineConfig, globalIgnores } from 'eslint/config'
7
+
8
+ export default defineConfig([
9
+ globalIgnores(['dist']),
10
+ {
11
+ files: ['**/*.{ts,tsx}'],
12
+ extends: [
13
+ js.configs.recommended,
14
+ tseslint.configs.recommended,
15
+ reactHooks.configs.flat.recommended,
16
+ reactRefresh.configs.vite,
17
+ ],
18
+ languageOptions: {
19
+ ecmaVersion: 2020,
20
+ globals: globals.browser,
21
+ },
22
+ },
23
+ ])
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>react-ts-tailwind-axios</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>