versioned-d.ts-tools 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -6
- package/dist/dts-utilities.d.ts +41 -41
- package/dist/dts-utilities.js +333 -305
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -5
- package/dist/version-remover.d.ts +2 -2
- package/dist/version-remover.js +162 -96
- package/dist/whats-new.d.ts +2 -2
- package/dist/whats-new.js +76 -55
- package/package.json +18 -16
- package/dist/dts-utilities.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/version-remover.js.map +0 -1
- package/dist/whats-new.js.map +0 -1
package/README.md
CHANGED
|
@@ -23,27 +23,80 @@ npm install versioned-d.ts-tools
|
|
|
23
23
|
Removes specific API versions from TypeScript definition files.
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
version-remover [source d.ts] [
|
|
26
|
+
version-remover [source d.ts] [output file name] [version string] [optional config file]
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
**
|
|
29
|
+
**Examples:**
|
|
30
|
+
|
|
30
31
|
```bash
|
|
31
|
-
|
|
32
|
+
# Basic usage
|
|
33
|
+
version-remover excel.d.ts excel_1_7.d.ts "Api set: ExcelApi 1.8"
|
|
34
|
+
|
|
35
|
+
# With configuration file for custom replacements
|
|
36
|
+
version-remover excel.d.ts excel_1_18.d.ts "Api set: ExcelApi 1.19" my-excel-config.json
|
|
32
37
|
```
|
|
33
38
|
|
|
34
|
-
This tool removes all declarations marked with the specified
|
|
39
|
+
This tool removes all declarations marked with the specified version string from the source `.d.ts` file and creates a new file with the remaining declarations.
|
|
40
|
+
|
|
41
|
+
#### Configuration File
|
|
42
|
+
|
|
43
|
+
You can provide an optional JSON configuration file to specify additional text replacements that should be applied after removing the API version. This is useful for cleaning up type unions or references that become invalid after removing certain APIs.
|
|
44
|
+
|
|
45
|
+
Some API versions (like "Api set: ExcelApi 1.19", "Api set: ExcelApi 1.11", "Api set: Mailbox 1.14", etc.) may require custom replacements to handle type union cleanups and parameter removals. You'll need to create configuration files for these scenarios based on your specific needs.
|
|
46
|
+
|
|
47
|
+
You can provide an optional JSON configuration file to specify additional text replacements that should be applied after removing the API version. This is useful for cleaning up type unions or references that become invalid after removing certain APIs.
|
|
48
|
+
|
|
49
|
+
**Configuration file format:**
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"replacements": [
|
|
54
|
+
{
|
|
55
|
+
"find": "old text to find",
|
|
56
|
+
"replace": "replacement text",
|
|
57
|
+
"description": "Optional description of what this replacement does"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"find": "/regex pattern/g",
|
|
61
|
+
"replace": "replacement",
|
|
62
|
+
"isRegex": true,
|
|
63
|
+
"description": "Example regex replacement"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Example configuration:**
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"replacements": [
|
|
74
|
+
{
|
|
75
|
+
"find": "type CardLayoutSection = CardLayoutListSection | CardLayoutTableSection | CardLayoutTwoColumnSection;",
|
|
76
|
+
"replace": "type CardLayoutSection = CardLayoutListSection | CardLayoutTableSection;",
|
|
77
|
+
"description": "Remove CardLayoutTwoColumnSection from union type"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"find": "icon?: string | EntityCompactLayoutIcons;",
|
|
81
|
+
"replace": "icon?: string;",
|
|
82
|
+
"description": "Remove EntityCompactLayoutIcons from icon property"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
```
|
|
35
87
|
|
|
36
88
|
### whats-new
|
|
37
89
|
|
|
38
90
|
Compares two TypeScript definition files and generates a markdown report of the differences.
|
|
39
91
|
|
|
40
92
|
```bash
|
|
41
|
-
whats-new [
|
|
93
|
+
whats-new [new d.ts] [old d.ts] [output file name (minus extension)] [relative path]
|
|
42
94
|
```
|
|
43
95
|
|
|
44
96
|
**Example:**
|
|
97
|
+
|
|
45
98
|
```bash
|
|
46
|
-
whats-new
|
|
99
|
+
whats-new excel_1_9.d.ts excel_1_8.d.ts excel_whats_new javascript/api/excel/excel.
|
|
47
100
|
```
|
|
48
101
|
|
|
49
102
|
This generates a `excel_whats_new.md` file containing a markdown table showing what's new between the two versions.
|
package/dist/dts-utilities.d.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
declare enum ClassType {
|
|
2
|
-
Class = "Class",
|
|
3
|
-
Interface = "Interface",
|
|
4
|
-
Enum = "Enum"
|
|
5
|
-
}
|
|
6
|
-
declare enum FieldType {
|
|
7
|
-
Property = "Property",
|
|
8
|
-
Method = "Method",
|
|
9
|
-
Event = "Event",
|
|
10
|
-
Enum = "Enum"
|
|
11
|
-
}
|
|
12
|
-
declare class FieldStruct {
|
|
13
|
-
declarationString: string;
|
|
14
|
-
comment: string;
|
|
15
|
-
type: FieldType;
|
|
16
|
-
name: string;
|
|
17
|
-
constructor(decString: string, commentString: string, fieldType: FieldType, fieldName: string);
|
|
18
|
-
}
|
|
19
|
-
declare class ClassStruct {
|
|
20
|
-
declarationString: string;
|
|
21
|
-
comment: string;
|
|
22
|
-
type: ClassType;
|
|
23
|
-
fields: FieldStruct[];
|
|
24
|
-
constructor(decString: any, commentString: string, classType: ClassType);
|
|
25
|
-
copyWithoutFields(): ClassStruct;
|
|
26
|
-
sortFields(): void;
|
|
27
|
-
getClassName(): string;
|
|
28
|
-
}
|
|
29
|
-
export declare class APISet {
|
|
30
|
-
api: ClassStruct[];
|
|
31
|
-
constructor();
|
|
32
|
-
addClass(clas: ClassStruct): void;
|
|
33
|
-
containsClass(clas: ClassStruct): boolean;
|
|
34
|
-
containsField(clas: ClassStruct, field: FieldStruct): boolean;
|
|
35
|
-
diff(other: APISet): APISet;
|
|
36
|
-
getAsDTS(): string;
|
|
37
|
-
getAsMarkdown(relativePath: string): string;
|
|
38
|
-
sort(): void;
|
|
39
|
-
}
|
|
40
|
-
export declare function parseDTS(fileName: string, fileContents: string): APISet;
|
|
41
|
-
export {};
|
|
1
|
+
declare enum ClassType {
|
|
2
|
+
Class = "Class",
|
|
3
|
+
Interface = "Interface",
|
|
4
|
+
Enum = "Enum"
|
|
5
|
+
}
|
|
6
|
+
declare enum FieldType {
|
|
7
|
+
Property = "Property",
|
|
8
|
+
Method = "Method",
|
|
9
|
+
Event = "Event",
|
|
10
|
+
Enum = "Enum"
|
|
11
|
+
}
|
|
12
|
+
declare class FieldStruct {
|
|
13
|
+
declarationString: string;
|
|
14
|
+
comment: string;
|
|
15
|
+
type: FieldType;
|
|
16
|
+
name: string;
|
|
17
|
+
constructor(decString: string, commentString: string, fieldType: FieldType, fieldName: string);
|
|
18
|
+
}
|
|
19
|
+
declare class ClassStruct {
|
|
20
|
+
declarationString: string;
|
|
21
|
+
comment: string;
|
|
22
|
+
type: ClassType;
|
|
23
|
+
fields: FieldStruct[];
|
|
24
|
+
constructor(decString: any, commentString: string, classType: ClassType);
|
|
25
|
+
copyWithoutFields(): ClassStruct;
|
|
26
|
+
sortFields(): void;
|
|
27
|
+
getClassName(): string;
|
|
28
|
+
}
|
|
29
|
+
export declare class APISet {
|
|
30
|
+
api: ClassStruct[];
|
|
31
|
+
constructor();
|
|
32
|
+
addClass(clas: ClassStruct): void;
|
|
33
|
+
containsClass(clas: ClassStruct): boolean;
|
|
34
|
+
containsField(clas: ClassStruct, field: FieldStruct): boolean;
|
|
35
|
+
diff(other: APISet): APISet;
|
|
36
|
+
getAsDTS(): string;
|
|
37
|
+
getAsMarkdown(relativePath: string): string;
|
|
38
|
+
sort(): void;
|
|
39
|
+
}
|
|
40
|
+
export declare function parseDTS(fileName: string, fileContents: string): APISet;
|
|
41
|
+
export {};
|