@t1ep1l0t/create-fsd 2.0.1 → 3.0.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 (42) hide show
  1. package/README.md +105 -49
  2. package/bin/cli.js +36 -12
  3. package/package.json +8 -4
  4. package/templates/react-ts/.editorconfig +12 -0
  5. package/templates/react-ts/.env.example +1 -0
  6. package/templates/react-ts/.prettierignore +7 -0
  7. package/templates/react-ts/.prettierrc +10 -0
  8. package/templates/react-ts/.vscode/extensions.json +7 -0
  9. package/templates/react-ts/README.md +70 -0
  10. package/templates/react-ts/eslint.config.js +143 -0
  11. package/templates/react-ts/index.html +13 -0
  12. package/templates/react-ts/package.json +55 -0
  13. package/templates/react-ts/public/locales/en/basic.json +9 -0
  14. package/templates/react-ts/public/locales/ru/basic.json +9 -0
  15. package/templates/react-ts/src/app/App.tsx +11 -0
  16. package/templates/react-ts/src/app/providers/i18n/index.ts +37 -0
  17. package/templates/react-ts/src/app/providers/router/index.tsx +25 -0
  18. package/templates/react-ts/src/app/styles/global.css +15 -0
  19. package/templates/react-ts/src/app/styles/index.css +9 -0
  20. package/templates/react-ts/src/entities/.gitkeep +0 -0
  21. package/templates/react-ts/src/features/.gitkeep +0 -0
  22. package/templates/react-ts/src/main.tsx +14 -0
  23. package/templates/react-ts/src/pages/about/AboutPage.tsx +91 -0
  24. package/templates/react-ts/src/pages/about/index.ts +1 -0
  25. package/templates/react-ts/src/pages/home/HomePage.tsx +94 -0
  26. package/templates/react-ts/src/pages/home/index.ts +1 -0
  27. package/templates/react-ts/src/shared/api/client.ts +32 -0
  28. package/templates/react-ts/src/shared/api/query-client.ts +11 -0
  29. package/templates/react-ts/src/shared/store/counter.ts +15 -0
  30. package/templates/react-ts/src/shared/ui/Button/Button.tsx +31 -0
  31. package/templates/react-ts/src/shared/ui/Button/index.ts +1 -0
  32. package/templates/react-ts/src/shared/ui/Card/Card.tsx +16 -0
  33. package/templates/react-ts/src/shared/ui/Card/index.ts +1 -0
  34. package/templates/react-ts/src/vite-env.d.ts +10 -0
  35. package/templates/react-ts/src/widgets/Header/Header.tsx +45 -0
  36. package/templates/react-ts/src/widgets/Header/index.ts +1 -0
  37. package/templates/react-ts/src/widgets/layouts/BaseLayout/BaseLayout.tsx +13 -0
  38. package/templates/react-ts/src/widgets/layouts/BaseLayout/index.ts +1 -0
  39. package/templates/react-ts/tsconfig.app.json +39 -0
  40. package/templates/react-ts/tsconfig.json +37 -0
  41. package/templates/react-ts/tsconfig.node.json +11 -0
  42. package/templates/react-ts/vite.config.ts +23 -0
