/
index.ts
64 lines (54 loc) · 1.74 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { ElectronProcess, ForgeMakeResult } from '@electron-forge/shared-types';
import ForgeUtils from '../util';
import _import, { ImportOptions } from './import';
import init, { InitOptions } from './init';
import make, { MakeOptions } from './make';
import _package, { PackageOptions } from './package';
import publish, { PublishOptions } from './publish';
import start, { StartOptions } from './start';
export class ForgeAPI {
/**
* Attempt to import a given module directory to the Electron Forge standard.
*
* * Sets up `git` and the correct NPM dependencies
* * Adds a template forge config to `package.json`
*/
import(opts: ImportOptions): Promise<void> {
return _import(opts);
}
/**
* Initialize a new Electron Forge template project in the given directory.
*/
init(opts: InitOptions): Promise<void> {
return init(opts);
}
/**
* Make distributables for an Electron application
*/
make(opts: MakeOptions): Promise<ForgeMakeResult[]> {
return make(opts);
}
/**
* Resolves hooks if they are a path to a file (instead of a `Function`)
*/
async package(opts: PackageOptions): Promise<void> {
await _package(opts);
}
/**
* Publish an Electron application into the given target service
*/
publish(opts: PublishOptions): Promise<void> {
return publish(opts);
}
/**
* Start an Electron application.
*
* Handles things like native module rebuilding for you on the fly
*/
start(opts: StartOptions): Promise<ElectronProcess> {
return start(opts);
}
}
const api = new ForgeAPI();
const utils = new ForgeUtils();
export { ForgeMakeResult, ElectronProcess, ForgeUtils, ImportOptions, InitOptions, MakeOptions, PackageOptions, PublishOptions, StartOptions, api, utils };