Skip to content

refactor: use the new @electron/docs-parser module and rewrite in TS #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ electron.d.ts
node_modules
package-lock.json
.npmrc
.env
.env
lib_old
dist
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "all",
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"parser": "typescript"
}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Electron TypeScript Definitions [![Build Status](https://travis-ci.org/electron/electron-typescript-definitions.svg?branch=master)](https://travis-ci.org/electron/electron-typescript-definitions)

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.
This module uses Electron's [JSON API documentation](https://github.com/electron/docs-parser) to produce a TypeScript definition file for the Electron API.

## Installation

```sh
npm install electron-typescript-definitions --save
npm install @electron/typescript-definitions --save
```

## CLI Usage

To generate the definitions

```sh
electron-typescript-definitions --in=path/to/electron/api.json --out=path/to/electron.d.ts
electron-typescript-definitions --api=path/to/electron/api.json --out-dir=path/to/out/dir
```

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

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

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

## License
Expand Down
17 changes: 0 additions & 17 deletions base/base_inner.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
// TODO: Replace this declaration with NodeJS.EventEmitter
class EventEmitter {
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
prependListener(event: string, listener: Function): this;
prependOnceListener(event: string, listener: Function): this;
eventNames(): Array<(string | symbol)>;
}

class Accelerator extends String {

}
139 changes: 0 additions & 139 deletions lib/dynamic-param-interfaces.js

This file was deleted.

75 changes: 0 additions & 75 deletions lib/master-interfaces.js

This file was deleted.

Loading