Skip to content

Commit 5484c6e

Browse files
authored
Merge pull request #383 from Microsoft/convertToTS
Convert generation script to TS, and update the source webidl
2 parents 97cfb5b + 6d46a8b commit 5484c6e

32 files changed

+106798
-40410
lines changed

.gitignore

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,6 @@ __pycache__/
278278
# tools/**
279279
# !tools/packages.config
280280

281-
# Telerik's JustMock configuration file
282-
*.jmconfig
283-
284-
# BizTalk build output
285-
*.btp.cs
286-
*.btm.cs
287-
*.odx.cs
288-
*.xsd.cs
289-
290-
.paket/
291-
.fake/
292-
generated/
281+
generated/
282+
lib/
283+
inputfiles/browser.webidl.json

.travis.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
language: csharp
2-
mono:
3-
- latest
1+
language: node_js
42

5-
script:
6-
- ./build.sh
3+
node_js:
4+
- 'stable'
5+
6+
sudo: false
7+
8+
install:
9+
- npm uninstall typescript --no-save
10+
- npm install

README.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,27 @@ AppVeyor Status: [![Build status](https://ci.appveyor.com/api/projects/status/8o
44
Travis CI Status: [![Build Status](https://travis-ci.org/Microsoft/TSJS-lib-generator.svg?branch=master)](https://travis-ci.org/Microsoft/TSJS-lib-generator)
55

66
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.
88

99
## Build Instructions
1010

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:
1312

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+
```
1528

1629
## Contribution Guidelines
1730

@@ -22,7 +35,7 @@ In order to make the tests pass, please update the baseline as well in any pull
2235
For common changes, it is sufficient to change the json files.
2336
There are three json files that are typically used to alter the type generation: `addedTypes.json`, `overridingTypes.json`, and `removedTypes.json`.
2437
`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.
2639

2740
The format of each file can be inferred from their existing content.
2841

@@ -53,16 +66,15 @@ A "Living Standard" ([example](https://xhr.spec.whatwg.org/)) should be added he
5366

5467
## Code Structure
5568

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+
5872

5973
## Input Files
6074

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**.
6276
- 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`.
6578
- `overridingTypes.json`: types that are defined in the spec file but has a better or more up-to-date definitions in the json files.
6679
- `removedTypes.json`: types that are defined in the spec file but should be removed.
6780
- `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

Comments
 (0)