@idealyst/cli 1.0.90 → 1.0.92

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 (103) hide show
  1. package/dist/generators/init.js +8 -13
  2. package/dist/generators/init.js.map +1 -1
  3. package/dist/generators/utils.js +3 -7
  4. package/dist/generators/utils.js.map +1 -1
  5. package/dist/template/.devcontainer/gitignore.template +2 -0
  6. package/dist/template/gitignore.template +56 -0
  7. package/dist/template/mcp.json.template +8 -0
  8. package/dist/template/packages/api/gitignore.template +35 -0
  9. package/dist/template/packages/database/gitignore.template +41 -0
  10. package/dist/template/packages/mobile/babel.config.js +1 -2
  11. package/dist/template/packages/mobile/gitignore.template +73 -0
  12. package/dist/template/packages/mobile/package.json +10 -2
  13. package/dist/template/packages/shared/gitignore.template +35 -0
  14. package/dist/template/packages/web/gitignore.template +35 -0
  15. package/dist/template/yarnrc.yml.template +4 -0
  16. package/package.json +2 -2
  17. package/template/.devcontainer/Dockerfile +26 -0
  18. package/template/.devcontainer/devcontainer.json +113 -0
  19. package/template/.devcontainer/docker-compose.yml +59 -0
  20. package/template/.devcontainer/figma-mcp.sh +32 -0
  21. package/template/.devcontainer/setup.sh +45 -0
  22. package/template/.dockerignore +151 -0
  23. package/template/.env.example +36 -0
  24. package/template/.env.production +56 -0
  25. package/template/DOCKER.md +0 -0
  26. package/template/Dockerfile +111 -0
  27. package/template/README.md +233 -0
  28. package/template/docker/nginx/prod.conf +238 -0
  29. package/template/docker/nginx.conf +131 -0
  30. package/template/docker/postgres/init.sql +41 -0
  31. package/template/docker/prometheus/prometheus.yml +52 -0
  32. package/template/docker-compose.prod.yml +146 -0
  33. package/template/docker-compose.yml +143 -0
  34. package/template/jest.config.js +20 -0
  35. package/template/package.json +45 -0
  36. package/template/packages/api/.env.example +6 -0
  37. package/template/packages/api/README.md +274 -0
  38. package/template/packages/api/__tests__/api.test.ts +26 -0
  39. package/template/packages/api/jest.config.js +23 -0
  40. package/template/packages/api/jest.setup.js +9 -0
  41. package/template/packages/api/package.json +56 -0
  42. package/template/packages/api/src/context.ts +19 -0
  43. package/template/packages/api/src/controllers/TestController.ts +0 -0
  44. package/template/packages/api/src/index.ts +9 -0
  45. package/template/packages/api/src/lib/crud.ts +150 -0
  46. package/template/packages/api/src/lib/database.ts +23 -0
  47. package/template/packages/api/src/router/index.ts +163 -0
  48. package/template/packages/api/src/routers/test.ts +59 -0
  49. package/template/packages/api/src/routers/user.example.ts +83 -0
  50. package/template/packages/api/src/server.ts +50 -0
  51. package/template/packages/api/src/trpc.ts +28 -0
  52. package/template/packages/api/tsconfig.json +43 -0
  53. package/template/packages/database/README.md +162 -0
  54. package/template/packages/database/package.json +49 -0
  55. package/template/packages/database/prisma/seed.ts +64 -0
  56. package/template/packages/database/schema.prisma +107 -0
  57. package/template/packages/database/src/index.ts +15 -0
  58. package/template/packages/database/src/validators.ts +10 -0
  59. package/template/packages/database/tsconfig.json +18 -0
  60. package/template/packages/mobile/README.md +86 -0
  61. package/template/packages/mobile/__tests__/App.test.tsx +156 -0
  62. package/template/packages/mobile/__tests__/components.test.tsx +300 -0
  63. package/template/packages/mobile/app.json +5 -0
  64. package/template/packages/mobile/babel.config.js +10 -0
  65. package/template/packages/mobile/index.js +6 -0
  66. package/template/packages/mobile/jest.config.js +21 -0
  67. package/template/packages/mobile/jest.setup.js +12 -0
  68. package/template/packages/mobile/metro.config.js +27 -0
  69. package/template/packages/mobile/package.json +60 -0
  70. package/template/packages/mobile/src/utils/trpc.ts +7 -0
  71. package/template/packages/mobile/tsconfig.json +28 -0
  72. package/template/packages/shared/README.md +135 -0
  73. package/template/packages/shared/__tests__/shared.test.ts +51 -0
  74. package/template/packages/shared/jest.config.js +22 -0
  75. package/template/packages/shared/package.json +62 -0
  76. package/template/packages/shared/src/components/App.tsx +46 -0
  77. package/template/packages/shared/src/components/HelloWorld.tsx +304 -0
  78. package/template/packages/shared/src/components/index.ts +1 -0
  79. package/template/packages/shared/src/index.ts +14 -0
  80. package/template/packages/shared/src/navigation/AppRouter.tsx +565 -0
  81. package/template/packages/shared/src/trpc/client.ts +44 -0
  82. package/template/packages/shared/tsconfig.json +22 -0
  83. package/template/packages/web/README.md +131 -0
  84. package/template/packages/web/__tests__/App.test.tsx +342 -0
  85. package/template/packages/web/__tests__/components.test.tsx +564 -0
  86. package/template/packages/web/index.html +13 -0
  87. package/template/packages/web/jest.config.js +27 -0
  88. package/template/packages/web/jest.setup.js +24 -0
  89. package/template/packages/web/package.json +69 -0
  90. package/template/packages/web/src/components/TestDemo.tsx +164 -0
  91. package/template/packages/web/src/main.tsx +25 -0
  92. package/template/packages/web/src/utils/trpc.ts +7 -0
  93. package/template/packages/web/tsconfig.json +26 -0
  94. package/template/packages/web/vite.config.ts +98 -0
  95. package/template/setup.sh +30 -0
  96. package/template/tsconfig.json +31 -0
  97. package/dist/template/packages/mobile/src/App-with-trpc.tsx +0 -30
  98. package/dist/template/packages/web/src/App-with-trpc.tsx +0 -32
  99. /package/dist/template/{.dockerignore → dockerignore.template} +0 -0
  100. /package/dist/template/{.env.example → env.example.template} +0 -0
  101. /package/dist/template/packages/api/{.env.example → env.example.template} +0 -0
  102. /package/{dist/template/packages/mobile/src/App-with-trpc-and-shared.tsx → template/packages/mobile/src/App.tsx} +0 -0
  103. /package/{dist/template/packages/web/src/App-with-trpc-and-shared.tsx → template/packages/web/src/App.tsx} +0 -0