@@ -0,0 +1,10 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ readonly VITE_API_URL: string
5
+ // add more env variables here as needed
6
+ }
7
+
8
+ interface ImportMeta {
9
+ readonly env: ImportMetaEnv
10
+ }
@@ -0,0 +1,45 @@
1
+ import { Link } from 'react-router-dom';
2
+ import { useTranslation } from 'react-i18next';
3
+
4
+ export function Header() {
5
+ const { t, i18n } = useTranslation();
6
+
7
+ const toggleLanguage = () => {
8
+ const newLang = i18n.language === 'en' ? 'ru' : 'en';
9
+ i18n.changeLanguage(newLang);
10
+ };
11
+
12
+ return (
13
+ <header className="bg-white shadow-sm">
14
+ <div className="container mx-auto px-4 py-4">
15
+ <nav className="flex items-center justify-between">
16
+ <div className="flex items-center gap-8">
17
+ <Link to="/" className="text-xl font-bold text-blue-600">
18
+ FSD App
19
+ </Link>
20
+ <div className="flex gap-4">
21
+ <Link
22
+ to="/"
23
+ className="text-gray-700 hover:text-blue-600 transition-colors"
24
+ >
25
+ {t('home')}
26
+ </Link>
27
+ <Link
28
+ to="/about"
29
+ className="text-gray-700 hover:text-blue-600 transition-colors"
30
+ >
31
+ {t('about')}
32
+ </Link>
33
+ </div>
34
+ </div>
35
+ <button
36
+ onClick={toggleLanguage}
37
+ className="px-3 py-1 bg-gray-100 hover:bg-gray-200 rounded-md text-sm transition-colors"
38
+ >
39
+ {i18n.language === 'en' ? 'RU' : 'EN'}
40
+ </button>
41
+ </nav>
42
+ </div>
43
+ </header>
44
+ );
45
+ }
@@ -0,0 +1 @@
1
+ export { Header } from './Header';
@@ -0,0 +1,13 @@
1
+ import { Outlet } from 'react-router-dom';
2
+ import { Header } from '@widgets/Header';
3
+
4
+ export function BaseLayout() {
5
+ return (
6
+ <div className="min-h-screen bg-gray-50">
7
+ <Header />
8
+ <main className="container mx-auto px-4 py-8">
9
+ <Outlet />
10
+ </main>
11
+ </div>
12
+ );
13
+ }
@@ -0,0 +1 @@
1
+ export { BaseLayout } from './BaseLayout';
@@ -0,0 +1,39 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "target": "ES2020",
6
+ "useDefineForClassFields": true,
7
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
8
+ "module": "ESNext",
9
+ "skipLibCheck": true,
10
+
11
+ /* Bundler mode */
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "moduleDetection": "force",
17
+ "noEmit": true,
18
+ "jsx": "react-jsx",
19
+
20
+ /* Linting */
21
+ "strict": true,
22
+ "noUnusedLocals": true,
23
+ "noUnusedParameters": true,
24
+ "noFallthroughCasesInSwitch": true,
25
+
26
+ /* Path aliases */
27
+ "baseUrl": ".",
28
+ "paths": {
29
+ "@/*": ["./src/*"],
30
+ "@app/*": ["./src/app/*"],
31
+ "@pages/*": ["./src/pages/*"],
32
+ "@widgets/*": ["./src/widgets/*"],
33
+ "@features/*": ["./src/features/*"],
34
+ "@entities/*": ["./src/entities/*"],
35
+ "@shared/*": ["./src/shared/*"]
36
+ }
37
+ },
38
+ "include": ["src"]
39
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true,
15
+ "jsx": "react-jsx",
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+
23
+ /* Path aliases */
24
+ "baseUrl": ".",
25
+ "paths": {
26
+ "@/*": ["./src/*"],
27
+ "@app/*": ["./src/app/*"],
28
+ "@pages/*": ["./src/pages/*"],
29
+ "@widgets/*": ["./src/widgets/*"],
30
+ "@features/*": ["./src/features/*"],
31
+ "@entities/*": ["./src/entities/*"],
32
+ "@shared/*": ["./src/shared/*"]
33
+ }
34
+ },
35
+ "include": ["src"],
36
+ "references": [{ "path": "./tsconfig.node.json" }]
37
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "skipLibCheck": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "allowSyntheticDefaultImports": true,
8
+ "strict": true
9
+ },
10
+ "include": ["vite.config.ts"]
11
+ }
@@ -0,0 +1,23 @@
1
+ import path from 'path'
2
+ import { fileURLToPath } from 'url'
3
+
4
+ import tailwindcss from '@tailwindcss/vite'
5
+ import react from '@vitejs/plugin-react'
6
+ import { defineConfig } from 'vite'
7
+
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
9
+
10
+ export default defineConfig({
11
+ plugins: [react(), tailwindcss()],
12
+ resolve: {
13
+ alias: {
14
+ '@': path.resolve(__dirname, './src'),
15
+ '@app': path.resolve(__dirname, './src/app'),
16
+ '@pages': path.resolve(__dirname, './src/pages'),
17
+ '@widgets': path.resolve(__dirname, './src/widgets'),
18
+ '@features': path.resolve(__dirname, './src/features'),
19
+ '@entities': path.resolve(__dirname, './src/entities'),
20
+ '@shared': path.resolve(__dirname, './src/shared'),
21
+ },
22
+ },
23
+ })