@idealyst/cli 1.0.45 → 1.0.46

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.
@@ -1,265 +1,11 @@
1
- import React, { useState } from 'react';
2
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
3
- import { httpBatchLink } from '@trpc/client';
4
- import { Screen, Text, View, Button, ScrollView } from '@idealyst/components';
5
- import { trpc } from './utils/trpc';
1
+ import React from 'react';
6
2
 
7
- // Import shared components and utilities
8
- import {
9
- UserCard,
10
- PostCard,
11
- LoadingSpinner,
12
- ErrorMessage,
13
- FeatureCard,
14
- TabButton,
15
- DEMO_USERS,
16
- DEMO_POSTS,
17
- formatRelativeTime,
18
- type User,
19
- type Post
20
- } from '{{workspaceScope}}/shared';
21
-
22
- // Create tRPC client
23
- const queryClient = new QueryClient();
24
-
25
- const trpcClient = trpc.createClient({
26
- links: [
27
- httpBatchLink({
28
- url: 'http://localhost:3001/trpc', // Update this to your API URL
29
- // For device testing, you might need: 'http://192.168.1.xxx:3001/trpc'
30
- // Optional: Add headers for authentication
31
- // headers() {
32
- // return {
33
- // authorization: getAuthToken(),
34
- // };
35
- // },
36
- }),
37
- ],
38
- });
3
+ // Import shared components
4
+ import { HelloWorld } from '@{{workspaceScope}}/shared';
39
5
 
