@electron-forge/shared-types 6.0.0-beta.7 → 6.0.0-beta.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,39 +1,75 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="electron-packager" />
3
2
  import { ChildProcess } from 'child_process';
4
- import { Options } from 'electron-packager';
5
- import { RebuildOptions } from 'electron-rebuild/lib/src/rebuild';
6
- export declare type ForgePlatform = 'darwin' | 'mas' | 'win32' | 'linux';
7
- export declare type ForgeArch = 'ia32' | 'x64' | 'armv7l' | 'arm';
8
- export declare type ForgeHookFn = (forgeConfig: ForgeConfig, ...args: any[]) => Promise<void>;
3
+ import { OraImpl } from '@electron-forge/async-ora';
4
+ import { ArchOption, Options as ElectronPackagerOptions, TargetPlatform } from 'electron-packager';
5
+ import { RebuildOptions } from 'electron-rebuild';
6
+ export declare type ElectronProcess = ChildProcess & {
7
+ restarted: boolean;
8
+ };
9
+ export declare type ForgePlatform = TargetPlatform;
10
+ export declare type ForgeArch = ArchOption;
11
+ export declare type ForgeConfigPublisher = IForgeResolvablePublisher | IForgePublisher;
12
+ export declare type ForgeConfigMaker = IForgeResolvableMaker | IForgeMaker;
13
+ export declare type ForgeConfigPlugin = IForgeResolvablePlugin | IForgePlugin;
14
+ export interface ForgeSimpleHookSignatures {
15
+ generateAssets: [platform: ForgePlatform, version: ForgeArch];
16
+ postStart: [appProcess: ElectronProcess];
17
+ prePackage: [platform: ForgePlatform, version: ForgeArch];
18
+ packageAfterCopy: [buildPath: string, electronVersion: string, platform: ForgePlatform, arch: ForgeArch];
19
+ packageAfterPrune: [buildPath: string, electronVersion: string, platform: ForgePlatform, arch: ForgeArch];
20
+ packageAfterExtract: [buildPath: string, electronVersion: string, platform: ForgePlatform, arch: ForgeArch];
21
+ postPackage: [
22
+ packageResult: {
23
+ platform: ForgePlatform;
24
+ arch: ForgeArch;
25
+ outputPaths: string[];
26
+ spinner?: OraImpl;
27
+ }
28
+ ];
29
+ preMake: [];
30
+ }
31
+ export interface ForgeMutatingHookSignatures {
32
+ postMake: [makeResults: ForgeMakeResult[]];
33
+ resolveForgeConfig: [currentConfig: ResolvedForgeConfig];
34
+ readPackageJson: [packageJson: Record<string, any>];
35
+ }
36
+ export declare type ForgeHookName = keyof (ForgeSimpleHookSignatures & ForgeMutatingHookSignatures);
37
+ export declare type ForgeSimpleHookFn<Hook extends keyof ForgeSimpleHookSignatures> = (forgeConfig: ResolvedForgeConfig, ...args: ForgeSimpleHookSignatures[Hook]) => Promise<void>;
38
+ export declare type ForgeMutatingHookFn<Hook extends keyof ForgeMutatingHookSignatures> = (forgeConfig: ResolvedForgeConfig, ...args: ForgeMutatingHookSignatures[Hook]) => Promise<ForgeMutatingHookSignatures[Hook][0] | undefined>;
39
+ export declare type ForgeHookFn<Hook extends ForgeHookName> = Hook extends keyof ForgeSimpleHookSignatures ? ForgeSimpleHookFn<Hook> : Hook extends keyof ForgeMutatingHookSignatures ? ForgeMutatingHookFn<Hook> : never;
40
+ export declare type ForgeHookMap = {
41
+ [S in ForgeHookName]?: ForgeHookFn<S>;
42
+ };
9
43
  export interface IForgePluginInterface {
10
- triggerHook(hookName: string, hookArgs: any[]): Promise<void>;
11
- overrideStartLogic(opts: any): Promise<ChildProcess | false>;
44
+ triggerHook<Hook extends keyof ForgeSimpleHookSignatures>(hookName: Hook, hookArgs: ForgeSimpleHookSignatures[Hook]): Promise<void>;
45
+ triggerMutatingHook<Hook extends keyof ForgeMutatingHookSignatures>(hookName: Hook, item: ForgeMutatingHookSignatures[Hook][0]): Promise<ForgeMutatingHookSignatures[Hook][0]>;
46
+ overrideStartLogic(opts: StartOptions): Promise<StartResult>;
12
47
  }
