Skip to content

Commit 65f2381

Browse files
authored
fix: use workspace package versions in protocol test codegen (#1399)
1 parent cf9257e commit 65f2381

File tree

5 files changed

+115
-79
lines changed

5 files changed

+115
-79
lines changed

.changeset/warm-poems-type.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ generate-protocol-tests:
1212
rm -rf ./private/smithy-rpcv2-cbor
1313
cp -r ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen/smithy-rpcv2-cbor/typescript-codegen ./private/smithy-rpcv2-cbor
1414
cp ./packages/core/jest.config.js ./private/smithy-rpcv2-cbor
15+
node ./scripts/post-protocol-test-codegen
1516
npx prettier --write ./private/smithy-rpcv2-cbor
1617
yarn
1718

private/smithy-rpcv2-cbor/package.json

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,29 @@
1919
"@aws-crypto/sha256-browser": "5.2.0",
2020
"@aws-crypto/sha256-js": "5.2.0",
2121
"@aws-sdk/types": "latest",
22-
"@smithy/config-resolver": "^3.0.6",
23-
"@smithy/core": "^2.4.1",
24-
"@smithy/fetch-http-handler": "^3.2.5",
25-
"@smithy/hash-node": "^3.0.4",
26-
"@smithy/invalid-dependency": "^3.0.4",
27-
"@smithy/middleware-content-length": "^3.0.6",
28-
"@smithy/middleware-retry": "^3.0.16",
29-
"@smithy/middleware-serde": "^3.0.4",
30-
"@smithy/middleware-stack": "^3.0.4",
31-
"@smithy/node-config-provider": "^3.1.5",
32-
"@smithy/node-http-handler": "^3.2.0",
33-
"@smithy/protocol-http": "^4.1.1",
34-
"@smithy/smithy-client": "^3.3.0",
35-
"@smithy/types": "^3.4.0",
36-
"@smithy/url-parser": "^3.0.4",
37-
"@smithy/util-base64": "^3.0.0",
38-
"@smithy/util-body-length-browser": "^3.0.0",
39-
"@smithy/util-body-length-node": "^3.0.0",
40-
"@smithy/util-defaults-mode-browser": "^3.0.16",
41-
"@smithy/util-defaults-mode-node": "^3.0.16",
42-
"@smithy/util-middleware": "^3.0.4",
43-
"@smithy/util-retry": "^3.0.4",
44-
"@smithy/util-utf8": "^3.0.0",
22+
"@smithy/config-resolver": "workspace:^",
23+
"@smithy/core": "workspace:^",
24+
"@smithy/fetch-http-handler": "workspace:^",
25+
"@smithy/hash-node": "workspace:^",
26+
"@smithy/invalid-dependency": "workspace:^",
27+
"@smithy/middleware-content-length": "workspace:^",
28+
"@smithy/middleware-retry": "workspace:^",
29+
"@smithy/middleware-serde": "workspace:^",
30+
"@smithy/middleware-stack": "workspace:^",
31+
"@smithy/node-config-provider": "workspace:^",
32+
"@smithy/node-http-handler": "workspace:^",
33+
"@smithy/protocol-http": "workspace:^",
34+
"@smithy/smithy-client": "workspace:^",
35+
"@smithy/types": "workspace:^",
36+
"@smithy/url-parser": "workspace:^",
37+
"@smithy/util-base64": "workspace:^",
38+
"@smithy/util-body-length-browser": "workspace:^",
39+
"@smithy/util-body-length-node": "workspace:^",
40+
"@smithy/util-defaults-mode-browser": "workspace:^",
41+
"@smithy/util-defaults-mode-node": "workspace:^",
42+
"@smithy/util-middleware": "workspace:^",
43+
"@smithy/util-retry": "workspace:^",
44+
"@smithy/util-utf8": "workspace:^",
4545
"tslib": "^2.6.2"
4646
},
4747
"devDependencies": {

scripts/post-protocol-test-codegen.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
*
3+
* Script to be run after protocol test codegen to set the smithy dependencies
4+
* to workspace:^
5+
*
6+
*/
7+
8+
const path = require("node:path");
9+
const fs = require("node:fs");
10+
11+
const root = path.join(__dirname, "..");
12+
13+
const private = path.join(root, "private");
14+
15+
const privatePackages = fs.readdirSync(private);
16+
17+
for (const dir of privatePackages) {
18+
const pkgJsonPath = path.join(private, dir, "package.json");
19+
if (fs.existsSync(pkgJsonPath)) {
20+
const pkgJson = require(pkgJsonPath);
21+
for (const dep in pkgJson.dependencies ?? {}) {
22+
if (dep.startsWith("@smithy/")) {
23+
pkgJson.dependencies[dep] = "workspace:^";
24+
}
25+
}
26+
for (const dep in pkgJson.devDependencies ?? {}) {
27+
if (dep.startsWith("@smithy/")) {
28+
pkgJson.dependencies[dep] = "workspace:^";
29+
}
30+
}
31+
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2) + "\n");
32+
}
33+
}

