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.
- package/bin/index.js +78 -0
- package/package.json +25 -0
- package/templates/react/js/tailwind/axios/README.md +73 -0
- package/templates/react/js/tailwind/axios/eslint.config.js +23 -0
- package/templates/react/js/tailwind/axios/index.html +13 -0
- package/templates/react/js/tailwind/axios/package-lock.json +4469 -0
- package/templates/react/js/tailwind/axios/package.json +35 -0
- package/templates/react/js/tailwind/axios/postcss.config.js +6 -0
- package/templates/react/js/tailwind/axios/public/vite.svg +1 -0
- package/templates/react/js/tailwind/axios/react-ts-tailwind-axios/.env.example +1 -0
- package/templates/react/js/tailwind/axios/src/App.css +0 -0
- package/templates/react/js/tailwind/axios/src/App.jsx +14 -0
- package/templates/react/js/tailwind/axios/src/api/axios.js +201 -0
- package/templates/react/js/tailwind/axios/src/component/auth/VerifyOtpModal.jsx +65 -0
- package/templates/react/js/tailwind/axios/src/component/common/ui/Toast/Toast.js +59 -0
- package/templates/react/js/tailwind/axios/src/contants/constants.js +45 -0
- package/templates/react/js/tailwind/axios/src/index.css +4 -0
- package/templates/react/js/tailwind/axios/src/main.jsx +12 -0
- package/templates/react/js/tailwind/axios/src/pages/Dashboard.jsx +10 -0
- package/templates/react/js/tailwind/axios/src/pages/Login.jsx +70 -0
- package/templates/react/js/tailwind/axios/src/pages/Signup.jsx +75 -0
- package/templates/react/js/tailwind/axios/src/router/AppRoutes.jsx +19 -0
- package/templates/react/js/tailwind/axios/src/utils/utils.js +59 -0
- package/templates/react/js/tailwind/axios/tailwind.config.js +8 -0
- package/templates/react/js/tailwind/axios/vite.config.js +6 -0
- package/templates/react/ts/tailwind/axios/README.md +73 -0
- package/templates/react/ts/tailwind/axios/eslint.config.js +23 -0
- package/templates/react/ts/tailwind/axios/index.html +13 -0
- package/templates/react/ts/tailwind/axios/package-lock.json +4498 -0
- package/templates/react/ts/tailwind/axios/package.json +38 -0
- package/templates/react/ts/tailwind/axios/postcss.config.js +6 -0
- package/templates/react/ts/tailwind/axios/public/vite.svg +1 -0
- package/templates/react/ts/tailwind/axios/react-ts-tailwind-axios/.env.example +1 -0
- package/templates/react/ts/tailwind/axios/src/App.css +0 -0
- package/templates/react/ts/tailwind/axios/src/App.tsx +14 -0
- package/templates/react/ts/tailwind/axios/src/api/axios.ts +236 -0
- package/templates/react/ts/tailwind/axios/src/component/auth/VerifyOtpModal.tsx +70 -0
- package/templates/react/ts/tailwind/axios/src/component/common/ui/Toast/Toast.ts +58 -0
- package/templates/react/ts/tailwind/axios/src/contants/constants.ts +45 -0
- package/templates/react/ts/tailwind/axios/src/index.css +4 -0
- package/templates/react/ts/tailwind/axios/src/main.tsx +10 -0
- package/templates/react/ts/tailwind/axios/src/pages/Dashboard.tsx +10 -0
- package/templates/react/ts/tailwind/axios/src/pages/Login.tsx +70 -0
- package/templates/react/ts/tailwind/axios/src/pages/Signup.tsx +75 -0
- package/templates/react/ts/tailwind/axios/src/router/AppRoutes.tsx +19 -0
- package/templates/react/ts/tailwind/axios/src/utils/utils.ts +59 -0
- package/templates/react/ts/tailwind/axios/tailwind.config.js +8 -0
- package/templates/react/ts/tailwind/axios/tsconfig.app.json +28 -0
- package/templates/react/ts/tailwind/axios/tsconfig.json +12 -0
- package/templates/react/ts/tailwind/axios/tsconfig.node.json +26 -0
- package/templates/react/ts/tailwind/axios/vite.config.ts +7 -0
package/bin/index.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import inquirer from "inquirer";
|
|
4
|
+
import fs from "fs-extra";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { execa } from "execa";
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
import { fileURLToPath } from "url";
|
|
9
|
+
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = path.dirname(__filename);
|
|
12
|
+
const cwd = process.cwd();
|
|
13
|
+
|
|
14
|
+
async function run() {
|
|
15
|
+
console.log(chalk.blue("\n🚀 Create Frontend Boilerplate\n"));
|
|
16
|
+
|
|
17
|
+
const answers = await inquirer.prompt([
|
|
18
|
+
{
|
|
19
|
+
type: "list",
|
|
20
|
+
name: "framework",
|
|
21
|
+
message: "Choose framework:",
|
|
22
|
+
choices: ["react", "next"]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: "list",
|
|
26
|
+
name: "language",
|
|
27
|
+
message: "Choose language:",
|
|
28
|
+
choices: ["ts", "js"]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "list",
|
|
32
|
+
name: "style",
|
|
33
|
+
message: "Choose styling:",
|
|
34
|
+
choices: ["tailwind", "scss"]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "input",
|
|
38
|
+
name: "projectName",
|
|
39
|
+
message: "Project name:",
|
|
40
|
+
default: "my-app"
|
|
41
|
+
}
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
const templatePath = path.resolve(
|
|
45
|
+
__dirname,
|
|
46
|
+
"../templates",
|
|
47
|
+
answers.framework,
|
|
48
|
+
answers.language,
|
|
49
|
+
answers.style,
|
|
50
|
+
"axios"
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
console.log("Using template path:", templatePath);
|
|
54
|
+
|
|
55
|
+
if (!fs.existsSync(templatePath)) {
|
|
56
|
+
console.error(
|
|
57
|
+
chalk.red("\n❌ Template not found. Please check templates folder.\n")
|
|
58
|
+
);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const targetPath = path.join(cwd, answers.projectName);
|
|
63
|
+
|
|
64
|
+
await fs.copy(templatePath, targetPath);
|
|
65
|
+
|
|
66
|
+
console.log(chalk.yellow("\n📦 Installing dependencies...\n"));
|
|
67
|
+
|
|
68
|
+
await execa("npm", ["install"], {
|
|
69
|
+
cwd: targetPath,
|
|
70
|
+
stdio: "inherit"
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
console.log(chalk.green("\n✅ Done!\n"));
|
|
74
|
+
console.log(`cd ${answers.projectName}`);
|
|
75
|
+
console.log("npm run dev");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
run();
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-fe-boilerplate",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI to scaffold React boilerplates with authentication, OTP, Tailwind and Axios",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-fe-boilerplate": "bin/index.js"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"chalk": "^5.6.2",
|
|
11
|
+
"commander": "^11.0.0",
|
|
12
|
+
"crypto-js": "^4.2.0",
|
|
13
|
+
"execa": "^8.0.1",
|
|
14
|
+
"fs-extra": "^11.3.3",
|
|
15
|
+
"inquirer": "^9.3.8",
|
|
16
|
+
"react-toastify": "^11.0.5"
|
|
17
|
+
},
|
|
18
|
+
"main": "index.js",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [],
|
|
23
|
+
"author": "",
|
|
24
|
+
"license": "ISC"
|
|
25
|
+
}
|
|
@@ -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-js-tailwind-axios</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|