You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Travis CI Status: [](https://travis-ci.org/Microsoft/TSJS-lib-generator)
5
5
6
6
This tool is used to generate `dom.generated.d.ts`, `webworker.generated.d.ts` and `dom.es6.generated.d.ts` for TypeScript.
7
-
The input file is the XML spec file generated by the Microsoft Edge browser.
7
+
The input file is the JSON webidl file generated by the Microsoft Edge browser.
8
8
9
9
## Build Instructions
10
10
11
-
To build the tool, simply clone this repo, and run `build.cmd` (Windows) or `build.sh` (OS X/Unix) on the command line.
12
-
If it runs successfully, the output files will be generated under the `generated` folder.
11
+
To get things setup:
13
12
14
-
Note: for OS X and Unix users, [Mono 4.2 or higher](http://www.mono-project.com/download/) is required.
13
+
```sh
14
+
npm install
15
+
```
16
+
17
+
To generate the .d.ts files
18
+
19
+
```sh
20
+
npm run build
21
+
```
22
+
23
+
To test:
24
+
25
+
```sh
26
+
npm run test
27
+
```
15
28
16
29
## Contribution Guidelines
17
30
@@ -22,7 +35,7 @@ In order to make the tests pass, please update the baseline as well in any pull
22
35
For common changes, it is sufficient to change the json files.
23
36
There are three json files that are typically used to alter the type generation: `addedTypes.json`, `overridingTypes.json`, and `removedTypes.json`.
24
37
`comments.json` can used to add comments to the types.
25
-
Finally, `knownWorkerEnums` and `knownWorkerInterfaces` determine which types are available in a WebWorker environment.
38
+
Finally, `knownWorkerTypes.json` determine which types are available in a WebWorker environment.
26
39
27
40
The format of each file can be inferred from their existing content.
28
41
@@ -53,16 +66,15 @@ A "Living Standard" ([example](https://xhr.spec.whatwg.org/)) should be added he
53
66
54
67
## Code Structure
55
68
56
-
-`Build.fsx`: Runs `TS.fsx` for all targets, then does a snapshot test by comparing the `generated/` and `baseline/` contents.
57
-
-`TS.fsx`: handles the emitting of the `.d.ts` files.
69
+
-`src/index.ts`: handles the emitting of the `.d.ts` files.
70
+
-`src/test.ts`: verifies the otuput by comparing the `generated/` and `baseline/` contents.
71
+
58
72
59
73
## Input Files
60
74
61
-
-`browser.webidl.xml`: an XML spec file generated by Microsoft Edge. **Do not edit this file**.
75
+
-`browser.webidl.preprocessed.json`: a JSON file generated by Microsoft Edge. **Do not edit this file**.
62
76
- Due to the different update schedules between Edge and TypeScript, this may not be the most up-to-date version of the spec.
63
-
-`webworker.webidl.xml`: an XML spec file generated by Microsoft Edge that contains types for Web Workers. **Do not edit this file**.
64
-
-`addedTypes.json`: types that should exist in either browser or webworker but are missing from the Edge spec. The type can be `property`, `method`, `interface`, `constructor`, or `indexer`.
77
+
-`addedTypes.json`: types that should exist in either browser or webworker but are missing from the Edge spec. The format of the file mimics that of `browser.webidl.preprocessed.json`.
65
78
-`overridingTypes.json`: types that are defined in the spec file but has a better or more up-to-date definitions in the json files.
66
79
-`removedTypes.json`: types that are defined in the spec file but should be removed.
67
80
-`comments.json`: comment strings to be embedded in the generated .js files.
68
-
-`sample.json`: sample json file used to tell F# json type provider that structure of the json files. The content of it is not used anywhere. **Do not edit this file**.
0 commit comments