yarn.lock

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,7 +2250,7 @@ __metadata:
22502250
languageName: unknown
22512251
linkType: soft
22522252

2253-
"@smithy/config-resolver@^3.0.6, @smithy/config-resolver@workspace:^, @smithy/config-resolver@workspace:packages/config-resolver":
2253+
"@smithy/config-resolver@workspace:^, @smithy/config-resolver@workspace:packages/config-resolver":
22542254
version: 0.0.0-use.local
22552255
resolution: "@smithy/config-resolver@workspace:packages/config-resolver"
22562256
dependencies:
@@ -2266,7 +2266,7 @@ __metadata:
22662266
languageName: unknown
22672267
linkType: soft
22682268

2269-
"@smithy/core@^2.4.1, @smithy/core@workspace:packages/core":
2269+
"@smithy/core@workspace:^, @smithy/core@workspace:packages/core":
22702270
version: 0.0.0-use.local
22712271
resolution: "@smithy/core@workspace:packages/core"
22722272
dependencies:
@@ -2402,7 +2402,7 @@ __metadata:
24022402
languageName: unknown
24032403
linkType: soft
24042404

2405-
"@smithy/fetch-http-handler@^3.2.5, @smithy/fetch-http-handler@workspace:^, @smithy/fetch-http-handler@workspace:packages/fetch-http-handler":
2405+
"@smithy/fetch-http-handler@workspace:^, @smithy/fetch-http-handler@workspace:packages/fetch-http-handler":
24062406
version: 0.0.0-use.local
24072407
resolution: "@smithy/fetch-http-handler@workspace:packages/fetch-http-handler"
24082408
dependencies:
@@ -2435,7 +2435,7 @@ __metadata:
24352435
languageName: unknown
24362436
linkType: soft
24372437

2438-
"@smithy/hash-node@^3.0.4, @smithy/hash-node@workspace:packages/hash-node":
2438+
"@smithy/hash-node@workspace:^, @smithy/hash-node@workspace:packages/hash-node":
24392439
version: 0.0.0-use.local
24402440
resolution: "@smithy/hash-node@workspace:packages/hash-node"
24412441
dependencies:
@@ -2469,7 +2469,7 @@ __metadata:
24692469
languageName: unknown
24702470
linkType: soft
24712471

2472-
"@smithy/invalid-dependency@^3.0.4, @smithy/invalid-dependency@workspace:packages/invalid-dependency":
2472+
"@smithy/invalid-dependency@workspace:^, @smithy/invalid-dependency@workspace:packages/invalid-dependency":
24732473
version: 0.0.0-use.local
24742474
resolution: "@smithy/invalid-dependency@workspace:packages/invalid-dependency"
24752475
dependencies:
@@ -2557,7 +2557,7 @@ __metadata:
25572557
languageName: unknown
25582558
linkType: soft
25592559

2560-
"@smithy/middleware-content-length@^3.0.6, @smithy/middleware-content-length@workspace:packages/middleware-content-length":
2560+
"@smithy/middleware-content-length@workspace:^, @smithy/middleware-content-length@workspace:packages/middleware-content-length":
25612561
version: 0.0.0-use.local
25622562
resolution: "@smithy/middleware-content-length@workspace:packages/middleware-content-length"
25632563
dependencies:
@@ -2590,7 +2590,7 @@ __metadata:
25902590
languageName: unknown
25912591
linkType: soft
25922592

2593-
"@smithy/middleware-retry@^3.0.16, @smithy/middleware-retry@workspace:^, @smithy/middleware-retry@workspace:packages/middleware-retry":
2593+
"@smithy/middleware-retry@workspace:^, @smithy/middleware-retry@workspace:packages/middleware-retry":
25942594
version: 0.0.0-use.local
25952595
resolution: "@smithy/middleware-retry@workspace:packages/middleware-retry"
25962596
dependencies:
@@ -2612,7 +2612,7 @@ __metadata:
26122612
languageName: unknown
26132613
linkType: soft
26142614

