@aws/nx-plugin 0.2.1 → 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.
Files changed (81) hide show
  1. package/LICENSE-THIRD-PARTY +77 -66
  2. package/generators.json +11 -0
  3. package/package.json +6 -2
  4. package/src/cloudscape-website/app/README.md +1 -1
  5. package/src/cloudscape-website/app/__snapshots__/generator.spec.ts.snap +93 -29
  6. package/src/cloudscape-website/app/files/app/README.md.template +4 -2
  7. package/src/cloudscape-website/app/files/app/src/{layouts/App → components/AppLayout}/index.tsx.template +38 -19
  8. package/src/cloudscape-website/app/files/app/src/{layouts/App → components/AppLayout}/navitems.ts.template +1 -1
  9. package/src/cloudscape-website/app/files/app/src/hooks/useAppLayout.tsx.template +5 -0
  10. package/src/cloudscape-website/app/files/app/src/main.tsx.template +13 -6
  11. package/src/cloudscape-website/app/files/app/src/routeTree.gen.ts.template +111 -0
  12. package/src/cloudscape-website/app/files/app/src/routes/__root.tsx.template +6 -0
  13. package/src/cloudscape-website/app/files/app/src/routes/index.tsx.template +5 -0
  14. package/src/cloudscape-website/app/files/app/src/routes/welcome/index.tsx.template +21 -0
  15. package/src/cloudscape-website/app/files/app/src/styles.css.template +1 -0
  16. package/src/cloudscape-website/app/generator.js +24 -13
  17. package/src/cloudscape-website/app/generator.js.map +1 -1
  18. package/src/cloudscape-website/cognito-auth/__snapshots__/generator.spec.ts.snap +2 -2
  19. package/src/cloudscape-website/cognito-auth/generator.js +2 -2
  20. package/src/cloudscape-website/cognito-auth/generator.js.map +1 -1
  21. package/src/cloudscape-website/runtime-config/__snapshots__/generator.spec.ts.snap +2 -4
  22. package/src/cloudscape-website/runtime-config/generator.js +3 -3
  23. package/src/cloudscape-website/runtime-config/generator.js.map +1 -1
  24. package/src/index.d.ts +1 -0
  25. package/src/index.js +4 -0
  26. package/src/index.js.map +1 -1
  27. package/src/infra/app/__snapshots__/generator.spec.ts.snap +2 -0
  28. package/src/infra/app/generator.js.map +1 -1
  29. package/src/license/README.md +290 -0
  30. package/src/license/__snapshots__/config.spec.ts.snap +96 -0
  31. package/src/license/config-types.d.ts +121 -0
  32. package/src/license/config-types.js +3 -0
  33. package/src/license/config-types.js.map +1 -0
  34. package/src/license/config.d.ts +25 -0
  35. package/src/license/config.js +177 -0
  36. package/src/license/config.js.map +1 -0
  37. package/src/license/generator.d.ts +8 -0
  38. package/src/license/generator.js +29 -0
  39. package/src/license/generator.js.map +1 -0
  40. package/src/license/schema.d.ts +17 -0
  41. package/src/license/schema.json +23 -0
  42. package/src/license/sync/files/licenses/ASL/LICENSE.template +96 -0
  43. package/src/license/sync/files/licenses/Apache-2.0/LICENSE.template +175 -0
  44. package/src/license/sync/files/licenses/MIT/LICENSE.template +21 -0
  45. package/src/license/sync/generator.d.ts +9 -0
  46. package/src/license/sync/generator.js +315 -0
  47. package/src/license/sync/generator.js.map +1 -0
  48. package/src/license/sync/project-file-sync.d.ts +15 -0
  49. package/src/license/sync/project-file-sync.js +52 -0
  50. package/src/license/sync/project-file-sync.js.map +1 -0
  51. package/src/license/sync/schema.json +9 -0
  52. package/src/trpc/react/__snapshots__/generator.spec.ts.snap +4 -6
  53. package/src/trpc/react/generator.js +1 -1
  54. package/src/trpc/react/generator.js.map +1 -1
  55. package/src/ts/lib/eslint.js +5 -9
  56. package/src/ts/lib/eslint.js.map +1 -1
  57. package/src/utils/ast.d.ts +5 -1
  58. package/src/utils/ast.js +35 -1
  59. package/src/utils/ast.js.map +1 -1
  60. package/src/utils/config/__snapshots__/utils.spec.ts.snap +16 -0
  61. package/src/utils/config/files/aws-nx-plugin.config.mts.template +5 -0
  62. package/src/utils/config/index.d.ts +15 -0
  63. package/src/utils/config/index.js +5 -0
  64. package/src/utils/config/index.js.map +1 -0
  65. package/src/utils/config/utils.d.ts +20 -0
  66. package/src/utils/config/utils.js +71 -0
  67. package/src/utils/config/utils.js.map +1 -0
  68. package/src/utils/git.d.ts +9 -0
  69. package/src/utils/git.js +27 -0
  70. package/src/utils/git.js.map +1 -0
  71. package/src/utils/js.d.ts +8 -0
  72. package/src/utils/js.js +34 -0
  73. package/src/utils/js.js.map +1 -0
  74. package/src/utils/toml.d.ts +10 -0
  75. package/src/utils/toml.js +17 -0
  76. package/src/utils/toml.js.map +1 -0
  77. package/src/utils/versions.d.ts +4 -3
  78. package/src/utils/versions.js +3 -2
  79. package/src/utils/versions.js.map +1 -1
  80. package/src/cloudscape-website/app/files/app/src/layouts/Routes/index.tsx.template +0 -16
  81. package/src/cloudscape-website/app/files/app/src/pages/Home/index.tsx.template +0 -23
