Skip to content

Commit

Permalink
feat(jsii): allow specifying a deprecation message regardless of stab…
Browse files Browse the repository at this point in the history
…ility (#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`.
  • Loading branch information
RomainMuller committed Jun 13, 2023
1 parent 66939ca commit 38d327c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/jsii-pacmak/lib/targets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2125,7 +2125,14 @@ class Package {
scripts,
};

switch (this.metadata.docs?.stability) {
// Packages w/ a deprecated message may have a non-deprecated stability (e.g: when EoL happens
// for a stable package). We pretend it's deprecated for the purpose of trove classifiers when
// this happens.
switch (
this.metadata.docs?.deprecated
? spec.Stability.Deprecated
: this.metadata.docs?.stability
) {
case spec.Stability.Experimental:
setupKwargs.classifiers.push('Development Status :: 4 - Beta');
break;
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii/lib/project-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ function _validateStability(
if (!stability && deprecated) {
stability = spec.Stability.Deprecated;
} else if (deprecated && stability !== spec.Stability.Deprecated) {
throw new Error(
console.warn(
`Package is deprecated (${deprecated}), but it's stability is ${stability} and not ${spec.Stability.Deprecated}`,
);
}
Expand Down

0 comments on commit 38d327c

Please sign in to comment.