@idealyst/cli 1.0.89 → 1.0.90
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.
- package/dist/generators/index.js +3 -40
- package/dist/generators/index.js.map +1 -1
- package/dist/generators/init.js +273 -0
- package/dist/generators/init.js.map +1 -0
- package/dist/generators/utils.js +5 -0
- package/dist/generators/utils.js.map +1 -1
- package/dist/index.js +20 -202
- package/dist/index.js.map +1 -1
- package/dist/scripts/configure-react-native-monorepo.js +144 -0
- package/dist/scripts/configure-react-native-monorepo.js.map +1 -0
- package/dist/{templates/workspace → template}/README.md +66 -12
- package/dist/template/package.json +45 -0
- package/{templates → dist/template/packages}/api/package.json +3 -1
- package/{templates → dist/template/packages}/database/package.json +1 -1
- package/dist/{templates/native → template/packages/mobile}/babel.config.js +1 -0
- package/{templates/native → dist/template/packages/mobile}/metro.config.js +4 -4
- package/{templates/native → dist/template/packages/mobile}/package.json +5 -2
- package/{templates → dist/template/packages}/shared/package.json +2 -2
- package/{templates → dist/template/packages}/web/package.json +4 -1
- package/dist/types/generators/index.d.ts +1 -7
- package/dist/types/generators/init.d.ts +5 -0
- package/dist/types/scripts/configure-react-native-monorepo.d.ts +23 -0
- package/dist/types/types.d.ts +0 -4
- package/package.json +1 -1
- package/dist/generators/api.js +0 -31
- package/dist/generators/api.js.map +0 -1
- package/dist/generators/database.js +0 -31
- package/dist/generators/database.js.map +0 -1
- package/dist/generators/fullstack.js +0 -418
- package/dist/generators/fullstack.js.map +0 -1
- package/dist/generators/native.js +0 -112
- package/dist/generators/native.js.map +0 -1
- package/dist/generators/shared.js +0 -29
- package/dist/generators/shared.js.map +0 -1
- package/dist/generators/web.js +0 -45
- package/dist/generators/web.js.map +0 -1
- package/dist/generators/workspace.js +0 -83
- package/dist/generators/workspace.js.map +0 -1
- package/dist/templates/api/package.json +0 -54
- package/dist/templates/database/package.json +0 -49
- package/dist/templates/native/metro.config.js +0 -27
- package/dist/templates/native/package.json +0 -49
- package/dist/templates/native/src/App.tsx +0 -8
- package/dist/templates/shared/package.json +0 -62
- package/dist/templates/shared/src/components/App.tsx +0 -47
- package/dist/templates/shared/src/components/HelloWorld.tsx +0 -307
- package/dist/templates/shared/src/navigation/AppRouter.tsx +0 -98
- package/dist/templates/web/package.json +0 -66
- package/dist/templates/web/src/App.tsx +0 -14
- package/dist/templates/workspace/package.json +0 -35
- package/dist/types/generators/api.d.ts +0 -2
- package/dist/types/generators/database.d.ts +0 -2
- package/dist/types/generators/fullstack.d.ts +0 -2
- package/dist/types/generators/native.d.ts +0 -2
- package/dist/types/generators/shared.d.ts +0 -2
- package/dist/types/generators/web.d.ts +0 -2
- package/dist/types/generators/workspace.d.ts +0 -2
- package/templates/api/.env.example +0 -6
- package/templates/api/README.md +0 -274
- package/templates/api/__tests__/api.test.ts +0 -26
- package/templates/api/jest.config.js +0 -23
- package/templates/api/jest.setup.js +0 -9
- package/templates/api/src/context.ts +0 -19
- package/templates/api/src/controllers/TestController.ts +0 -0
- package/templates/api/src/index.ts +0 -9
- package/templates/api/src/lib/crud.ts +0 -150
- package/templates/api/src/lib/database.ts +0 -23
- package/templates/api/src/router/index.ts +0 -163
- package/templates/api/src/routers/test.ts +0 -59
- package/templates/api/src/routers/user.example.ts +0 -83
- package/templates/api/src/server.ts +0 -50
- package/templates/api/src/trpc.ts +0 -28
- package/templates/api/tsconfig.json +0 -43
- package/templates/database/README.md +0 -162
- package/templates/database/prisma/seed.ts +0 -64
- package/templates/database/schema.prisma +0 -107
- package/templates/database/src/index.ts +0 -15
- package/templates/database/src/validators.ts +0 -10
- package/templates/database/tsconfig.json +0 -18
- package/templates/native/README.md +0 -86
- package/templates/native/__tests__/App.test.tsx +0 -156
- package/templates/native/__tests__/components.test.tsx +0 -300
- package/templates/native/app.json +0 -5
- package/templates/native/babel.config.js +0 -10
- package/templates/native/index.js +0 -6
- package/templates/native/jest.config.js +0 -21
- package/templates/native/jest.setup.js +0 -12
- package/templates/native/src/App-with-trpc.tsx +0 -30
- package/templates/native/src/App.tsx +0 -8
- package/templates/native/src/utils/trpc.ts +0 -7
- package/templates/native/tsconfig.json +0 -28
- package/templates/shared/README.md +0 -135
- package/templates/shared/__tests__/shared.test.ts +0 -51
- package/templates/shared/jest.config.js +0 -22
- package/templates/shared/src/components/index.ts +0 -1
- package/templates/shared/src/index.ts +0 -14
- package/templates/shared/src/trpc/client.ts +0 -44
- package/templates/shared/tsconfig.json +0 -22
- package/templates/web/README.md +0 -131
- package/templates/web/__tests__/App.test.tsx +0 -342
- package/templates/web/__tests__/components.test.tsx +0 -564
- package/templates/web/index.html +0 -13
- package/templates/web/jest.config.js +0 -27
- package/templates/web/jest.setup.js +0 -24
- package/templates/web/src/App-with-trpc.tsx +0 -32
- package/templates/web/src/App.tsx +0 -14
- package/templates/web/src/components/TestDemo.tsx +0 -164
- package/templates/web/src/main.tsx +0 -25
- package/templates/web/src/utils/trpc.ts +0 -7
- package/templates/web/tsconfig.json +0 -26
- package/templates/web/vite.config.ts +0 -98
- package/templates/workspace/.devcontainer/Dockerfile +0 -26
- package/templates/workspace/.devcontainer/devcontainer.json +0 -113
- package/templates/workspace/.devcontainer/docker-compose.yml +0 -59
- package/templates/workspace/.devcontainer/figma-mcp.sh +0 -32
- package/templates/workspace/.devcontainer/setup.sh +0 -45
- package/templates/workspace/.dockerignore +0 -151
- package/templates/workspace/.env.example +0 -36
- package/templates/workspace/.env.production +0 -56
- package/templates/workspace/DOCKER.md +0 -0
- package/templates/workspace/Dockerfile +0 -111
- package/templates/workspace/README.md +0 -179
- package/templates/workspace/docker/nginx/prod.conf +0 -238
- package/templates/workspace/docker/nginx.conf +0 -131
- package/templates/workspace/docker/postgres/init.sql +0 -41
- package/templates/workspace/docker/prometheus/prometheus.yml +0 -52
- package/templates/workspace/docker-compose.prod.yml +0 -146
- package/templates/workspace/docker-compose.yml +0 -143
- package/templates/workspace/jest.config.js +0 -20
- package/templates/workspace/package.json +0 -38
- package/templates/workspace/setup.sh +0 -30
- package/templates/workspace/tsconfig.json +0 -31
- /package/dist/{templates/workspace → template}/.devcontainer/Dockerfile +0 -0
- /package/dist/{templates/workspace → template}/.devcontainer/devcontainer.json +0 -0
- /package/dist/{templates/workspace → template}/.devcontainer/docker-compose.yml +0 -0
- /package/dist/{templates/workspace → template}/.devcontainer/figma-mcp.sh +0 -0
- /package/dist/{templates/workspace → template}/.devcontainer/setup.sh +0 -0
- /package/dist/{templates/workspace → template}/.dockerignore +0 -0
- /package/dist/{templates/workspace → template}/.env.example +0 -0
- /package/dist/{templates/workspace → template}/DOCKER.md +0 -0
- /package/dist/{templates/workspace → template}/Dockerfile +0 -0
- /package/dist/{templates/workspace → template}/docker/nginx/prod.conf +0 -0
- /package/dist/{templates/workspace → template}/docker/nginx.conf +0 -0
- /package/dist/{templates/workspace → template}/docker/postgres/init.sql +0 -0
- /package/dist/{templates/workspace → template}/docker/prometheus/prometheus.yml +0 -0
- /package/dist/{templates/workspace → template}/docker-compose.prod.yml +0 -0
- /package/dist/{templates/workspace → template}/docker-compose.yml +0 -0
- /package/dist/{templates/workspace → template}/jest.config.js +0 -0
- /package/dist/{templates → template/packages}/api/.env.example +0 -0
- /package/dist/{templates → template/packages}/api/README.md +0 -0
- /package/dist/{templates → template/packages}/api/__tests__/api.test.ts +0 -0
- /package/dist/{templates → template/packages}/api/jest.config.js +0 -0
- /package/dist/{templates → template/packages}/api/jest.setup.js +0 -0
- /package/dist/{templates → template/packages}/api/src/context.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/controllers/TestController.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/index.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/lib/crud.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/lib/database.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/router/index.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/routers/test.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/routers/user.example.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/server.ts +0 -0
- /package/dist/{templates → template/packages}/api/src/trpc.ts +0 -0
- /package/dist/{templates → template/packages}/api/tsconfig.json +0 -0
- /package/dist/{templates → template/packages}/database/README.md +0 -0
- /package/dist/{templates → template/packages}/database/prisma/seed.ts +0 -0
- /package/dist/{templates → template/packages}/database/schema.prisma +0 -0
- /package/dist/{templates → template/packages}/database/src/index.ts +0 -0
- /package/dist/{templates → template/packages}/database/src/validators.ts +0 -0
- /package/dist/{templates → template/packages}/database/tsconfig.json +0 -0
- /package/dist/{templates/native → template/packages/mobile}/README.md +0 -0
- /package/dist/{templates/native → template/packages/mobile}/__tests__/App.test.tsx +0 -0
- /package/dist/{templates/native → template/packages/mobile}/__tests__/components.test.tsx +0 -0
- /package/dist/{templates/native → template/packages/mobile}/app.json +0 -0
- /package/dist/{templates/native → template/packages/mobile}/index.js +0 -0
- /package/dist/{templates/native → template/packages/mobile}/jest.config.js +0 -0
- /package/dist/{templates/native → template/packages/mobile}/jest.setup.js +0 -0
- /package/dist/{templates/native → template/packages/mobile}/src/App-with-trpc-and-shared.tsx +0 -0
- /package/dist/{templates/native → template/packages/mobile}/src/App-with-trpc.tsx +0 -0
- /package/{templates/native/src/App-with-trpc-and-shared.tsx → dist/template/packages/mobile/src/App.tsx} +0 -0
- /package/dist/{templates/native → template/packages/mobile}/src/utils/trpc.ts +0 -0
- /package/dist/{templates/native → template/packages/mobile}/tsconfig.json +0 -0
- /package/dist/{templates → template/packages}/shared/README.md +0 -0
- /package/dist/{templates → template/packages}/shared/__tests__/shared.test.ts +0 -0
- /package/dist/{templates → template/packages}/shared/jest.config.js +0 -0
- /package/{templates → dist/template/packages}/shared/src/components/App.tsx +0 -0
- /package/{templates → dist/template/packages}/shared/src/components/HelloWorld.tsx +0 -0
- /package/dist/{templates → template/packages}/shared/src/components/index.ts +0 -0
- /package/dist/{templates → template/packages}/shared/src/index.ts +0 -0
- /package/{templates → dist/template/packages}/shared/src/navigation/AppRouter.tsx +0 -0
- /package/dist/{templates → template/packages}/shared/src/trpc/client.ts +0 -0
- /package/dist/{templates → template/packages}/shared/tsconfig.json +0 -0
- /package/dist/{templates → template/packages}/web/README.md +0 -0
- /package/dist/{templates → template/packages}/web/__tests__/App.test.tsx +0 -0
- /package/dist/{templates → template/packages}/web/__tests__/components.test.tsx +0 -0
- /package/dist/{templates → template/packages}/web/index.html +0 -0
- /package/dist/{templates → template/packages}/web/jest.config.js +0 -0
- /package/dist/{templates → template/packages}/web/jest.setup.js +0 -0
- /package/dist/{templates → template/packages}/web/src/App-with-trpc-and-shared.tsx +0 -0
- /package/dist/{templates → template/packages}/web/src/App-with-trpc.tsx +0 -0
- /package/{templates/web/src/App-with-trpc-and-shared.tsx → dist/template/packages/web/src/App.tsx} +0 -0
- /package/dist/{templates → template/packages}/web/src/components/TestDemo.tsx +0 -0
- /package/dist/{templates → template/packages}/web/src/main.tsx +0 -0
- /package/dist/{templates → template/packages}/web/src/utils/trpc.ts +0 -0
- /package/dist/{templates → template/packages}/web/tsconfig.json +0 -0
- /package/dist/{templates → template/packages}/web/vite.config.ts +0 -0
- /package/dist/{templates/workspace → template}/setup.sh +0 -0
- /package/dist/{templates/workspace → template}/tsconfig.json +0 -0
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
# {{projectName}}
|
|
2
|
-
|
|
3
|
-
{{description}}
|
|
4
|
-
|
|
5
|
-
## Getting Started
|
|
6
|
-
|
|
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
|
-
|
|
9
|
-
### Prerequisites
|
|
10
|
-
|
|
11
|
-
- Node.js 18+
|
|
12
|
-
- Yarn
|
|
13
|
-
|
|
14
|
-
### Installation
|
|
15
|
-
|
|
16
|
-
Install dependencies:
|
|
17
|
-
```bash
|
|
18
|
-
yarn install
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### Development
|
|
22
|
-
|
|
23
|
-
Run tests:
|
|
24
|
-
```bash
|
|
25
|
-
yarn test
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Type checking:
|
|
29
|
-
```bash
|
|
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" />
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Project Structure
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
{{projectName}}/
|
|
63
|
-
├── src/
|
|
64
|
-
│ ├── components/ # Shared components
|
|
65
|
-
│ ├── utils/ # Utility functions
|
|
66
|
-
│ ├── types/ # TypeScript types
|
|
67
|
-
│ └── index.ts # Main export file
|
|
68
|
-
├── dist/ # Built library (generated)
|
|
69
|
-
├── rollup.config.js # Build configuration
|
|
70
|
-
└── tsconfig.json # TypeScript configuration
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Features
|
|
74
|
-
|
|
75
|
-
- **Cross-platform**: Works on both React Native and React web
|
|
76
|
-
- **TypeScript**: Full type safety
|
|
77
|
-
- **Tree-shakeable**: Optimized for bundle size
|
|
78
|
-
- **Peer Dependencies**: Lightweight by design
|
|
79
|
-
- **Idealyst Theme Integration**: Compatible with the Idealyst theming system
|
|
80
|
-
|
|
81
|
-
### Usage
|
|
82
|
-
|
|
83
|
-
After building, you can import and use the library in your projects:
|
|
84
|
-
|
|
85
|
-
```tsx
|
|
86
|
-
import { SharedComponent, toTitleCase, ComponentProps } from '{{packageName}}';
|
|
87
|
-
|
|
88
|
-
// Use the shared component
|
|
89
|
-
<SharedComponent
|
|
90
|
-
title="Hello World"
|
|
91
|
-
description="This works on both web and mobile!"
|
|
92
|
-
/>
|
|
93
|
-
|
|
94
|
-
// Use utility functions
|
|
95
|
-
const formatted = toTitleCase('hello world'); // "Hello World"
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Building for Production
|
|
99
|
-
|
|
100
|
-
Build the library:
|
|
101
|
-
```bash
|
|
102
|
-
yarn build
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
This creates:
|
|
106
|
-
- `dist/index.js` - CommonJS build
|
|
107
|
-
- `dist/index.esm.js` - ES modules build
|
|
108
|
-
- `dist/index.d.ts` - TypeScript declarations
|
|
109
|
-
|
|
110
|
-
### Publishing
|
|
111
|
-
|
|
112
|
-
Before publishing, make sure to:
|
|
113
|
-
|
|
114
|
-
1. Update the version in `package.json`
|
|
115
|
-
2. Build the library: `yarn build`
|
|
116
|
-
3. Publish to npm: `npm publish`
|
|
117
|
-
|
|
118
|
-
### Development in Monorepo
|
|
119
|
-
|
|
120
|
-
If you're using this in a monorepo, you can reference it directly:
|
|
121
|
-
|
|
122
|
-
```json
|
|
123
|
-
{
|
|
124
|
-
"dependencies": {
|
|
125
|
-
"{{packageName}}": "workspace:*"
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Learn More
|
|
131
|
-
|
|
132
|
-
- [Idealyst Framework Documentation](https://github.com/your-username/idealyst-framework)
|
|
133
|
-
- [React Native Documentation](https://reactnative.dev/)
|
|
134
|
-
- [React Documentation](https://react.dev/)
|
|
135
|
-
- [Rollup Documentation](https://rollupjs.org/)
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { HelloWorld } from '../src/index';
|
|
2
|
-
|
|
3
|
-
describe('Shared Library', () => {
|
|
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();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
describe('Sample Shared Tests', () => {
|
|
24
|
-
it('should pass a basic test', () => {
|
|
25
|
-
expect(1 + 1).toBe(2);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should handle string operations', () => {
|
|
29
|
-
const testString = 'Hello World';
|
|
30
|
-
expect(testString).toContain('World');
|
|
31
|
-
expect(testString.length).toBe(11);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should work with objects', () => {
|
|
35
|
-
const testObj = { name: 'test', value: 42 };
|
|
36
|
-
expect(testObj).toHaveProperty('name');
|
|
37
|
-
expect(testObj).toHaveProperty('value', 42);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should handle arrays', () => {
|
|
41
|
-
const testArray = [1, 2, 3, 4, 5];
|
|
42
|
-
expect(testArray).toHaveLength(5);
|
|
43
|
-
expect(testArray).toContain(3);
|
|
44
|
-
expect(testArray.filter(x => x > 3)).toEqual([4, 5]);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('should work with async operations', async () => {
|
|
48
|
-
const result = await Promise.resolve('async test');
|
|
49
|
-
expect(result).toBe('async test');
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/** @type {import('jest').Config} */
|
|
2
|
-
module.exports = {
|
|
3
|
-
preset: 'ts-jest',
|
|
4
|
-
testEnvironment: 'node',
|
|
5
|
-
roots: ['<rootDir>/src', '<rootDir>/__tests__'],
|
|
6
|
-
testMatch: [
|
|
7
|
-
'**/__tests__/**/*.{ts,tsx,js}',
|
|
8
|
-
'**/*.{test,spec}.{ts,tsx,js}'
|
|
9
|
-
],
|
|
10
|
-
transform: {
|
|
11
|
-
'^.+\\.tsx?$': 'ts-jest',
|
|
12
|
-
},
|
|
13
|
-
collectCoverageFrom: [
|
|
14
|
-
'src/**/*.{ts,tsx}',
|
|
15
|
-
'!src/**/*.d.ts',
|
|
16
|
-
'!src/**/index.ts',
|
|
17
|
-
],
|
|
18
|
-
coverageDirectory: 'coverage',
|
|
19
|
-
coverageReporters: ['text', 'lcov'],
|
|
20
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
|
|
21
|
-
testTimeout: 10000,
|
|
22
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { App } from './App';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Export the unified App component
|
|
2
|
-
export { App } from './components';
|
|
3
|
-
|
|
4
|
-
// Export navigation router
|
|
5
|
-
export { default as AppRouter } from './navigation/AppRouter';
|
|
6
|
-
|
|
7
|
-
// Export tRPC client utilities
|
|
8
|
-
export { trpc, createTRPCClient, createVanillaTRPCClient } from './trpc/client';
|
|
9
|
-
export type { TRPCClientConfig, AppRouter } from './trpc/client';
|
|
10
|
-
|
|
11
|
-
// Simple type for the HelloWorld component props
|
|
12
|
-
export interface HelloWorldProps {
|
|
13
|
-
name?: string;
|
|
14
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
|
|
2
|
-
import { createTRPCReact } from "@trpc/react-query";
|
|
3
|
-
import type { AppRouter } from "@{{workspaceScope}}/api";
|
|
4
|
-
|
|
5
|
-
// Create the tRPC React hooks with full type safety
|
|
6
|
-
export const trpc: ReturnType<typeof createTRPCReact<AppRouter>> =
|
|
7
|
-
createTRPCReact<AppRouter>();
|
|
8
|
-
|
|
9
|
-
// Configuration for tRPC client
|
|
10
|
-
export interface TRPCClientConfig {
|
|
11
|
-
apiUrl: string;
|
|
12
|
-
headers?: () => Record<string, string>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Create tRPC client factory
|
|
16
|
-
export function createTRPCClient(
|
|
17
|
-
config: TRPCClientConfig
|
|
18
|
-
): ReturnType<typeof trpc.createClient> {
|
|
19
|
-
return trpc.createClient({
|
|
20
|
-
links: [
|
|
21
|
-
httpBatchLink({
|
|
22
|
-
url: config.apiUrl,
|
|
23
|
-
headers: config.headers,
|
|
24
|
-
}),
|
|
25
|
-
],
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Create a vanilla client (for use outside of React components)
|
|
30
|
-
export function createVanillaTRPCClient(
|
|
31
|
-
config: TRPCClientConfig
|
|
32
|
-
): ReturnType<typeof createTRPCProxyClient<AppRouter>> {
|
|
33
|
-
return createTRPCProxyClient<AppRouter>({
|
|
34
|
-
links: [
|
|
35
|
-
httpBatchLink({
|
|
36
|
-
url: config.apiUrl,
|
|
37
|
-
headers: config.headers,
|
|
38
|
-
}),
|
|
39
|
-
],
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Export types
|
|
44
|
-
export type { AppRouter } from "@{{workspaceScope}}/api";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"lib": ["ES2020"],
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"declaration": true,
|
|
13
|
-
"jsx": "react-jsx",
|
|
14
|
-
"noEmit": true
|
|
15
|
-
},
|
|
16
|
-
"include": [
|
|
17
|
-
"src/**/*"
|
|
18
|
-
],
|
|
19
|
-
"exclude": [
|
|
20
|
-
"node_modules"
|
|
21
|
-
]
|
|
22
|
-
}
|
package/templates/web/README.md
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
# {{projectName}}
|
|
2
|
-
|
|
3
|
-
{{description}}
|
|
4
|
-
|
|
5
|
-
## Getting Started
|
|
6
|
-
|
|
7
|
-
This is a React web application built with the Idealyst Framework and Vite, with full-stack capabilities including database and API integration.
|
|
8
|
-
|
|
9
|
-
### Prerequisites
|
|
10
|
-
|
|
11
|
-
- Node.js 18+
|
|
12
|
-
- Yarn
|
|
13
|
-
|
|
14
|
-
### Installation
|
|
15
|
-
|
|
16
|
-
Install dependencies:
|
|
17
|
-
```bash
|
|
18
|
-
yarn install
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### Database Setup
|
|
22
|
-
|
|
23
|
-
If your project includes a database, set it up:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
# Navigate to the database package
|
|
27
|
-
cd packages/database
|
|
28
|
-
|
|
29
|
-
# Install dependencies
|
|
30
|
-
yarn install
|
|
31
|
-
|
|
32
|
-
# Generate Prisma client
|
|
33
|
-
yarn prisma:generate
|
|
34
|
-
|
|
35
|
-
# Run database migrations
|
|
36
|
-
yarn prisma:migrate
|
|
37
|
-
|
|
38
|
-
# Seed the database with sample data
|
|
39
|
-
yarn prisma:seed
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### API Setup
|
|
43
|
-
|
|
44
|
-
If your project includes an API, start the API server:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
# Navigate to the API package
|
|
48
|
-
cd packages/api
|
|
49
|
-
|
|
50
|
-
# Install dependencies
|
|
51
|
-
yarn install
|
|
52
|
-
|
|
53
|
-
# Start the API server (usually on port 3000)
|
|
54
|
-
yarn dev
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Development
|
|
58
|
-
|
|
59
|
-
Start the web development server:
|
|
60
|
-
```bash
|
|
61
|
-
yarn dev
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
The app will be available at `http://localhost:3000`
|
|
65
|
-
|
|
66
|
-
If you have both database and API packages, make sure to start them first before starting the web app for full functionality.
|
|
67
|
-
|
|
68
|
-
### Building for Production
|
|
69
|
-
|
|
70
|
-
Build the app:
|
|
71
|
-
```bash
|
|
72
|
-
yarn build
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Preview the production build:
|
|
76
|
-
```bash
|
|
77
|
-
yarn preview
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Project Structure
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
{{projectName}}/
|
|
84
|
-
├── packages/
|
|
85
|
-
│ ├── database/ # Database schema and migrations (if included)
|
|
86
|
-
│ ├── api/ # tRPC API server (if included)
|
|
87
|
-
│ ├── shared/ # Shared components and utilities
|
|
88
|
-
│ └── web/ # React web application
|
|
89
|
-
├── src/
|
|
90
|
-
│ ├── App.tsx # Main app component
|
|
91
|
-
│ ├── main.tsx # App entry point
|
|
92
|
-
│ ├── components/ # React components
|
|
93
|
-
│ └── utils/ # Utility functions and tRPC client
|
|
94
|
-
├── index.html # HTML template
|
|
95
|
-
├── vite.config.ts # Vite configuration
|
|
96
|
-
└── tsconfig.json # TypeScript configuration
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Features
|
|
100
|
-
|
|
101
|
-
- **Full-Stack Type Safety**: End-to-end TypeScript from database to frontend
|
|
102
|
-
- **tRPC Integration**: Type-safe API calls with automatic TypeScript inference
|
|
103
|
-
- **Database Integration**: Prisma ORM with SQLite for development
|
|
104
|
-
- **Idealyst Components**: Cross-platform UI components
|
|
105
|
-
- **Idealyst Navigation**: Consistent navigation system
|
|
106
|
-
- **Idealyst Theme**: Unified theming across platforms
|
|
107
|
-
- **React 19.1**: Latest React version
|
|
108
|
-
- **Vite**: Fast build tool and dev server
|
|
109
|
-
- **React Native Web**: Use React Native components on the web
|
|
110
|
-
|
|
111
|
-
### API Demo
|
|
112
|
-
|
|
113
|
-
If your project includes the API demo, you can access it at `/test-demo` to see:
|
|
114
|
-
- Real-time database queries
|
|
115
|
-
- CRUD operations (Create, Read, Update, Delete)
|
|
116
|
-
- Type-safe tRPC integration
|
|
117
|
-
- Form handling with validation
|
|
118
|
-
|
|
119
|
-
### Development
|
|
120
|
-
|
|
121
|
-
The app uses the Idealyst Framework for consistent UI and navigation that works across web and mobile platforms.
|
|
122
|
-
|
|
123
|
-
Edit `src/App.tsx` to start building your application.
|
|
124
|
-
|
|
125
|
-
### Learn More
|
|
126
|
-
|
|
127
|
-
- [Idealyst Framework Documentation](https://github.com/your-username/idealyst-framework)
|
|
128
|
-
- [tRPC Documentation](https://trpc.io/)
|
|
129
|
-
- [Prisma Documentation](https://prisma.io/)
|
|
130
|
-
- [React Documentation](https://react.dev/)
|
|
131
|
-
- [Vite Documentation](https://vitejs.dev/)
|