Skip to content

Commit a967ef7

Browse files
committed
fix: ensure correct peer dependency version range
1 parent 33321d2 commit a967ef7

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
},
110110
{
111111
"filename": "projects/angular-server-side-configuration/package.json",
112-
"type": "json"
112+
"updater": "scripts/standard-version-updater.js"
113113
},
114114
{
115115
"filename": "projects/angular-server-side-configuration/schematics/migration.json",

projects/angular-server-side-configuration/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@
2727
"migrations": "./schematics/migration.json"
2828
},
2929
"peerDependencies": {
30-
"@angular/common": "^17.0.0",
3130
"@angular/core": "^17.0.0"
3231
},
3332
"dependencies": {
34-
"tslib": "^2.3.0",
3533
"glob": "^10.0.0"
3634
}
3735
}

scripts/standard-version-updater.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
module.exports.readVersion = function (_contents) {
2-
const pkg = require('../package.json');
3-
return pkg.version;
2+
return require('../package.json').version;
43
};
54

65
module.exports.writeVersion = function (contents, version) {
76
try {
87
const json = JSON.parse(contents);
9-
json.schematics.dockerfile.version = version;
8+
if (json.name && json.version) {
9+
// projects/angular-server-side-configuration/package.json
10+
json.version = version;
11+
const majorVersionRange = `^${version.split('.')[0]}.0.0`;
12+
for (const name of Object.keys(json.peerDependencies).filter((n) =>
13+
n.startsWith('@angular/'),
14+
)) {
15+
json.peerDependencies[name] = majorVersionRange;
16+
}
17+
} else {
18+
// projects/angular-server-side-configuration/schematics/migration.json
19+
json.schematics.dockerfile.version = version;
20+
}
1021
return JSON.stringify(json, null, 2);
1122
} catch {
1223
return contents.replace(

0 commit comments

Comments
 (0)