Skip to content

Commit 7d0f4f1

Browse files
refactor: use the new @electron/docs-parser module and rewrite in TS (#139)
1 parent c23d2b9 commit 7d0f4f1

22 files changed

+1706
-2402
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ electron.d.ts
22
node_modules
33
package-lock.json
44
.npmrc
5-
.env
5+
.env
6+
lib_old
7+
dist

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"trailingComma": "all",
3+
"tabWidth": 2,
4+
"singleQuote": true,
5+
"printWidth": 100,
6+
"parser": "typescript"
7+
}

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Electron TypeScript Definitions [![Build Status](https://travis-ci.org/electron/electron-typescript-definitions.svg?branch=master)](https://travis-ci.org/electron/electron-typescript-definitions)
22

3-
This module uses Electron's [JSON API documentation](https://electron.atom.io/blog/2016/09/27/api-docs-json-schema) to produce a TypeScript definition file for the Electron API.
3+
This module uses Electron's [JSON API documentation](https://github.com/electron/docs-parser) to produce a TypeScript definition file for the Electron API.
44

55
## Installation
66

77
```sh
8-
npm install electron-typescript-definitions --save
8+
npm install @electron/typescript-definitions --save
99
```
1010

1111
## CLI Usage
1212

1313
To generate the definitions
1414

1515
```sh
16-
electron-typescript-definitions --in=path/to/electron/api.json --out=path/to/electron.d.ts
16+
electron-typescript-definitions --api=path/to/electron/api.json --out-dir=path/to/out/dir
1717
```
1818

1919
Any warnings during the generation can normally be ignored unless it actually throws
@@ -25,11 +25,11 @@ The module exports a function that parses a given API JSON object and returns
2525
an array of lines to create the definition file
2626

2727
```js
28-
const generateDefinitions = require('electron-typescript-definitions')
28+
const { generateDefinitions } = require('electron-typescript-definitions')
2929
const apiPath = './vendor/electron/docs/api.json'
3030

31-
const definitionLines = generateDefinitions(require(apiPath))
32-
// definitionLines will be an array of file lines
31+
const definitionLines = generateDefinitions({ electronApi: require(apiPath) })
32+
// definitionLines will be an strin representation of the definition file
3333
```
3434

3535
## License

base/base_inner.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
// TODO: Replace this declaration with NodeJS.EventEmitter
2-
class EventEmitter {
3-
addListener(event: string, listener: Function): this;
4-
on(event: string, listener: Function): this;
5-
once(event: string, listener: Function): this;
6-
removeListener(event: string, listener: Function): this;
7-
removeAllListeners(event?: string): this;
8-
setMaxListeners(n: number): this;
9-
getMaxListeners(): number;
10-
listeners(event: string): Function[];
11-
emit(event: string, ...args: any[]): boolean;
12-
listenerCount(type: string): number;
13-
prependListener(event: string, listener: Function): this;
14-
prependOnceListener(event: string, listener: Function): this;
15-
eventNames(): Array<(string | symbol)>;
16-
}
17-
181
class Accelerator extends String {
192

203
}

lib/dynamic-param-interfaces.js

Lines changed: 0 additions & 139 deletions
This file was deleted.

lib/master-interfaces.js

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)