@leo-h/create-nodejs-app 1.0.20 → 1.0.22

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 (53) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/package.json.js +1 -1
  3. package/dist/src/compose-app/replace-content-in-file.compose.js +1 -1
  4. package/dist/src/core/validation.js +1 -1
  5. package/dist/src/validations/back-end-framework.validation.js +1 -0
  6. package/dist/src/validations/front-end-framework.validation.js +1 -0
  7. package/dist/src/validations/project-name-validation.js +1 -1
  8. package/dist/src/validations/template.validation.js +1 -1
  9. package/package.json +2 -2
  10. package/templates/clean/package.json +1 -1
  11. package/templates/clean/pnpm-lock.yaml +24 -24
  12. package/templates/fastify/package.json +1 -1
  13. package/templates/fastify/pnpm-lock.yaml +28 -28
  14. package/templates/nest/package.json +1 -1
  15. package/templates/nest/pnpm-lock.yaml +26 -26
  16. package/templates/react-vite/.env.example +8 -0
  17. package/templates/react-vite/.husky/pre-commit +1 -0
  18. package/templates/react-vite/.lintstagedrc.json +4 -0
  19. package/templates/react-vite/.prettierignore +7 -0
  20. package/templates/react-vite/.prettierrc.json +6 -0
  21. package/templates/react-vite/eslint.config.js +36 -0
  22. package/templates/react-vite/gitignore +24 -0
  23. package/templates/react-vite/index.html +12 -0
  24. package/templates/react-vite/npmrc +1 -0
  25. package/templates/react-vite/orval.config.ts +51 -0
  26. package/templates/react-vite/package.json +50 -0
  27. package/templates/react-vite/pnpm-lock.yaml +5412 -0
  28. package/templates/react-vite/public/vite.svg +1 -0
  29. package/templates/react-vite/scripts/orval-generate-api-definition.ts +90 -0
  30. package/templates/react-vite/src/@types/routes.ts +24 -0
  31. package/templates/react-vite/src/api/errors/api-error.ts +7 -0
  32. package/templates/react-vite/src/api/errors/api-unexpected-response-error.ts +8 -0
  33. package/templates/react-vite/src/api/swr-fetcher.ts +41 -0
  34. package/templates/react-vite/src/app.tsx +14 -0
  35. package/templates/react-vite/src/env.ts +19 -0
  36. package/templates/react-vite/src/hooks/use-current-route-handle-params.ts +16 -0
  37. package/templates/react-vite/src/index.css +29 -0
  38. package/templates/react-vite/src/lib/zod-i18n-translation-for-end-users.json +103 -0
  39. package/templates/react-vite/src/lib/zod-i18n.ts +20 -0
  40. package/templates/react-vite/src/main.tsx +13 -0
  41. package/templates/react-vite/src/pages/_layouts/app.tsx +17 -0
  42. package/templates/react-vite/src/pages/_layouts/auth.tsx +17 -0
  43. package/templates/react-vite/src/pages/app/dashboard/dashboard.tsx +12 -0
  44. package/templates/react-vite/src/pages/app/dashboard/styles.css +40 -0
  45. package/templates/react-vite/src/pages/auth/sign-in/index.tsx +83 -0
  46. package/templates/react-vite/src/pages/auth/sign-in/styles.css +92 -0
  47. package/templates/react-vite/src/routes.tsx +65 -0
  48. package/templates/react-vite/src/vite-env.d.ts +1 -0
  49. package/templates/react-vite/tsconfig.app.json +32 -0
  50. package/templates/react-vite/tsconfig.json +13 -0
  51. package/templates/react-vite/tsconfig.node.json +24 -0
  52. package/templates/react-vite/vite.config.ts +9 -0
  53. package/dist/src/validations/framework.validation.js +0 -1
