Skip to content

Commit b1aa517

Browse files
vhashimotoozeke
authored andcommitted
feat: add Typescript type definitions (#28)
* Add TypeScript definitions. * Return the void * Semicolon and docs * Create ILogger interface * Add more loggers * Add TSLint for linting
1 parent 2be625c commit b1aa517

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

index.d.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Type definitions for update-electron-app 1.1.2
2+
// Project: https://github.com/electron/update-electron-app
3+
// Definitions by: HashimotoYT <[email protected]>
4+
5+
export function updater(
6+
opts?: {
7+
/**
8+
* @param {String} repo A GitHub repository in the format `owner/repo`.
9+
* Defaults to your `package.json`'s `"repository"` field
10+
*/
11+
repo?: string;
12+
/**
13+
* @param {String} host Defaults to `https://update.electronjs.org`
14+
*/
15+
host?: string;
16+
/**
17+
* @param {String} updateInterval How frequently to check for updates. Defaults to `10 minutes`.
18+
* Minimum allowed interval is `5 minutes`.
19+
*/
20+
updateInterval?: string;
21+
/**
22+
* @param {Object} logger A custom logger object that defines a `log` function.
23+
* Defaults to `console`. See electron-log, a module
24+
* that aggregates logs from main and renderer processes into a single file.
25+
*/
26+
logger?: ILogger;
27+
},
28+
): void;
29+
30+
interface ILogger {
31+
log(message: string): void;
32+
info(message: string): void;
33+
error(message: string): void;
34+
warn(message: string): void;
35+
}

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "A drop-in module that adds autoUpdating capabilities to Electron apps",
55
"repository": "https://github.com/electron/update-electron-app",
66
"main": "index.js",
7+
"types": "index.d.ts",
78
"license": "MIT",
89
"dependencies": {
910
"electron-is-dev": "^0.3.0",
@@ -13,13 +14,16 @@
1314
},
1415
"devDependencies": {
1516
"jest": "^22.4.3",
17+
"semantic-release": "^15.1.7",
1618
"standard": "^11.0.1",
1719
"standard-markdown": "^4.0.2",
1820
"travis-deploy-once": "^4.4.1",
19-
"semantic-release": "^15.1.7"
21+
"tslint": "^5.10.0",
22+
"typescript": "^2.8.3"
2023
},
2124
"scripts": {
22-
"test": "jest && standard --fix && standard-markdown",
25+
"test": "jest && standard --fix && npm run lint && standard-markdown",
26+
"lint": "tslint -c tslint.json index.d.ts",
2327
"watch": "jest --watch --notify --notifyMode=change --coverage",
2428
"travis-deploy-once": "travis-deploy-once",
2529
"semantic-release": "semantic-release"

tslint.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"defaultSeverity": "error",
3+
"extends": [
4+
"tslint:recommended"
5+
],
6+
"jsRules": {},
7+
"rules": {},
8+
"rulesDirectory": []
9+
}

0 commit comments

Comments
 (0)