Skip to content

Commit 38d327c

Browse files
authored
feat(jsii): allow specifying a deprecation message regardless of stability (#4145)
Previously, `jsii` required the package's stability to be `deprecated` if there cas a `deprecated` message configured. This is however problematic when a `stable` package reaches End-of-Support and the maintainer wants to signal this in npmjs.com. Instead of failing, only log a warning to possibly raise awareness on an unintended configuration. Additionally - emit the `Development Status :: 7 - Inactive` trove classifier on packages with a `deprecated` message, even if their stability is not `deprecated`.
1 parent 66939ca commit 38d327c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/jsii-pacmak/lib/targets/python.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2125,7 +2125,14 @@ class Package {
21252125
scripts,
21262126
};
21272127

2128-
switch (this.metadata.docs?.stability) {
2128+
// Packages w/ a deprecated message may have a non-deprecated stability (e.g: when EoL happens
2129+
// for a stable package). We pretend it's deprecated for the purpose of trove classifiers when
2130+
// this happens.
2131+
switch (
2132+
this.metadata.docs?.deprecated
2133+
? spec.Stability.Deprecated
2134+
: this.metadata.docs?.stability
2135+
) {
21292136
case spec.Stability.Experimental:
21302137
setupKwargs.classifiers.push('Development Status :: 4 - Beta');
21312138
break;

packages/jsii/lib/project-info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ function _validateStability(
484484
if (!stability && deprecated) {
485485
stability = spec.Stability.Deprecated;
486486
} else if (deprecated && stability !== spec.Stability.Deprecated) {
487-
throw new Error(
487+
console.warn(
488488
`Package is deprecated (${deprecated}), but it's stability is ${stability} and not ${spec.Stability.Deprecated}`,
489489
);
490490
}

0 commit comments

Comments
 (0)