Skip to content

Commit a2a3ae5

Browse files
authored
feat: add TypeScript definition (#1131)
Based on `@types/electron-packager`, it's updated for 14.2.1. It replaces `docs/api.md` as the canonical API documentation (`docs/api.md` remains with a link-based redirect for links to the Markdown file). * build: publish TypeScript API docs to GitHub Pages
1 parent 61f6c0c commit a2a3ae5

16 files changed

+856
-566
lines changed

.circleci/config.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ steps-ci: &steps-ci
3737
- *step-restore-electron-cache
3838
- run: test/ci/_before_script.js
3939
- *step-save-electron-cache
40-
- run: npm test
40+
- run: npm run lint
41+
- run: npm run tsd
42+
- run: npm run coverage
4143
- run: npm run codecov
4244

4345
version: 2.1

.eslintrc.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module.exports = {
2+
extends: [
3+
'eslint:recommended',
4+
'plugin:ava/recommended',
5+
'plugin:import/errors',
6+
'plugin:import/warnings',
7+
'plugin:promise/recommended',
8+
'standard'
9+
],
10+
parserOptions: {
11+
sourceType: 'script'
12+
},
13+
plugins: [
14+
'ava'
15+
],
16+
rules: {
17+
'ava/no-import-test-files': 0,
18+
'ava/no-ignored-test-files': 0,
19+
indent: [
20+
'error',
21+
2,
22+
{
23+
'CallExpression': {
24+
'arguments': 'first'
25+
},
26+
'SwitchCase': 1
27+
}
28+
],
29+
'no-console': 0,
30+
strict: 'error'
31+
}
32+
}

.eslintrc.typescript.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const eslintConfig = require('./.eslintrc')
2+
eslintConfig.parser = '@typescript-eslint/parser'
3+
eslintConfig.parserOptions.sourceType = 'module'
4+
eslintConfig.extends.push(
5+
'plugin:@typescript-eslint/eslint-recommended',
6+
'plugin:@typescript-eslint/recommended'
7+
)
8+
9+
eslintConfig.rules['comma-dangle'] = ['error', 'only-multiline']
10+
eslintConfig.rules.semi = ['error', 'always']
11+
eslintConfig.rules['space-before-function-paren'] = ['error', 'never']
12+
13+
module.exports = eslintConfig

.github/workflows/docs.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- v[0-9]+.[0-9]+.[0-9]+*
9+
10+
jobs:
11+
docs:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Fetch all git branches
16+
run: git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
17+
- uses: actions/setup-node@v1
18+
with:
19+
node-version: 12.x
20+
- run: npm install --engine-strict --no-lockfile
21+
- run: npm run docs:build
22+
- uses: docker://malept/gha-gh-pages:1.0.0
23+
with:
24+
docsPath: typedoc
25+
showUnderscoreFiles: true
26+
versionDocs: true
27+
env:
28+
DOCS_SSH_DEPLOY_KEY: ${{ secrets.DOCS_SSH_DEPLOY_KEY }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ yarn.lock
88
test/fixtures/basic/main-link.js
99
!test/fixtures/prune-is-module/node_modules
1010
test/work
11+
typedoc
1112
.DS_Store
1213
.nyc_output
1314
npm-debug.log

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Here are some things to keep in mind as you file pull requests to fix bugs, add
5252
spot regressions much easier.
5353
* If your PR changes the behavior of an existing feature, or adds a new feature, please add/edit
5454
the package's documentation. Files that will likely need to be updated include `README.md`,
55-
`docs/api.md`, and `usage.txt`.
55+
`src/index.d.ts`, and `usage.txt`.
5656
* This project uses the [JavaScript Standard Style](https://standardjs.com/) as a coding convention.
5757
CI will fail if the PR does not conform to this standard.
5858
* One of the philosophies of the project is to keep the code base as small as possible. If you are

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Package your [Electron](https://electronjs.org) app into OS-specific bundles (`.
1010
[Supported Platforms](#supported-platforms) |
1111
[Installation](#installation) |
1212
[Usage](#usage) |
13-
[API](https://github.com/electron/electron-packager/blob/master/docs/api.md) |
13+
[API](https://electron.github.io/electron-packager/master/) |
1414
[Contributing](https://github.com/electron/electron-packager/blob/master/CONTRIBUTING.md) |
1515
[Support](https://github.com/electron/electron-packager/blob/master/SUPPORT.md) |
1616
[Related Apps/Libraries](#related) |
@@ -72,7 +72,7 @@ later needs to be installed. On macOS, it is installable via [Homebrew](http://b
7272

7373
## Usage
7474

75-
JavaScript API usage can be found in the [API documentation](https://github.com/electron/electron-packager/blob/master/docs/api.md).
75+
JavaScript API usage can be found in the [API documentation](https://electron.github.io/electron-packager/master/modules/electronpackager.html).
7676

7777
### From the Command Line
7878

@@ -95,7 +95,7 @@ This will:
9595

9696
For an overview of the other optional flags, run `electron-packager --help` or see
9797
[usage.txt](https://github.com/electron/electron-packager/blob/master/usage.txt). For
98-
detailed descriptions, see the [API documentation](https://github.com/electron/electron-packager/blob/master/docs/api.md).
98+
detailed descriptions, see the [API documentation](https://electron.github.io/electron-packager/master/modules/electronpackager.html).
9999

100100
If `appname` is omitted, this will use the name specified by "productName" or "name" in the nearest package.json.
101101

docs/_config.yml

-1
This file was deleted.

0 commit comments

Comments
 (0)