40
6
  function App() {
41
- const [currentTab, setCurrentTab] = useState<'home' | 'users' | 'posts'>('home');
42
-
43
- // Example tRPC usage
44
- const { data: helloData, isLoading: helloLoading, error: helloError } = trpc.hello.useQuery({ name: 'Mobile User' });
45
- const { data: usersData, isLoading: usersLoading } = trpc.users.getAll.useQuery();
46
- const { data: postsData, isLoading: postsLoading } = trpc.posts.getAll.useQuery();
47
-
48
- const renderHome = () => (
49
- <ScrollView style={{ flex: 1 }}>
50
- <View style={{ padding: 20 }}>
51
- {/* Welcome Section */}
52
- <View style={{ marginBottom: 32, alignItems: 'center' }}>
53
- <Text variant="h1" style={{ textAlign: 'center', marginBottom: 16 }}>
54
- Welcome to {{appName}}! 📱
55
- </Text>
56
- <Text variant="body" style={{ textAlign: 'center', marginBottom: 16, fontSize: 18 }}>
57
- A cross-platform mobile app built with React Native and the Idealyst Framework
58
- </Text>
59
-
60
- {/* tRPC Connection Test */}
61
- <View style={{
62
- padding: 16,
63
- backgroundColor: '#e3f2fd',
64
- borderRadius: 8,
65
- marginBottom: 24,
66
- width: '100%'
67
- }}>
68
- <Text variant="h3" style={{ marginBottom: 8, textAlign: 'center' }}>🔗 API Connection</Text>
69
- {helloLoading && <Text style={{ textAlign: 'center' }}>Testing connection...</Text>}
70
- {helloError && <Text style={{ color: 'red', textAlign: 'center' }}>Error: {helloError.message}</Text>}
71
- {helloData && <Text style={{ color: 'green', textAlign: 'center' }}>✅ {helloData.greeting}</Text>}
72
- </View>
73
- </View>
74
-
75
- {/* Features Overview */}
76
- <View style={{ marginBottom: 32 }}>
77
- <Text variant="h2" style={{ marginBottom: 16, textAlign: 'center' }}>🏗️ What's Included</Text>
78
- <FeatureCard
79
- icon="🔗"
80
- title="Full Integration"
81
- description="Connected to your database and API with end-to-end type safety"
82
- />
83
- <FeatureCard
84
- icon="📦"
85
- title="Shared Components"
86
- description="Cross-platform UI components that work on web and mobile"
87
- />
88
- <FeatureCard
89
- icon="🎨"
90
- title="Idealyst Design"
91
- description="Beautiful, consistent styling with the Idealyst component library"
92
- />
93
- <FeatureCard
94
- icon="⚡"
95
- title="Real-time Updates"
96
- description="tRPC provides instant synchronization with your backend"
97
- />
98
- </View>
99
-
100
- {/* Quick Data Preview */}
101
- <View style={{ marginBottom: 32 }}>
102
- <Text variant="h2" style={{ marginBottom: 16, textAlign: 'center' }}>📊 Live Data</Text>
103
-
104
- {/* Users Preview */}
105
- <View style={{ marginBottom: 20 }}>
106
- <Text variant="h3" style={{ marginBottom: 12 }}>👥 Users ({usersLoading ? '...' : usersData?.length || DEMO_USERS.length})</Text>
107
- {usersLoading ? (
108
- <LoadingSpinner message="Loading users..." />
109
- ) : (
110
- <View>
111
- {(usersData || DEMO_USERS.slice(0, 2)).map((user: User) => (
112
- <UserCard
113
- key={user.id}
114
- user={user}
115
- showBio={false}
116
- onPress={() => console.log('View profile:', user.name)}
117
- />
118
- ))}
119
- </View>
120
- )}
121
- </View>
122
-
123
- {/* Posts Preview */}
124
- <View style={{ marginBottom: 20 }}>
125
- <Text variant="h3" style={{ marginBottom: 12 }}>📝 Recent Posts ({postsLoading ? '...' : postsData?.length || DEMO_POSTS.length})</Text>
126
- {postsLoading ? (
127
- <LoadingSpinner message="Loading posts..." />
128
- ) : (
129
- <View>
130
- {(postsData || DEMO_POSTS.slice(0, 1)).map((post: Post) => {
131
- const author = DEMO_USERS.find(u => u.id === post.authorId);
132
- return (
133
- <PostCard
134
- key={post.id}
135
- post={post}
136
- author={author}
137
- onPress={() => console.log('Read post:', post.title)}
138
- onLike={() => console.log('Like post:', post.title)}
139
- />
140
- );
141
- })}
142
- </View>
143
- )}
144
- </View>
145
- </View>
146
-
147
- {/* Development Info */}
148
- <View style={{
149
- padding: 20,
150
- backgroundColor: '#f8f9fa',
151
- borderRadius: 8,
152
- marginBottom: 24
153
- }}>
154
- <Text variant="h3" style={{ marginBottom: 12, textAlign: 'center' }}>🚀 Development</Text>
155
- <Text variant="body" style={{ textAlign: 'center', marginBottom: 12 }}>
156
- This app is part of your full-stack workspace. Make changes to see them reflected instantly!
157
- </Text>
158
- <Text variant="caption" style={{ textAlign: 'center', fontStyle: 'italic' }}>
159
- Edit packages/mobile/src/App.tsx to customize this screen
160
- </Text>
161
- </View>
162
- </View>
163
- </ScrollView>
164
- );
165
-
166
- const renderUsers = () => {
167
- const { data: users, isLoading, error } = trpc.users.getAll.useQuery();
168
-
169
- if (isLoading) return <LoadingSpinner message="Loading users..." />;
170
- if (error) return <ErrorMessage message={error.message} />;
171
-
172
- const allUsers = users || DEMO_USERS;
173
-
174
- return (
175
- <ScrollView style={{ flex: 1, padding: 20 }}>
176
- <Text variant="h1" style={{ marginBottom: 20, textAlign: 'center' }}>👥 All Users ({allUsers.length})</Text>
177
- <View>
178
- {allUsers.map((user: User) => (
179
- <UserCard
180
- key={user.id}
181
- user={user}
182
- showBio={true}
183
- onPress={() => console.log('View profile:', user.name)}
184
- />
185
- ))}
186
- </View>
187
- </ScrollView>
188
- );
189
- };
190
-
191
- const renderPosts = () => {
192
- const { data: posts, isLoading, error } = trpc.posts.getAll.useQuery();
193
-
194
- if (isLoading) return <LoadingSpinner message="Loading posts..." />;
195
- if (error) return <ErrorMessage message={error.message} />;
196
-
197
- const allPosts = posts || DEMO_POSTS;
198
-
199
- return (
200
- <ScrollView style={{ flex: 1, padding: 20 }}>
201
- <Text variant="h1" style={{ marginBottom: 20, textAlign: 'center' }}>📝 All Posts ({allPosts.length})</Text>
202
- <View>
203
- {allPosts.map((post: Post) => {
204
- const author = DEMO_USERS.find(u => u.id === post.authorId);
205
- return (
206
- <PostCard
207
- key={post.id}
208
- post={post}
209
- author={author}
210
- showFullContent={false}
211
- onPress={() => console.log('Read post:', post.title)}
212
- onLike={() => console.log('Like post:', post.title)}
213
- />
214
- );
215
- })}
216
- </View>
217
- </ScrollView>
218
- );
219
- };
220
-
221
- const renderTabBar = () => (
222
- <View style={{
223
- flexDirection: 'row',
224
- backgroundColor: '#f8f9fa',
225
- borderTopWidth: 1,
226
- borderTopColor: '#e9ecef',
227
- paddingVertical: 10
228
- }}>
229
- <TabButton
230
- title="Home"
231
- icon="🏠"
232
- active={currentTab === 'home'}
233
- onPress={() => setCurrentTab('home')}
234
- />
235
- <TabButton
236
- title="Users"
237
- icon="👥"
238
- active={currentTab === 'users'}
239
- onPress={() => setCurrentTab('users')}
240
- />
241
- <TabButton
242
- title="Posts"
243
- icon="📝"
244
- active={currentTab === 'posts'}
245
- onPress={() => setCurrentTab('posts')}
246
- />
247
- </View>
248
- );
249
-
250
7
  return (
251
- <trpc.Provider client={trpcClient} queryClient={queryClient}>
252
- <QueryClientProvider client={queryClient}>
253
- <Screen>
254
- <View style={{ flex: 1 }}>
255
- {currentTab === 'home' && renderHome()}
256
- {currentTab === 'users' && renderUsers()}
257
- {currentTab === 'posts' && renderPosts()}
258
- {renderTabBar()}
259
- </View>
260
- </Screen>
261
- </QueryClientProvider>
262
- </trpc.Provider>
8
+ <HelloWorld name="{{projectName}} Mobile User" platform="mobile" projectName="{{projectName}}" />
263
9
  );
264
10
  }