13
- export interface ForgeConfig {
48
+ export declare type ForgeRebuildOptions = Omit<RebuildOptions, 'buildPath' | 'electronVersion' | 'arch'>;
49
+ export declare type ForgePackagerOptions = Omit<ElectronPackagerOptions, 'dir' | 'arch' | 'platform' | 'out' | 'electronVersion'>;
50
+ export interface ResolvedForgeConfig {
14
51
  /**
15
52
  * A string to uniquely identify artifacts of this build, will be appended
16
53
  * to the out dir to generate a nested directory. E.g. out/current-timestamp
17
54
  *
18
- * If a function is provided it must syncronously return the buildIdentifier
55
+ * If a function is provided, it must synchronously return the buildIdentifier
19
56
  */
20
57
  buildIdentifier?: string | (() => string);
21
- hooks?: {
22
- [hookName: string]: ForgeHookFn;
23
- };
58
+ hooks?: ForgeHookMap;
24
59
  /**
25
- * @generated
60
+ * @internal
26
61
  */
27
62
  pluginInterface: IForgePluginInterface;
28
63
  /**
29
- * An array of forge plugins or a tuple consisting of [pluginName, pluginOptions]
64
+ * An array of Forge plugins or a tuple consisting of [pluginName, pluginOptions]
30
65
  */
31
- plugins: (IForgePlugin | [string, any])[];
32
- electronRebuildConfig: RebuildOptions;
33
- packagerConfig: Options;
34
- makers: (IForgeResolvableMaker | IForgeMaker)[];
35
- publishers: (IForgeResolvablePublisher | IForgePublisher | string)[];
66
+ plugins: ForgeConfigPlugin[];
67
+ rebuildConfig: ForgeRebuildOptions;
68
+ packagerConfig: ForgePackagerOptions;
69
+ makers: ForgeConfigMaker[];
70
+ publishers: ForgeConfigPublisher[];
36
71
  }
72
+ export declare type ForgeConfig = Partial<Omit<ResolvedForgeConfig, 'pluginInterface'>>;
37
73
  export interface ForgeMakeResult {
38
74
  /**
39
75
  * An array of paths to artifacts generated for this make run
@@ -52,21 +88,28 @@ export interface ForgeMakeResult {
52
88
  */
53
89
  arch: ForgeArch;
54
90
  }
91
+ export interface IForgeResolvablePlugin {
92
+ name: string;
93
+ config?: any;
94
+ }
55
95
  export interface IForgePlugin {
96
+ /** @internal */
56
97
  __isElectronForgePlugin: boolean;
57
98
  name: string;
58
- init(dir: string, forgeConfig: ForgeConfig): void;
59
- getHook?(hookName: string): ForgeHookFn | null;
60
- startLogic?(opts: StartOptions): Promise<ChildProcess | false>;
99
+ init(dir: string, forgeConfig: ResolvedForgeConfig): void;
100
+ getHooks?(): ForgeHookMap;
101
+ startLogic?(opts: StartOptions): Promise<StartResult>;
61
102
  }
62
103
  export interface IForgeResolvableMaker {
104
+ enabled: boolean;
63
105
  name: string;
64
106
  platforms: ForgePlatform[] | null;
65
107
  config: any;
66
108
  }
67
109
  export interface IForgeMaker {
110
+ /** @internal */
68
111
  __isElectronForgeMaker: boolean;
69
- platforms?: undefined;
112
+ readonly platforms?: ForgePlatform[];
70
113
  }
71
114
  export interface IForgeResolvablePublisher {
72
115
  name: string;
@@ -74,8 +117,9 @@ export interface IForgeResolvablePublisher {
74
117
  config?: any;
75
118
  }
76
119
  export interface IForgePublisher {
120
+ /** @internal */
77
121
  __isElectronForgePublisher: boolean;
78
- platforms?: undefined;
122
+ readonly platforms?: ForgePlatform[];
79
123
  }
80
124
  export interface StartOptions {
81
125
  /**
@@ -106,4 +150,25 @@ export interface StartOptions {
106
150
  * Enables the node inspector, you can connect to this from chrome://inspect
107
151
  */
108
152
  inspect?: boolean;
153
+ /**
154
+ * Enables the node inspector, you can connect to this from chrome://inspect
155
+ * Pauses the execution on first JavaScript line until debugger connects.
156
+ */
157
+ inspectBrk?: boolean;
158
+ }
159
+ export declare type StartResult = ElectronProcess | string | string[] | false;
160
+ export interface InitTemplateOptions {
161
+ copyCIFiles?: boolean;
109
162
  }
163
+ export interface ForgeTemplate {
164
+ requiredForgeVersion?: string;
165
+ dependencies?: string[];
166
+ devDependencies?: string[];
167
+ initializeTemplate?: (dir: string, options: InitTemplateOptions) => Promise<void>;
168
+ }
169
+ export declare type PackagePerson = undefined | string | {
170
+ name: string;
171
+ email?: string;
172
+ url?: string;
173
+ };
174
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,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GAAG,MAAM,CAAC,EAAE,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,oBAAY,WAAW,GAAG,eAAe,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC;AAEtE,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnF;AAED,oBAAY,aAAa,GACrB,SAAS,GACT,MAAM,GACN;IACE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
2
5
 
3
- require("source-map-support/register");
4
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbXX0=
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
package/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ // ⚠️ AUTOGENERATED ⚠️ AUTOGENERATED ⚠️ AUTOGENERATED ⚠️
2
+ // This file was automatically generated by `tools/gen-ts-glue.ts`. Do not modify directly if you want to keep your changes.
3
+ export * from "./src/index";
package/package.json CHANGED
@@ -1,21 +1,19 @@
1
1
  {
2
2
  "name": "@electron-forge/shared-types",
3
- "version": "6.0.0-beta.7",
4
- "description": "Shared types across forge",
5
- "repository": "https://github.com/electron-userland/electron-forge",
3
+ "version": "6.0.0-beta.70",
4
+ "description": "Shared types across Electron Forge",
5
+ "repository": "https://github.com/electron/forge",
6
6
  "author": "Samuel Attard",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
9
- "typings": "index.d.ts",
10
- "scripts": {
11
- "test": "echo No Tests For Shared Types"
12
- },
9
+ "typings": "dist/index.d.ts",
13
10
  "dependencies": {
14
- "@types/electron-packager": "^10.1.0",
15
- "electron-rebuild": "^1.6.0",
16
- "ora": "^2.0.0"
11
+ "@electron-forge/async-ora": "6.0.0-beta.70",
12
+ "electron-packager": "^17.0.0",
13
+ "electron-rebuild": "^3.2.6",
14
+ "ora": "^5.0.0"
17
15
  },
18
16
  "engines": {
19
- "node": ">= 6.0"
17
+ "node": ">= 14.17.5"
20
18
  }
21
19
  }
package/src/index.ts CHANGED
@@ -1,119 +1,208 @@
1
- /* tslint:disable ter-indent */
2
-
3
1
  import { ChildProcess } from 'child_process';
4
- import { Options } from 'electron-packager';
5
- import { RebuildOptions } from 'electron-rebuild/lib/src/rebuild';
6
-
7
- // declare module '@electron-forge/shared-types' {
8
- export type ForgePlatform = 'darwin' | 'mas' | 'win32' | 'linux';
9
- export type ForgeArch = 'ia32' | 'x64' | 'armv7l' | 'arm';
10
- export type ForgeHookFn = (forgeConfig: ForgeConfig, ...args: any[]) => Promise<void>;
11
- export interface IForgePluginInterface {
12
- triggerHook(hookName: string, hookArgs: any[]): Promise<void>;
13
- overrideStartLogic(opts: any): Promise<ChildProcess | false>;
14
- }
15
- export interface ForgeConfig {
16
- /**
17
- * A string to uniquely identify artifacts of this build, will be appended
18
- * to the out dir to generate a nested directory. E.g. out/current-timestamp
19
- *
20
- * If a function is provided it must syncronously return the buildIdentifier
21
- */
22
- buildIdentifier?: string | (() => string);
23
- hooks?: {
24
- [hookName: string]: ForgeHookFn;
2
+
3
+ import { OraImpl } from '@electron-forge/async-ora';
4
+ import { ArchOption, Options as ElectronPackagerOptions, TargetPlatform } from 'electron-packager';
5
+ import { RebuildOptions } from 'electron-rebuild';
6
+
7
+ export type ElectronProcess = ChildProcess & { restarted: boolean };
8
+
9
+ export type ForgePlatform = TargetPlatform;
10
+ export type ForgeArch = ArchOption;
11
+ export type ForgeConfigPublisher = IForgeResolvablePublisher | IForgePublisher;
12
+ export type ForgeConfigMaker = IForgeResolvableMaker | IForgeMaker;
13
+ export type ForgeConfigPlugin = IForgeResolvablePlugin | IForgePlugin;
14
+
15
+ export interface ForgeSimpleHookSignatures {
16
+ generateAssets: [platform: ForgePlatform, version: ForgeArch];
17
+ postStart: [appProcess: ElectronProcess];
18
+ prePackage: [platform: ForgePlatform, version: ForgeArch];
19
+ packageAfterCopy: [buildPath: string, electronVersion: string, platform: ForgePlatform, arch: ForgeArch];
20
+ packageAfterPrune: [buildPath: string, electronVersion: string, platform: ForgePlatform, arch: ForgeArch];
21
+ packageAfterExtract: [buildPath: string, electronVersion: string, platform: ForgePlatform, arch: ForgeArch];
22
+ postPackage: [
23
+ packageResult: {
24
+ platform: ForgePlatform;
25
+ arch: ForgeArch;
26
+ outputPaths: string[];
27
+ spinner?: OraImpl;
28
+ }
29
+ ];
30
+ preMake: [];
31
+ }
32
+
33
+ export interface ForgeMutatingHookSignatures {
34
+ postMake: [makeResults: ForgeMakeResult[]];
35
+ resolveForgeConfig: [currentConfig: ResolvedForgeConfig];
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
+ readPackageJson: [packageJson: Record<string, any>];
38
+ }
39
+
40
+ export type ForgeHookName = keyof (ForgeSimpleHookSignatures & ForgeMutatingHookSignatures);
41
+ export type ForgeSimpleHookFn<Hook extends keyof ForgeSimpleHookSignatures> = (
42
+ forgeConfig: ResolvedForgeConfig,
43
+ ...args: ForgeSimpleHookSignatures[Hook]
44
+ ) => Promise<void>;
45
+ export type ForgeMutatingHookFn<Hook extends keyof ForgeMutatingHookSignatures> = (
46
+ forgeConfig: ResolvedForgeConfig,
47
+ ...args: ForgeMutatingHookSignatures[Hook]
48
+ ) => Promise<ForgeMutatingHookSignatures[Hook][0] | undefined>;
49
+ export type ForgeHookFn<Hook extends ForgeHookName> = Hook extends keyof ForgeSimpleHookSignatures
50
+ ? ForgeSimpleHookFn<Hook>
51
+ : Hook extends keyof ForgeMutatingHookSignatures
52
+ ? ForgeMutatingHookFn<Hook>
53
+ : never;
54
+ export type ForgeHookMap = {
55
+ [S in ForgeHookName]?: ForgeHookFn<S>;
56
+ };
57
+
58
+ export interface IForgePluginInterface {
59
+ triggerHook<Hook extends keyof ForgeSimpleHookSignatures>(hookName: Hook, hookArgs: ForgeSimpleHookSignatures[Hook]): Promise<void>;
60
+ triggerMutatingHook<Hook extends keyof ForgeMutatingHookSignatures>(
61
+ hookName: Hook,
62
+ item: ForgeMutatingHookSignatures[Hook][0]
63
+ ): Promise<ForgeMutatingHookSignatures[Hook][0]>;
64
+ overrideStartLogic(opts: StartOptions): Promise<StartResult>;
65
+ }
66
+ /* eslint-enable @typescript-eslint/no-explicit-any */
67
+
68
+ export type ForgeRebuildOptions = Omit<RebuildOptions, 'buildPath' | 'electronVersion' | 'arch'>;
69
+ export type ForgePackagerOptions = Omit<ElectronPackagerOptions, 'dir' | 'arch' | 'platform' | 'out' | 'electronVersion'>;
70
+ export interface ResolvedForgeConfig {
71
+ /**
72
+ * A string to uniquely identify artifacts of this build, will be appended
73
+ * to the out dir to generate a nested directory. E.g. out/current-timestamp
74
+ *
75
+ * If a function is provided, it must synchronously return the buildIdentifier
76
+ */
77
+ buildIdentifier?: string | (() => string);
78
+ hooks?: ForgeHookMap;
79
+ /**
80
+ * @internal
81
+ */
82
+ pluginInterface: IForgePluginInterface;
83
+ /**
84
+ * An array of Forge plugins or a tuple consisting of [pluginName, pluginOptions]
85
+ */
86
+ plugins: ForgeConfigPlugin[];
87
+ rebuildConfig: ForgeRebuildOptions;
88
+ packagerConfig: ForgePackagerOptions;
89
+ makers: ForgeConfigMaker[];
90
+ publishers: ForgeConfigPublisher[];
91
+ }
92
+ export type ForgeConfig = Partial<Omit<ResolvedForgeConfig, 'pluginInterface'>>;
93
+ export interface ForgeMakeResult {
94
+ /**
95
+ * An array of paths to artifacts generated for this make run
96
+ */
97
+ artifacts: string[];
98
+ /**
99
+ * The state of the package.json file when the make happened
100
+ */
101
+ packageJSON: any; // eslint-disable-line @typescript-eslint/no-explicit-any
102
+ /**
103
+ * The platform this make run was for
104
+ */
105
+ platform: ForgePlatform;
106
+ /**
107
+ * The arch this make run was for
108
+ */
109
+ arch: ForgeArch;
110
+ }
111
+
112
+ export interface IForgeResolvablePlugin {
113
+ name: string;
114
+ config?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
115
+ }
116
+
117
+ export interface IForgePlugin {
118
+ /** @internal */
119
+ __isElectronForgePlugin: boolean;
120
+ name: string;
121
+
122
+ init(dir: string, forgeConfig: ResolvedForgeConfig): void;
123
+ getHooks?(): ForgeHookMap;
124
+ startLogic?(opts: StartOptions): Promise<StartResult>;
125
+ }
126
+
127
+ export interface IForgeResolvableMaker {
128
+ enabled: boolean;
129
+ name: string;
130
+ platforms: ForgePlatform[] | null;
131
+ config: any; // eslint-disable-line @typescript-eslint/no-explicit-any
132
+ }
133
+
134
+ export interface IForgeMaker {
135
+ /** @internal */
136
+ __isElectronForgeMaker: boolean;
137
+ readonly platforms?: ForgePlatform[];
138
+ }
139
+
140
+ export interface IForgeResolvablePublisher {
141
+ name: string;
142
+ platforms?: ForgePlatform[] | null;
143
+ config?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
144
+ }
145
+
146
+ export interface IForgePublisher {
147
+ /** @internal */
148
+ __isElectronForgePublisher: boolean;
149
+ readonly platforms?: ForgePlatform[];
150
+ }
151
+
152
+ export interface StartOptions {
153
+ /**
154
+ * The path to the electron forge project to run
155
+ */
156
+ dir?: string;
157
+ /**
158
+ * The path (relative to dir) to the electron app to run relative to the project directory
159
+ */
160
+ appPath?: string;
161
+ /**
162
+ * Whether to use sensible defaults or prompt the user visually
163
+ */
164
+ interactive?: boolean;
165
+ /**
166
+ * Enables advanced internal Electron debug calls
167
+ */
168
+ enableLogging?: boolean;
169
+ /**
170
+ * Arguments to pass through to the launched Electron application
171
+ */
172
+ args?: (string | number)[];
173
+ /**
174
+ * Runs the Electron process as if it were node, disables all Electron API's
175
+ */
176
+ runAsNode?: boolean;
177
+ /**
178
+ * Enables the node inspector, you can connect to this from chrome://inspect
179
+ */
180
+ inspect?: boolean;
181
+ /**
182
+ * Enables the node inspector, you can connect to this from chrome://inspect
183
+ * Pauses the execution on first JavaScript line until debugger connects.
184
+ */
185
+ inspectBrk?: boolean;
186
+ }
187
+
188
+ export type StartResult = ElectronProcess | string | string[] | false;
189
+
190
+ export interface InitTemplateOptions {
191
+ copyCIFiles?: boolean;
192
+ }
193
+
194
+ export interface ForgeTemplate {
195
+ requiredForgeVersion?: string;
196
+ dependencies?: string[];
197
+ devDependencies?: string[];
198
+ initializeTemplate?: (dir: string, options: InitTemplateOptions) => Promise<void>;
199
+ }
200
+
201
+ export type PackagePerson =
202
+ | undefined
203
+ | string
204
+ | {
205
+ name: string;
206
+ email?: string;
207
+ url?: string;
25
208
  };
26
- /**
27
- * @generated
28
- */
29
- pluginInterface: IForgePluginInterface;
30
- /**
31
- * An array of forge plugins or a tuple consisting of [pluginName, pluginOptions]
32
- */
33
- plugins: (IForgePlugin | [string, any])[];
34
- electronRebuildConfig: RebuildOptions;
35
- packagerConfig: Options;
36
- makers: (IForgeResolvableMaker | IForgeMaker)[];
37
- publishers: (IForgeResolvablePublisher | IForgePublisher | string)[];
38
- }
39
- export interface ForgeMakeResult {
40
- /**
41
- * An array of paths to artifacts generated for this make run
42
- */
43
- artifacts: string[];
44
- /**
45
- * The state of the package.json file when the make happened
46
- */
47
- packageJSON: any;
48
- /**
49
- * The platform this make run was for
50
- */
51
- platform: ForgePlatform;
52
- /**
53
- * The arch this make run was for
54
- */
55
- arch: ForgeArch;
56
- }
57
-
58
- export interface IForgePlugin {
59
- __isElectronForgePlugin: boolean;
60
- name: string;
61
-
62
- init(dir: string, forgeConfig: ForgeConfig): void;
63
- getHook?(hookName: string): ForgeHookFn | null;
64
- startLogic?(opts: StartOptions): Promise<ChildProcess | false>;
65
- }
66
-
67
- export interface IForgeResolvableMaker {
68
- name: string;
69
- platforms: ForgePlatform[] | null;
70
- config: any;
71
- }
72
-
73
- export interface IForgeMaker {
74
- __isElectronForgeMaker: boolean;
75
- platforms?: undefined;
76
- }
77
-
78
- export interface IForgeResolvablePublisher {
79
- name: string;
80
- platforms?: ForgePlatform[] | null;
81
- config?: any;
82
- }
83
-
84
- export interface IForgePublisher {
85
- __isElectronForgePublisher: boolean;
86
- platforms?: undefined;
87
- }
88
-
89
- export interface StartOptions {
90
- /**
91
- * The path to the electron forge project to run
92
- */
93
- dir?: string;
94
- /**
95
- * The path (relative to dir) to the electron app to run relative to the project directory
96
- */
97
- appPath?: string;
98
- /**
99
- * Whether to use sensible defaults or prompt the user visually
100
- */
101
- interactive?: boolean;
102
- /**
103
- * Enables advanced internal Electron debug calls
104
- */
105
- enableLogging?: boolean;
106
- /**
107
- * Arguments to pass through to the launched Electron application
108
- */
109
- args?: (string | number)[];
110
- /**
111
- * Runs the Electron process as if it were node, disables all Electron API's
112
- */
113
- runAsNode?: boolean;
114
- /**
115
- * Enables the node inspector, you can connect to this from chrome://inspect
116
- */
117
- inspect?: boolean;
118
- }
119
- // }
package/tsconfig.json CHANGED
@@ -1,23 +1,36 @@
1
1
  {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "target": "es6",
5
- "outDir": "dist",
6
- "lib": [
7
- "es6",
8
- "dom",
9
- "es7"
10
- ],
11
- "sourceMap": true,
12
- "rootDir": "src",
13
- "experimentalDecorators": true,
14
- "strict": true,
15
- "esModuleInterop": true,
16
- "declaration": true
17
- },
18
- "exclude": [
19
- "node_modules",
20
- "dist",
21
- "test"
22
- ]
2
+ "//": "⚠️ AUTOGENERATED ⚠️ This file was automatically generated by tools/gen-tsconfigs.ts, do not edit manually.",
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "target": "es2019",
6
+ "outDir": "dist",
7
+ "lib": [
8
+ "dom",
9
+ "es2019"
10
+ ],
11
+ "sourceMap": true,
12
+ "rootDir": "src",
13
+ "experimentalDecorators": true,
14
+ "strict": true,
15
+ "esModuleInterop": true,
16
+ "declaration": true,
17
+ "composite": true,
18
+ "declarationMap": true,
19
+ "typeRoots": [
20
+ "../../../typings",
21
+ "../../../node_modules/@types"
22
+ ]
23
+ },
24
+ "exclude": [
25
+ "node_modules",
26
+ "dist",
27
+ "test",
28
+ "index.ts",
29
+ "tmpl"
30
+ ],
31
+ "references": [
32
+ {
33
+ "path": "../async-ora"
34
+ }
35
+ ]
23
36
  }