@pipelab/plugin-electron 1.0.0-beta.1 → 1.0.0-beta.4

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/src/index.ts DELETED
@@ -1,94 +0,0 @@
1
- import { makeRunner } from "./make";
2
- import { packageRunner } from "./package";
3
- import { previewRunner } from "./preview";
4
-
5
- import { createNodeDefinition } from "@pipelab/plugin-core";
6
- const icon = new URL("./public/electron.webp", import.meta.url).href;
7
- import {
8
- createMakeProps,
9
- createPackageProps,
10
- createPackageV2Props,
11
- createPreviewProps,
12
- IDMake,
13
- IDPackage,
14
- IDPackageV2,
15
- IDPreview,
16
- } from "./forge";
17
- import { configureRunner, props } from "./configure";
18
- import { packageV2Runner } from "./package-v2";
19
-
20
- export default createNodeDefinition({
21
- description: "Electron",
22
- name: "Electron",
23
- id: "electron",
24
- icon: {
25
- type: "image",
26
- image: icon,
27
- },
28
- nodes: [
29
- // make and package
30
- {
31
- node: createMakeProps(
32
- IDMake,
33
- "Create Installer",
34
- "Create a distributable installer for your chosen platform",
35
- "",
36
- "`Build package for ${fmt.param(params['input-folder'], 'primary', 'Input folder not set')}`",
37
- ),
38
- runner: makeRunner,
39
- // disabled: platform === 'linux' ? 'Electron is not supported on Linux' : undefined
40
- },
41
- // package
42
- // v1
43
- {
44
- node: createPackageProps(
45
- IDPackage,
46
- "Package app",
47
- "Gather all necessary files and prepare your app for distribution, creating a platform-specific bundle.",
48
- "",
49
- "`Package app from ${fmt.param(params['input-folder'], 'primary', 'Input folder not set')}`",
50
- true,
51
- ),
52
- runner: packageRunner,
53
- },
54
- // v2
55
- {
56
- node: createPackageV2Props(
57
- IDPackageV2,
58
- "Package app with configuration",
59
- "Gather all necessary files and prepare your app for distribution, creating a platform-specific bundle.",
60
- "",
61
- "`Package app from ${fmt.param(params['input-folder'], 'primary', 'Input folder not set')}`",
62
- false,
63
- false,
64
- undefined,
65
- false,
66
- false,
67
- ),
68
- runner: packageV2Runner,
69
- },
70
- {
71
- node: createPreviewProps(
72
- IDPreview,
73
- "Preview app",
74
- "Package and preview your app from an URL",
75
- "",
76
- "`Preview app from ${fmt.param(params['input-url'], 'primary', 'URL not set')}`",
77
- ),
78
- runner: previewRunner,
79
- },
80
- {
81
- node: props,
82
- runner: configureRunner,
83
- },
84
- // {
85
- // node: propsConfigureV2,
86
- // runner: configureV2Runner
87
- // }
88
- // make without package
89
- // {
90
- // node: packageApp,
91
- // runner: packageRunner,
92
- // },
93
- ],
94
- });
package/src/make.spec.ts DELETED
@@ -1,57 +0,0 @@
1
- import { expect, test, vi } from "vitest";
2
- import { makeRunner } from "./make.js";
3
- import { tmpdir } from "node:os";
4
- import { join } from "node:path";
5
- import { type fs } from "memfs";
6
- import { browserWindow } from "@pipelab/shared";
7
-
8
- // ...
9
-
10
- // vi.mock('node:fs/promises', async () => {
11
- // const memfs: { fs: typeof fs } = await vi.importActual('memfs')
12
-
13
- // return memfs.fs.promises
14
- // })
15
-
16
- test("adds 1 + 2 to equal 3", async () => {
17
- const outputs: Record<string, unknown> = {};
18
-
19
- const id = "ut-electron-build";
20
- const tmpDir = join(tmpdir(), id);
21
-
22
- console.log("tmpDir", tmpDir);
23
-
24
- const inputFolder = join(process.cwd(), "fixtures", "build");
25
-
26
- console.log("inputFolder", inputFolder);
27
-
28
- // await makeRunner({
29
- // inputs: {
30
- // 'input-folder': inputFolder,
31
- // configuration: {},
32
- // arch: undefined,
33
- // platform: undefined
34
- // },
35
- // log: (...args) => {
36
- // console.log(...args)
37
- // },
38
- // setOutput: (key, value) => {
39
- // outputs[key] = value
40
- // },
41
- // meta: {
42
- // definition: ''
43
- // },
44
- // setMeta: () => {
45
- // console.log('set meta defined here')
46
- // },
47
- // cwd: tmpDir,
48
- // paths: {
49
- // assets: '',
50
- // unpack: ''
51
- // },
52
- // api: undefined,
53
- // browserWindow
54
- // })
55
- console.log("outputs", outputs);
56
- expect(true).toBe(true);
57
- }, 120_000);
package/src/make.ts DELETED
@@ -1,22 +0,0 @@
1
- import { createActionRunner } from "@pipelab/plugin-core";
2
- import { forge, createMakeProps } from "./forge";
3
- import { merge } from "ts-deepmerge";
4
- import { defaultElectronConfig } from "./utils";
5
-
6
- export const makeRunner = createActionRunner<ReturnType<typeof createMakeProps>>(
7
- async (options) => {
8
- const appFolder = options.inputs["input-folder"];
9
-
10
- if (!options.inputs.configuration) {
11
- throw new Error("Missing electron configuration");
12
- }
13
-
14
- const completeConfiguration = merge(
15
- defaultElectronConfig,
16
- options.inputs.configuration,
17
- ) as DesktopApp.Electron;
18
-
19
- // @ts-expect-error options is not really compatible
20
- return await forge("make", appFolder, options, completeConfiguration);
21
- },
22
- );
package/src/package-v2.ts DELETED
@@ -1,52 +0,0 @@
1
- import { createActionRunner } from "@pipelab/plugin-core";
2
- import { forge } from "./forge";
3
- import { createPackageV2Props } from "./forge";
4
- import { merge } from "ts-deepmerge";
5
- import { defaultElectronConfig } from "./utils";
6
-
7
- export const packageV2Runner = createActionRunner<ReturnType<typeof createPackageV2Props>>(
8
- async (options) => {
9
- const appFolder = options.inputs["input-folder"];
10
-
11
- const completeConfiguration = merge(defaultElectronConfig, {
12
- alwaysOnTop: options.inputs["alwaysOnTop"],
13
- appBundleId: options.inputs["appBundleId"],
14
- appCategoryType: options.inputs["appCategoryType"],
15
- appCopyright: options.inputs["appCopyright"],
16
- appVersion: options.inputs["appVersion"],
17
- author: options.inputs["author"],
18
- customMainCode: options.inputs["customMainCode"],
19
- description: options.inputs["description"],
20
- electronVersion: options.inputs["electronVersion"],
21
- disableAsarPackaging: options.inputs["disableAsarPackaging"],
22
- forceHighPerformanceGpu: options.inputs["forceHighPerformanceGpu"],
23
- enableExtraLogging: options.inputs["enableExtraLogging"],
24
- clearServiceWorkerOnBoot: options.inputs["clearServiceWorkerOnBoot"],
25
- enableDisableRendererBackgrounding: options.inputs["enableDisableRendererBackgrounding"],
26
- enableInProcessGPU: options.inputs["enableInProcessGPU"],
27
- frame: options.inputs["frame"],
28
- fullscreen: options.inputs["fullscreen"],
29
- icon: options.inputs["icon"],
30
- height: options.inputs["height"],
31
- name: options.inputs["name"],
32
- toolbar: options.inputs["toolbar"],
33
- transparent: options.inputs["transparent"],
34
- width: options.inputs["width"],
35
- enableSteamSupport: options.inputs["enableSteamSupport"],
36
- steamGameId: options.inputs["steamGameId"],
37
- ignore: options.inputs["ignore"],
38
- openDevtoolsOnStart: options.inputs["openDevtoolsOnStart"],
39
- enableDiscordSupport: options.inputs["enableDiscordSupport"],
40
- discordAppId: options.inputs["discordAppId"],
41
- customPackages: options.inputs["customPackages"],
42
- backgroundColor: options.inputs["backgroundColor"],
43
- enableDoctor: options.inputs["enableDoctor"],
44
- serverMode: options.inputs["serverMode"],
45
- } satisfies DesktopApp.Electron) as DesktopApp.Electron;
46
-
47
- options.log("completeConfiguration", completeConfiguration);
48
-
49
- // @ts-expect-error options is not really compatible
50
- return await forge("package", appFolder, options, completeConfiguration);
51
- },
52
- );
package/src/package.ts DELETED
@@ -1,22 +0,0 @@
1
- import { createActionRunner } from "@pipelab/plugin-core";
2
- import { createPackageProps, forge } from "./forge";
3
- import { merge } from "ts-deepmerge";
4
- import { defaultElectronConfig } from "./utils";
5
-
6
- export const packageRunner = createActionRunner<ReturnType<typeof createPackageProps>>(
7
- async (options) => {
8
- const appFolder = options.inputs["input-folder"];
9
-
10
- if (!options.inputs.configuration) {
11
- throw new Error("Missing electron configuration");
12
- }
13
-
14
- const completeConfiguration = merge(
15
- defaultElectronConfig,
16
- options.inputs.configuration,
17
- ) as DesktopApp.Electron;
18
-
19
- // @ts-expect-error options is not really compatible
20
- return await forge("package", appFolder, options, completeConfiguration);
21
- },
22
- );
package/src/preview.ts DELETED
@@ -1,35 +0,0 @@
1
- import { createActionRunner, runWithLiveLogs } from "@pipelab/plugin-core";
2
- import { createPreviewProps, forge } from "./forge";
3
- import { merge } from "ts-deepmerge";
4
- import { defaultElectronConfig } from "./utils";
5
-
6
- export const previewRunner = createActionRunner<ReturnType<typeof createPreviewProps>>(
7
- async (options) => {
8
- const url = options.inputs["input-url"];
9
- if (url === "") {
10
- throw new Error("URL can't be empty");
11
- }
12
-
13
- if (!options.inputs.configuration) {
14
- throw new Error("Missing electron configuration");
15
- }
16
-
17
- const completeConfiguration = merge(
18
- defaultElectronConfig,
19
- options.inputs.configuration,
20
- ) as DesktopApp.Electron;
21
-
22
- const output = await forge("package", undefined, options, completeConfiguration);
23
- options.log("Opening preview", JSON.stringify(output));
24
- options.log("Opening url", url);
25
- await runWithLiveLogs(
26
- output.binary,
27
- ["--url", url],
28
- {
29
- cancelSignal: options.abortSignal,
30
- },
31
- options.log,
32
- );
33
- return;
34
- },
35
- );
Binary file
package/src/utils.ts DELETED
@@ -1,35 +0,0 @@
1
- export const defaultElectronConfig = {
2
- alwaysOnTop: false,
3
- appBundleId: "com.pipelab.app",
4
- appCategoryType: "",
5
- appCopyright: "Copyright © 2024 Pipelab",
6
- appVersion: "1.0.0",
7
- author: "Pipelab",
8
- customMainCode: "",
9
- description: "A simple Electron application",
10
- electronVersion: "",
11
- disableAsarPackaging: true,
12
- forceHighPerformanceGpu: false,
13
- enableExtraLogging: false,
14
- clearServiceWorkerOnBoot: false,
15
- enableDisableRendererBackgrounding: false,
16
- enableInProcessGPU: false,
17
- frame: true,
18
- fullscreen: false,
19
- icon: "",
20
- height: 600,
21
- name: "Pipelab",
22
- toolbar: true,
23
- transparent: false,
24
- width: 800,
25
- enableSteamSupport: false,
26
- steamGameId: 480,
27
- enableDiscordSupport: false,
28
- discordAppId: "",
29
- ignore: [] as string[],
30
- backgroundColor: "#FFF",
31
- openDevtoolsOnStart: false,
32
- enableDoctor: false,
33
- customPackages: [] as string[],
34
- serverMode: "default",
35
- } satisfies DesktopApp.Electron;
@@ -1,64 +0,0 @@
1
- import { expect, test, describe, afterEach } from "vitest";
2
- import { mkdir, writeFile, access } from "node:fs/promises";
3
- import { join, dirname } from "node:path";
4
- import { fileURLToPath } from "node:url";
5
- import { createSandbox, runAction } from "@pipelab/test-utils";
6
- import { getBinName } from "@pipelab/constants";
7
- import { packageRunner } from "../../src/package";
8
-
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = dirname(__filename);
11
-
12
- describe("End-to-End: Electron Plugin", () => {
13
- let sandbox: Awaited<ReturnType<typeof createSandbox>>;
14
-
15
- afterEach(async () => {
16
- if (sandbox) {
17
- await sandbox.remove();
18
- }
19
- });
20
-
21
- test(
22
- "should package a project using 'electron-package' node",
23
- async () => {
24
- sandbox = await createSandbox("electron-e2e");
25
- // 1. Setup a dummy project to package
26
- const projectToPackage = join(sandbox.path, "my-app");
27
- await mkdir(projectToPackage, { recursive: true });
28
- await writeFile(
29
- join(projectToPackage, "package.json"),
30
- JSON.stringify({ name: "my-app", version: "1.0.0", main: "index.js" }),
31
- );
32
- await writeFile(join(projectToPackage, "index.js"), "console.log('hello electron')");
33
- await writeFile(join(projectToPackage, "index.html"), "<h1>Hello Electron</h1>");
34
-
35
- // 2. Run the action directly
36
- const inputs = {
37
- "input-folder": projectToPackage,
38
- configuration: { name: "my-app" },
39
- };
40
-
41
- const result = await runAction(packageRunner, {
42
- inputs,
43
- sandboxPath: sandbox.path,
44
- });
45
-
46
- // 3. Verification
47
- const outputs = result.outputs;
48
- expect(outputs).toBeDefined();
49
- expect(outputs.output).toEqual(expect.any(String));
50
-
51
- // Verify output exists in the dynamically generated output folder
52
- await expect(access(outputs.output as string)).resolves.not.toThrow();
53
-
54
- // Verify and run the binary
55
- const platform = process.platform;
56
- const binName = getBinName("my-app", platform);
57
- const binaryPath = join(outputs.output as string, binName);
58
-
59
- console.log("Calculated binary path:", binaryPath);
60
- await expect(access(binaryPath)).resolves.not.toThrow();
61
- },
62
- 5 * 60 * 1000,
63
- ); // 5 minutes timeout for real build
64
- });
@@ -1,171 +0,0 @@
1
- {
2
- "description": "",
3
- "name": "Folder to Electron",
4
- "variables": [],
5
- "canvas": {
6
- "blocks": [
7
- {
8
- "uid": "electron-package-node",
9
- "type": "action",
10
- "origin": {
11
- "nodeId": "electron:package:v2",
12
- "pluginId": "electron"
13
- },
14
- "params": {
15
- "arch": {
16
- "editor": "simple",
17
- "value": ""
18
- },
19
- "platform": {
20
- "editor": "simple",
21
- "value": ""
22
- },
23
- "input-folder": {
24
- "editor": "simple",
25
- "value": "\"./tests/e2e/fixtures/html-export\""
26
- },
27
- "name": {
28
- "editor": "simple",
29
- "value": "\"Pipelab\""
30
- },
31
- "appBundleId": {
32
- "editor": "simple",
33
- "value": "\"com.pipelab.app\""
34
- },
35
- "appCopyright": {
36
- "editor": "simple",
37
- "value": "\"Copyright © 2024 Pipelab\""
38
- },
39
- "appVersion": {
40
- "editor": "simple",
41
- "value": "\"1.0.0\""
42
- },
43
- "icon": {
44
- "editor": "simple",
45
- "value": ""
46
- },
47
- "author": {
48
- "editor": "simple",
49
- "value": "\"Pipelab\""
50
- },
51
- "description": {
52
- "editor": "simple",
53
- "value": "\"A sample application\""
54
- },
55
- "appCategoryType": {
56
- "editor": "simple",
57
- "value": "\"public.app-category.developer-tools\""
58
- },
59
- "width": {
60
- "editor": "simple",
61
- "value": 800
62
- },
63
- "height": {
64
- "editor": "simple",
65
- "value": 600
66
- },
67
- "fullscreen": {
68
- "editor": "simple",
69
- "value": "false"
70
- },
71
- "frame": {
72
- "editor": "simple",
73
- "value": "true"
74
- },
75
- "transparent": {
76
- "editor": "simple",
77
- "value": "false"
78
- },
79
- "toolbar": {
80
- "editor": "simple",
81
- "value": "false"
82
- },
83
- "alwaysOnTop": {
84
- "editor": "simple",
85
- "value": "false"
86
- },
87
- "electronVersion": {
88
- "editor": "simple",
89
- "value": ""
90
- },
91
- "customMainCode": {
92
- "editor": "simple",
93
- "value": ""
94
- },
95
- "disableAsarPackaging": {
96
- "editor": "simple",
97
- "value": "true"
98
- },
99
- "enableExtraLogging": {
100
- "editor": "simple",
101
- "value": "false"
102
- },
103
- "clearServiceWorkerOnBoot": {
104
- "editor": "simple",
105
- "value": "false"
106
- },
107
- "enableInProcessGPU": {
108
- "editor": "simple",
109
- "value": "false"
110
- },
111
- "enableDisableRendererBackgrounding": {
112
- "editor": "simple",
113
- "value": "false"
114
- },
115
- "forceHighPerformanceGpu": {
116
- "editor": "simple",
117
- "value": "false"
118
- },
119
- "websocketApi": {
120
- "editor": "simple",
121
- "value": "[]"
122
- },
123
- "ignore": {
124
- "editor": "simple",
125
- "value": "[\n // use 'src/app/' as starting point\n]"
126
- },
127
- "enableSteamSupport": {
128
- "editor": "simple",
129
- "value": "true"
130
- },
131
- "steamGameId": {
132
- "editor": "simple",
133
- "value": ""
134
- },
135
- "openDevtoolsOnStart": {
136
- "editor": "simple",
137
- "value": false
138
- },
139
- "enableDiscordSupport": {
140
- "editor": "simple",
141
- "value": false
142
- },
143
- "discordAppId": {
144
- "editor": "simple",
145
- "value": ""
146
- },
147
- "customPackages": {
148
- "editor": "editor",
149
- "value": "[\n]"
150
- },
151
- "backgroundColor": {
152
- "editor": "simple",
153
- "value": "\"#FFFFFF\""
154
- }
155
- }
156
- }
157
- ],
158
- "triggers": [
159
- {
160
- "type": "event",
161
- "origin": {
162
- "pluginId": "system",
163
- "nodeId": "manual"
164
- },
165
- "uid": "manual-start",
166
- "params": {}
167
- }
168
- ]
169
- },
170
- "version": "3.0.0"
171
- }
@@ -1,58 +0,0 @@
1
- {
2
- "version": "3.0.0",
3
- "name": "Noobs are coming tauri",
4
- "description": "",
5
- "canvas": {
6
- "blocks": [
7
- {
8
- "uid": "tauri-package-node",
9
- "type": "action",
10
- "origin": { "nodeId": "tauri:package:v2", "pluginId": "tauri" },
11
- "params": {
12
- "arch": { "editor": "simple", "value": "" },
13
- "platform": { "editor": "simple", "value": "" },
14
- "input-folder": {
15
- "editor": "simple",
16
- "value": "\"./tests/e2e/fixtures/html-export\""
17
- },
18
- "name": { "editor": "simple", "value": "\"Pipelab\"" },
19
- "appBundleId": { "editor": "simple", "value": "\"com.pipelab.app\"" },
20
- "appCopyright": { "editor": "simple", "value": "\"Copyright © 2024 Pipelab\"" },
21
- "appVersion": { "editor": "simple", "value": "\"1.0.0\"" },
22
- "icon": { "editor": "simple", "value": "" },
23
- "author": { "editor": "simple", "value": "\"Pipelab\"" },
24
- "description": { "editor": "simple", "value": "\"A simple Electron application\"" },
25
- "appCategoryType": {
26
- "editor": "simple",
27
- "value": "\"public.app-category.developer-tools\""
28
- },
29
- "width": { "editor": "simple", "value": 800 },
30
- "height": { "editor": "simple", "value": 600 },
31
- "fullscreen": { "editor": "simple", "value": false },
32
- "frame": { "editor": "simple", "value": true },
33
- "transparent": { "editor": "simple", "value": false },
34
- "toolbar": { "editor": "simple", "value": true },
35
- "alwaysOnTop": { "editor": "simple", "value": false },
36
- "tauriVersion": { "editor": "simple", "value": "\"\"" },
37
- "enableExtraLogging": { "editor": "simple", "value": false },
38
- "openDevtoolsOnStart": { "editor": "simple", "value": false },
39
- "websocketApi": { "editor": "simple", "value": "[]" },
40
- "ignore": { "editor": "simple", "value": "[\n // use 'src/app/' as starting point\n]" },
41
- "enableSteamSupport": { "editor": "simple", "value": false },
42
- "steamGameId": { "editor": "simple", "value": 480 },
43
- "enableDiscordSupport": { "editor": "simple", "value": false },
44
- "discordAppId": { "editor": "simple", "value": "\"\"" }
45
- }
46
- }
47
- ],
48
- "triggers": [
49
- {
50
- "type": "event",
51
- "origin": { "pluginId": "system", "nodeId": "manual" },
52
- "uid": "manual-start",
53
- "params": {}
54
- }
55
- ]
56
- },
57
- "variables": []
58
- }
@@ -1,20 +0,0 @@
1
- import { defineConfig } from "vitest/config";
2
-
3
- export default defineConfig({
4
- test: {
5
- fileParallelism: false,
6
- testTimeout: 60000,
7
- hookTimeout: 60000,
8
- maxWorkers: 1,
9
- minWorkers: 1,
10
- poolOptions: {
11
- forks: {
12
- singleFork: true,
13
- },
14
- },
15
- include: ["**/*.spec.ts"],
16
- root: "tests/e2e",
17
- environment: "node",
18
- env: { NODE_ENV: "development", PIPELAB_DISABLE_HISTORY: "true" },
19
- },
20
- });
package/tsconfig.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "@pipelab/tsconfig/vue.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "rootDir": "src",
6
- "types": ["node"],
7
- "skipLibCheck": true
8
- },
9
- "include": ["src"]
10
- }
package/tsdown.config.ts DELETED
@@ -1,15 +0,0 @@
1
- import { defineConfig } from "tsdown";
2
-
3
- export default defineConfig({
4
- entry: ["src/index.ts"],
5
- format: ["esm", "cjs"],
6
- dts: true,
7
- clean: true,
8
- loader: {
9
- ".webp": "dataurl",
10
- ".png": "dataurl",
11
- ".jpg": "dataurl",
12
- ".jpeg": "dataurl",
13
- ".svg": "dataurl",
14
- },
15
- });