265
11
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## Getting Started
6
6
 
7
- This is a shared library built with the Idealyst Framework that can be used across React Native and React web applications.
7
+ This is a shared component library built with the Idealyst Framework that can be used across React Native and React web applications. It exports source TypeScript files directly for seamless integration in monorepo setups.
8
8
 
9
9
  ### Prerequisites
10
10
 
@@ -20,14 +20,40 @@ yarn install
20
20
 
21
21
  ### Development
22
22
 
23
- Build the library:
23
+ Run tests:
24
24
  ```bash
25
- yarn build
25
+ yarn test
26
26
  ```
27
27
 
28
- Watch for changes during development:
28
+ Type checking:
29
29
  ```bash
30
- yarn dev
30
+ yarn type-check
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ Import the HelloWorld component in your React or React Native app:
36
+
37
+ ```typescript
38
+ import { HelloWorld } from '@{{workspaceName}}/shared';
39
+
40
+ function App() {
41
+ return <HelloWorld name="Developer" />;
42
+ }
43
+ ```
44
+
45
+ ## Component
46
+
47
+ ### HelloWorld
48
+
49
+ A simple welcome component that works on both web and mobile platforms.
50
+
51
+ **Props:**
52
+ - `name?: string` - Name to display in the greeting (defaults to "World")
53
+
54
+ **Example:**
55
+ ```typescript
56
+ <HelloWorld name="Alice" />
31
57
  ```
32
58
 
33
59
  ### Project Structure
@@ -1,10 +1,22 @@
1
- import { add_stuff } from '../src/index';
1
+ import { HelloWorld } from '../src/index';
2
2
 
3
3
  describe('Shared Library', () => {
4
- it('should export add_stuff', () => {
5
- expect(add_stuff).toBeDefined();
6
- expect(typeof add_stuff).toBe('string');
7
- expect(add_stuff).toBe('here');
4
+ it('should export HelloWorld component', () => {
5
+ expect(HelloWorld).toBeDefined();
6
+ expect(typeof HelloWorld).toBe('function');
7
+ });
8
+ });
9
+
10
+ describe('HelloWorld Component', () => {
11
+ it('should be a React component', () => {
12
+ expect(HelloWorld).toBeDefined();
13
+ expect(typeof HelloWorld).toBe('function');
14
+ });
15
+
16
+ it('should accept props', () => {
17
+ // Test that the component function exists and can be called
18
+ // Note: Full component testing would require a React testing environment
19
+ expect(() => HelloWorld({ name: 'Test' })).not.toThrow();
8
20
  });
9
21
  });
10
22
 
@@ -2,44 +2,25 @@
2
2
  "name": "{{packageName}}",
3
3
  "version": "{{version}}",
4
4
  "description": "{{description}}",
5
- "main": "dist/index.js",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
5
+ "main": "src/index.ts",
6
+ "module": "src/index.ts",
7
+ "types": "src/index.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./dist/index.js",
11
- "require": "./dist/index.js",
12
- "types": "./dist/index.d.ts"
13
- },
14
- "./types": {
15
- "import": "./dist/types/index.js",
16
- "require": "./dist/types/index.js",
17
- "types": "./dist/types/index.d.ts"
18
- },
19
- "./components": {
20
- "import": "./dist/components/index.js",
21
- "require": "./dist/components/index.js",
22
- "types": "./dist/components/index.d.ts"
23
- },
24
- "./utils": {
25
- "import": "./dist/utils/index.js",
26
- "require": "./dist/utils/index.js",
27
- "types": "./dist/utils/index.d.ts"
10
+ "import": "./src/index.ts",
11
+ "require": "./src/index.ts",
12
+ "types": "./src/index.ts"
28
13
  }
29
14
  },
30
15
  "scripts": {
31
- "build": "tsc",
32
16
  "test": "jest",
33
17
  "test:watch": "jest --watch",
34
18
  "test:coverage": "jest --coverage",
35
19
  "type-check": "tsc --noEmit"
36
20
  },
37
- "dependencies": {
38
- "zod": "^3.22.4"
39
- },
21
+ "dependencies": {},
40
22
  "peerDependencies": {
41
23
  "@idealyst/components": "^1.0.21",
42
- "@idealyst/navigation": "^1.0.21",
43
24
  "@idealyst/theme": "^1.0.21",
44
25
  "react": "^19.1.0",
45
26
  "react-native": "^0.80.1"
@@ -51,7 +32,6 @@
51
32
  },
52
33
  "devDependencies": {
53
34
  "@idealyst/components": "^1.0.21",
54
- "@idealyst/navigation": "^1.0.21",
55
35
  "@idealyst/theme": "^1.0.21",
56
36
  "@types/jest": "^29.5.12",
57
37
  "@types/react": "^19.1.0",
@@ -62,7 +42,6 @@
62
42
  "typescript": "^5.0.0"
63
43
  },
64
44
  "files": [
65
- "dist",
66
45
  "src"
67
46
  ],
68
47
  "keywords": [
@@ -0,0 +1,117 @@
1
+ import React from 'react';
2
+ import { View, Text, Card, Screen } from '@idealyst/components';
3
+
4
+ interface HelloWorldProps {
5
+ name?: string;
6
+ platform?: 'web' | 'mobile';
7
+ projectName?: string;
8
+ }
9
+
10
+ export const HelloWorld: React.FC<HelloWorldProps> = ({
11
+ name = 'World',
12
+ platform = 'web',
13
+ projectName = 'Your Project'
14
+ }) => {
15
+ const platformEmoji = platform === 'mobile' ? '📱' : '🌐';
16
+ const platformText = platform === 'mobile'
17
+ ? 'Your mobile development environment is ready. This shared component works seamlessly across mobile and web platforms.'
18
+ : 'Your web development environment is ready. This shared component works seamlessly across web and mobile platforms.';
19
+
20
+ return (
21
+ <Screen style={{ flex: 1, padding: 20 }}>
22
+ <View style={{ maxWidth: 600, alignSelf: 'center' }}>
23
+ <Text size="xlarge" weight="bold" style={{
24
+ marginBottom: 16,
25
+ textAlign: 'center',
26
+ color: '#1e293b'
27
+ }}>
28
+ Welcome to {projectName}! {platformEmoji}
29
+ </Text>
30
+
31
+ <Text size="large" style={{
32
+ marginBottom: 32,
33
+ textAlign: 'center',
34
+ color: '#64748b',
35
+ lineHeight: 24,
36
+ paddingHorizontal: 16
37
+ }}>
38
+ {platformText}
39
+ </Text>
40
+ {/* Framework Branding Card */}
41
+ <Card variant="elevated" padding="large" intent="primary">
42
+ <View style={{ alignItems: 'center' }}>
43
+ <Text style={{ fontSize: 32, marginBottom: 16 }}>🚀</Text>
44
+ <Text size="xlarge" weight="bold" style={{ marginBottom: 8, textAlign: 'center' }}>
45
+ Idealyst Framework
46
+ </Text>
47
+ <Text size="medium" style={{ marginBottom: 16, textAlign: 'center' }}>
48
+ Hello, {name}! Welcome to your cross-platform workspace.
49
+ </Text>
50
+
51
+ {/* Technology Tags */}
52
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'center', gap: 8 }}>
53
+ <Card variant="filled" padding="small" style={{ backgroundColor: 'rgba(255, 255, 255, 0.2)' }}>
54
+ <Text size="small" weight="semibold">React</Text>
55
+ </Card>
56
+ <Card variant="filled" padding="small" style={{ backgroundColor: 'rgba(255, 255, 255, 0.2)' }}>
57
+ <Text size="small" weight="semibold">TypeScript</Text>
58
+ </Card>
59
+ <Card variant="filled" padding="small" style={{ backgroundColor: 'rgba(255, 255, 255, 0.2)' }}>
60
+ <Text size="small" weight="semibold">Cross-Platform</Text>
61
+ </Card>
62
+ </View>
63
+ </View>
64
+ </Card>
65
+
66
+ {/* Quick Start Guide Card */}
67
+ <Card variant="outlined" padding="large" style={{ marginTop: 16 }}>
68
+ <Text size="large" weight="bold" style={{ marginBottom: 16 }}>
69
+ 🎯 Quick Start Guide
70
+ </Text>
71
+
72
+ <View style={{ marginBottom: 16 }}>
73
+ <Text size="medium" weight="semibold" style={{ marginBottom: 8 }}>
74
+ Your Workspace Overview:
75
+ </Text>
76
+ <Text size="small" style={{ marginBottom: 4 }}>
77
+ • <Text weight="semibold">packages/web/</Text> - React web application
78
+ </Text>
79
+ <Text size="small" style={{ marginBottom: 4 }}>
80
+ • <Text weight="semibold">packages/mobile/</Text> - React Native mobile app
81
+ </Text>
82
+ <Text size="small" style={{ marginBottom: 4 }}>
83
+ • <Text weight="semibold">packages/shared/</Text> - Cross-platform components
84
+ </Text>
85
+ <Text size="small" style={{ marginBottom: 4 }}>
86
+ • <Text weight="semibold">packages/api/</Text> - tRPC API server
87
+ </Text>
88
+ </View>
89
+
90
+ <View style={{ marginBottom: 16 }}>
91
+ <Text size="medium" weight="semibold" style={{ marginBottom: 8 }}>
92
+ Try Editing:
93
+ </Text>
94
+ <Text size="small" style={{ marginBottom: 4 }}>
95
+ 1. Edit this component in <Text weight="semibold">packages/shared/src/components/HelloWorld.tsx</Text>
96
+ </Text>
97
+ <Text size="small" style={{ marginBottom: 4 }}>
98
+ 2. Watch changes appear in both web and mobile apps instantly!
99
+ </Text>
100
+ <Text size="small" style={{ marginBottom: 4 }}>
101
+ 3. Run <Text weight="semibold">yarn dev</Text> to start all development servers
102
+ </Text>
103
+ </View>
104
+
105
+ <Card variant="filled" intent="success" padding="medium">
106
+ <Text size="small" weight="semibold" style={{ marginBottom: 4 }}>
107
+ ✨ Framework Features:
108
+ </Text>
109
+ <Text size="small">
110
+ Shared components • Type safety • Hot reload • Cross-platform compatibility
111
+ </Text>
112
+ </Card>
113
+ </Card>
114
+ </View>
115
+ </Screen>
116
+ );
117
+ };