2615-
"@smithy/middleware-serde@^3.0.4, @smithy/middleware-serde@workspace:^, @smithy/middleware-serde@workspace:packages/middleware-serde":
2615+
"@smithy/middleware-serde@workspace:^, @smithy/middleware-serde@workspace:packages/middleware-serde":
26162616
version: 0.0.0-use.local
26172617
resolution: "@smithy/middleware-serde@workspace:packages/middleware-serde"
26182618
dependencies:
@@ -2626,7 +2626,7 @@ __metadata:
26262626
languageName: unknown
26272627
linkType: soft
26282628

2629-
"@smithy/middleware-stack@^3.0.4, @smithy/middleware-stack@workspace:^, @smithy/middleware-stack@workspace:packages/middleware-stack":
2629+
"@smithy/middleware-stack@workspace:^, @smithy/middleware-stack@workspace:packages/middleware-stack":
26302630
version: 0.0.0-use.local
26312631
resolution: "@smithy/middleware-stack@workspace:packages/middleware-stack"
26322632
dependencies:
@@ -2639,7 +2639,7 @@ __metadata:
26392639
languageName: unknown
26402640
linkType: soft
26412641

2642-
"@smithy/node-config-provider@^3.1.5, @smithy/node-config-provider@workspace:^, @smithy/node-config-provider@workspace:packages/node-config-provider":
2642+
"@smithy/node-config-provider@workspace:^, @smithy/node-config-provider@workspace:packages/node-config-provider":
26432643
version: 0.0.0-use.local
26442644
resolution: "@smithy/node-config-provider@workspace:packages/node-config-provider"
26452645
dependencies:
@@ -2655,7 +2655,7 @@ __metadata:
26552655
languageName: unknown
26562656
linkType: soft
26572657

2658-
"@smithy/node-http-handler@^3.2.0, @smithy/node-http-handler@workspace:^, @smithy/node-http-handler@workspace:packages/node-http-handler":
2658+
"@smithy/node-http-handler@workspace:^, @smithy/node-http-handler@workspace:packages/node-http-handler":
26592659
version: 0.0.0-use.local
26602660
resolution: "@smithy/node-http-handler@workspace:packages/node-http-handler"
26612661
dependencies:
@@ -2685,7 +2685,7 @@ __metadata:
26852685
languageName: unknown
26862686
linkType: soft
26872687

2688-
"@smithy/protocol-http@^4.1.1, @smithy/protocol-http@workspace:^, @smithy/protocol-http@workspace:packages/protocol-http":
2688+
"@smithy/protocol-http@workspace:^, @smithy/protocol-http@workspace:packages/protocol-http":
26892689
version: 0.0.0-use.local
26902690
resolution: "@smithy/protocol-http@workspace:packages/protocol-http"
26912691
dependencies:
@@ -2784,7 +2784,7 @@ __metadata:
27842784
languageName: unknown
27852785
linkType: soft
27862786

