@aws/nx-plugin 0.3.0 → 0.4.0
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 +55 -65
- package/package.json +2 -1
- package/src/cloudscape-website/app/README.md +1 -1
- package/src/cloudscape-website/app/__snapshots__/generator.spec.ts.snap +93 -29
- package/src/cloudscape-website/app/files/app/README.md.template +4 -2
- package/src/cloudscape-website/app/files/app/src/{layouts/App → components/AppLayout}/index.tsx.template +38 -19
- package/src/cloudscape-website/app/files/app/src/{layouts/App → components/AppLayout}/navitems.ts.template +1 -1
- package/src/cloudscape-website/app/files/app/src/hooks/useAppLayout.tsx.template +5 -0
- package/src/cloudscape-website/app/files/app/src/main.tsx.template +13 -6
- package/src/cloudscape-website/app/files/app/src/routeTree.gen.ts.template +111 -0
- package/src/cloudscape-website/app/files/app/src/routes/__root.tsx.template +6 -0
- package/src/cloudscape-website/app/files/app/src/routes/index.tsx.template +5 -0
- package/src/cloudscape-website/app/files/app/src/routes/welcome/index.tsx.template +21 -0
- package/src/cloudscape-website/app/files/app/src/styles.css.template +1 -0
- package/src/cloudscape-website/app/generator.js +24 -13
- package/src/cloudscape-website/app/generator.js.map +1 -1
- package/src/cloudscape-website/cognito-auth/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/cloudscape-website/cognito-auth/generator.js +2 -2
- package/src/cloudscape-website/cognito-auth/generator.js.map +1 -1
- package/src/cloudscape-website/runtime-config/__snapshots__/generator.spec.ts.snap +2 -4
- package/src/cloudscape-website/runtime-config/generator.js +3 -3
- package/src/cloudscape-website/runtime-config/generator.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +2 -0
- package/src/infra/app/generator.js.map +1 -1
- package/src/license/README.md +50 -15
- package/src/license/__snapshots__/config.spec.ts.snap +10 -3
- package/src/license/config-types.d.ts +14 -0
- package/src/license/config.d.ts +1 -1
- package/src/license/config.js +15 -12
- package/src/license/config.js.map +1 -1
- package/src/license/generator.js +1 -4
- package/src/license/generator.js.map +1 -1
- package/src/license/sync/generator.js +40 -32
- package/src/license/sync/generator.js.map +1 -1
- package/src/license/sync/project-file-sync.d.ts +15 -0
- package/src/license/sync/project-file-sync.js +52 -0
- package/src/license/sync/project-file-sync.js.map +1 -0
- package/src/trpc/react/__snapshots__/generator.spec.ts.snap +4 -6
- package/src/trpc/react/generator.js +1 -1
- package/src/trpc/react/generator.js.map +1 -1
- package/src/ts/lib/eslint.js +1 -1
- package/src/ts/lib/eslint.js.map +1 -1
- package/src/utils/toml.d.ts +10 -0
- package/src/utils/toml.js +17 -0
- package/src/utils/toml.js.map +1 -0
- package/src/utils/versions.d.ts +4 -3
- package/src/utils/versions.js +3 -2
- package/src/utils/versions.js.map +1 -1
- package/src/cloudscape-website/app/files/app/src/layouts/Routes/index.tsx.template +0 -16
- package/src/cloudscape-website/app/files/app/src/pages/Home/index.tsx.template +0 -23
- /package/src/license/{files → sync/files}/licenses/ASL/LICENSE.template +0 -0
- /package/src/license/{files → sync/files}/licenses/Apache-2.0/LICENSE.template +0 -0
- /package/src/license/{files → sync/files}/licenses/MIT/LICENSE.template +0 -0
package/LICENSE-THIRD-PARTY
CHANGED
|
@@ -2948,12 +2948,12 @@ SOFTWARE.
|
|
|
2948
2948
|
|
|
2949
2949
|
---
|
|
2950
2950
|
|
|
2951
|
-
The following software may be included in this product: @esbuild/
|
|
2951
|
+
The following software may be included in this product: @esbuild/darwin-arm64 (0.21.5)
|
|
2952
2952
|
This software contains the following license and notice below:
|
|
2953
2953
|
|
|
2954
2954
|
MIT License
|
|
2955
2955
|
|
|
2956
|
-
Copyright (c) The maintainers of @esbuild/
|
|
2956
|
+
Copyright (c) The maintainers of @esbuild/darwin-arm64 <https://github.com/evanw/esbuild#readme>
|
|
2957
2957
|
|
|
2958
2958
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
2959
2959
|
|
|
@@ -2963,12 +2963,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
2963
2963
|
|
|
2964
2964
|
---
|
|
2965
2965
|
|
|
2966
|
-
The following software may be included in this product: @esbuild/
|
|
2966
|
+
The following software may be included in this product: @esbuild/darwin-arm64 (0.24.0)
|
|
2967
2967
|
This software contains the following license and notice below:
|
|
2968
2968
|
|
|
2969
2969
|
MIT License
|
|
2970
2970
|
|
|
2971
|
-
Copyright (c) The maintainers of @esbuild/
|
|
2971
|
+
Copyright (c) The maintainers of @esbuild/darwin-arm64 <https://github.com/evanw/esbuild#readme>
|
|
2972
2972
|
|
|
2973
2973
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
2974
2974
|
|
|
@@ -4095,27 +4095,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
4095
4095
|
|
|
4096
4096
|
---
|
|
4097
4097
|
|
|
4098
|
-
The following software may be included in this product: @nx/nx-
|
|
4098
|
+
The following software may be included in this product: @nx/nx-darwin-arm64 (20.4.0)
|
|
4099
4099
|
This software contains the following license and notice below:
|
|
4100
4100
|
|
|
4101
4101
|
MIT License
|
|
4102
4102
|
|
|
4103
|
-
Copyright (c) The maintainers of @nx/nx-
|
|
4104
|
-
|
|
4105
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4106
|
-
|
|
4107
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
4108
|
-
|
|
4109
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
4110
|
-
|
|
4111
|
-
---
|
|
4112
|
-
|
|
4113
|
-
The following software may be included in this product: @nx/nx-linux-x64-musl (20.4.0)
|
|
4114
|
-
This software contains the following license and notice below:
|
|
4115
|
-
|
|
4116
|
-
MIT License
|
|
4117
|
-
|
|
4118
|
-
Copyright (c) The maintainers of @nx/nx-linux-x64-musl <https://github.com/nrwl/nx#readme>
|
|
4103
|
+
Copyright (c) The maintainers of @nx/nx-darwin-arm64 <https://github.com/nrwl/nx#readme>
|
|
4119
4104
|
|
|
4120
4105
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4121
4106
|
|
|
@@ -4513,22 +4498,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
4513
4498
|
|
|
4514
4499
|
---
|
|
4515
4500
|
|
|
4516
|
-
The following software may be included in this product: @rollup/rollup-
|
|
4517
|
-
This software contains the following license and notice below:
|
|
4518
|
-
|
|
4519
|
-
MIT License
|
|
4520
|
-
|
|
4521
|
-
Copyright (c) Lukas Taegert-Atkinson
|
|
4522
|
-
|
|
4523
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4524
|
-
|
|
4525
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
4526
|
-
|
|
4527
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
4528
|
-
|
|
4529
|
-
---
|
|
4530
|
-
|
|
4531
|
-
The following software may be included in this product: @rollup/rollup-linux-x64-musl (4.22.5)
|
|
4501
|
+
The following software may be included in this product: @rollup/rollup-darwin-arm64 (4.22.5)
|
|
4532
4502
|
This software contains the following license and notice below:
|
|
4533
4503
|
|
|
4534
4504
|
MIT License
|
|
@@ -4571,34 +4541,7 @@ SOFTWARE.
|
|
|
4571
4541
|
|
|
4572
4542
|
---
|
|
4573
4543
|
|
|
4574
|
-
The following software may be included in this product: @rspack/binding-
|
|
4575
|
-
This software contains the following license and notice below:
|
|
4576
|
-
|
|
4577
|
-
MIT License
|
|
4578
|
-
|
|
4579
|
-
Copyright (c) 2022-present Bytedance Inc and its affiliates.
|
|
4580
|
-
|
|
4581
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4582
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
4583
|
-
in the Software without restriction, including without limitation the rights
|
|
4584
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
4585
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
4586
|
-
furnished to do so, subject to the following conditions:
|
|
4587
|
-
|
|
4588
|
-
The above copyright notice and this permission notice shall be included in all
|
|
4589
|
-
copies or substantial portions of the Software.
|
|
4590
|
-
|
|
4591
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
4592
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
4593
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
4594
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
4595
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
4596
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
4597
|
-
SOFTWARE.
|
|
4598
|
-
|
|
4599
|
-
---
|
|
4600
|
-
|
|
4601
|
-
The following software may be included in this product: @rspack/binding-linux-x64-musl (1.1.8)
|
|
4544
|
+
The following software may be included in this product: @rspack/binding-darwin-arm64 (1.1.8)
|
|
4602
4545
|
This software contains the following license and notice below:
|
|
4603
4546
|
|
|
4604
4547
|
MIT License
|
|
@@ -11426,6 +11369,34 @@ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHE
|
|
|
11426
11369
|
|
|
11427
11370
|
---
|
|
11428
11371
|
|
|
11372
|
+
The following software may be included in this product: fsevents (2.3.3)
|
|
11373
|
+
This software contains the following license and notice below:
|
|
11374
|
+
|
|
11375
|
+
MIT License
|
|
11376
|
+
-----------
|
|
11377
|
+
|
|
11378
|
+
Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller
|
|
11379
|
+
|
|
11380
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11381
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11382
|
+
in the Software without restriction, including without limitation the rights
|
|
11383
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11384
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11385
|
+
furnished to do so, subject to the following conditions:
|
|
11386
|
+
|
|
11387
|
+
The above copyright notice and this permission notice shall be included in
|
|
11388
|
+
all copies or substantial portions of the Software.
|
|
11389
|
+
|
|
11390
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11391
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
11392
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
11393
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
11394
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
11395
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
11396
|
+
THE SOFTWARE.
|
|
11397
|
+
|
|
11398
|
+
---
|
|
11399
|
+
|
|
11429
11400
|
The following software may be included in this product: function-bind (1.1.2)
|
|
11430
11401
|
This software contains the following license and notice below:
|
|
11431
11402
|
|
|
@@ -38382,6 +38353,25 @@ END OF TERMS AND CONDITIONS
|
|
|
38382
38353
|
|
|
38383
38354
|
---
|
|
38384
38355
|
|
|
38356
|
+
The following software may be included in this product: @iarna/toml (2.2.5)
|
|
38357
|
+
This software contains the following license and notice below:
|
|
38358
|
+
|
|
38359
|
+
Copyright (c) 2016, Rebecca Turner <me@re-becca.org>
|
|
38360
|
+
|
|
38361
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
38362
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
38363
|
+
copyright notice and this permission notice appear in all copies.
|
|
38364
|
+
|
|
38365
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
38366
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
38367
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
38368
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
38369
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
38370
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
38371
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
38372
|
+
|
|
38373
|
+
---
|
|
38374
|
+
|
|
38385
38375
|
The following software may be included in this product: @isaacs/cliui (8.0.2)
|
|
38386
38376
|
This software contains the following license and notice below:
|
|
38387
38377
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws/nx-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"nx": "20.4.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"@iarna/toml": "^2.2.5",
|
|
18
19
|
"@nx/devkit": "^20.4.0",
|
|
19
20
|
"@nx/eslint": "^20.4.0",
|
|
20
21
|
"@nx/js": "^20.4.0",
|
|
@@ -233,7 +233,7 @@ import RuntimeConfigProvider from './components/RuntimeConfig';
|
|
|
233
233
|
|
|
234
234
|
const App = () => (
|
|
235
235
|
<RuntimeConfigProvider>
|
|
236
|
-
<
|
|
236
|
+
<RouterProvider router={router} />
|
|
237
237
|
</RuntimeConfigProvider>
|
|
238
238
|
);
|
|
239
239
|
```
|
|
@@ -21,7 +21,8 @@ exports[`cloudscape-website generator > should configure TypeScript correctly >
|
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
23
|
exports[`cloudscape-website generator > should configure vite correctly > vite.config.ts 1`] = `
|
|
24
|
-
"
|
|
24
|
+
"import { TanStackRouterVite } from '@tanstack/router-plugin/vite';
|
|
25
|
+
/// <reference types='vitest' />
|
|
25
26
|
import { defineConfig } from 'vite';
|
|
26
27
|
import react from '@vitejs/plugin-react';
|
|
27
28
|
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
@@ -40,7 +41,12 @@ export default defineConfig({
|
|
|
40
41
|
port: 4300,
|
|
41
42
|
host: 'localhost',
|
|
42
43
|
},
|
|
43
|
-
plugins: [
|
|
44
|
+
plugins: [
|
|
45
|
+
react(),
|
|
46
|
+
nxViteTsPaths(),
|
|
47
|
+
nxCopyAssetsPlugin(['*.md']),
|
|
48
|
+
TanStackRouterVite(),
|
|
49
|
+
],
|
|
44
50
|
build: {
|
|
45
51
|
outDir: '../dist/test-app',
|
|
46
52
|
emptyOutDir: true,
|
|
@@ -70,7 +76,6 @@ exports[`cloudscape-website generator > should generate base files and structure
|
|
|
70
76
|
import { createContext, useCallback, useEffect, useState } from 'react';
|
|
71
77
|
import { NavItems } from './navitems';
|
|
72
78
|
import Config from '../../config';
|
|
73
|
-
import Routes from '../Routes';
|
|
74
79
|
|
|
75
80
|
import {
|
|
76
81
|
BreadcrumbGroup,
|
|
@@ -78,10 +83,11 @@ import {
|
|
|
78
83
|
SideNavigation,
|
|
79
84
|
TopNavigation,
|
|
80
85
|
} from '@cloudscape-design/components';
|
|
81
|
-
import
|
|
86
|
+
import CloudscapeAppLayout, {
|
|
82
87
|
AppLayoutProps,
|
|
83
88
|
} from '@cloudscape-design/components/app-layout';
|
|
84
|
-
import {
|
|
89
|
+
import { matchByPath, useLocation, useNavigate } from '@tanstack/react-router';
|
|
90
|
+
import { Outlet } from '@tanstack/react-router';
|
|
85
91
|
|
|
86
92
|
const getBreadcrumbs = (
|
|
87
93
|
pathName: string,
|
|
@@ -104,7 +110,7 @@ const getBreadcrumbs = (
|
|
|
104
110
|
.replace('//', '/')}\`;
|
|
105
111
|
|
|
106
112
|
const matched =
|
|
107
|
-
!availableRoutes || availableRoutes.find((r) =>
|
|
113
|
+
!availableRoutes || availableRoutes.find((r) => matchByPath(r, href, {}));
|
|
108
114
|
|
|
109
115
|
return {
|
|
110
116
|
href: matched ? \`\${href}\${search}\` : '#',
|
|
@@ -113,6 +119,12 @@ const getBreadcrumbs = (
|
|
|
113
119
|
});
|
|
114
120
|
};
|
|
115
121
|
|
|
122
|
+
export interface AppLayoutContext {
|
|
123
|
+
appLayoutProps: AppLayoutProps;
|
|
124
|
+
setAppLayoutProps: (props: AppLayoutProps) => void;
|
|
125
|
+
displayHelpPanel: (helpContent: React.ReactNode) => void;
|
|
126
|
+
}
|
|
127
|
+
|
|
116
128
|
/**
|
|
117
129
|
* Context for updating/retrieving the AppLayout.
|
|
118
130
|
*/
|
|
@@ -120,19 +132,21 @@ export const AppLayoutContext = createContext({
|
|
|
120
132
|
appLayoutProps: {},
|
|
121
133
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
122
134
|
setAppLayoutProps: (_: AppLayoutProps) => {},
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
136
|
+
displayHelpPanel: (_: React.ReactNode) => {},
|
|
123
137
|
});
|
|
124
138
|
|
|
125
139
|
/**
|
|
126
140
|
* Defines the App layout and contains logic for routing.
|
|
127
141
|
*/
|
|
128
|
-
const
|
|
142
|
+
const AppLayout: React.FC = () => {
|
|
129
143
|
const navigate = useNavigate();
|
|
130
|
-
const
|
|
144
|
+
const appLayout = React.useRef<AppLayoutProps.Ref>(null);
|
|
131
145
|
const [activeBreadcrumbs, setActiveBreadcrumbs] = useState<
|
|
132
146
|
BreadcrumbGroupProps.Item[]
|
|
133
147
|
>([{ text: '/', href: '/' }]);
|
|
134
148
|
const [appLayoutProps, setAppLayoutProps] = useState<AppLayoutProps>({});
|
|
135
|
-
const
|
|
149
|
+
const { pathname, search } = useLocation();
|
|
136
150
|
|
|
137
151
|
const setAppLayoutPropsSafe = useCallback(
|
|
138
152
|
(props: AppLayoutProps) => {
|
|
@@ -143,10 +157,13 @@ const App: React.FC = () => {
|
|
|
143
157
|
);
|
|
144
158
|
|
|
145
159
|
useEffect(() => {
|
|
146
|
-
|
|
147
|
-
|
|
160
|
+
const breadcrumbs = getBreadcrumbs(
|
|
161
|
+
pathname,
|
|
162
|
+
Object.entries(search).reduce((p, [k, v]) => p + \`\${k}=\${v}\`, ''),
|
|
163
|
+
'/',
|
|
164
|
+
);
|
|
148
165
|
setActiveBreadcrumbs(breadcrumbs);
|
|
149
|
-
}, [
|
|
166
|
+
}, [pathname, search]);
|
|
150
167
|
|
|
151
168
|
const onNavigate = useCallback(
|
|
152
169
|
(e: CustomEvent<{ href: string; external?: boolean }>) => {
|
|
@@ -155,7 +172,7 @@ const App: React.FC = () => {
|
|
|
155
172
|
setAppLayoutPropsSafe({
|
|
156
173
|
contentType: undefined,
|
|
157
174
|
});
|
|
158
|
-
navigate(e.detail.href);
|
|
175
|
+
navigate({ to: e.detail.href });
|
|
159
176
|
}
|
|
160
177
|
},
|
|
161
178
|
[navigate, setAppLayoutPropsSafe],
|
|
@@ -163,7 +180,14 @@ const App: React.FC = () => {
|
|
|
163
180
|
|
|
164
181
|
return (
|
|
165
182
|
<AppLayoutContext.Provider
|
|
166
|
-
value={{
|
|
183
|
+
value={{
|
|
184
|
+
appLayoutProps,
|
|
185
|
+
setAppLayoutProps: setAppLayoutPropsSafe,
|
|
186
|
+
displayHelpPanel: (helpContent: React.ReactNode) => {
|
|
187
|
+
setAppLayoutPropsSafe({ tools: helpContent, toolsHide: false });
|
|
188
|
+
appLayout.current?.openTools();
|
|
189
|
+
},
|
|
190
|
+
}}
|
|
167
191
|
>
|
|
168
192
|
<TopNavigation
|
|
169
193
|
identity={{
|
|
@@ -174,7 +198,8 @@ const App: React.FC = () => {
|
|
|
174
198
|
},
|
|
175
199
|
}}
|
|
176
200
|
/>
|
|
177
|
-
<
|
|
201
|
+
<CloudscapeAppLayout
|
|
202
|
+
ref={appLayout}
|
|
178
203
|
breadcrumbs={
|
|
179
204
|
<BreadcrumbGroup onFollow={onNavigate} items={activeBreadcrumbs} />
|
|
180
205
|
}
|
|
@@ -182,19 +207,19 @@ const App: React.FC = () => {
|
|
|
182
207
|
navigation={
|
|
183
208
|
<SideNavigation
|
|
184
209
|
header={{ text: Config.applicationName, href: '/' }}
|
|
185
|
-
activeHref={
|
|
210
|
+
activeHref={pathname}
|
|
186
211
|
onFollow={onNavigate}
|
|
187
212
|
items={NavItems}
|
|
188
213
|
/>
|
|
189
214
|
}
|
|
190
|
-
content={<
|
|
215
|
+
content={<Outlet />}
|
|
191
216
|
{...appLayoutProps}
|
|
192
217
|
/>
|
|
193
218
|
</AppLayoutContext.Provider>
|
|
194
219
|
);
|
|
195
220
|
};
|
|
196
221
|
|
|
197
|
-
export default
|
|
222
|
+
export default AppLayout;
|
|
198
223
|
"
|
|
199
224
|
`;
|
|
200
225
|
|
|
@@ -209,27 +234,59 @@ exports[`cloudscape-website generator > should generate base files and structure
|
|
|
209
234
|
exports[`cloudscape-website generator > should generate base files and structure > main.tsx 1`] = `
|
|
210
235
|
"import React from 'react';
|
|
211
236
|
import { createRoot } from 'react-dom/client';
|
|
212
|
-
import { BrowserRouter } from 'react-router-dom';
|
|
213
237
|
import { I18nProvider } from '@cloudscape-design/components/i18n';
|
|
214
238
|
import messages from '@cloudscape-design/components/i18n/messages/all.en';
|
|
215
|
-
import
|
|
239
|
+
import { RouterProvider, createRouter } from '@tanstack/react-router';
|
|
240
|
+
import { routeTree } from './routeTree.gen';
|
|
216
241
|
|
|
217
242
|
import '@cloudscape-design/global-styles/index.css';
|
|
218
243
|
|
|
244
|
+
const router = createRouter({ routeTree });
|
|
245
|
+
|
|
246
|
+
// Register the router instance for type safety
|
|
247
|
+
declare module '@tanstack/react-router' {
|
|
248
|
+
interface Register {
|
|
249
|
+
router: typeof router;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
219
253
|
const root = document.getElementById('root');
|
|
220
254
|
root &&
|
|
221
255
|
createRoot(root).render(
|
|
222
256
|
<React.StrictMode>
|
|
223
257
|
<I18nProvider locale="en" messages={[messages]}>
|
|
224
|
-
<
|
|
225
|
-
<App />
|
|
226
|
-
</BrowserRouter>
|
|
258
|
+
<RouterProvider router={router} />
|
|
227
259
|
</I18nProvider>
|
|
228
260
|
</React.StrictMode>,
|
|
229
261
|
);
|
|
230
262
|
"
|
|
231
263
|
`;
|
|
232
264
|
|
|
265
|
+
exports[`cloudscape-website generator > should generate base files and structure > welcome-index.tsx 1`] = `
|
|
266
|
+
"import {
|
|
267
|
+
ContentLayout,
|
|
268
|
+
Header,
|
|
269
|
+
SpaceBetween,
|
|
270
|
+
Container,
|
|
271
|
+
} from '@cloudscape-design/components';
|
|
272
|
+
import { createFileRoute } from '@tanstack/react-router';
|
|
273
|
+
|
|
274
|
+
export const Route = createFileRoute('/welcome/')({
|
|
275
|
+
component: RouteComponent,
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
function RouteComponent() {
|
|
279
|
+
return (
|
|
280
|
+
<ContentLayout header={<Header>Welcome</Header>}>
|
|
281
|
+
<SpaceBetween size="l">
|
|
282
|
+
<Container>Welcome to your new Cloudscape website!</Container>
|
|
283
|
+
</SpaceBetween>
|
|
284
|
+
</ContentLayout>
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
"
|
|
288
|
+
`;
|
|
289
|
+
|
|
233
290
|
exports[`cloudscape-website generator > should generate shared constructs > common/constructs-app-index.ts 1`] = `
|
|
234
291
|
"export * from './test-app.js';
|
|
235
292
|
"
|
|
@@ -463,21 +520,28 @@ export class TestApp extends StaticWebsite {
|
|
|
463
520
|
exports[`cloudscape-website generator > should handle custom directory option > custom-dir-main.tsx 1`] = `
|
|
464
521
|
"import React from 'react';
|
|
465
522
|
import { createRoot } from 'react-dom/client';
|
|
466
|
-
import { BrowserRouter } from 'react-router-dom';
|
|
467
523
|
import { I18nProvider } from '@cloudscape-design/components/i18n';
|
|
468
524
|
import messages from '@cloudscape-design/components/i18n/messages/all.en';
|
|
469
|
-
import
|
|
525
|
+
import { RouterProvider, createRouter } from '@tanstack/react-router';
|
|
526
|
+
import { routeTree } from './routeTree.gen';
|
|
470
527
|
|
|
471
528
|
import '@cloudscape-design/global-styles/index.css';
|
|
472
529
|
|
|
530
|
+
const router = createRouter({ routeTree });
|
|
531
|
+
|
|
532
|
+
// Register the router instance for type safety
|
|
533
|
+
declare module '@tanstack/react-router' {
|
|
534
|
+
interface Register {
|
|
535
|
+
router: typeof router;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
473
539
|
const root = document.getElementById('root');
|
|
474
540
|
root &&
|
|
475
541
|
createRoot(root).render(
|
|
476
542
|
<React.StrictMode>
|
|
477
543
|
<I18nProvider locale="en" messages={[messages]}>
|
|
478
|
-
<
|
|
479
|
-
<App />
|
|
480
|
-
</BrowserRouter>
|
|
544
|
+
<RouterProvider router={router} />
|
|
481
545
|
</I18nProvider>
|
|
482
546
|
</React.StrictMode>,
|
|
483
547
|
);
|
|
@@ -489,10 +553,10 @@ exports[`cloudscape-website generator > should handle npm scope prefix correctly
|
|
|
489
553
|
"@cloudscape-design/board-components": "^3.0.84",
|
|
490
554
|
"@cloudscape-design/components": "^3.0.823",
|
|
491
555
|
"@cloudscape-design/global-styles": "^1.0.34",
|
|
556
|
+
"@tanstack/react-router": "^1.99.7",
|
|
492
557
|
"aws-cdk-lib": "^2.166.0",
|
|
493
558
|
"constructs": "^10.4.2",
|
|
494
559
|
"react": "18.3.1",
|
|
495
560
|
"react-dom": "18.3.1",
|
|
496
|
-
"react-router-dom": "^7.1.1",
|
|
497
561
|
}
|
|
498
562
|
`;
|
|
@@ -33,10 +33,12 @@ You can also automatically fix some lint errors by running the following command
|
|
|
33
33
|
|
|
34
34
|
In order to integrate with cognito or trpc backends, you need to have a `runtime-config.json` file in your `/public` website directory. You can fetch this is follows:
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
`<%= pkgMgrCmd %> nx run <%= fullyQualifiedName %>:load:runtime-config`
|
|
37
37
|
|
|
38
38
|
> [!IMPORTANT]
|
|
39
|
-
> Ensure you have
|
|
39
|
+
> Ensure you have AWS CLI and curl installed
|
|
40
|
+
> You have deployed your CDK infrastructure into the appropriate account
|
|
41
|
+
> You have assumed a role in the AWS account with sufficient permissions to call describe-stacks from cloudformation
|
|
40
42
|
|
|
41
43
|
## Useful links
|
|
42
44
|
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { createContext, useCallback, useEffect, useState } from 'react';
|
|
3
3
|
import { NavItems } from './navitems';
|
|
4
4
|
import Config from '../../config';
|
|
5
|
-
import Routes from '../Routes';
|
|
6
5
|
|
|
7
6
|
import {
|
|
8
7
|
BreadcrumbGroup,
|
|
@@ -10,16 +9,17 @@ import {
|
|
|
10
9
|
SideNavigation,
|
|
11
10
|
TopNavigation,
|
|
12
11
|
} from '@cloudscape-design/components';
|
|
13
|
-
import
|
|
12
|
+
import CloudscapeAppLayout, {
|
|
14
13
|
AppLayoutProps,
|
|
15
14
|
} from '@cloudscape-design/components/app-layout';
|
|
16
|
-
import {
|
|
15
|
+
import { matchByPath, useLocation, useNavigate } from '@tanstack/react-router';
|
|
16
|
+
import { Outlet } from '@tanstack/react-router';
|
|
17
17
|
|
|
18
18
|
const getBreadcrumbs = (
|
|
19
19
|
pathName: string,
|
|
20
20
|
search: string,
|
|
21
21
|
defaultBreadcrumb: string,
|
|
22
|
-
availableRoutes?: string[]
|
|
22
|
+
availableRoutes?: string[],
|
|
23
23
|
) => {
|
|
24
24
|
const segments = [
|
|
25
25
|
defaultBreadcrumb,
|
|
@@ -36,7 +36,7 @@ const getBreadcrumbs = (
|
|
|
36
36
|
.replace('//', '/')}`;
|
|
37
37
|
|
|
38
38
|
const matched =
|
|
39
|
-
!availableRoutes || availableRoutes.find((r) =>
|
|
39
|
+
!availableRoutes || availableRoutes.find((r) => matchByPath(r, href, {}));
|
|
40
40
|
|
|
41
41
|
return {
|
|
42
42
|
href: matched ? `${href}${search}` : '#',
|
|
@@ -45,6 +45,12 @@ const getBreadcrumbs = (
|
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
export interface AppLayoutContext {
|
|
49
|
+
appLayoutProps: AppLayoutProps;
|
|
50
|
+
setAppLayoutProps: (props: AppLayoutProps) => void;
|
|
51
|
+
displayHelpPanel: (helpContent: React.ReactNode) => void;
|
|
52
|
+
}
|
|
53
|
+
|
|
48
54
|
/**
|
|
49
55
|
* Context for updating/retrieving the AppLayout.
|
|
50
56
|
*/
|
|
@@ -52,33 +58,38 @@ export const AppLayoutContext = createContext({
|
|
|
52
58
|
appLayoutProps: {},
|
|
53
59
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
54
60
|
setAppLayoutProps: (_: AppLayoutProps) => {},
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
62
|
+
displayHelpPanel: (_: React.ReactNode) => {},
|
|
55
63
|
});
|
|
56
64
|
|
|
57
65
|
/**
|
|
58
66
|
* Defines the App layout and contains logic for routing.
|
|
59
67
|
*/
|
|
60
|
-
const
|
|
68
|
+
const AppLayout: React.FC = () => {
|
|
61
69
|
const navigate = useNavigate();
|
|
62
|
-
const
|
|
70
|
+
const appLayout = React.useRef<AppLayoutProps.Ref>(null);
|
|
63
71
|
const [activeBreadcrumbs, setActiveBreadcrumbs] = useState<
|
|
64
72
|
BreadcrumbGroupProps.Item[]
|
|
65
73
|
>([{ text: '/', href: '/' }]);
|
|
66
74
|
const [appLayoutProps, setAppLayoutProps] = useState<AppLayoutProps>({});
|
|
67
|
-
const
|
|
75
|
+
const { pathname, search } = useLocation();
|
|
68
76
|
|
|
69
77
|
const setAppLayoutPropsSafe = useCallback(
|
|
70
78
|
(props: AppLayoutProps) => {
|
|
71
79
|
JSON.stringify(appLayoutProps) !== JSON.stringify(props) &&
|
|
72
80
|
setAppLayoutProps(props);
|
|
73
81
|
},
|
|
74
|
-
[appLayoutProps]
|
|
82
|
+
[appLayoutProps],
|
|
75
83
|
);
|
|
76
84
|
|
|
77
85
|
useEffect(() => {
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
const breadcrumbs = getBreadcrumbs(
|
|
87
|
+
pathname,
|
|
88
|
+
Object.entries(search).reduce((p, [k, v]) => p + `${k}=${v}`, ''),
|
|
89
|
+
'/',
|
|
90
|
+
);
|
|
80
91
|
setActiveBreadcrumbs(breadcrumbs);
|
|
81
|
-
}, [
|
|
92
|
+
}, [pathname, search]);
|
|
82
93
|
|
|
83
94
|
const onNavigate = useCallback(
|
|
84
95
|
(e: CustomEvent<{ href: string; external?: boolean }>) => {
|
|
@@ -87,15 +98,22 @@ const App: React.FC = () => {
|
|
|
87
98
|
setAppLayoutPropsSafe({
|
|
88
99
|
contentType: undefined,
|
|
89
100
|
});
|
|
90
|
-
navigate(e.detail.href);
|
|
101
|
+
navigate({ to: e.detail.href });
|
|
91
102
|
}
|
|
92
103
|
},
|
|
93
|
-
[navigate, setAppLayoutPropsSafe]
|
|
104
|
+
[navigate, setAppLayoutPropsSafe],
|
|
94
105
|
);
|
|
95
106
|
|
|
96
107
|
return (
|
|
97
108
|
<AppLayoutContext.Provider
|
|
98
|
-
value={{
|
|
109
|
+
value={{
|
|
110
|
+
appLayoutProps,
|
|
111
|
+
setAppLayoutProps: setAppLayoutPropsSafe,
|
|
112
|
+
displayHelpPanel: (helpContent: React.ReactNode) => {
|
|
113
|
+
setAppLayoutPropsSafe({ tools: helpContent, toolsHide: false });
|
|
114
|
+
appLayout.current?.openTools();
|
|
115
|
+
},
|
|
116
|
+
}}
|
|
99
117
|
>
|
|
100
118
|
<TopNavigation
|
|
101
119
|
identity={{
|
|
@@ -106,7 +124,8 @@ const App: React.FC = () => {
|
|
|
106
124
|
},
|
|
107
125
|
}}
|
|
108
126
|
/>
|
|
109
|
-
<
|
|
127
|
+
<CloudscapeAppLayout
|
|
128
|
+
ref={appLayout}
|
|
110
129
|
breadcrumbs={
|
|
111
130
|
<BreadcrumbGroup onFollow={onNavigate} items={activeBreadcrumbs} />
|
|
112
131
|
}
|
|
@@ -114,16 +133,16 @@ const App: React.FC = () => {
|
|
|
114
133
|
navigation={
|
|
115
134
|
<SideNavigation
|
|
116
135
|
header={{ text: Config.applicationName, href: '/' }}
|
|
117
|
-
activeHref={
|
|
136
|
+
activeHref={pathname}
|
|
118
137
|
onFollow={onNavigate}
|
|
119
138
|
items={NavItems}
|
|
120
139
|
/>
|
|
121
140
|
}
|
|
122
|
-
content={<
|
|
141
|
+
content={<Outlet />}
|
|
123
142
|
{...appLayoutProps}
|
|
124
143
|
/>
|
|
125
144
|
</AppLayoutContext.Provider>
|
|
126
145
|
);
|
|
127
146
|
};
|
|
128
147
|
|
|
129
|
-
export default
|
|
148
|
+
export default AppLayout;
|
|
@@ -4,5 +4,5 @@ import { SideNavigationProps } from '@cloudscape-design/components';
|
|
|
4
4
|
* Define your Navigation Items here
|
|
5
5
|
*/
|
|
6
6
|
export const NavItems: SideNavigationProps.Item[] = [
|
|
7
|
-
{ text: '
|
|
7
|
+
{ text: 'Welcome', type: 'link', href: '/welcome' },
|
|
8
8
|
];
|