@electron-forge/shared-types 6.0.0-beta.6 → 6.0.0-beta.63

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,38 +1,42 @@
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 { ArchOption, Options, TargetPlatform } from 'electron-packager';
4
+ import { RebuildOptions } from 'electron-rebuild';
5
+ export declare type ElectronProcess = ChildProcess & {
6
+ restarted: boolean;
7
+ };
8
+ export declare type ForgePlatform = TargetPlatform;
9
+ export declare type ForgeArch = ArchOption;
10
+ export declare type ForgeHookFn = (forgeConfig: ForgeConfig, ...args: any[]) => Promise<any>;
11
+ export declare type ForgeConfigPublisher = IForgeResolvablePublisher | IForgePublisher | string;
9
12
  export interface IForgePluginInterface {
10
13
  triggerHook(hookName: string, hookArgs: any[]): Promise<void>;
11
- overrideStartLogic(opts: any): Promise<ChildProcess | false>;
14
+ triggerMutatingHook<T>(hookName: string, item: T): Promise<any>;
15
+ overrideStartLogic(opts: StartOptions): Promise<StartResult>;
12
16
  }
13
17
  export interface ForgeConfig {
14
18
  /**
15
19
  * A string to uniquely identify artifacts of this build, will be appended
16
20
  * to the out dir to generate a nested directory. E.g. out/current-timestamp
17
21
  *
18
- * If a function is provided it must syncronously return the buildIdentifier
22
+ * If a function is provided, it must synchronously return the buildIdentifier
19
23
  */
20
24
  buildIdentifier?: string | (() => string);
21
25
  hooks?: {
22
26
  [hookName: string]: ForgeHookFn;
23
27
  };
24
28
  /**
25
- * @generated
29
+ * @internal
26
30
  */
27
31
  pluginInterface: IForgePluginInterface;
28
32
  /**
29
- * An array of forge plugins or a tuple consisting of [pluginName, pluginOptions]
33
+ * An array of Forge plugins or a tuple consisting of [pluginName, pluginOptions]
30
34
  */
31
- plugins: (IForgePlugin | [string, any])[];
32
- electronRebuildConfig: RebuildOptions;
33
- packagerConfig: Options;
35
+ plugins: (IForgePlugin | [string, Record<string, unknown>])[];
36
+ electronRebuildConfig: Partial<RebuildOptions>;
37
+ packagerConfig: Partial<Options>;
34
38
  makers: (IForgeResolvableMaker | IForgeMaker)[];
35
- publishers: (IForgeResolvablePublisher | IForgePublisher | string)[];
39
+ publishers: ForgeConfigPublisher[];
36
40
  }
37
41
  export interface ForgeMakeResult {
38
42
  /**
@@ -57,7 +61,7 @@ export interface IForgePlugin {
57
61
  name: string;
58
62
  init(dir: string, forgeConfig: ForgeConfig): void;
59
63
  getHook?(hookName: string): ForgeHookFn | null;
60
- startLogic?(opts: StartOptions): Promise<ChildProcess | false>;
64
+ startLogic?(opts: StartOptions): Promise<StartResult>;
61
65
  }
62
66
  export interface IForgeResolvableMaker {
63
67
  name: string;
@@ -66,7 +70,7 @@ export interface IForgeResolvableMaker {
66
70
  }
67
71
  export interface IForgeMaker {
68
72
  __isElectronForgeMaker: boolean;
69
- platforms?: undefined;
73
+ readonly platforms?: ForgePlatform[];
70
74
  }
71
75
  export interface IForgeResolvablePublisher {
72
76
  name: string;
@@ -75,7 +79,7 @@ export interface IForgeResolvablePublisher {
75
79
  }
76
80
  export interface IForgePublisher {
77
81
  __isElectronForgePublisher: boolean;
78
- platforms?: undefined;
82
+ readonly platforms?: ForgePlatform[];
79
83
  }
80
84
  export interface StartOptions {
81
85
  /**
@@ -107,3 +111,18 @@ export interface StartOptions {
107
111
  */
108
112
  inspect?: boolean;
109
113
  }
