Skip to content

Commit b127051

Browse files
committed
handle peerDeps
1 parent afe1ca6 commit b127051

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

scripts/exp/release.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,22 @@ async function updatePackageJsons(
216216

217217
// update dep version and remove -exp in dep names
218218
// don't care about devDependencies because they are irrelavant when using the package
219-
const dependencies = packageJson.dependencies || {};
220-
const newDependenciesObj: { [key: string]: string } = {};
221-
for (const d of Object.keys(dependencies)) {
222-
const dNextVersion = versions.get(d);
223-
const nameWithoutExp = removeExpInPackageName(d);
224-
if (!dNextVersion) {
225-
newDependenciesObj[nameWithoutExp] = dependencies[d];
226-
} else {
227-
newDependenciesObj[nameWithoutExp] = dNextVersion;
219+
const depTypes = ['dependencies', 'peerDependencies'];
220+
221+
for (const depType of depTypes) {
222+
const dependencies = packageJson[depType] || {};
223+
const newDependenciesObj: { [key: string]: string } = {};
224+
for (const d of Object.keys(dependencies)) {
225+
const dNextVersion = versions.get(d);
226+
const nameWithoutExp = removeExpInPackageName(d);
227+
if (!dNextVersion) {
228+
newDependenciesObj[nameWithoutExp] = dependencies[d];
229+
} else {
230+
newDependenciesObj[nameWithoutExp] = dNextVersion;
231+
}
228232
}
233+
packageJson[depType] = newDependenciesObj;
229234
}
230-
packageJson.dependencies = newDependenciesObj;
231235
}
232236

233237
// set private to false

0 commit comments

Comments
 (0)