2787-
"@smithy/smithy-client@^3.3.0, @smithy/smithy-client@workspace:^, @smithy/smithy-client@workspace:packages/smithy-client":
2787+
"@smithy/smithy-client@workspace:^, @smithy/smithy-client@workspace:packages/smithy-client":
27882788
version: 0.0.0-use.local
27892789
resolution: "@smithy/smithy-client@workspace:packages/smithy-client"
27902790
dependencies:
@@ -2809,29 +2809,29 @@ __metadata:
28092809
"@aws-crypto/sha256-browser": 5.2.0
28102810
"@aws-crypto/sha256-js": 5.2.0
28112811
"@aws-sdk/types": latest
2812-
"@smithy/config-resolver": ^3.0.6
2813-
"@smithy/core": ^2.4.1
2814-
"@smithy/fetch-http-handler": ^3.2.5
2815-
"@smithy/hash-node": ^3.0.4
2816-
"@smithy/invalid-dependency": ^3.0.4
2817-
"@smithy/middleware-content-length": ^3.0.6
2818-
"@smithy/middleware-retry": ^3.0.16
2819-
"@smithy/middleware-serde": ^3.0.4
2820-
"@smithy/middleware-stack": ^3.0.4
2821-
"@smithy/node-config-provider": ^3.1.5
2822-
"@smithy/node-http-handler": ^3.2.0
2823-
"@smithy/protocol-http": ^4.1.1
2824-
"@smithy/smithy-client": ^3.3.0
2825-
"@smithy/types": ^3.4.0
2826-
"@smithy/url-parser": ^3.0.4
2827-
"@smithy/util-base64": ^3.0.0
2828-
"@smithy/util-body-length-browser": ^3.0.0
2829-
"@smithy/util-body-length-node": ^3.0.0
2830-
"@smithy/util-defaults-mode-browser": ^3.0.16
2831-
"@smithy/util-defaults-mode-node": ^3.0.16
2832-
"@smithy/util-middleware": ^3.0.4
2833-
"@smithy/util-retry": ^3.0.4
2834-
"@smithy/util-utf8": ^3.0.0
2812+
"@smithy/config-resolver": "workspace:^"
2813+
"@smithy/core": "workspace:^"
2814+
"@smithy/fetch-http-handler": "workspace:^"
2815+
"@smithy/hash-node": "workspace:^"
2816+
"@smithy/invalid-dependency": "workspace:^"
2817+
"@smithy/middleware-content-length": "workspace:^"
2818+
"@smithy/middleware-retry": "workspace:^"
2819+
"@smithy/middleware-serde": "workspace:^"
2820+
"@smithy/middleware-stack": "workspace:^"
2821+
"@smithy/node-config-provider": "workspace:^"
2822+
"@smithy/node-http-handler": "workspace:^"
2823+
"@smithy/protocol-http": "workspace:^"
2824+
"@smithy/smithy-client": "workspace:^"
2825+
"@smithy/types": "workspace:^"
2826+
"@smithy/url-parser": "workspace:^"
2827+
"@smithy/util-base64": "workspace:^"
2828+
"@smithy/util-body-length-browser": "workspace:^"
2829+
"@smithy/util-body-length-node": "workspace:^"
2830+
"@smithy/util-defaults-mode-browser": "workspace:^"
2831+
"@smithy/util-defaults-mode-node": "workspace:^"
2832+
"@smithy/util-middleware": "workspace:^"
2833+
"@smithy/util-retry": "workspace:^"
2834+
"@smithy/util-utf8": "workspace:^"
28352835
"@tsconfig/node16": 16.1.3
28362836
"@types/node": ^16.18.96
28372837
concurrently: 7.0.0
@@ -2842,7 +2842,7 @@ __metadata:
28422842
languageName: unknown
28432843
linkType: soft
28442844

2845-
"@smithy/types@^3.1.0, @smithy/types@^3.4.0, @smithy/types@workspace:^, @smithy/types@workspace:packages/types":
2845+
"@smithy/types@^3.1.0, @smithy/types@workspace:^, @smithy/types@workspace:packages/types":
28462846
version: 0.0.0-use.local
28472847
resolution: "@smithy/types@workspace:packages/types"
28482848
dependencies:
@@ -2854,7 +2854,7 @@ __metadata:
28542854
languageName: unknown
28552855
linkType: soft
28562856

2857-
"@smithy/url-parser@^3.0.4, @smithy/url-parser@workspace:^, @smithy/url-parser@workspace:packages/url-parser":
2857+
"@smithy/url-parser@workspace:^, @smithy/url-parser@workspace:packages/url-parser":
28582858
version: 0.0.0-use.local
28592859
resolution: "@smithy/url-parser@workspace:packages/url-parser"
28602860
dependencies:
@@ -2868,7 +2868,7 @@ __metadata:
28682868
languageName: unknown
28692869
linkType: soft
28702870

2871-
"@smithy/util-base64@^3.0.0, @smithy/util-base64@workspace:^, @smithy/util-base64@workspace:packages/util-base64":
2871+
"@smithy/util-base64@workspace:^, @smithy/util-base64@workspace:packages/util-base64":
28722872
version: 0.0.0-use.local
28732873
resolution: "@smithy/util-base64@workspace:packages/util-base64"
28742874
dependencies:
@@ -2883,7 +2883,7 @@ __metadata:
28832883
languageName: unknown
28842884
linkType: soft
28852885

2886-
"@smithy/util-body-length-browser@^3.0.0, @smithy/util-body-length-browser@workspace:^, @smithy/util-body-length-browser@workspace:packages/util-body-length-browser":
2886+
"@smithy/util-body-length-browser@workspace:^, @smithy/util-body-length-browser@workspace:packages/util-body-length-browser":
28872887
version: 0.0.0-use.local
28882888
resolution: "@smithy/util-body-length-browser@workspace:packages/util-body-length-browser"
28892889
dependencies:
@@ -2895,7 +2895,7 @@ __metadata:
28952895
languageName: unknown
28962896
linkType: soft
28972897

2898-
"@smithy/util-body-length-node@^3.0.0, @smithy/util-body-length-node@workspace:packages/util-body-length-node":
2898+
"@smithy/util-body-length-node@workspace:^, @smithy/util-body-length-node@workspace:packages/util-body-length-node":
28992899
version: 0.0.0-use.local
29002900
resolution: "@smithy/util-body-length-node@workspace:packages/util-body-length-node"
29012901
dependencies:
@@ -2945,7 +2945,7 @@ __metadata:
29452945
languageName: unknown
29462946
linkType: soft
29472947