114
+ export declare type StartResult = ElectronProcess | string | string[] | false;
115
+ export interface InitTemplateOptions {
116
+ copyCIFiles?: boolean;
117
+ }
118
+ export interface ForgeTemplate {
119
+ requiredForgeVersion?: string;
120
+ dependencies?: string[];
121
+ devDependencies?: string[];
122
+ initializeTemplate?: (dir: string, options: InitTemplateOptions) => Promise<void>;
123
+ }
124
+ export declare type PackagePerson = undefined | string | {
125
+ name: string;
126
+ email?: string;
127
+ url?: string;
128
+ };
package/index.d.ts CHANGED
@@ -1,119 +1,145 @@
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';
2
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
+ import { ArchOption, Options, TargetPlatform } from 'electron-packager';
4
+ import { RebuildOptions } from 'electron-rebuild';
6
5
 
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;
25
- };
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
- }
6
+ export type ElectronProcess = ChildProcess & { restarted: boolean };
7
+
8
+ export type ForgePlatform = TargetPlatform;
9
+ export type ForgeArch = ArchOption;
10
+ // Why: hooks have any number/kind of args/return values
11
+ /* eslint-disable @typescript-eslint/no-explicit-any */
12
+ export type ForgeHookFn = (forgeConfig: ForgeConfig, ...args: any[]) => Promise<any>;
13
+ export type ForgeConfigPublisher = IForgeResolvablePublisher | IForgePublisher | string;
14
+ export interface IForgePluginInterface {
15
+ triggerHook(hookName: string, hookArgs: any[]): Promise<void>;
16
+ triggerMutatingHook<T>(hookName: string, item: T): Promise<any>;
17
+ overrideStartLogic(opts: StartOptions): Promise<StartResult>;
18
+ }
19
+ /* eslint-enable @typescript-eslint/no-explicit-any */
20
+ export interface ForgeConfig {
21
+ /**
22
+ * A string to uniquely identify artifacts of this build, will be appended
23
+ * to the out dir to generate a nested directory. E.g. out/current-timestamp
24
+ *
25
+ * If a function is provided, it must synchronously return the buildIdentifier
26
+ */
27
+ buildIdentifier?: string | (() => string);
28
+ hooks?: {
29
+ [hookName: string]: ForgeHookFn;
30
+ };
31
+ /**
32
+ * @internal
33
+ */
34
+ pluginInterface: IForgePluginInterface;
35
+ /**
36
+ * An array of Forge plugins or a tuple consisting of [pluginName, pluginOptions]
37
+ */
38
+ plugins: (IForgePlugin | [string, Record<string, unknown>])[];
39
+ electronRebuildConfig: Partial<RebuildOptions>;
40
+ packagerConfig: Partial<Options>;
41
+ makers: (IForgeResolvableMaker | IForgeMaker)[];
42
+ publishers: ForgeConfigPublisher[];
43
+ }
44
+ export interface ForgeMakeResult {
45
+ /**
46
+ * An array of paths to artifacts generated for this make run
47
+ */
48
+ artifacts: string[];
49
+ /**
50
+ * The state of the package.json file when the make happened
51
+ */
52
+ packageJSON: any; // eslint-disable-line @typescript-eslint/no-explicit-any
53
+ /**
54
+ * The platform this make run was for
55
+ */
56
+ platform: ForgePlatform;
57
+ /**
58
+ * The arch this make run was for
59
+ */
60
+ arch: ForgeArch;
61
+ }
62
+
63
+ export interface IForgePlugin {
64
+ __isElectronForgePlugin: boolean;
65
+ name: string;
66
+
67
+ init(dir: string, forgeConfig: ForgeConfig): void;
68
+ getHook?(hookName: string): ForgeHookFn | null;
69
+ startLogic?(opts: StartOptions): Promise<StartResult>;
70
+ }
57
71
 
58
- export interface IForgePlugin {
59
- __isElectronForgePlugin: boolean;
60
- name: string;
72
+ export interface IForgeResolvableMaker {
73
+ name: string;
74
+ platforms: ForgePlatform[] | null;
75
+ config: any; // eslint-disable-line @typescript-eslint/no-explicit-any
76
+ }
61
77
 
62
- init(dir: string, forgeConfig: ForgeConfig): void;
63
- getHook?(hookName: string): ForgeHookFn | null;
64
- startLogic?(opts: StartOptions): Promise<ChildProcess | false>;
65
- }
78
+ export interface IForgeMaker {
79
+ __isElectronForgeMaker: boolean;
80
+ readonly platforms?: ForgePlatform[];
81
+ }
66
82
 
