@auto-engineer/frontend-generator-react-graphql 0.1.1

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 (63) hide show
  1. package/CHANGELOG.md +156 -0
  2. package/LICENSE +10 -0
  3. package/README.md +362 -0
  4. package/dist/builder.d.ts +7 -0
  5. package/dist/builder.d.ts.map +1 -0
  6. package/dist/builder.js +189 -0
  7. package/dist/builder.js.map +1 -0
  8. package/dist/cli-manifest.d.ts +3 -0
  9. package/dist/cli-manifest.d.ts.map +1 -0
  10. package/dist/cli-manifest.js +10 -0
  11. package/dist/cli-manifest.js.map +1 -0
  12. package/dist/commands/copy-example.d.ts +59 -0
  13. package/dist/commands/copy-example.d.ts.map +1 -0
  14. package/dist/commands/copy-example.js +118 -0
  15. package/dist/commands/copy-example.js.map +1 -0
  16. package/dist/commands/generate-client.d.ts +60 -0
  17. package/dist/commands/generate-client.d.ts.map +1 -0
  18. package/dist/commands/generate-client.js +110 -0
  19. package/dist/commands/generate-client.js.map +1 -0
  20. package/dist/configure-starter.d.ts +2 -0
  21. package/dist/configure-starter.d.ts.map +1 -0
  22. package/dist/configure-starter.js +40 -0
  23. package/dist/configure-starter.js.map +1 -0
  24. package/dist/delete-directory.d.ts +2 -0
  25. package/dist/delete-directory.d.ts.map +1 -0
  26. package/dist/delete-directory.js +17 -0
  27. package/dist/delete-directory.js.map +1 -0
  28. package/dist/figma-helpers.d.ts +33 -0
  29. package/dist/figma-helpers.d.ts.map +1 -0
  30. package/dist/figma-helpers.js +99 -0
  31. package/dist/figma-helpers.js.map +1 -0
  32. package/dist/generator/generateComponents.d.ts +3 -0
  33. package/dist/generator/generateComponents.d.ts.map +1 -0
  34. package/dist/generator/generateComponents.js +111 -0
  35. package/dist/generator/generateComponents.js.map +1 -0
  36. package/dist/generator/templates/app.ejs +22 -0
  37. package/dist/generator/templates/component.ejs +18 -0
  38. package/dist/generator/templates/page.ejs +15 -0
  39. package/dist/index.d.ts +7 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +59 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/run-codegen.d.ts +2 -0
  44. package/dist/run-codegen.d.ts.map +1 -0
  45. package/dist/run-codegen.js +84 -0
  46. package/dist/run-codegen.js.map +1 -0
  47. package/dist/scaffold-gql-operations.d.ts +3 -0
  48. package/dist/scaffold-gql-operations.d.ts.map +1 -0
  49. package/dist/scaffold-gql-operations.js +77 -0
  50. package/dist/scaffold-gql-operations.js.map +1 -0
  51. package/dist/templates/createFile.d.ts +8 -0
  52. package/dist/templates/createFile.d.ts.map +1 -0
  53. package/dist/templates/createFile.js +66 -0
  54. package/dist/templates/createFile.js.map +1 -0
  55. package/dist/types.d.ts +62 -0
  56. package/dist/types.d.ts.map +1 -0
  57. package/dist/types.js +2 -0
  58. package/dist/types.js.map +1 -0
  59. package/dist/write-graphql-schema.d.ts +2 -0
  60. package/dist/write-graphql-schema.d.ts.map +1 -0
  61. package/dist/write-graphql-schema.js +14 -0
  62. package/dist/write-graphql-schema.js.map +1 -0
  63. package/package.json +47 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,156 @@