2948-
"@smithy/util-defaults-mode-browser@^3.0.16, @smithy/util-defaults-mode-browser@workspace:packages/util-defaults-mode-browser":
2948+
"@smithy/util-defaults-mode-browser@workspace:^, @smithy/util-defaults-mode-browser@workspace:packages/util-defaults-mode-browser":
29492949
version: 0.0.0-use.local
29502950
resolution: "@smithy/util-defaults-mode-browser@workspace:packages/util-defaults-mode-browser"
29512951
dependencies:
@@ -2962,7 +2962,7 @@ __metadata:
29622962
languageName: unknown
29632963
linkType: soft
29642964

2965-
"@smithy/util-defaults-mode-node@^3.0.16, @smithy/util-defaults-mode-node@workspace:packages/util-defaults-mode-node":
2965+
"@smithy/util-defaults-mode-node@workspace:^, @smithy/util-defaults-mode-node@workspace:packages/util-defaults-mode-node":
29662966
version: 0.0.0-use.local
29672967
resolution: "@smithy/util-defaults-mode-node@workspace:packages/util-defaults-mode-node"
29682968
dependencies:
@@ -3008,7 +3008,7 @@ __metadata:
30083008
languageName: unknown
30093009
linkType: soft
30103010

3011-
"@smithy/util-middleware@^3.0.4, @smithy/util-middleware@workspace:^, @smithy/util-middleware@workspace:packages/util-middleware":
3011+
"@smithy/util-middleware@workspace:^, @smithy/util-middleware@workspace:packages/util-middleware":
30123012
version: 0.0.0-use.local
30133013
resolution: "@smithy/util-middleware@workspace:packages/util-middleware"
30143014
dependencies:
@@ -3022,7 +3022,7 @@ __metadata:
30223022
languageName: unknown
30233023
linkType: soft
30243024

3025-
"@smithy/util-retry@^3.0.4, @smithy/util-retry@workspace:^, @smithy/util-retry@workspace:packages/util-retry":
3025+
"@smithy/util-retry@workspace:^, @smithy/util-retry@workspace:packages/util-retry":
30263026
version: 0.0.0-use.local
30273027
resolution: "@smithy/util-retry@workspace:packages/util-retry"
30283028
dependencies:
@@ -3118,7 +3118,17 @@ __metadata:
31183118
languageName: unknown
31193119
linkType: soft
31203120

3121-
"@smithy/util-utf8@^3.0.0, @smithy/util-utf8@workspace:^, @smithy/util-utf8@workspace:packages/util-utf8":
3121+
"@smithy/util-utf8@npm:^2.0.0":
3122+
version: 2.3.0
3123+
resolution: "@smithy/util-utf8@npm:2.3.0"
3124+
dependencies:
3125+
"@smithy/util-buffer-from": ^2.2.0
3126+
tslib: ^2.6.2
3127+
checksum: 00e55d4b4e37d48be0eef3599082402b933c52a1407fed7e8e8ad76d94d81a0b30b8bfaf2047c59d9c3af31e5f20e7a8c959cb7ae270f894255e05a2229964f0
3128+
languageName: node
3129+
linkType: hard
3130+
3131+
"@smithy/util-utf8@workspace:^, @smithy/util-utf8@workspace:packages/util-utf8":
31223132
version: 0.0.0-use.local
31233133
resolution: "@smithy/util-utf8@workspace:packages/util-utf8"
31243134
dependencies:
@@ -3131,16 +3141,6 @@ __metadata:
31313141
languageName: unknown
31323142
linkType: soft
31333143

3134-
"@smithy/util-utf8@npm:^2.0.0":
3135-
version: 2.3.0
3136-
resolution: "@smithy/util-utf8@npm:2.3.0"
3137-
dependencies:
3138-
"@smithy/util-buffer-from": ^2.2.0
3139-
tslib: ^2.6.2
3140-
checksum: 00e55d4b4e37d48be0eef3599082402b933c52a1407fed7e8e8ad76d94d81a0b30b8bfaf2047c59d9c3af31e5f20e7a8c959cb7ae270f894255e05a2229964f0
3141-
languageName: node
3142-
linkType: hard
3143-
31443144
"@smithy/util-waiter@workspace:packages/util-waiter":
31453145
version: 0.0.0-use.local
31463146
resolution: "@smithy/util-waiter@workspace:packages/util-waiter"

0 commit comments

Comments
 (0)