Skip to content

Commit

Permalink
feat: add Typescript type definitions (#28)
Browse files Browse the repository at this point in the history
* Add TypeScript definitions.

* Return the void

* Semicolon and docs

* Create ILogger interface

* Add more loggers

* Add TSLint for linting
  • Loading branch information
vhashimotoo authored and zeke committed May 22, 2018
1 parent 2be625c commit b1aa517
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
35 changes: 35 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Type definitions for update-electron-app 1.1.2
// Project: https://github.com/electron/update-electron-app
// Definitions by: HashimotoYT <[email protected]>

export function updater(
opts?: {
/**
* @param {String} repo A GitHub repository in the format `owner/repo`.
* Defaults to your `package.json`'s `"repository"` field
*/
repo?: string;
/**
* @param {String} host Defaults to `https://update.electronjs.org`
*/
host?: string;
/**
* @param {String} updateInterval How frequently to check for updates. Defaults to `10 minutes`.
* Minimum allowed interval is `5 minutes`.
*/
updateInterval?: string;
/**
* @param {Object} logger A custom logger object that defines a `log` function.
* Defaults to `console`. See electron-log, a module
* that aggregates logs from main and renderer processes into a single file.
*/
logger?: ILogger;
},
): void;

interface ILogger {
log(message: string): void;
info(message: string): void;
error(message: string): void;
warn(message: string): void;
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "A drop-in module that adds autoUpdating capabilities to Electron apps",
"repository": "https://github.com/electron/update-electron-app",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
"dependencies": {
"electron-is-dev": "^0.3.0",
Expand All @@ -13,13 +14,16 @@
},
"devDependencies": {
"jest": "^22.4.3",
"semantic-release": "^15.1.7",
"standard": "^11.0.1",
"standard-markdown": "^4.0.2",
"travis-deploy-once": "^4.4.1",
"semantic-release": "^15.1.7"
"tslint": "^5.10.0",
"typescript": "^2.8.3"
},
"scripts": {
"test": "jest && standard --fix && standard-markdown",
"test": "jest && standard --fix && npm run lint && standard-markdown",
"lint": "tslint -c tslint.json index.d.ts",
"watch": "jest --watch --notify --notifyMode=change --coverage",
"travis-deploy-once": "travis-deploy-once",
"semantic-release": "semantic-release"
Expand Down
9 changes: 9 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {},
"rulesDirectory": []
}

0 comments on commit b1aa517

Please sign in to comment.