@@ -0,0 +1,65 @@
1
+ import { createBrowserRouter } from "react-router";
2
+ import {
3
+ CustomRouteDefinition,
4
+ ReactRouterRouteDefinition,
5
+ } from "./@types/routes";
6
+ import { AppLayout } from "./pages/_layouts/app";
7
+ import { AuthLayout } from "./pages/_layouts/auth";
8
+ import { SignIn } from "./pages/auth/sign-in";
9
+ import { Dashboard } from "./pages/app/dashboard/dashboard";
10
+
11
+ export const authNavigationRoutes = [
12
+ {
13
+ path: "/sign-in",
14
+ label: "Sign In",
15
+ },
16
+ ] as const satisfies CustomRouteDefinition[];
17
+
18
+ export const appNavigationRoutes = [
19
+ {
20
+ path: "/dashboard",
21
+ label: "Dashboard",
22
+ },
23
+ ] as const satisfies CustomRouteDefinition[];
24
+
25
+ export const router = createBrowserRouter([
26
+ {
27
+ element: <AuthLayout />,
28
+ children: [
29
+ {
30
+ path: "*",
31
+ element: <SignIn />,
32
+ index: true,
33
+ handle: {
34
+ metadata: {
35
+ title: "Sign In",
36
+ },
37
+ },
38
+ },
39
+ {
40
+ path: "/sign-in",
41
+ element: <SignIn />,
42
+ index: true,
43
+ handle: {
44
+ metadata: {
45
+ title: "Sign In",
46
+ },
47
+ },
48
+ },
49
+ ] satisfies ReactRouterRouteDefinition<typeof authNavigationRoutes>[],
50
+ },
51
+ {
52
+ element: <AppLayout />,
53
+ children: [
54
+ {
55
+ path: "/dashboard",
56
+ element: <Dashboard />,
57
+ handle: {
58
+ metadata: {
59
+ title: "Dashboard",
60
+ },
61
+ },
62
+ },
63
+ ] satisfies ReactRouterRouteDefinition<typeof appNavigationRoutes>[],
64
+ },
65
+ ]);
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
+ "target": "ES2020",
5
+ "useDefineForClassFields": true,
6
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
+ "module": "ESNext",
8
+ "skipLibCheck": true,
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "isolatedModules": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+ "jsx": "react-jsx",
17
+
18
+ /* Linting */
19
+ "strict": true,
20
+ "noUnusedLocals": true,
21
+ "noUnusedParameters": true,
22
+ "noFallthroughCasesInSwitch": true,
23
+ "noUncheckedSideEffectImports": true,
24
+
25
+ /* Custom */
26
+ "baseUrl": ".",
27
+ "paths": {
28
+ "@/*": ["./src/*"]
29
+ }
30
+ },
31
+ "include": ["src"]
32
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
6
+ ],
7
+ "compilerOptions": {
8
+ "baseUrl": ".",
9
+ "paths": {
10
+ "@/*": ["./src/*"]
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "ES2022",
5
+ "lib": ["ES2023"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "isolatedModules": true,
13
+ "moduleDetection": "force",
14
+ "noEmit": true,
15
+
16
+ /* Linting */
17
+ "strict": true,
18
+ "noUnusedLocals": true,
19
+ "noUnusedParameters": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+ "noUncheckedSideEffectImports": true
22
+ },
23
+ "include": ["vite.config.ts"]
24
+ }
@@ -0,0 +1,9 @@
1
+ import react from "@vitejs/plugin-react";
2
+ import { defineConfig } from "vite";
3
+ import tsconfigPaths from "vite-tsconfig-paths";
4
+
5
+ // https://vite.dev/config/
6
+ export default defineConfig({
7
+ plugins: [react(), tsconfigPaths()],
8
+ envPrefix: "APP",
9
+ });
@@ -1 +0,0 @@
1
- const validation=require("../core/validation.js"),getValidOptionsFromPrompt=require("../utils/get-valid-options-from-prompt.js"),frameworks=[{title:"Fastify",value:"fastify"},{title:"Nest + SWC",value:"nest"},{title:"tRPC",value:"trpc",disabled:!0}],validFrameworks=getValidOptionsFromPrompt.getValidOptionsFromSelect(frameworks);class FrameworkValidation extends validation.Validation{static create(t){return new this().createValidation(t)}async validate(){let{framework:t}=this.params;return t=t.toLowerCase(),validFrameworks.includes(t)?{isValid:!0}:{isValid:!1,issue:`Invalid framework, consider the options: ${validFrameworks.map(e=>`"${e}"`).join(", ")}.`}}}exports.FrameworkValidation=FrameworkValidation;exports.frameworks=frameworks;exports.validFrameworks=validFrameworks;