@pavlos-samaras/react-cli 2.0.2 → 2.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/dist/commands/generate/utils/generateComponent.d.ts.map +1 -1
- package/dist/commands/generate/utils/generateComponent.js +7 -6
- package/dist/commands/generate/utils/generateComponent.js.map +1 -1
- package/dist/commands/generate/utils/generateHook.d.ts.map +1 -1
- package/dist/commands/generate/utils/generateHook.js +3 -2
- package/dist/commands/generate/utils/generateHook.js.map +1 -1
- package/dist/commands/generate/utils/runGenerateComponent.js +1 -1
- package/dist/commands/generate/utils/runGenerateComponent.js.map +1 -1
- package/dist/commands/generate/utils/runGenerateHook.js +1 -1
- package/dist/commands/generate/utils/runGenerateHook.js.map +1 -1
- package/dist/commands/new/new.constants.d.ts +2 -0
- package/dist/commands/new/new.constants.d.ts.map +1 -1
- package/dist/commands/new/new.constants.js +2 -0
- package/dist/commands/new/new.constants.js.map +1 -1
- package/dist/commands/new/new.d.ts.map +1 -1
- package/dist/commands/new/new.js +16 -27
- package/dist/commands/new/new.js.map +1 -1
- package/dist/commands/new/new.types.d.ts +7 -0
- package/dist/commands/new/new.types.d.ts.map +1 -0
- package/dist/commands/new/new.types.js +2 -0
- package/dist/commands/new/new.types.js.map +1 -0
- package/dist/commands/new/utils/general.d.ts +3 -0
- package/dist/commands/new/utils/general.d.ts.map +1 -0
- package/dist/commands/new/utils/general.js +6 -0
- package/dist/commands/new/utils/general.js.map +1 -0
- package/dist/commands/new/utils/runCommand.d.ts +2 -0
- package/dist/commands/new/utils/runCommand.d.ts.map +1 -0
- package/dist/commands/new/utils/runCommand.js +7 -0
- package/dist/commands/new/utils/runCommand.js.map +1 -0
- package/dist/commands/new/utils/runCreateVite.d.ts +2 -0
- package/dist/commands/new/utils/runCreateVite.d.ts.map +1 -0
- package/dist/commands/new/utils/runCreateVite.js +32 -0
- package/dist/commands/new/utils/runCreateVite.js.map +1 -0
- package/dist/commands/new/utils/runCustomTemplate.d.ts +3 -0
- package/dist/commands/new/utils/runCustomTemplate.d.ts.map +1 -0
- package/dist/commands/new/utils/runCustomTemplate.js +25 -0
- package/dist/commands/new/utils/runCustomTemplate.js.map +1 -0
- package/dist/utils/general.d.ts +4 -0
- package/dist/utils/general.d.ts.map +1 -0
- package/dist/utils/general.js +3 -0
- package/dist/utils/general.js.map +1 -0
- package/package.json +3 -2
- package/templates/component.tpl +9 -0
- package/templates/hook.tpl +3 -0
- package/templates/react/README.md +12 -0
- package/templates/react/eslint.config.js +29 -0
- package/templates/react/index.html +13 -0
- package/templates/react/jsconfig.json +13 -0
- package/templates/react/package.json +30 -0
- package/templates/react/public/favicon.svg +1 -0
- package/templates/react/src/app/App.jsx +12 -0
- package/templates/react/src/app/providers.jsx +13 -0
- package/templates/react/src/app/routes.jsx +19 -0
- package/templates/react/src/config/queryClient.config.js +12 -0
- package/templates/react/src/lib/queryClient.jsx +6 -0
- package/templates/react/src/main.jsx +13 -0
- package/templates/react/src/pages/home/Home.jsx +11 -0
- package/templates/react/src/pages/home/Home.module.scss +0 -0
- package/templates/react/vite.config.js +18 -0
- package/templates/react-ts/README.md +75 -0
- package/templates/react-ts/eslint.config.js +22 -0
- package/templates/react-ts/index.html +13 -0
- package/templates/react-ts/package-lock.json +3221 -0
- package/templates/react-ts/package.json +33 -0
- package/templates/react-ts/public/favicon.svg +1 -0
- package/templates/react-ts/src/app/App.tsx +12 -0
- package/templates/react-ts/src/app/providers.tsx +16 -0
- package/templates/react-ts/src/app/routes.tsx +19 -0
- package/templates/react-ts/src/config/queryClient.config.ts +14 -0
- package/templates/react-ts/src/lib/queryClient.tsx +6 -0
- package/templates/react-ts/src/main.tsx +13 -0
- package/templates/react-ts/src/pages/home/Home.module.scss +0 -0
- package/templates/react-ts/src/pages/home/Home.tsx +11 -0
- package/templates/react-ts/tsconfig.app.json +29 -0
- package/templates/react-ts/tsconfig.json +7 -0
- package/templates/react-ts/tsconfig.node.json +23 -0
- package/templates/react-ts/vite.config.ts +18 -0
- package/templates/stylesheet.tpl +3 -0
- package/dist/templates/component.d.ts +0 -3
- package/dist/templates/component.d.ts.map +0 -1
- package/dist/templates/component.js +0 -11
- package/dist/templates/component.js.map +0 -1
- package/dist/templates/hook.d.ts +0 -3
- package/dist/templates/hook.d.ts.map +0 -1
- package/dist/templates/hook.js +0 -5
- package/dist/templates/hook.js.map +0 -1
- package/dist/templates/stylesheet.d.ts +0 -3
- package/dist/templates/stylesheet.d.ts.map +0 -1
- package/dist/templates/stylesheet.js +0 -7
- package/dist/templates/stylesheet.js.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Suspense, lazy } from "react";
|
|
2
|
+
import { Routes, Route } from "react-router";
|
|
3
|
+
|
|
4
|
+
const HomePage = lazy(() => import("@/pages/home/Home"));
|
|
5
|
+
|
|
6
|
+
const AppRoutes = () => {
|
|
7
|
+
return (
|
|
8
|
+
<Suspense fallback={<div>Loading...</div>}>
|
|
9
|
+
<Routes>
|
|
10
|
+
<Route path="/" element={<HomePage />} />
|
|
11
|
+
|
|
12
|
+
{/* Fallback route, must be last */}
|
|
13
|
+
<Route path="*" element={<div>404 Page Not Found</div>} />
|
|
14
|
+
</Routes>
|
|
15
|
+
</Suspense>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default AppRoutes;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const STALE_TIME_MINS = 5;
|
|
2
|
+
const STALE_TIME_MILLISECONDS = STALE_TIME_MINS * 60 * 1000;
|
|
3
|
+
|
|
4
|
+
export const queryClientConfig = {
|
|
5
|
+
defaultOptions: {
|
|
6
|
+
queries: {
|
|
7
|
+
refetchOnWindowFocus: false,
|
|
8
|
+
retry: 1,
|
|
9
|
+
staleTime: STALE_TIME_MILLISECONDS,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StrictMode } from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
import App from "./app/App.jsx";
|
|
4
|
+
|
|
5
|
+
const rootEl = document.getElementById("root");
|
|
6
|
+
if (!rootEl) throw new Error("root element wasn't found");
|
|
7
|
+
const root = createRoot(rootEl);
|
|
8
|
+
|
|
9
|
+
root.render(
|
|
10
|
+
<StrictMode>
|
|
11
|
+
<App />
|
|
12
|
+
</StrictMode>,
|
|
13
|
+
);
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import react from "@vitejs/plugin-react";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { defineConfig } from "vite";
|
|
4
|
+
|
|
5
|
+
// https://vite.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [react()],
|
|
8
|
+
resolve: {
|
|
9
|
+
alias: {
|
|
10
|
+
"@": path.resolve(import.meta.dirname, "src"),
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
css: {
|
|
14
|
+
modules: {
|
|
15
|
+
localsConvention: "camelCase",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
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 [Oxc](https://oxc.rs)
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
|
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
|
+
|
|
47
|
+
You can also install [eslint-plugin-react-x](https://npmx.dev/package/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://npmx.dev/package/eslint-plugin-react-dom) for React-specific lint rules:
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
// eslint.config.js
|
|
51
|
+
import reactX from 'eslint-plugin-react-x'
|
|
52
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
53
|
+
|
|
54
|
+
export default defineConfig([
|
|
55
|
+
globalIgnores(['dist']),
|
|
56
|
+
{
|
|
57
|
+
files: ['**/*.{ts,tsx}'],
|
|
58
|
+
extends: [
|
|
59
|
+
// Other configs...
|
|
60
|
+
// Enable lint rules for React
|
|
61
|
+
reactX.configs['recommended-typescript'],
|
|
62
|
+
// Enable lint rules for React DOM
|
|
63
|
+
reactDom.configs.recommended,
|
|
64
|
+
],
|
|
65
|
+
languageOptions: {
|
|
66
|
+
parserOptions: {
|
|
67
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
68
|
+
tsconfigRootDir: import.meta.dirname,
|
|
69
|
+
},
|
|
70
|
+
// other options...
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
globals: globals.browser,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
])
|
|
@@ -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="/favicon.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>my-app</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|