electronup 0.0.2 → 0.0.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/README.md +2 -2
- package/dist/bin/electronup.js +12 -22
- package/dist/client/index.d.ts +3 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# electronup
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
> 融合构建 electron 应用需要的构建工具,保留原有配置习惯的命令行工具
|
|
@@ -81,7 +81,7 @@ pnpm add @quiteer/electronup -D
|
|
|
81
81
|
```json
|
|
82
82
|
{
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@quiteer/
|
|
84
|
+
"@quiteer/parser-config": "^1.0.3",
|
|
85
85
|
"cac": "^6.7.14",
|
|
86
86
|
"dotenv": "^16.0.3",
|
|
87
87
|
"electron-builder": "^23.6.0",
|
package/dist/bin/electronup.js
CHANGED
|
@@ -34,7 +34,7 @@ var import_cac = require("cac");
|
|
|
34
34
|
var import_rimraf = require("rimraf");
|
|
35
35
|
|
|
36
36
|
// package.json
|
|
37
|
-
var version = "0.0.
|
|
37
|
+
var version = "0.0.4";
|
|
38
38
|
|
|
39
39
|
// src/transform/getConfig.ts
|
|
40
40
|
var import_path = require("path");
|
|
@@ -189,11 +189,8 @@ var injectEnv = () => {
|
|
|
189
189
|
function getTsupConfig(config, allConfig) {
|
|
190
190
|
const { command, root, minify } = store;
|
|
191
191
|
const isServe = command === "serve";
|
|
192
|
-
const userConfig = {
|
|
193
|
-
minify: minify === false ? false : isServe,
|
|
194
|
-
...config
|
|
195
|
-
};
|
|
196
192
|
const defaultConfig = {
|
|
193
|
+
minify: minify === false ? false : isServe,
|
|
197
194
|
external: ["electron", ...config.external ?? []],
|
|
198
195
|
noExternal: config.noExternal,
|
|
199
196
|
entry: { electron: (0, import_path3.resolve)(root, allConfig.mainDir || "main" /* mainDir */, "index.ts") },
|
|
@@ -207,8 +204,7 @@ function getTsupConfig(config, allConfig) {
|
|
|
207
204
|
return startElectron((0, import_path3.resolve)(root, allConfig.resourceDir || "dist/resource" /* resourceDir */, "electron.js"));
|
|
208
205
|
}
|
|
209
206
|
};
|
|
210
|
-
config
|
|
211
|
-
return { ...userConfig, ...defaultConfig };
|
|
207
|
+
return { ...config, ...defaultConfig };
|
|
212
208
|
}
|
|
213
209
|
var electronProcess;
|
|
214
210
|
var manualRestart = false;
|
|
@@ -250,21 +246,15 @@ function getViteConfig(config, allConfig) {
|
|
|
250
246
|
const { root, minify } = store;
|
|
251
247
|
const defaultConfig = {
|
|
252
248
|
base: "./",
|
|
253
|
-
|
|
254
|
-
server: { host: "0.0.0.0" },
|
|
249
|
+
...config,
|
|
255
250
|
build: {
|
|
256
|
-
|
|
257
|
-
target: "esnext",
|
|
251
|
+
...config?.build,
|
|
258
252
|
minify: minify && "esbuild",
|
|
259
|
-
|
|
260
|
-
emptyOutDir: true,
|
|
261
|
-
...config?.build
|
|
253
|
+
outDir: (0, import_path4.resolve)(root, allConfig.resourceDir || "dist/resource" /* resourceDir */)
|
|
262
254
|
},
|
|
263
|
-
|
|
255
|
+
root: allConfig.renderDir || "render" /* renderDir */,
|
|
256
|
+
publicDir: (0, import_path4.resolve)(root, allConfig.publicDir || "public" /* publicDir */)
|
|
264
257
|
};
|
|
265
|
-
config?.resolve && (defaultConfig.resolve = config.resolve);
|
|
266
|
-
config?.plugins && (defaultConfig.plugins = config.plugins);
|
|
267
|
-
defaultConfig.publicDir = (0, import_path4.resolve)(root, allConfig.publicDir || "public" /* publicDir */);
|
|
268
258
|
return defaultConfig;
|
|
269
259
|
}
|
|
270
260
|
|
|
@@ -283,17 +273,17 @@ async function getElectronupConfig(config) {
|
|
|
283
273
|
}
|
|
284
274
|
|
|
285
275
|
// src/transform/getExportConfig.ts
|
|
286
|
-
var exportElectronupConfig = (config) => {
|
|
276
|
+
var exportElectronupConfig = async (config) => {
|
|
287
277
|
const typeStr = typeof config;
|
|
288
278
|
if (typeStr === "function") {
|
|
289
|
-
const option = config({ command: store.command, root: store.root });
|
|
279
|
+
const option = await config({ command: store.command, root: store.root });
|
|
290
280
|
return option;
|
|
291
281
|
}
|
|
292
282
|
if (typeStr === "object")
|
|
293
283
|
return config;
|
|
294
284
|
throw new Error("electronup \u914D\u7F6E\u9519\u8BEF,\u89E3\u6790\u5931\u8D25\uFF01");
|
|
295
285
|
};
|
|
296
|
-
var electronupConfig = (config) => getElectronupConfig(exportElectronupConfig(config));
|
|
286
|
+
var electronupConfig = async (config) => getElectronupConfig(await exportElectronupConfig(config));
|
|
297
287
|
|
|
298
288
|
// src/runner/watch.ts
|
|
299
289
|
var import_portfinder = require("portfinder");
|
|
@@ -445,7 +435,7 @@ cli.command("[config-file]", "start dev server").alias("dev").option("-p , --por
|
|
|
445
435
|
store.minify = !!minify;
|
|
446
436
|
watch(option);
|
|
447
437
|
});
|
|
448
|
-
cli.command("build [root]", "\u6784\u5EFA").option("-o , --option", "\u81EA\u5B9A\u4E49 , \u81EA\u5B9A\u4E49\u6784\u5EFA\u9009\u9879 ").option("--dir", "\u53EA\u751F\u6210\u76EE\u5F55").option("--no-asar", "asar false").option("--win", " \u6784\u5EFA win \u4E0B\u8F93\u51FA\u5305").option("--mac", " \u6784\u5EFA mac \u4E0B\u8F93\u51FA\u5305").option("--linux", " \u6784\u5EFA linux \u8F93\u51FA\u5305").option("--ia32", " \u6784\u5EFA ia32 \
|
|
438
|
+
cli.command("build [root]", "\u6784\u5EFA").option("-o , --option", "\u81EA\u5B9A\u4E49 , \u81EA\u5B9A\u4E49\u6784\u5EFA\u9009\u9879 ").option("--dir", "\u53EA\u751F\u6210\u76EE\u5F55").option("--no-asar", "asar false").option("--win", " \u6784\u5EFA win \u5E73\u53F0\u4E0B\u7684\u8F93\u51FA\u5305").option("--mac", " \u6784\u5EFA mac \u5E73\u53F0\u4E0B\u7684\u8F93\u51FA\u5305").option("--linux", " \u6784\u5EFA linux \u5E73\u53F0\u4E0B\u7684\u8F93\u51FA\u5305").option("--ia32", " \u6784\u5EFA ia32 \u67B6\u6784").option("--x64", " \u6784\u5EFA x64 \u67B6\u6784").option("--arm64", " \u6784\u5EFA arm64 \u67B6\u6784").option("--armv7l", " \u6784\u5EFA armv7l \u67B6\u6784").option("--universal", " \u6784\u5EFA universal \u5E73\u53F0\u5305").action(async (configFile, options) => {
|
|
449
439
|
const {
|
|
450
440
|
mode,
|
|
451
441
|
minify,
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { Configuration } from 'electron-builder';
|
|
2
|
-
import {
|
|
2
|
+
import { UserConfig } from 'vite';
|
|
3
3
|
import { Options } from 'tsup';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
resolve?: ResolveOptions & {
|
|
7
|
-
alias?: AliasOptions;
|
|
8
|
-
}
|
|
9
|
-
plugins?: PluginOption[]
|
|
10
|
-
build?:UserConfig['build']
|
|
11
|
-
viteOptions?: Omit<UserConfig, 'plugins' | 'resolve' | 'publicDir'| 'build'>
|
|
12
|
-
}
|
|
5
|
+
type ViteConfig = Omit<UserConfig, 'publicDir'>
|
|
13
6
|
|
|
14
7
|
interface TsupConfig {
|
|
15
|
-
target?: Options['target'];
|
|
16
8
|
external?: (string | RegExp)[];
|
|
17
9
|
noExternal?: (string | RegExp)[];
|
|
18
10
|
}
|
|
@@ -67,7 +59,7 @@ interface ConfigEnv {
|
|
|
67
59
|
root: string
|
|
68
60
|
}
|
|
69
61
|
|
|
70
|
-
type ElectronupConfigFn = (env: ConfigEnv) => ElectronupConfig
|
|
62
|
+
type ElectronupConfigFn = (env: ConfigEnv) => ElectronupConfig | Promise<ElectronupConfig>
|
|
71
63
|
type UserElectronupConfig = ElectronupConfig | ElectronupConfigFn
|
|
72
64
|
|
|
73
65
|
declare const defineConfig: (config: UserElectronupConfig) => UserElectronupConfig;
|