Skip to content

Commit efae447

Browse files
authored
feat: Register module-level stability (#515)
Adds the necessary code to detect and forward module-level stability indications to the assembly, so it can be used by downstream languages. This effectively removes the `markdown` attribute from the `Assembly` in favor of using the `docs` attribute. Also, renders a `package-info.json` file for packages that have documentation (a `README.md` file, deprecation notice, or stability indication). Implements awslabs/cdk-ops#367
1 parent 606b2ac commit efae447

File tree

87 files changed

+3946
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+3946
-89
lines changed

packages/jsii-calc-lib/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"name": "@scope/jsii-calc-lib",
33
"version": "0.11.0",
44
"description": "A simple calcuator library built on JSII.",
5+
"stability": "deprecated",
6+
"deprecated": "Really just deprecated for shows...",
57
"main": "lib/index.js",
68
"types": "lib/index.d.ts",
79
"private": true,
@@ -51,4 +53,4 @@
5153
"type": "git",
5254
"url": "https://github.com/awslabs/jsii.git"
5355
}
54-
}
56+
}

packages/jsii-calc-lib/test/assembly.jsii

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@
8484
}
8585
},
8686
"description": "A simple calcuator library built on JSII.",
87+
"docs": {
88+
"deprecated": "Really just deprecated for shows...",
89+
"stability": "deprecated"
90+
},
8791
"homepage": "https://github.com/awslabs/jsii.git",
8892
"jsiiVersion": "0.11.0",
8993
"license": "Apache-2.0",
@@ -496,5 +500,5 @@
496500
}
497501
},
498502
"version": "0.11.0",
499-
"fingerprint": "EtAUzTnV+hmz9yrXilnsS0MhQuQ/qmpmbwxvdLu561k="
503+
"fingerprint": "x/BbPdAJTYB6QY83ucqo0CNLa2NoLebqPMbMY7BsyR4="
500504
}

packages/jsii-calc/lib/compliance.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,6 @@ export interface OptionalStruct {
16311631
*
16321632
* @see https://aws.amazon.com/
16331633
* @customAttribute hasAValue
1634-
* @deprecated Use something else please
16351634
* @stable
16361635
*/
16371636
export class ClassWithDocs {

packages/jsii-calc/lib/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from './calculator';
22
export * from './compliance';
33
export * from './documented';
44
export * from './erasures';
5+
export * from './stability';

packages/jsii-calc/lib/stability.ts

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// The following tests validate emission of stability markers
2+
3+
/** @experimental */
4+
export interface ExperimentalStruct {
5+
/** @experimental */
6+
readonly readonlyProperty: string;
7+
}
8+
/** @experimental */
9+
export interface IExperimentalInterface {
10+
/** @experimental */
11+
mutableProperty?: number;
12+
/** @experimental */
13+
method(): void;
14+
}
15+
/** @experimental */
16+
export class ExperimentalClass {
17+
/** @experimental */
18+
public readonly readonlyProperty: string;
19+
/** @experimental */
20+
public mutableProperty?: number;
21+
/** @experimental */
22+
constructor(readonlyString: string, mutableNumber?: number) {
23+
this.readonlyProperty = readonlyString;
24+
this.mutableProperty = mutableNumber;
25+
}
26+
27+
/** @experimental */
28+
public method(): void { return; }
29+
}
30+
/** @experimental */
31+
export enum ExperimentalEnum {
32+
/** @experimental */
33+
OptionA,
34+
/** @experimental */
35+
OptionB
36+
}
37+
38+
/** @stable */
39+
export interface StableStruct {
40+
/** @stable */
41+
readonly readonlyProperty: string;
42+
}
43+
/** @stable */
44+
export interface IStableInterface {
45+
/** @stable */
46+
mutableProperty?: number;
47+
/** @stable */
48+
method(): void;
49+
}
50+
/** @stable */
51+
export class StableClass {
52+
/** @stable */
53+
public readonly readonlyProperty: string = 'wazoo';
54+
/** @stable */
55+
public mutableProperty?: number;
56+
/** @stable */
57+
constructor(readonlyString: string, mutableNumber?: number) {
58+
this.readonlyProperty = readonlyString;
59+
this.mutableProperty = mutableNumber;
60+
}
61+
/** @stable */
62+
public method(): void { return; }
63+
}
64+
/** @stable */
65+
export enum StableEnum {
66+
/** @stable */
67+
OptionA,
68+
/** @stable */
69+
OptionB
70+
}
71+
72+
/** @deprecated it just wraps a string */
73+
export interface DeprecatedStruct {
74+
/** @deprecated well, yeah */
75+
readonly readonlyProperty: string;
76+
}
77+
/** @deprecated useless interface */
78+
export interface IDeprecatedInterface {
79+
/** @deprecated could be better */
80+
mutableProperty?: number;
81+
/** @deprecated services no purpose */
82+
method(): void;
83+
}
84+
/** @deprecated a pretty boring class */
85+
export class DeprecatedClass {
86+
/** @deprecated this is not always "wazoo", be ready to be disappointed */
87+
public readonly readonlyProperty: string;
88+
/** @deprecated shouldn't have been mutable */
89+
public mutableProperty?: number;
90+
/** @deprecated this constructor is "just" okay */
91+
constructor(readonlyString: string, mutableNumber?: number) {
92+
this.readonlyProperty = readonlyString;
93+
this.mutableProperty = mutableNumber;
94+
}
95+
/** @deprecated it was a bad idea */
96+
public method(): void { return; }
97+
}
98+
/** @deprecated your deprecated selection of bad options */
99+
export enum DeprecatedEnum {
100+
/** @deprecated option A is not great */
101+
OptionA,
102+
/** @deprecated option B is kinda bad, too */
103+
OptionB
104+
}

packages/jsii-calc/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
77
"private": true,
8+
"stability": "experimental",
89
"jsii": {
910
"outdir": "dist",
1011
"targets": {

0 commit comments

Comments
 (0)