@aws/nx-plugin-mcp 1.0.0-rc.53 → 1.0.0-rc.55
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/bin/aws-nx-mcp.js
CHANGED
|
@@ -20779,16 +20779,9 @@ var import_lodash_deburr = /* @__PURE__ */ __toESM(require_lodash_deburr(), 1);
|
|
|
20779
20779
|
const kebabCase = (str) => {
|
|
20780
20780
|
return (0, import_lodash_deburr.default)(str).replace(/[^a-zA-Z0-9]+/g, "-").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/^-+|-+$/g, "");
|
|
20781
20781
|
};
|
|
20782
|
-
//#endregion
|
|
20783
|
-
//#region ../nx-plugin/src/utils/commands.ts
|
|
20784
|
-
/**
|
|
20785
|
-
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
20786
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
20787
|
-
*/
|
|
20788
20782
|
/**
|
|
20789
|
-
* The nx version the plugin is built against
|
|
20790
|
-
*
|
|
20791
|
-
* plugin's `@nx/*` packages — a mismatch deadlocks `nx sync`.
|
|
20783
|
+
* The nx version the plugin is built against, and the single source of truth
|
|
20784
|
+
* for every place a workspace's nx is pinned.
|
|
20792
20785
|
*/
|
|
20793
20786
|
const NX_VERSION = {
|
|
20794
20787
|
"@a2a-js/sdk": "0.3.14",
|
|
@@ -20817,8 +20810,13 @@ const NX_VERSION = {
|
|
|
20817
20810
|
"@middy/core": "7.7.0",
|
|
20818
20811
|
"@nxlv/python": "22.2.2",
|
|
20819
20812
|
"@nx-extend/terraform": "10.3.0",
|
|
20813
|
+
nx: "23.1.0",
|
|
20820
20814
|
"@nx/devkit": "23.1.0",
|
|
20815
|
+
"@nx/js": "23.1.0",
|
|
20821
20816
|
"@nx/react": "23.1.0",
|
|
20817
|
+
"@nx/vite": "23.1.0",
|
|
20818
|
+
"@nx/vitest": "23.1.0",
|
|
20819
|
+
"@nx/workspace": "23.1.0",
|
|
20822
20820
|
"create-nx-workspace": "23.1.0",
|
|
20823
20821
|
"@swc-node/register": "1.12.1",
|
|
20824
20822
|
"@swc/core": "1.15.43",
|
|
@@ -20916,7 +20914,13 @@ const NX_VERSION = {
|
|
|
20916
20914
|
vitest: "4.1.10",
|
|
20917
20915
|
zod: "4.4.3",
|
|
20918
20916
|
ws: "8.21.1"
|
|
20919
|
-
}
|
|
20917
|
+
}.nx;
|
|
20918
|
+
//#endregion
|
|
20919
|
+
//#region ../nx-plugin/src/utils/commands.ts
|
|
20920
|
+
/**
|
|
20921
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
20922
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
20923
|
+
*/
|
|
20920
20924
|
const PACKAGE_MANAGER_COMMANDS = {
|
|
20921
20925
|
npm: {
|
|
20922
20926
|
exec: "npx",
|
|
@@ -77,117 +77,11 @@ For TypeScript, check out [Smithy TypeScript](https://github.com/smithy-lang/smi
|
|
|
77
77
|
|
|
78
78
|
Type Safe API provided a Projen project type named `SmithyShapeLibraryProject` which configured a project which contained Smithy models which could be reused by multiple Smithy-based APIs.
|
|
79
79
|
|
|
80
|
-
The
|
|
80
|
+
The equivalent is the <Link path="/guides/smithy-project">`smithy#project` generator</Link> with `type` set to `shapes`:
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
<RunGenerator generator="smithy#project" requiredParameters={{ name: 'my-shapes', type: 'shapes' }} />
|
|
83
83
|
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
1. Create your shape library using the `smithy#project` generator:
|
|
87
|
-
|
|
88
|
-
<RunGenerator generator="smithy#project" />
|
|
89
|
-
|
|
90
|
-
Specify any name for the `serviceName` option, as we will remove the `service` shape.
|
|
91
|
-
|
|
92
|
-
:::note
|
|
93
|
-
This generator is hidden at the time of writing and so you will need to execute it via the CLI.
|
|
94
|
-
:::
|
|
95
|
-
|
|
96
|
-
1. Replace the default model in `src` with the shapes you wish to define
|
|
97
|
-
|
|
98
|
-
1. Update `smithy-build.json` to remove the `plugins` and any unused maven dependencies
|
|
99
|
-
|
|
100
|
-
1. Replace `build.Dockerfile` with minimal build steps:
|
|
101
|
-
|
|
102
|
-
```docker
|
|
103
|
-
// build.Dockerfile
|
|
104
|
-
FROM public.ecr.aws/docker/library/node:24 AS builder
|
|
105
|
-
|
|
106
|
-
# Output directory
|
|
107
|
-
RUN mkdir /out
|
|
108
|
-
|
|
109
|
-
# Install Smithy CLI
|
|
110
|
-
# https://smithy.io/2.0/guides/smithy-cli/cli_installation.html
|
|
111
|
-
WORKDIR /smithy
|
|
112
|
-
ARG TARGETPLATFORM
|
|
113
|
-
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCH="aarch64"; else ARCH="x86_64"; fi && \
|
|
114
|
-
mkdir -p smithy-install/smithy && \
|
|
115
|
-
curl -L https://github.com/smithy-lang/smithy/releases/download/1.61.0/smithy-cli-linux-$ARCH.zip -o smithy-install/smithy-cli-linux-$ARCH.zip && \
|
|
116
|
-
unzip -qo smithy-install/smithy-cli-linux-$ARCH.zip -d smithy-install && \
|
|
117
|
-
mv smithy-install/smithy-cli-linux-$ARCH/* smithy-install/smithy
|
|
118
|
-
RUN smithy-install/smithy/install
|
|
119
|
-
|
|
120
|
-
# Copy project files
|
|
121
|
-
COPY smithy-build.json .
|
|
122
|
-
COPY src src
|
|
123
|
-
|
|
124
|
-
# Smithy build with Maven cache mount
|
|
125
|
-
RUN --mount=type=cache,target=/root/.m2/repository,id=maven-cache \
|
|
126
|
-
smithy build
|
|
127
|
-
|
|
128
|
-
RUN cp -r build/* /out/
|
|
129
|
-
|
|
130
|
-
# Export the /out directory
|
|
131
|
-
FROM scratch AS export
|
|
132
|
-
COPY --from=builder /out /
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
</Steps>
|
|
136
|
-
|
|
137
|
-
###### Consume the Shape Library
|
|
138
|
-
|
|
139
|
-
In your service model project(s), make the following changes to consume the shape library:
|
|
140
|
-
|
|
141
|
-
<Steps>
|
|
142
|
-
|
|
143
|
-
1. Update the `compile` target in `project.json` to add the workspace as build context, and a dependency on the shape library's `build` target
|
|
144
|
-
|
|
145
|
-
```json {10,15} "--build-context workspace=." "@my-project/shapes:build"
|
|
146
|
-
// project.json
|
|
147
|
-
{
|
|
148
|
-
"cache": true,
|
|
149
|
-
"outputs": ["{workspaceRoot}/dist/{projectRoot}/build"],
|
|
150
|
-
"executor": "nx:run-commands",
|
|
151
|
-
"options": {
|
|
152
|
-
"commands": [
|
|
153
|
-
"rimraf dist/packages/api/model/build",
|
|
154
|
-
"make-dir dist/packages/api/model/build",
|
|
155
|
-
"docker build --build-context workspace=. -f packages/api/model/build.Dockerfile --target export --output type=local,dest=dist/packages/api/model/build packages/api/model"
|
|
156
|
-
],
|
|
157
|
-
"parallel": false,
|
|
158
|
-
"cwd": "{workspaceRoot}"
|
|
159
|
-
},
|
|
160
|
-
"dependsOn": ["@my-project/shapes:build"]
|
|
161
|
-
}
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
1. Update the `build.Dockerfile` to copy the `src` directory from your shape library. For example, assuming the shape library is located in `packages/shapes`:
|
|
165
|
-
|
|
166
|
-
```docker {5}
|
|
167
|
-
// build.Dockerfile
|
|
168
|
-
# Copy project files
|
|
169
|
-
COPY smithy-build.json .
|
|
170
|
-
COPY src src
|
|
171
|
-
COPY --from=workspace packages/shapes/src shapes
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
1. Update `smithy-build.json` to add the shapes directory to its `sources`:
|
|
175
|
-
|
|
176
|
-
```json {4} "shapes/"
|
|
177
|
-
// smithy-build.json
|
|
178
|
-
{
|
|
179
|
-
"version": "1.0",
|
|
180
|
-
"sources": ["src/", "shapes/"],
|
|
181
|
-
"plugins": {
|
|
182
|
-
...
|
|
183
|
-
}
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
</Steps>
|
|
187
|
-
|
|
188
|
-
:::note
|
|
189
|
-
Please express your interest on the [GitHub issue here](https://github.com/awslabs/nx-plugin-for-aws/issues/304) if you have a use case for a dedicated Smithy shape library generator.
|
|
190
|
-
:::
|
|
84
|
+
Move the shapes from your `SmithyShapeLibraryProject` into the generated project's `src` folder, then refer to the <Link path="/guides/smithy-project#depending-on-a-shape-library">Smithy project guide</Link> for how to wire the library up as a dependency of your API's model.
|
|
191
85
|
|
|
192
86
|
#### Interceptors
|
|
193
87
|
|