@@ -2948,12 +2948,12 @@ SOFTWARE.
2948
2948
 
2949
2949
  ---
2950
2950
 
2951
- The following software may be included in this product: @esbuild/linux-x64 (0.21.5)
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/linux-x64 <https://github.com/evanw/esbuild#readme>
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/linux-x64 (0.24.0)
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/linux-x64 <https://github.com/evanw/esbuild#readme>
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-linux-x64-gnu (20.4.0)
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-linux-x64-gnu <https://github.com/nrwl/nx#readme>
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-linux-x64-gnu (4.22.5)
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-linux-x64-gnu (1.1.8)
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
@@ -10801,7 +10744,7 @@ THE SOFTWARE.
10801
10744
 
10802
10745
  ---
10803
10746
 
10804
- The following software may be included in this product: fast-glob (3.3.2)
10747
+ The following software may be included in this product: fast-glob (3.3.3)
10805
10748
  This software contains the following license and notice below:
10806
10749
 
10807
10750
  The MIT License (MIT)
@@ -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
 
@@ -38984,6 +38974,27 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
38984
38974
 
38985
38975
  ---
38986
38976
 
38977
+ The following software may be included in this product: minimatch (10.0.1)
38978
+ This software contains the following license and notice below:
38979
+
38980
+ The ISC License
38981
+
38982
+ Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors
38983
+
38984
+ Permission to use, copy, modify, and/or distribute this software for any
38985
+ purpose with or without fee is hereby granted, provided that the above
38986
+ copyright notice and this permission notice appear in all copies.
38987
+
38988
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
38989
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
38990
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
38991
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
38992
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
38993
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
38994
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
38995
+
38996
+ ---
38997
+
38987
38998
  The following software may be included in this product: minipass (7.1.2)
38988
38999
  This software contains the following license and notice below:
38989
39000
 
package/generators.json CHANGED
@@ -38,6 +38,17 @@
38
38
  "factory": "./src/trpc/react/generator",
39
39
  "schema": "./src/trpc/react/schema.json",
40
40
  "description": "provides React integration to a React website"
