Skip to content

Commit ff60765

Browse files
committed
bump test package file too
1 parent 9001570 commit ff60765

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

scripts/release/updateAPIVersions.ts

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,18 @@ async function updateVersionForJavascript(
5656

5757
clientsConfig.javascript.utilsPackageVersion = nextUtilsPackageVersion;
5858

59-
// update local playground deps
60-
const nodePgPackageFile = await readJsonFile(
61-
toAbsolutePath('playground/javascript/node/package.json')
62-
);
63-
const browserPgPackageFile = await readJsonFile(
64-
toAbsolutePath('playground/javascript/browser/package.json')
65-
);
66-
67-
if (!nodePgPackageFile || !browserPgPackageFile) {
68-
throw new Error('Failed to read playground package files');
69-
}
59+
// update local `package.json` files
60+
const pkgFiles = {
61+
node: await readJsonFile(
62+
toAbsolutePath('playground/javascript/node/package.json')
63+
),
64+
browser: await readJsonFile(
65+
toAbsolutePath('playground/javascript/browser/package.json')
66+
),
67+
cts: await readJsonFile(
68+
toAbsolutePath('tests/output/javascript/package.json')
69+
),
70+
};
7071

7172
// Sets the new version of the JavaScript client
7273
Object.values(GENERATORS)
@@ -93,13 +94,12 @@ async function updateVersionForJavascript(
9394
);
9495
}
9596

96-
if (nodePgPackageFile.dependencies[packageName]) {
97-
nodePgPackageFile.dependencies[packageName] = newVersion;
98-
}
99-
100-
if (browserPgPackageFile.dependencies[packageName]) {
101-
browserPgPackageFile.dependencies[packageName] = newVersion;
102-
}
97+
Object.values(pkgFiles).forEach((pkgFile) => {
98+
if (pkgFile.dependencies[packageName]) {
99+
// eslint-disable-next-line no-param-reassign
100+
pkgFile.dependencies[packageName] = newVersion;
101+
}
102+
});
103103

104104
// We don't want this field to be in the final file, it only exists
105105
// in the scripts.
@@ -109,14 +109,12 @@ async function updateVersionForJavascript(
109109
CLIENTS_JS_UTILS.forEach((util) => {
110110
const utilPackageName = `${clientsConfig.javascript.npmNamespace}/${util}`;
111111

112-
if (nodePgPackageFile.dependencies[utilPackageName]) {
113-
nodePgPackageFile.dependencies[utilPackageName] = nextUtilsPackageVersion;
114-
}
115-
116-
if (browserPgPackageFile.dependencies[utilPackageName]) {
117-
browserPgPackageFile.dependencies[utilPackageName] =
118-
nextUtilsPackageVersion;
119-
}
112+
Object.values(pkgFiles).forEach((pkgFile) => {
113+
if (pkgFile.dependencies[utilPackageName]) {
114+
// eslint-disable-next-line no-param-reassign
115+
pkgFile.dependencies[utilPackageName] = nextUtilsPackageVersion;
116+
}
117+
});
120118
});
121119

122120
// update `openapitools.json` config file
@@ -128,13 +126,19 @@ async function updateVersionForJavascript(
128126
// update `package.json` node playground file
129127
await writeJsonFile(
130128
toAbsolutePath('playground/javascript/node/package.json'),
131-
nodePgPackageFile
129+
pkgFiles.node
132130
);
133131

134132
// update `package.json` browser playground file
135133
await writeJsonFile(
136134
toAbsolutePath('playground/javascript/browser/package.json'),
137-
browserPgPackageFile
135+
pkgFiles.browser
136+
);
137+
138+
// update `package.json` node cts file
139+
await writeJsonFile(
140+
toAbsolutePath('tests/output/javascript/package.json'),
141+
pkgFiles.cts
138142
);
139143

140144
// update `clients.config.json` file for the utils version

0 commit comments

Comments
 (0)