@@ -0,0 +1,164 @@
1
+ import React, { useState } from 'react';
2
+ import { View, Text, Card, Button, Input } from '@idealyst/components';
3
+ import { trpc } from '../utils/trpc';
4
+
5
+ export const TestDemo: React.FC = () => {
6
+ const [newTestName, setNewTestName] = useState('');
7
+ const [newTestMessage, setNewTestMessage] = useState('');
8
+
9
+ // tRPC queries and mutations
10
+ const { data: tests, isLoading, refetch } = trpc.test.getAll.useQuery();
11
+ const createTestMutation = trpc.test.create.useMutation({
12
+ onSuccess: () => {
13
+ refetch();
14
+ setNewTestName('');
15
+ setNewTestMessage('');
16
+ },
17
+ });
18
+ const deleteTestMutation = trpc.test.delete.useMutation({
19
+ onSuccess: () => {
20
+ refetch();
21
+ },
22
+ });
23
+
24
+ const handleCreateTest = async () => {
25
+ if (!newTestName || !newTestMessage) return;
26
+
27
+ await createTestMutation.mutateAsync({
28
+ name: newTestName,
29
+ message: newTestMessage,
30
+ status: 'active',
31
+ });
32
+ };
33
+
34
+ const handleDeleteTest = async (id: string) => {
35
+ await deleteTestMutation.mutateAsync({ id });
36
+ };
37
+
38
+ if (isLoading) {
39
+ return (
40
+ <Card variant="outlined" padding="lg">
41
+ <Text size="md">Loading tests...</Text>
42
+ </Card>
43
+ );
44
+ }
45
+
46
+ return (
47
+ <View style={{ gap: 16 }}>
48
+ {/* Header */}
49
+ <Card variant="elevated" padding="lg" intent="primary">
50
+ <View style={{ alignItems: 'center' }}>
51
+ <Text style={{ fontSize: 24, marginBottom: 8 }}>🧪</Text>
52
+ <Text size="lg" weight="bold" style={{ marginBottom: 8, textAlign: 'center' }}>
53
+ tRPC + Database Test
54
+ </Text>
55
+ <Text size="md" style={{ textAlign: 'center' }}>
56
+ This demonstrates end-to-end type-safe API calls from the web app to the database.
57
+ </Text>
58
+ </View>
59
+ </Card>
60
+
61
+ {/* Create Test Form */}
62
+ <Card variant="outlined" padding="lg">
63
+ <Text size="md" weight="bold" style={{ marginBottom: 16 }}>
64
+ Create New Test
65
+ </Text>
66
+
67
+ <View style={{ gap: 12 }}>
68
+ <Input
69
+ label="Test Name"
70
+ value={newTestName}
71
+ onChangeText={setNewTestName}
72
+ placeholder="Enter test name"
73
+ />
74
+ <Input
75
+ label="Test Message"
76
+ value={newTestMessage}
77
+ onChangeText={setNewTestMessage}
78
+ placeholder="Enter test message"
79
+ multiline
80
+ />
81
+ <Button
82
+ variant="contained"
83
+ intent="primary"
84
+ onPress={handleCreateTest}
85
+ disabled={!newTestName || !newTestMessage || createTestMutation.isPending}
86
+ >
87
+ {createTestMutation.isPending ? 'Creating...' : 'Create Test'}
88
+ </Button>
89
+ </View>
90
+ </Card>
91
+
92
+ {/* Test Results */}
93
+ <Card variant="outlined" padding="lg">
94
+ <Text size="md" weight="bold" style={{ marginBottom: 16 }}>
95
+ Test Entries ({tests?.count || 0})
96
+ </Text>
97
+
98
+ {tests?.data && tests.data.length > 0 ? (
99
+ <View style={{ gap: 12 }}>
100
+ {tests.data.map((test) => (
101
+ <Card key={test.id} variant="filled" padding="md">
102
+ <View style={{
103
+ flexDirection: 'row',
104
+ justifyContent: 'space-between',
105
+ alignItems: 'flex-start',
106
+ gap: 12
107
+ }}>
108
+ <View style={{ flex: 1 }}>
109
+ <Text size="md" weight="semibold" style={{ marginBottom: 4 }}>
110
+ {test.name}
111
+ </Text>
112
+ <Text size="sm" style={{ marginBottom: 8, opacity: 0.8 }}>
113
+ {test.message}
114
+ </Text>
115
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
116
+ <Card
117
+ variant="filled"
118
+ padding="sm"
119
+ intent={test.status === 'active' ? 'success' : 'neutral'}
120
+ >
121
+ <Text size="sm" weight="semibold">
122
+ {test.status}
123
+ </Text>
124
+ </Card>
125
+ <Text size="sm" style={{ opacity: 0.6 }}>
126
+ {new Date(test.createdAt).toLocaleDateString()}
127
+ </Text>
128
+ </View>
129
+ </View>
130
+ <Button
131
+ variant="outlined"
132
+ intent="error"
133
+ size="sm"
134
+ onPress={() => handleDeleteTest(test.id)}
135
+ disabled={deleteTestMutation.isPending}
136
+ >
137
+ Delete
138
+ </Button>
139
+ </View>
140
+ </Card>
141
+ ))}
142
+ </View>
143
+ ) : (
144
+ <Card variant="filled" padding="md" style={{ opacity: 0.6 }}>
145
+ <Text size="sm" style={{ textAlign: 'center' }}>
146
+ No tests found. Create one above to get started!
147
+ </Text>
148
+ </Card>
149
+ )}
150
+ </Card>
151
+
152
+ {/* Type Safety Info */}
153
+ <Card variant="filled" intent="success" padding="md">
154
+ <Text size="sm" weight="semibold" style={{ marginBottom: 4 }}>
155
+ ✨ Type Safety Features:
156
+ </Text>
157
+ <Text size="sm">
158
+ • Full TypeScript types from database to frontend • tRPC ensures API type safety •
159
+ Prisma provides database schema validation • Real-time type checking across the stack
160
+ </Text>
161
+ </Card>
162
+ </View>
163
+ );
164
+ };
@@ -0,0 +1,25 @@
1
+ import '@idealyst/navigation/examples/unistyles';
2
+
3
+ import * as React from 'react';
4
+ import ReactDOM from 'react-dom/client';
5
+ import App from './App.tsx';
6
+
7
+ // Hydrate the app if it's SSR, otherwise render normally
8
+ const container = document.getElementById('root')!;
9
+
10
+ if (container.hasChildNodes()) {
11
+ // If the container has child nodes, it means we're hydrating SSR content
12
+ ReactDOM.hydrateRoot(container,
13
+ <React.StrictMode>
14
+ <App />
15
+ </React.StrictMode>
16
+ );
17
+ } else {
18
+ // Otherwise, render normally (for development)
19
+ const root = ReactDOM.createRoot(container);
20
+ root.render(
21
+ <React.StrictMode>
22
+ <App />
23
+ </React.StrictMode>
24
+ );
25
+ }
@@ -0,0 +1,7 @@
1
+ // Import tRPC client utilities from shared package
2
+ export {
3
+ trpc,
4
+ createTRPCClient,
5
+ createVanillaTRPCClient
6
+ } from '@{{workspaceScope}}/shared';
7
+ export type { TRPCClientConfig, AppRouter } from '@{{workspaceScope}}/shared';
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
5
+ "module": "ESNext",
6
+ "skipLibCheck": true,
7
+ "allowImportingTsExtensions": true,
8
+ "isolatedModules": true,
9
+ "moduleDetection": "force",
10
+ "noEmit": true,
11
+ "jsx": "react-jsx",
12
+ "strict": true,
13
+ "noUnusedLocals": true,
14
+ "noUnusedParameters": true,
15
+ "noFallthroughCasesInSwitch": true,
16
+ "noUncheckedIndexedAccess": true,
17
+ "baseUrl": ".",
18
+ "paths": {
19
+ "@/*": ["./src/*"],
20
+ "react-native": ["node_modules/react-native-web"]
21
+ },
22
+ "types": ["vite/client"]
23
+ },
24
+ "include": ["src/**/*"],
25
+ "exclude": ["node_modules", "dist"]
26
+ }
@@ -0,0 +1,98 @@
1
+ import react from "@vitejs/plugin-react";
2
+ import path from "path";
3
+ import { defineConfig } from "vite";
4
+ import babel from "vite-plugin-babel";
5
+
6
+ // https://vitejs.dev/config/
7
+ export default defineConfig({
8
+ plugins: [
9
+ babel({
10
+ filter: (id) =>
11
+ id.includes("node_modules/@idealyst/") ||
12
+ (id.includes("/packages/") &&
13
+ !id.includes("/packages/web/") &&
14
+ /\.(tsx?|jsx?)$/.test(id)),
15
+ babelConfig: {
16
+ presets: [
17
+ ["@babel/preset-react", { runtime: "automatic" }],
18
+ [
19
+ "@babel/preset-typescript",
20
+ {
21
+ isTSX: true,
22
+ allExtensions: true,
23
+ },
24
+ ],
25
+ ],
26
+ plugins: [
27
+ [
28
+ "react-native-unistyles/plugin",
29
+ {
30
+ root: "src",
31
+ autoProcessPaths: [
32
+ "@idealyst/components",
33
+ "@idealyst/navigation",
34
+ "@idealyst/theme",
35
+ ],
36
+ },
37
+ ],
38
+ ["@idealyst/components/plugin/web", { root: "src" }],
39
+ ],
40
+ },
41
+ }),
42
+ // Then process everything else with React plugin
43
+ react(),
44
+ ],
45
+ resolve: {
46
+ alias: {
47
+ // Use absolute path to resolve react-native-web properly
48
+ "react-native": path.resolve(__dirname, "node_modules/react-native-web"),
49
+ "@react-native/normalize-colors": path.resolve(
50
+ __dirname,
51
+ "../../node_modules/@react-native/normalize-colors"
52
+ ),
53
+ },
54
+ // Platform-specific file resolution
55
+ extensions: [".web.tsx", ".web.ts", ".tsx", ".ts", ".js", ".jsx"],
56
+ // Ensure proper resolution of package exports
57
+ conditions: ["browser", "import", "module", "default"],
58
+ // Ensure workspace dependencies resolve properly
59
+ preserveSymlinks: false,
60
+ },
61
+ define: {
62
+ global: "globalThis",
63
+ __DEV__: JSON.stringify(true),
64
+ },
65
+ optimizeDeps: {
66
+ include: [
67
+ "react-native-web",
68
+ "react-native-unistyles",
69
+ "react-native-unistyles/web",
70
+ "@mdi/react",
71
+ "@mdi/js",
72
+ ],
73
+ exclude: [
74
+ "react-native-edge-to-edge",
75
+ "react-native-nitro-modules",
76
+ "@idealyst/components",
77
+ "@idealyst/navigation",
78
+ "@idealyst/theme",
79
+ "@test/shared",
80
+ ],
81
+ esbuildOptions: {
82
+ loader: {
83
+ ".tsx": "tsx",
84
+ ".ts": "ts",
85
+ ".jsx": "jsx",
86
+ ".js": "jsx", // Important: treat .js files as JSX for React Native compatibility
87
+ },
88
+ alias: {
89
+ "react-native": path.resolve(__dirname, "node_modules/react-native-web"),
90
+ "@react-native/normalize-colors": path.resolve(__dirname, "../../node_modules/@react-native/normalize-colors"),
91
+ },
92
+ },
93
+ },
94
+ server: {
95
+ host: "0.0.0.0",
96
+ port: 5173,
97
+ },
98
+ });
@@ -0,0 +1,30 @@
1
+ #!/bin/bash
2
+
3
+ # Idealyst Framework Workspace Setup Script
4
+ # This script sets up the development environment for your workspace
5
+
6
+ echo "🏗️ Setting up Idealyst Framework workspace..."
7
+
8
+ # Install dependencies
9
+ echo "📦 Installing dependencies..."
10
+ yarn install
11
+
12
+ # Build all packages
13
+ echo "🔨 Building packages..."
14
+ yarn build:packages
15
+
16
+ # Set up git hooks (if using husky)
17
+ if [ -f "package.json" ] && grep -q "husky" package.json; then
18
+ echo "🪝 Setting up git hooks..."
19
+ yarn prepare
20
+ fi
21
+
22
+ echo "✅ Workspace setup complete!"
23
+ echo ""
24
+ echo "🚀 Quick start:"
25
+ echo " • Run 'yarn dev' to start development mode"
26
+ echo " • Run 'yarn build' to build all packages"
27
+ echo " • Run 'yarn test' to run tests"
28
+ echo " • Use 'idealyst create <type> <name>' to add new projects"
29
+ echo ""
30
+ echo "📚 Check README.md and DOCKER.md for more information."
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["ES2020"],
5
+ "module": "commonjs",
6
+ "esModuleInterop": true,
7
+ "allowSyntheticDefaultImports": true,
8
+ "strict": true,
9
+ "skipLibCheck": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "declaration": true,
12
+ "declarationMap": true,
13
+ "sourceMap": true,
14
+ "outDir": "./dist",
15
+ "rootDir": "./src"
16
+ },
17
+ "include": [
18
+ "packages/*/src/**/*"
19
+ ],
20
+ "exclude": [
21
+ "node_modules",
22
+ "dist",
23
+ "**/*.test.ts",
24
+ "**/*.spec.ts"
25
+ ],
26
+ "references": [
27
+ {
28
+ "path": "./packages/*"
29
+ }
30
+ ]
31
+ }
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
3
- import { NavigatorProvider } from '@idealyst/navigation';
4
- import { trpc, createTRPCClient, AppRouter } from '{{workspaceScope}}/shared';
5
-
6
- // Create tRPC client using shared factory
7
- const queryClient = new QueryClient();
8
-
9
- const trpcClient = createTRPCClient({
10
- apiUrl: 'http://localhost:3000/trpc', // Update this to your API URL
11
- // For device testing, you might need: 'http://192.168.1.xxx:3000/trpc'
12
- // Optional: Add headers for authentication
13
- // headers() {
14
- // return {
15
- // authorization: getAuthToken(),
16
- // };
17
- // },
18
- });
19
-
20
- function App() {
21
- return (
22
- <trpc.Provider client={trpcClient} queryClient={queryClient}>
23
- <QueryClientProvider client={queryClient}>
24
- <NavigatorProvider route={AppRouter} />
25
- </QueryClientProvider>
26
- </trpc.Provider>
27
- );
28
- }
29
-
30
- export default App;
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
3
- import { BrowserRouter } from 'react-router-dom';
4
- import { NavigatorProvider } from '@idealyst/navigation';
5
- import { trpc, createTRPCClient, AppRouter } from '{{workspaceScope}}/shared';
6
-
7
- // Create tRPC client using shared factory
8
- const queryClient = new QueryClient();
9
-
10
- const trpcClient = createTRPCClient({
11
- apiUrl: 'http://localhost:3000/trpc', // Update this to match your API URL
12
- // Optional: Add headers for authentication
13
- // headers() {
14
- // return {
15
- // authorization: getAuthToken(),
16
- // };
17
- // },
18
- });
19
-
20
- function App() {
21
- return (
22
- <trpc.Provider client={trpcClient} queryClient={queryClient}>
23
- <QueryClientProvider client={queryClient}>
24
- <BrowserRouter>
25
- <NavigatorProvider route={AppRouter} />
26
- </BrowserRouter>
27
- </QueryClientProvider>
28
- </trpc.Provider>
29
- );
30
- }
31
-
32
- export default App;