41
+ },
42
+ "license": {
43
+ "factory": "./src/license/generator",
44
+ "schema": "./src/license/schema.json",
45
+ "description": "Add LICENSE files and configure source code licence headers"
46
+ },
47
+ "license#sync": {
48
+ "factory": "./src/license/sync/generator",
49
+ "schema": "./src/license/sync/schema.json",
50
+ "description": "Sync generator for writing licence headers and subproject LICENSE files",
51
+ "hidden": true
41
52
  }
42
53
  }
43
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "license": "Apache-2.0",
@@ -11,16 +11,20 @@
11
11
  },
12
12
  "generators": "./generators.json",
13
13
  "peerDependencies": {
14
- "prettier": "^3.4.2"
14
+ "prettier": "^3.4.2",
15
+ "nx": "20.4.0"
15
16
  },
16
17
  "dependencies": {
18
+ "@iarna/toml": "^2.2.5",
17
19
  "@nx/devkit": "^20.4.0",
18
20
  "@nx/eslint": "^20.4.0",
19
21
  "@nx/js": "^20.4.0",
20
22
  "@nx/react": "^20.4.0",
21
23
  "@nx/vite": "^20.4.0",
22
24
  "@phenomnomnominal/tsquery": "6.1.3",
25
+ "fast-glob": "^3.3.3",
23
26
  "lodash.kebabcase": "4.1.1",
27
+ "minimatch": "^10.0.1",
24
28
  "typescript": "~5.5.4",
25
29
  "vite": "^5.4.0",
26
30
  "vitest": "^1.6.0"
@@ -233,7 +233,7 @@ import RuntimeConfigProvider from './components/RuntimeConfig';
233
233
 
234
234
  const App = () => (
235
235
  <RuntimeConfigProvider>
236
- <BrowserRouter>{/* Your app components */}</BrowserRouter>
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
- "/// <reference types='vitest' />
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: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
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 AppLayout, {
86
+ import CloudscapeAppLayout, {
82
87
  AppLayoutProps,
83
88
  } from '@cloudscape-design/components/app-layout';
84
- import { matchPath, useLocation, useNavigate } from 'react-router-dom';
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) => matchPath(r, href));
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 App: React.FC = () => {
142
+ const AppLayout: React.FC = () => {
129
143
  const navigate = useNavigate();
130
- const [activeHref, setActiveHref] = useState('/');
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 location = useLocation();
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
- setActiveHref(location.pathname);
147
- const breadcrumbs = getBreadcrumbs(location.pathname, location.search, '/');
160
+ const breadcrumbs = getBreadcrumbs(
161
+ pathname,
162
+ Object.entries(search).reduce((p, [k, v]) => p + \`\${k}=\${v}\`, ''),
163
+ '/',
164
+ );
148
165
  setActiveBreadcrumbs(breadcrumbs);
149
- }, [location]);
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={{ appLayoutProps, setAppLayoutProps: setAppLayoutPropsSafe }}
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
- <AppLayout
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={activeHref}
210
+ activeHref={pathname}
186
211
  onFollow={onNavigate}
187
212
  items={NavItems}
188
213
  />
189
214
  }
190
- content={<Routes />}
215
+ content={<Outlet />}
191
216
  {...appLayoutProps}
192
217
  />
193
218
  </AppLayoutContext.Provider>
194
219
  );
195
220
  };
196
221
 
197
- export default App;
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 App from './layouts/App';
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
- <BrowserRouter>
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 App from './layouts/App';
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
- <BrowserRouter>
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
- `AWS_REGION=ap-southeast-2 CDK_APP_DIR=./dist/packages/infra/cdk.out nx run <%= fullyQualifiedName %>:load:runtime-config`
36
+ `<%= pkgMgrCmd %> nx run <%= fullyQualifiedName %>:load:runtime-config`
37
37
 
38
38
  > [!IMPORTANT]
39
- > Ensure you have deployed your infrastructure first before executing this command.
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