@aws/nx-plugin 0.68.1 → 0.69.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.
- package/LICENSE-THIRD-PARTY +19 -195
- package/package.json +7 -7
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +15 -15
- package/src/infra/app/generator.js +1 -1
- package/src/infra/app/generator.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/py/strands-agent/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/trpc/react/__snapshots__/generator.spec.ts.snap +103 -46
- package/src/trpc/react/files/src/components/__apiNameClassName__ClientProvider.tsx.template +21 -10
- package/src/trpc/react/files/src/hooks/use__apiNameClassName__.tsx.template +16 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +195 -311
- package/src/ts/react-website/app/files/app/shadcn/src/app.tsx.template +12 -0
- package/src/ts/react-website/app/files/app/shadcn/src/components/AppLayout/index.tsx.template +116 -0
- package/src/ts/react-website/app/files/app/shadcn/src/components/alert.tsx.template +30 -0
- package/src/ts/react-website/app/files/app/shadcn/src/components/spinner.tsx.template +3 -0
- package/src/ts/react-website/app/files/app/shadcn/src/main.tsx.template +32 -0
- package/src/ts/react-website/app/files/app/shadcn/src/styles.css.template +2 -0
- package/src/ts/react-website/app/files/tanstack-router/shadcn/src/components/app-sidebar.tsx.template +49 -0
- package/src/ts/react-website/app/files/tanstack-router/shadcn/src/routes/index.tsx.template +16 -0
- package/src/ts/react-website/app/generator.d.ts +3 -2
- package/src/ts/react-website/app/generator.js +41 -11
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/app/schema.d.ts +1 -1
- package/src/ts/react-website/app/schema.json +6 -2
- package/src/ts/react-website/cognito-auth/generator.js +12 -8
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/utils.d.ts +1 -0
- package/src/ts/react-website/cognito-auth/utils.js +113 -1
- package/src/ts/react-website/cognito-auth/utils.js.map +1 -1
- package/src/utils/files/common/shadcn/readme/README.md.template +32 -0
- package/src/utils/files/common/shadcn/src/components/ui/alert.tsx.template +66 -0
- package/src/utils/files/common/shadcn/src/components/ui/breadcrumb.tsx.template +109 -0
- package/src/utils/files/common/shadcn/src/components/ui/button.tsx.template +62 -0
- package/src/utils/files/common/shadcn/src/components/ui/card.tsx.template +92 -0
- package/src/utils/files/common/shadcn/src/components/ui/input.tsx.template +21 -0
- package/src/utils/files/common/shadcn/src/components/ui/separator.tsx.template +28 -0
- package/src/utils/files/common/shadcn/src/components/ui/sheet.tsx.template +139 -0
- package/src/utils/files/common/shadcn/src/components/ui/sidebar.tsx.template +726 -0
- package/src/utils/files/common/shadcn/src/components/ui/skeleton.tsx.template +13 -0
- package/src/utils/files/common/shadcn/src/components/ui/spinner.tsx.template +16 -0
- package/src/utils/files/common/shadcn/src/components/ui/tooltip.tsx.template +61 -0
- package/src/utils/files/common/shadcn/src/hooks/use-mobile.ts.template +19 -0
- package/src/utils/files/common/shadcn/src/index.ts.template +2 -0
- package/src/utils/files/common/shadcn/src/lib/utils.ts.template +6 -0
- package/src/utils/files/common/shadcn/src/styles/globals.css.template +125 -0
- package/src/utils/files/shadcn/components.json.template +20 -0
- package/src/utils/shared-constructs-constants.d.ts +2 -0
- package/src/utils/shared-constructs-constants.js +3 -1
- package/src/utils/shared-constructs-constants.js.map +1 -1
- package/src/utils/shared-shadcn.d.ts +6 -0
- package/src/utils/shared-shadcn.js +123 -0
- package/src/utils/shared-shadcn.js.map +1 -0
- package/src/utils/versions.d.ts +38 -26
- package/src/utils/versions.js +37 -25
- package/src/utils/versions.js.map +1 -1
|
@@ -3,37 +3,51 @@
|
|
|
3
3
|
exports[`trpc react generator > should generate trpc react files > TestApiClientProvider.tsx 1`] = `
|
|
4
4
|
"import { AppRouter } from 'backend';
|
|
5
5
|
import { useQueryClient } from '@tanstack/react-query';
|
|
6
|
-
import {
|
|
7
|
-
import { FC, PropsWithChildren, useMemo } from 'react';
|
|
6
|
+
import { createTRPCOptionsProxy } from '@trpc/tanstack-react-query';
|
|
7
|
+
import { createContext, FC, PropsWithChildren, useMemo } from 'react';
|
|
8
8
|
import { useRuntimeConfig } from '../hooks/useRuntimeConfig';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
HTTPLinkOptions,
|
|
11
|
+
TRPCClient,
|
|
12
|
+
createTRPCClient,
|
|
13
|
+
httpLink,
|
|
14
|
+
} from '@trpc/client';
|
|
15
|
+
|
|
16
|
+
interface TestApiTRPCContextValue {
|
|
17
|
+
optionsProxy: ReturnType<typeof createTRPCOptionsProxy<AppRouter>>;
|
|
18
|
+
client: TRPCClient<AppRouter>;
|
|
19
|
+
}
|
|
10
20
|
|
|
11
|
-
export const TestApiTRPCContext
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
export const TestApiTRPCContext = createContext<TestApiTRPCContextValue | null>(
|
|
22
|
+
null,
|
|
23
|
+
);
|
|
14
24
|
|
|
15
25
|
export const TestApiClientProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
16
26
|
const queryClient = useQueryClient();
|
|
17
27
|
const runtimeConfig = useRuntimeConfig();
|
|
18
28
|
const apiUrl = runtimeConfig.apis.TestApi;
|
|
19
29
|
|
|
20
|
-
const
|
|
30
|
+
const container = useMemo<TestApiTRPCContextValue>(() => {
|
|
21
31
|
const linkOptions: HTTPLinkOptions<any> = {
|
|
22
32
|
url: apiUrl,
|
|
23
33
|
};
|
|
24
34
|
|
|
25
|
-
|
|
35
|
+
const client = createTRPCClient<AppRouter>({
|
|
26
36
|
links: [httpLink(linkOptions)],
|
|
27
37
|
});
|
|
28
|
-
|
|
38
|
+
|
|
39
|
+
const optionsProxy = createTRPCOptionsProxy<AppRouter>({
|
|
40
|
+
client,
|
|
41
|
+
queryClient,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return { optionsProxy, client };
|
|
45
|
+
}, [apiUrl, queryClient]);
|
|
29
46
|
|
|
30
47
|
return (
|
|
31
|
-
<TestApiTRPCContext.
|
|
32
|
-
trpcClient={trpcClient}
|
|
33
|
-
queryClient={queryClient}
|
|
34
|
-
>
|
|
48
|
+
<TestApiTRPCContext.Provider value={container}>
|
|
35
49
|
{children}
|
|
36
|
-
</TestApiTRPCContext.
|
|
50
|
+
</TestApiTRPCContext.Provider>
|
|
37
51
|
);
|
|
38
52
|
};
|
|
39
53
|
|
|
@@ -42,34 +56,60 @@ export default TestApiClientProvider;
|
|
|
42
56
|
`;
|
|
43
57
|
|
|
44
58
|
exports[`trpc react generator > should generate trpc react files > useTestApi.tsx 1`] = `
|
|
45
|
-
"import {
|
|
59
|
+
"import { useContext } from 'react';
|
|
60
|
+
import { TestApiTRPCContext } from '../components/TestApiClientProvider';
|
|
61
|
+
|
|
62
|
+
export const useTestApi = () => {
|
|
63
|
+
const container = useContext(TestApiTRPCContext);
|
|
64
|
+
if (!container) {
|
|
65
|
+
throw new Error('useTestApi must be used within TestApiClientProvider');
|
|
66
|
+
}
|
|
67
|
+
return container.optionsProxy;
|
|
68
|
+
};
|
|
46
69
|
|
|
47
|
-
export const
|
|
70
|
+
export const useTestApiClient = () => {
|
|
71
|
+
const container = useContext(TestApiTRPCContext);
|
|
72
|
+
if (!container) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
'useTestApiClient must be used within TestApiClientProvider',
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return container.client;
|
|
78
|
+
};
|
|
48
79
|
"
|
|
49
80
|
`;
|
|
50
81
|
|
|
51
82
|
exports[`trpc react generator > should handle Cognito auth option > TestApiClientProvider-Cognito.tsx 1`] = `
|
|
52
83
|
"import { AppRouter } from 'backend';
|
|
53
84
|
import { useQueryClient } from '@tanstack/react-query';
|
|
54
|
-
import {
|
|
55
|
-
import { FC, PropsWithChildren, useMemo } from 'react';
|
|
85
|
+
import { createTRPCOptionsProxy } from '@trpc/tanstack-react-query';
|
|
86
|
+
import { createContext, FC, PropsWithChildren, useMemo } from 'react';
|
|
56
87
|
import { useRuntimeConfig } from '../hooks/useRuntimeConfig';
|
|
57
|
-
import {
|
|
88
|
+
import {
|
|
89
|
+
HTTPLinkOptions,
|
|
90
|
+
TRPCClient,
|
|
91
|
+
createTRPCClient,
|
|
92
|
+
httpLink,
|
|
93
|
+
} from '@trpc/client';
|
|
58
94
|
import { useAuth } from 'react-oidc-context';
|
|
59
95
|
|
|
60
|
-
|
|
61
|
-
typeof
|
|
62
|
-
|
|
96
|
+
interface TestApiTRPCContextValue {
|
|
97
|
+
optionsProxy: ReturnType<typeof createTRPCOptionsProxy<AppRouter>>;
|
|
98
|
+
client: TRPCClient<AppRouter>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const TestApiTRPCContext = createContext<TestApiTRPCContextValue | null>(
|
|
102
|
+
null,
|
|
103
|
+
);
|
|
63
104
|
|
|
64
105
|
export const TestApiClientProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
65
106
|
const queryClient = useQueryClient();
|
|
66
107
|
const runtimeConfig = useRuntimeConfig();
|
|
67
108
|
const apiUrl = runtimeConfig.apis.TestApi;
|
|
68
|
-
|
|
69
109
|
const auth = useAuth();
|
|
70
110
|
const user = auth?.user;
|
|
71
111
|
|
|
72
|
-
const
|
|
112
|
+
const container = useMemo<TestApiTRPCContextValue>(() => {
|
|
73
113
|
const linkOptions: HTTPLinkOptions<any> = {
|
|
74
114
|
url: apiUrl,
|
|
75
115
|
headers: {
|
|
@@ -77,18 +117,22 @@ export const TestApiClientProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
|
77
117
|
},
|
|
78
118
|
};
|
|
79
119
|
|
|
80
|
-
|
|
120
|
+
const client = createTRPCClient<AppRouter>({
|
|
81
121
|
links: [httpLink(linkOptions)],
|
|
82
122
|
});
|
|
83
|
-
|
|
123
|
+
|
|
124
|
+
const optionsProxy = createTRPCOptionsProxy<AppRouter>({
|
|
125
|
+
client,
|
|
126
|
+
queryClient,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
return { optionsProxy, client };
|
|
130
|
+
}, [apiUrl, queryClient, user]);
|
|
84
131
|
|
|
85
132
|
return (
|
|
86
|
-
<TestApiTRPCContext.
|
|
87
|
-
trpcClient={trpcClient}
|
|
88
|
-
queryClient={queryClient}
|
|
89
|
-
>
|
|
133
|
+
<TestApiTRPCContext.Provider value={container}>
|
|
90
134
|
{children}
|
|
91
|
-
</TestApiTRPCContext.
|
|
135
|
+
</TestApiTRPCContext.Provider>
|
|
92
136
|
);
|
|
93
137
|
};
|
|
94
138
|
|
|
@@ -99,41 +143,54 @@ export default TestApiClientProvider;
|
|
|
99
143
|
exports[`trpc react generator > should handle IAM auth option > TestApiClientProvider-IAM.tsx 1`] = `
|
|
100
144
|
"import { AppRouter } from 'backend';
|
|
101
145
|
import { useQueryClient } from '@tanstack/react-query';
|
|
102
|
-
import {
|
|
103
|
-
import { FC, PropsWithChildren, useMemo } from 'react';
|
|
146
|
+
import { createTRPCOptionsProxy } from '@trpc/tanstack-react-query';
|
|
147
|
+
import { createContext, FC, PropsWithChildren, useMemo } from 'react';
|
|
104
148
|
import { useRuntimeConfig } from '../hooks/useRuntimeConfig';
|
|
105
|
-
import {
|
|
149
|
+
import {
|
|
150
|
+
HTTPLinkOptions,
|
|
151
|
+
TRPCClient,
|
|
152
|
+
createTRPCClient,
|
|
153
|
+
httpLink,
|
|
154
|
+
} from '@trpc/client';
|
|
106
155
|
import { useSigV4 } from '../hooks/useSigV4';
|
|
107
156
|
|
|
108
|
-
|
|
109
|
-
typeof
|
|
110
|
-
|
|
157
|
+
interface TestApiTRPCContextValue {
|
|
158
|
+
optionsProxy: ReturnType<typeof createTRPCOptionsProxy<AppRouter>>;
|
|
159
|
+
client: TRPCClient<AppRouter>;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export const TestApiTRPCContext = createContext<TestApiTRPCContextValue | null>(
|
|
163
|
+
null,
|
|
164
|
+
);
|
|
111
165
|
|
|
112
166
|
export const TestApiClientProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
113
167
|
const queryClient = useQueryClient();
|
|
114
168
|
const runtimeConfig = useRuntimeConfig();
|
|
115
169
|
const apiUrl = runtimeConfig.apis.TestApi;
|
|
116
|
-
|
|
117
170
|
const sigv4Client = useSigV4();
|
|
118
171
|
|
|
119
|
-
const
|
|
172
|
+
const container = useMemo<TestApiTRPCContextValue>(() => {
|
|
120
173
|
const linkOptions: HTTPLinkOptions<any> = {
|
|
121
174
|
url: apiUrl,
|
|
122
175
|
fetch: sigv4Client,
|
|
123
176
|
};
|
|
124
177
|
|
|
125
|
-
|
|
178
|
+
const client = createTRPCClient<AppRouter>({
|
|
126
179
|
links: [httpLink(linkOptions)],
|
|
127
180
|
});
|
|
128
|
-
|
|
181
|
+
|
|
182
|
+
const optionsProxy = createTRPCOptionsProxy<AppRouter>({
|
|
183
|
+
client,
|
|
184
|
+
queryClient,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
return { optionsProxy, client };
|
|
188
|
+
}, [apiUrl, queryClient, sigv4Client]);
|
|
129
189
|
|
|
130
190
|
return (
|
|
131
|
-
<TestApiTRPCContext.
|
|
132
|
-
trpcClient={trpcClient}
|
|
133
|
-
queryClient={queryClient}
|
|
134
|
-
>
|
|
191
|
+
<TestApiTRPCContext.Provider value={container}>
|
|
135
192
|
{children}
|
|
136
|
-
</TestApiTRPCContext.
|
|
193
|
+
</TestApiTRPCContext.Provider>
|
|
137
194
|
);
|
|
138
195
|
};
|
|
139
196
|
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { AppRouter } from "<%- backendProjectAlias %>";
|
|
2
2
|
import { useQueryClient } from "@tanstack/react-query";
|
|
3
|
-
import {
|
|
4
|
-
import { FC, PropsWithChildren, useMemo } from "react";
|
|
3
|
+
import { createTRPCOptionsProxy } from "@trpc/tanstack-react-query";
|
|
4
|
+
import { createContext, FC, PropsWithChildren, useMemo } from "react";
|
|
5
5
|
import { useRuntimeConfig } from "../hooks/useRuntimeConfig";
|
|
6
|
-
import { HTTPLinkOptions, createTRPCClient, httpLink } from "@trpc/client";
|
|
6
|
+
import { HTTPLinkOptions, TRPCClient, createTRPCClient, httpLink } from "@trpc/client";
|
|
7
7
|
<%_ if (auth === 'IAM') { _%>
|
|
8
8
|
import { useSigV4 } from "../hooks/useSigV4";
|
|
9
9
|
<%_ } else if (auth === 'Cognito') { _%>
|
|
10
10
|
import { useAuth } from "react-oidc-context";
|
|
11
11
|
<%_ } _%>
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
interface <%= apiNameClassName %>TRPCContextValue {
|
|
14
|
+
optionsProxy: ReturnType<typeof createTRPCOptionsProxy<AppRouter>>;
|
|
15
|
+
client: TRPCClient<AppRouter>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const <%= apiNameClassName %>TRPCContext = createContext<<%= apiNameClassName %>TRPCContextValue | null>(null);
|
|
14
19
|
|
|
15
20
|
export const <%= apiNameClassName %>ClientProvider: FC<PropsWithChildren> = ({
|
|
16
21
|
children,
|
|
@@ -18,7 +23,6 @@ export const <%= apiNameClassName %>ClientProvider: FC<PropsWithChildren> = ({
|
|
|
18
23
|
const queryClient = useQueryClient();
|
|
19
24
|
const runtimeConfig = useRuntimeConfig();
|
|
20
25
|
const apiUrl = runtimeConfig.apis.<%= apiNameClassName %>;
|
|
21
|
-
|
|
22
26
|
<%_ if (auth === 'IAM') { _%>
|
|
23
27
|
const sigv4Client = useSigV4();
|
|
24
28
|
<%_ } else if (auth === 'Cognito') { _%>
|
|
@@ -26,7 +30,7 @@ export const <%= apiNameClassName %>ClientProvider: FC<PropsWithChildren> = ({
|
|
|
26
30
|
const user = auth?.user;
|
|
27
31
|
<%_ } _%>
|
|
28
32
|
|
|
29
|
-
const
|
|
33
|
+
const container = useMemo<<%= apiNameClassName %>TRPCContextValue>(() => {
|
|
30
34
|
const linkOptions: HTTPLinkOptions<any> = {
|
|
31
35
|
url: apiUrl,
|
|
32
36
|
<%_ if (auth === 'IAM') { _%>
|
|
@@ -38,15 +42,22 @@ export const <%= apiNameClassName %>ClientProvider: FC<PropsWithChildren> = ({
|
|
|
38
42
|
<%_ } _%>
|
|
39
43
|
};
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
const client = createTRPCClient<AppRouter>({
|
|
42
46
|
links: [httpLink(linkOptions)],
|
|
43
47
|
});
|
|
44
|
-
|
|
48
|
+
|
|
49
|
+
const optionsProxy = createTRPCOptionsProxy<AppRouter>({
|
|
50
|
+
client,
|
|
51
|
+
queryClient,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return { optionsProxy, client };
|
|
55
|
+
}, [apiUrl, queryClient<% if (auth === 'IAM') { %>, sigv4Client<% } else if (auth === 'Cognito') { %>, user<% } %>]);
|
|
45
56
|
|
|
46
57
|
return (
|
|
47
|
-
<<%= apiNameClassName %>TRPCContext.
|
|
58
|
+
<<%= apiNameClassName %>TRPCContext.Provider value={container}>
|
|
48
59
|
{children}
|
|
49
|
-
</<%= apiNameClassName %>TRPCContext.
|
|
60
|
+
</<%= apiNameClassName %>TRPCContext.Provider>
|
|
50
61
|
);
|
|
51
62
|
};
|
|
52
63
|
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
1
2
|
import { <%= apiNameClassName %>TRPCContext } from '../components/<%- apiNameClassName %>ClientProvider';
|
|
2
3
|
|
|
3
|
-
export const use<%- apiNameClassName %> =
|
|
4
|
+
export const use<%- apiNameClassName %> = () => {
|
|
5
|
+
const container = useContext(<%= apiNameClassName %>TRPCContext);
|
|
6
|
+
if (!container) {
|
|
7
|
+
throw new Error('use<%- apiNameClassName %> must be used within <%= apiNameClassName %>ClientProvider');
|
|
8
|
+
}
|
|
9
|
+
return container.optionsProxy;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const use<%- apiNameClassName %>Client = () => {
|
|
13
|
+
const container = useContext(<%= apiNameClassName %>TRPCContext);
|
|
14
|
+
if (!container) {
|
|
15
|
+
throw new Error('use<%- apiNameClassName %>Client must be used within <%= apiNameClassName %>ClientProvider');
|
|
16
|
+
}
|
|
17
|
+
return container.client;
|
|
18
|
+
};
|
|
@@ -645,7 +645,7 @@ exports[`ts#mcp-server generator > should match snapshot for generated files > u
|
|
|
645
645
|
"zod": "4.3.6"
|
|
646
646
|
},
|
|
647
647
|
"devDependencies": {
|
|
648
|
-
"@modelcontextprotocol/inspector": "0.
|
|
648
|
+
"@modelcontextprotocol/inspector": "0.19.0",
|
|
649
649
|
"@types/express": "5.0.6",
|
|
650
650
|
"tsx": "4.21.0"
|
|
651
651
|
}
|
|
@@ -248,7 +248,7 @@ export const registerCreateWorkspaceCommandTool = (server: McpServer) => {
|
|
|
248
248
|
text: \`Run the following command to create a workspace:
|
|
249
249
|
|
|
250
250
|
\\\`\\\`\\\`bash
|
|
251
|
-
npx create-nx-workspace@22.4.
|
|
251
|
+
npx create-nx-workspace@22.4.2 \${workspaceName} --pm=\${packageManager} --preset=@aws/nx-plugin --ci=skip --aiAgents
|
|
252
252
|
\\\`\\\`\\\`
|
|
253
253
|
|
|
254
254
|
This will create a new workspace within the \${workspaceName} directory.
|