67
- export interface IForgeResolvableMaker {
68
- name: string;
69
- platforms: ForgePlatform[] | null;
70
- config: any;
71
- }
83
+ export interface IForgeResolvablePublisher {
84
+ name: string;
85
+ platforms?: ForgePlatform[] | null;
86
+ config?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
87
+ }
72
88
 
73
- export interface IForgeMaker {
74
- __isElectronForgeMaker: boolean;
75
- platforms?: undefined;
76
- }
89
+ export interface IForgePublisher {
90
+ __isElectronForgePublisher: boolean;
91
+ readonly platforms?: ForgePlatform[];
92
+ }
77
93
 
78
- export interface IForgeResolvablePublisher {
79
- name: string;
80
- platforms?: ForgePlatform[] | null;
81
- config?: any;
82
- }
94
+ export interface StartOptions {
95
+ /**
96
+ * The path to the electron forge project to run
97
+ */
98
+ dir?: string;
99
+ /**
100
+ * The path (relative to dir) to the electron app to run relative to the project directory
101
+ */
102
+ appPath?: string;
103
+ /**
104
+ * Whether to use sensible defaults or prompt the user visually
105
+ */
106
+ interactive?: boolean;
107
+ /**
108
+ * Enables advanced internal Electron debug calls
109
+ */
110
+ enableLogging?: boolean;
111
+ /**
112
+ * Arguments to pass through to the launched Electron application
113
+ */
114
+ args?: (string | number)[];
115
+ /**
116
+ * Runs the Electron process as if it were node, disables all Electron API's
117
+ */
118
+ runAsNode?: boolean;
119
+ /**
120
+ * Enables the node inspector, you can connect to this from chrome://inspect
121
+ */
122
+ inspect?: boolean;
123
+ }
83
124
 
84
- export interface IForgePublisher {
85
- __isElectronForgePublisher: boolean;
86
- platforms?: undefined;
87
- }
125
+ export type StartResult = ElectronProcess | string | string[] | false;
88
126
 
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
- }
127
+ export interface InitTemplateOptions {
128
+ copyCIFiles?: boolean;
119
129
  }
130
+
131
+ export interface ForgeTemplate {
132
+ requiredForgeVersion?: string;
133
+ dependencies?: string[];
134
+ devDependencies?: string[];
135
+ initializeTemplate?: (dir: string, options: InitTemplateOptions) => Promise<void>;
136
+ }
137
+
138
+ export type PackagePerson =
139
+ | undefined
140
+ | string
141
+ | {
142
+ name: string;
143
+ email?: string;
144
+ url?: string;
145
+ };
package/package.json CHANGED
@@ -1,21 +1,19 @@
1
1
  {
2
2
  "name": "@electron-forge/shared-types",
3
- "version": "6.0.0-beta.6",
4
- "description": "Shared types across forge",
3
+ "version": "6.0.0-beta.63",
4
+ "description": "Shared types across Electron Forge",
5
5
  "repository": "https://github.com/electron-userland/electron-forge",
6
6
  "author": "Samuel Attard",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
9
9
  "typings": "index.d.ts",
10
- "scripts": {
11
- "test": "echo No Tests For Shared Types"
12
- },
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.63",
12
+ "electron-packager": "^15.4.0",
13
+ "electron-rebuild": "^3.2.6",
14
+ "ora": "^5.0.0"
17
15
  },
18
16
  "engines": {
19
- "node": ">= 6.0"
17
+ "node": ">= 12.13.0"
20
18
  }
21
19
  }
package/tsconfig.json CHANGED
@@ -1,23 +1,27 @@
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
- ]
23
- }
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "target": "es2019",
5
+ "outDir": "dist",
6
+ "lib": [
7
+ "dom",
8
+ "es2019"
9
+ ],
10
+ "sourceMap": true,
11
+ "rootDir": ".",
12
+ "experimentalDecorators": true,
13
+ "strict": true,
14
+ "esModuleInterop": true,
15
+ "declaration": true,
16
+ "typeRoots": [
17
+ "../../../node_modules/@types",
18
+ "../../../typings"
19
+ ]
20
+ },
21
+ "exclude": [
22
+ "node_modules",
23
+ "dist",
24
+ "test",
25
+ "index.ts"
26
+ ]
27
+ }