@idealyst/cli 1.0.53 → 1.0.56
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/package.json +3 -2
- package/templates/native/src/App-with-trpc-and-shared.tsx +11 -16
- package/templates/native/src/App-with-trpc.tsx +11 -16
- package/templates/shared/package.json +2 -1
- package/templates/shared/src/trpc/client.ts +12 -7
- package/templates/web/src/App-with-trpc-and-shared.tsx +10 -15
- package/templates/web/src/App-with-trpc.tsx +10 -15
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idealyst/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.56",
|
|
4
4
|
"description": "CLI tool for generating Idealyst Framework projects",
|
|
5
|
+
"readme": "README.md",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"bin": {
|
|
7
8
|
"idealyst": "dist/index.js",
|
|
@@ -9,7 +10,7 @@
|
|
|
9
10
|
},
|
|
10
11
|
"repository": {
|
|
11
12
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/
|
|
13
|
+
"url": "https://github.com/IdealystIO/idealyst-framework.git",
|
|
13
14
|
"directory": "packages/cli"
|
|
14
15
|
},
|
|
15
16
|
"author": "Your Name <your.email@example.com>",
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
-
import { httpBatchLink } from '@trpc/client';
|
|
4
3
|
import { NavigatorProvider } from '@idealyst/navigation';
|
|
5
|
-
import { trpc } from './utils/trpc';
|
|
4
|
+
import { trpc, createTRPCClient } from './utils/trpc';
|
|
6
5
|
import { AppRouter } from '@{{workspaceScope}}/shared';
|
|
7
6
|
|
|
8
|
-
// Create tRPC client
|
|
7
|
+
// Create tRPC client using shared factory
|
|
9
8
|
const queryClient = new QueryClient();
|
|
10
9
|
|
|
11
|
-
const trpcClient =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// };
|
|
21
|
-
// },
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
10
|
+
const trpcClient = createTRPCClient({
|
|
11
|
+
apiUrl: 'http://localhost:3000/trpc', // Update this to your API URL
|
|
12
|
+
// For device testing, you might need: 'http://192.168.1.xxx:3000/trpc'
|
|
13
|
+
// Optional: Add headers for authentication
|
|
14
|
+
// headers() {
|
|
15
|
+
// return {
|
|
16
|
+
// authorization: getAuthToken(),
|
|
17
|
+
// };
|
|
18
|
+
// },
|
|
24
19
|
});
|
|
25
20
|
|
|
26
21
|
function App() {
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
-
import { httpBatchLink } from '@trpc/client';
|
|
4
3
|
import { NavigatorProvider } from '@idealyst/navigation';
|
|
5
|
-
import { trpc } from './utils/trpc';
|
|
4
|
+
import { trpc, createTRPCClient } from './utils/trpc';
|
|
6
5
|
import AppRouter from './navigation/AppRouter';
|
|
7
6
|
|
|
8
|
-
// Create tRPC client
|
|
7
|
+
// Create tRPC client using shared factory
|
|
9
8
|
const queryClient = new QueryClient();
|
|
10
9
|
|
|
11
|
-
const trpcClient =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// };
|
|
21
|
-
// },
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
10
|
+
const trpcClient = createTRPCClient({
|
|
11
|
+
apiUrl: 'http://localhost:3000/trpc', // Update this to your API URL
|
|
12
|
+
// For device testing, you might need: 'http://192.168.1.xxx:3000/trpc'
|
|
13
|
+
// Optional: Add headers for authentication
|
|
14
|
+
// headers() {
|
|
15
|
+
// return {
|
|
16
|
+
// authorization: getAuthToken(),
|
|
17
|
+
// };
|
|
18
|
+
// },
|
|
24
19
|
});
|
|
25
20
|
|
|
26
21
|
function App() {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import type { AppRouter } from
|
|
1
|
+
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
|
|
2
|
+
import { createTRPCReact } from "@trpc/react-query";
|
|
3
|
+
import type { AppRouter } from "@{{workspaceScope}}/api";
|
|
4
4
|
|
|
5
5
|
// Create the tRPC React hooks with full type safety
|
|
6
|
-
export const trpc
|
|
6
|
+
export const trpc: ReturnType<typeof createTRPCReact<AppRouter>> =
|
|
7
|
+
createTRPCReact<AppRouter>();
|
|
7
8
|
|
|
8
9
|
// Configuration for tRPC client
|
|
9
10
|
export interface TRPCClientConfig {
|
|
@@ -12,7 +13,9 @@ export interface TRPCClientConfig {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
// Create tRPC client factory
|
|
15
|
-
export function createTRPCClient(
|
|
16
|
+
export function createTRPCClient(
|
|
17
|
+
config: TRPCClientConfig
|
|
18
|
+
): ReturnType<typeof trpc.createClient> {
|
|
16
19
|
return trpc.createClient({
|
|
17
20
|
links: [
|
|
18
21
|
httpBatchLink({
|
|
@@ -24,7 +27,9 @@ export function createTRPCClient(config: TRPCClientConfig) {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
// Create a vanilla client (for use outside of React components)
|
|
27
|
-
export function createVanillaTRPCClient(
|
|
30
|
+
export function createVanillaTRPCClient(
|
|
31
|
+
config: TRPCClientConfig
|
|
32
|
+
): ReturnType<typeof createTRPCProxyClient<AppRouter>> {
|
|
28
33
|
return createTRPCProxyClient<AppRouter>({
|
|
29
34
|
links: [
|
|
30
35
|
httpBatchLink({
|
|
@@ -36,4 +41,4 @@ export function createVanillaTRPCClient(config: TRPCClientConfig) {
|
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
// Export types
|
|
39
|
-
export type { AppRouter } from
|
|
44
|
+
export type { AppRouter } from "@{{workspaceScope}}/api";
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
-
import { httpBatchLink } from '@trpc/client';
|
|
4
3
|
import { BrowserRouter } from 'react-router-dom';
|
|
5
4
|
import { NavigatorProvider } from '@idealyst/navigation';
|
|
6
|
-
import { trpc } from './utils/trpc';
|
|
5
|
+
import { trpc, createTRPCClient } from './utils/trpc';
|
|
7
6
|
import { AppRouter } from '@{{workspaceScope}}/shared';
|
|
8
7
|
|
|
9
|
-
// Create tRPC client
|
|
8
|
+
// Create tRPC client using shared factory
|
|
10
9
|
const queryClient = new QueryClient();
|
|
11
10
|
|
|
12
|
-
const trpcClient =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// };
|
|
21
|
-
// },
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
11
|
+
const trpcClient = createTRPCClient({
|
|
12
|
+
apiUrl: 'http://localhost:3000/trpc', // Update this to match your API URL
|
|
13
|
+
// Optional: Add headers for authentication
|
|
14
|
+
// headers() {
|
|
15
|
+
// return {
|
|
16
|
+
// authorization: getAuthToken(),
|
|
17
|
+
// };
|
|
18
|
+
// },
|
|
24
19
|
});
|
|
25
20
|
|
|
26
21
|
function App() {
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
-
import { httpBatchLink } from '@trpc/client';
|
|
4
3
|
import { BrowserRouter } from 'react-router-dom';
|
|
5
4
|
import { NavigatorProvider } from '@idealyst/navigation';
|
|
6
|
-
import { trpc } from './utils/trpc';
|
|
5
|
+
import { trpc, createTRPCClient } from './utils/trpc';
|
|
7
6
|
import AppRouterWithTrpc from './navigation/AppRouterWithTrpc';
|
|
8
7
|
|
|
9
|
-
// Create tRPC client
|
|
8
|
+
// Create tRPC client using shared factory
|
|
10
9
|
const queryClient = new QueryClient();
|
|
11
10
|
|
|
12
|
-
const trpcClient =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// };
|
|
21
|
-
// },
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
11
|
+
const trpcClient = createTRPCClient({
|
|
12
|
+
apiUrl: 'http://localhost:3000/trpc', // Update this to match your API URL
|
|
13
|
+
// Optional: Add headers for authentication
|
|
14
|
+
// headers() {
|
|
15
|
+
// return {
|
|
16
|
+
// authorization: getAuthToken(),
|
|
17
|
+
// };
|
|
18
|
+
// },
|
|
24
19
|
});
|
|
25
20
|
|
|
26
21
|
function App() {
|