1
+ # @auto-engineer/frontend-react-graphql-generator
2
+
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - renamed packages
8
+ - Updated dependencies
9
+ - @auto-engineer/message-bus@0.5.2
10
+ - @auto-engineer/ai-gateway@0.6.2
11
+
12
+ ## 0.4.1
13
+
14
+ ### Patch Changes
15
+
16
+ - version bump for testihng
17
+ - Updated dependencies
18
+ - @auto-engineer/ai-gateway@0.6.1
19
+ - @auto-engineer/message-bus@0.5.1
20
+
21
+ ## 0.4.0
22
+
23
+ ### Minor Changes
24
+
25
+ - Major overhaul of the plugin system
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies
30
+ - @auto-engineer/ai-gateway@0.6.0
31
+ - @auto-engineer/message-bus@0.5.0
32
+
33
+ ## 0.3.1
34
+
35
+ ### Patch Changes
36
+
37
+ - Uses AI with a default provider
38
+ - Updated dependencies
39
+ - @auto-engineer/ai-gateway@0.5.1
40
+
41
+ ## 0.3.0
42
+
43
+ ### Minor Changes
44
+
45
+ - • All cli commands now use commands and emit events on the bus
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies
50
+ - @auto-engineer/ai-gateway@0.5.0
51
+ - @auto-engineer/message-bus@0.4.0
52
+
53
+ ## 0.2.4
54
+
55
+ ### Patch Changes
56
+
57
+ - Add debug logging throughout packages for better debugging and issue tracking. Fix MCP server hanging issue in frontend-implementer by ensuring it only starts when run directly, not when imported as a module. The debug logs can be enabled by setting DEBUG environment variable (e.g., DEBUG=frontend-checks:_,frontend-impl:_)
58
+
59
+ ## 0.2.3
60
+
61
+ ### Patch Changes
62
+
63
+ - TEST
64
+
65
+ ## 0.2.2
66
+
67
+ ### Patch Changes
68
+
69
+ - TEST
70
+
71
+ ## 0.2.1
72
+
73
+ ### Patch Changes
74
+
75
+ - version testing
76
+ - Updated dependencies
77
+ - @auto-engineer/ai-gateway@0.4.3
78
+ - @auto-engineer/message-bus@0.3.3
79
+
80
+ ## 0.4.2
81
+
82
+ ### Patch Changes
83
+
84
+ - Bump versions
85
+ - Updated dependencies
86
+ - @auto-engineer/ai-gateway@0.4.2
87
+ - @auto-engineer/message-bus@0.3.2
88
+
89
+ ## 0.4.1
90
+
91
+ ### Patch Changes
92
+
93
+ - Version bump to trigger builds
94
+ - Updated dependencies
95
+ - @auto-engineer/ai-gateway@0.4.1
96
+ - @auto-engineer/message-bus@0.3.1
97
+
98
+ ## 0.4.0
99
+
100
+ ### Minor Changes
101
+
102
+ - [#22](https://github.com/SamHatoum/auto-engineer/pull/22) [`927b39a`](https://github.com/SamHatoum/auto-engineer/commit/927b39a2c08c0baa1942b2955a8e8015e09364d9) Thanks [@SamHatoum](https://github.com/SamHatoum)! - Some major refactorings of the directory structure
103
+
104
+ ### Patch Changes
105
+
106
+ - [`f3e97e5`](https://github.com/SamHatoum/auto-engineer/commit/f3e97e563b79ca8328e802dd502e65285ec58ce9) Thanks [@SamHatoum](https://github.com/SamHatoum)! - global version bump to test release process
107
+
108
+ - Updated dependencies [[`f3e97e5`](https://github.com/SamHatoum/auto-engineer/commit/f3e97e563b79ca8328e802dd502e65285ec58ce9), [`927b39a`](https://github.com/SamHatoum/auto-engineer/commit/927b39a2c08c0baa1942b2955a8e8015e09364d9)]:
109
+ - @auto-engineer/ai-gateway@0.4.0
110
+ - @auto-engineer/message-bus@0.3.0
111
+
112
+ ## 0.3.0
113
+
114
+ ### Minor Changes
115
+
116
+ - [`330afa5`](https://github.com/SamHatoum/auto-engineer/commit/330afa565079e3b528d0f448d64919a8dc78d684) Thanks [@SamHatoum](https://github.com/SamHatoum)! - Fix multiple dependency issues
117
+
118
+ ### Patch Changes
119
+
120
+ - Updated dependencies [[`330afa5`](https://github.com/SamHatoum/auto-engineer/commit/330afa565079e3b528d0f448d64919a8dc78d684)]:
121
+ - @auto-engineer/ai-gateway@0.3.0
122
+ - @auto-engineer/message-bus@0.2.0
123
+
124
+ ## 0.2.0
125
+
126
+ ### Minor Changes
127
+
128
+ - [#24](https://github.com/SamHatoum/auto-engineer/pull/24) [`d4dcacd`](https://github.com/SamHatoum/auto-engineer/commit/d4dcacd18cf2217d3ac9f4354f79ab7ff2ba39a0) Thanks [@SamHatoum](https://github.com/SamHatoum)! - Making commands independent and CLI based
129
+
130
+ - [#22](https://github.com/SamHatoum/auto-engineer/pull/22) [`e39acf3`](https://github.com/SamHatoum/auto-engineer/commit/e39acf31e9051652084d0de99cf8c89b40e6531c) Thanks [@SamHatoum](https://github.com/SamHatoum)! - Some major refactorings of the directory structure
131
+
132
+ ### Patch Changes
133
+
134
+ - Updated dependencies [[`d4dcacd`](https://github.com/SamHatoum/auto-engineer/commit/d4dcacd18cf2217d3ac9f4354f79ab7ff2ba39a0), [`e39acf3`](https://github.com/SamHatoum/auto-engineer/commit/e39acf31e9051652084d0de99cf8c89b40e6531c)]:
135
+ - @auto-engineer/ai-gateway@0.2.0
136
+ - @auto-engineer/message-bus@0.1.0
137
+
138
+ ## 0.1.2
139
+
140
+ ### Patch Changes
141
+
142
+ - Fix workspace:\* dependencies to use actual version numbers for npm publishing
143
+
144
+ - Updated dependencies []:
145
+ - @auto-engineer/ai-gateway@0.1.2
146
+ - @auto-engineer/message-bus@0.0.3
147
+
148
+ ## 0.1.1
149
+
150
+ ### Patch Changes
151
+
152
+ - Bump versions to fix npm publish conflicts
153
+
154
+ - Updated dependencies []:
155
+ - @auto-engineer/ai-gateway@0.1.1
156
+ - @auto-engineer/message-bus@0.0.2
package/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+ Elastic License 2.0
2
+
3
+ Copyright 2024 Sam Hatoum
4
+
5
+ This software and associated documentation files (the "Software") are licensed under the Elastic License 2.0 (the "License"). You may not use this file except in compliance with the License.
6
+
7
+ You may obtain a copy of the License at:
8
+ https://www.elastic.co/licensing/elastic-license
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,362 @@
1
+ # @auto-engineer/frontend-generator-react-graphql
2
+
3
+ React client generation plugin for the Auto Engineer CLI that scaffolds GraphQL-powered frontend applications. This plugin creates type-safe React applications with tooling, design systems, and GraphQL integration.
4
+
5
+ ## Installation
6
+
7
+ This is a plugin for the Auto Engineer CLI. Install both the CLI and this plugin:
8
+
9
+ ```bash
10
+ npm install -g @auto-engineer/cli
11
+ npm install @auto-engineer/frontend-generator-react-graphql
12
+ ```
13
+
14
+ ## Configuration
15
+
16
+ Add this plugin to your `auto.config.ts`:
17
+
18
+ ```typescript
19
+ export default {
20
+ plugins: [
21
+ '@auto-engineer/frontend-generator-react-graphql',
22
+ // ... other plugins
23
+ ],
24
+ };
25
+ ```
26
+
27
+ ## Commands
28
+
29
+ This plugin provides the following commands:
30
+
31
+ - `generate:client` - Generate a React GraphQL client application
32
+ - `copy:example` - Copy an example React GraphQL project template
33
+
34
+ ## What does this plugin do?
35
+
36
+ The React GraphQL Generator creates React applications with GraphQL integration. It generates project scaffolding, configures build tools, sets up design systems, and creates type-safe GraphQL operations.
37
+
38
+ ## Key Features
39
+
40
+ ### Project Scaffolding
41
+
42
+ - React project structure with TypeScript
43
+ - Vite configuration for development and builds
44
+ - ESLint and Prettier setup for code quality
45
+ - Testing infrastructure with Vitest and Testing Library
46
+
47
+ ### GraphQL Integration
48
+
49
+ - Apollo Client setup with type-safe operations
50
+ - Code generation from GraphQL schemas
51
+ - Optimistic updates and error handling patterns
52
+ - Real-time subscriptions and caching strategies
53
+
54
+ ### Design System Support
55
+
56
+ - Design system options (Material-UI, shadcn/ui)
57
+ - Theming and styling patterns
58
+ - Responsive design with CSS techniques
59
+ - Component library integration and customization
60
+
61
+ ### Developer Experience
62
+
63
+ - Hot module replacement for feedback
64
+ - TypeScript for compile-time safety
65
+ - IntelliSense and autocomplete support
66
+ - Development tools and debugging
67
+
68
+ ## Available Starter Templates
69
+
70
+ ### shadcn/ui Starter
71
+
72
+ React application using shadcn/ui components:
73
+
74
+ ```bash
75
+ auto copy:example --template=shadcn
76
+ ```
77
+
78
+ Features:
79
+
80
+ - shadcn/ui: Accessible components built with Radix UI
81
+ - Tailwind CSS: Utility-first CSS framework
82
+ - Apollo Client: GraphQL client with caching and state management
83
+ - React Router: Client-side routing with type safety
84
+ - Form Handling: React Hook Form with Zod validation
85
+ - Toast Notifications: User feedback with react-hot-toast
86
+
87
+ Project structure:
88
+
89
+ ```
90
+ client/
91
+ ├── src/
92
+ │ ├── components/
93
+ │ │ ├── atoms/ # shadcn/ui components
94
+ │ │ ├── molecules/ # Composed components
95
+ │ │ └── organisms/ # Complex UI sections
96
+ │ ├── pages/ # Application pages
97
+ │ ├── hooks/ # Custom React hooks
98
+ │ ├── lib/ # Utilities and configuration
99
+ │ ├── graphql/ # Generated GraphQL operations
100
+ │ └── styles/ # Global styles and theme
101
+ ├── public/ # Static assets
102
+ └── package.json
103
+ ```
104
+
105
+ ### Material-UI Starter
106
+
107
+ React application using Material-UI:
108
+
109
+ ```bash
110
+ auto copy:example --template=mui
111
+ ```
112
+
113
+ Features:
114
+
115
+ - Material-UI (MUI): React components implementing Google's Material Design
116
+ - Emotion: CSS-in-JS library for styling
117
+ - Apollo Client: GraphQL integration with Material-UI components
118
+ - React Router: Navigation with Material-UI integration
119
+ - Theme Customization: Theming system
120
+ - Responsive Design: Mobile-first approach with breakpoints
121
+
122
+ ## Generated Application Features
123
+
124
+ ### Type-Safe GraphQL Operations
125
+
126
+ The generator creates fully typed GraphQL operations:
127
+
128
+ ```typescript
129
+ // Generated types from GraphQL schema
130
+ export interface User {
131
+ id: string;
132
+ name: string;
133
+ email: string;
134
+ avatar?: string;
135
+ }
136
+
137
+ // Generated Apollo hooks
138
+ export const useGetUsersQuery = () => {
139
+ return useQuery<GetUsersQuery, GetUsersQueryVariables>(GET_USERS);
140
+ };
141
+
142
+ export const useCreateUserMutation = () => {
143
+ return useMutation<CreateUserMutation, CreateUserMutationVariables>(CREATE_USER);
144
+ };
145
+ ```
146
+
147
+ ### Component Architecture
148
+
149
+ Organized component structure following atomic design principles:
150
+
151
+ ```typescript
152
+ // Atoms - Basic building blocks
153
+ export function Button({ children, variant, ...props }: ButtonProps) {
154
+ return (
155
+ <button className={`btn btn-${variant}`} {...props}>
156
+ {children}
157
+ </button>
158
+ );
159
+ }
160
+
161
+ // Molecules - Combined atoms
162
+ export function SearchBox({ onSearch, placeholder }: SearchBoxProps) {
163
+ return (
164
+ <div className="flex gap-2">
165
+ <Input placeholder={placeholder} />
166
+ <Button onClick={onSearch}>Search</Button>
167
+ </div>
168
+ );
169
+ }
170
+
171
+ // Organisms - Complex UI sections
172
+ export function UserList({ users, onUserSelect }: UserListProps) {
173
+ return (
174
+ <div className="space-y-4">
175
+ <SearchBox onSearch={handleSearch} />
176
+ <div className="grid gap-4">
177
+ {users.map(user => (
178
+ <UserCard key={user.id} user={user} onClick={onUserSelect} />
179
+ ))}
180
+ </div>
181
+ </div>
182
+ );
183
+ }
184
+ ```
185
+
186
+ ### Page Components
187
+
188
+ Complete page implementations with routing:
189
+
190
+ ```typescript
191
+ export function UsersPage() {
192
+ const { data, loading, error } = useGetUsersQuery();
193
+ const [searchTerm, setSearchTerm] = useState('');
194
+
195
+ const filteredUsers = useMemo(() =>
196
+ data?.users.filter(user =>
197
+ user.name.toLowerCase().includes(searchTerm.toLowerCase())
198
+ ) || [],
199
+ [data?.users, searchTerm]
200
+ );
201
+
202
+ if (loading) return <LoadingSpinner />;
203
+ if (error) return <ErrorBoundary error={error} />;
204
+
205
+ return (
206
+ <PageLayout title="Users" breadcrumbs={[{ label: 'Users', href: '/users' }]}>
207
+ <UserList
208
+ users={filteredUsers}
209
+ onUserSelect={handleUserSelect}
210
+ />
211
+ </PageLayout>
212
+ );
213
+ }
214
+ ```
215
+
216
+ ## Build Configuration
217
+
218
+ ### Vite Setup
219
+
220
+ Build configuration with:
221
+
222
+ - Fast HMR for development
223
+ - Production builds
224
+ - Code splitting and lazy loading
225
+ - Environment variable handling
226
+ - Asset optimization
227
+
228
+ ### GraphQL Code Generation
229
+
230
+ Type generation from GraphQL schemas:
231
+
232
+ ```typescript
233
+ // codegen.ts configuration
234
+ import type { CodegenConfig } from '@graphql-codegen/cli';
235
+
236
+ const config: CodegenConfig = {
237
+ schema: 'http://localhost:4000/graphql',
238
+ documents: ['src/**/*.{ts,tsx}'],
239
+ generates: {
240
+ './src/graphql/generated.ts': {
241
+ plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
242
+ config: {
243
+ withHooks: true,
244
+ withComponent: false,
245
+ withHOC: false,
246
+ },
247
+ },
248
+ },
249
+ };
250
+ ```
251
+
252
+ ## Configuration Options
253
+
254
+ Customize generation through `auto.config.ts`:
255
+
256
+ ```typescript
257
+ export default {
258
+ plugins: [
259
+ [
260
+ '@auto-engineer/frontend-generator-react-graphql',
261
+ {
262
+ // Template selection
263
+ template: 'shadcn', // or 'mui'
264
+
265
+ // Build configuration
266
+ bundler: 'vite',
267
+
268
+ // GraphQL configuration
269
+ graphqlEndpoint: 'http://localhost:4000/graphql',
270
+ generateMocks: true,
271
+
272
+ // Styling approach
273
+ cssFramework: 'tailwind', // or 'emotion'
274
+
275
+ // Additional features
276
+ includeStorybook: true,
277
+ includePWA: false,
278
+ includeI18n: false,
279
+ },
280
+ ],
281
+ ],
282
+ };
283
+ ```
284
+
285
+ ## Integration with Other Plugins
286
+
287
+ Works with the Auto Engineer ecosystem:
288
+
289
+ - **@auto-engineer/server-generator-apollo-emmett**: Consumes GraphQL schemas from generated servers
290
+ - **@auto-engineer/design-system-importer**: Integrates imported design tokens and components
291
+ - **@auto-engineer/frontend-implementer**: Provides scaffolding for AI-powered implementation
292
+ - **@auto-engineer/frontend-checks**: Validates generated applications
293
+ - **@auto-engineer/information-architect**: Uses IA specifications for navigation structure
294
+
295
+ ## Development Workflow
296
+
297
+ 1. **Generate Client Application**:
298
+
299
+ ```bash
300
+ auto generate:client
301
+ ```
302
+
303
+ 2. **Start Development Server**:
304
+
305
+ ```bash
306
+ cd client
307
+ npm run start
308
+ ```
309
+
310
+ 3. **Generate GraphQL Types** (when schema changes):
311
+
312
+ ```bash
313
+ npm run codegen
314
+ ```
315
+
316
+ 4. **Build for Production**:
317
+ ```bash
318
+ npm run build
319
+ ```
320
+
321
+ ## Testing Infrastructure
322
+
323
+ Generated applications include testing setup:
324
+
325
+ - Unit Testing: Vitest with React Testing Library
326
+ - Component Testing: Isolated component testing
327
+ - Integration Testing: Page-level testing with mocked GraphQL
328
+ - E2E Testing: Playwright configuration for end-to-end tests
329
+
330
+ Example test:
331
+
332
+ ```typescript
333
+ describe('UserList Component', () => {
334
+ it('renders users correctly', async () => {
335
+ const mockUsers = [
336
+ { id: '1', name: 'John Doe', email: 'john@example.com' }
337
+ ];
338
+
339
+ render(
340
+ <MockedProvider mocks={[getUsersMock(mockUsers)]}>
341
+ <UserList />
342
+ </MockedProvider>
343
+ );
344
+
345
+ await waitFor(() => {
346
+ expect(screen.getByText('John Doe')).toBeInTheDocument();
347
+ });
348
+ });
349
+ });
350
+ ```
351
+
352
+ ## Performance Considerations
353
+
354
+ Generated applications include:
355
+
356
+ - Code Splitting: Route-based and component-based splitting
357
+ - Lazy Loading: Images and non-critical components
358
+ - Bundle Analysis: Tools to analyze and optimize bundle size
359
+ - Caching Strategies: Apollo Client caching and persistence
360
+ - Optimization: Production build optimizations
361
+
362
+ The React GraphQL Generator provides a foundation for building React applications with GraphQL, allowing developers to focus on business logic rather than configuration and setup.
@@ -0,0 +1,7 @@
1
+ export declare class FrontendScaffoldBuilder {
2
+ private starterFiles;
3
+ cloneStarter(_starterDir: string): Promise<this>;
4
+ private collectFiles;
5
+ build(outputDir: string): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAQA,qBAAa,uBAAuB;IAClC,OAAO,CAAC,YAAY,CAAkC;IAEhD,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAUxC,YAAY;IAsJpB,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAuB9C"}