electronup 0.0.2 → 0.0.3
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 +13 -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.3";
|
|
38
38
|
|
|
39
39
|
// src/transform/getConfig.ts
|
|
40
40
|
var import_path = require("path");
|
|
@@ -189,11 +189,9 @@ 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
|
+
target: "es5",
|
|
194
|
+
minify: minify === false ? false : isServe,
|
|
197
195
|
external: ["electron", ...config.external ?? []],
|
|
198
196
|
noExternal: config.noExternal,
|
|
199
197
|
entry: { electron: (0, import_path3.resolve)(root, allConfig.mainDir || "main" /* mainDir */, "index.ts") },
|
|
@@ -207,8 +205,7 @@ function getTsupConfig(config, allConfig) {
|
|
|
207
205
|
return startElectron((0, import_path3.resolve)(root, allConfig.resourceDir || "dist/resource" /* resourceDir */, "electron.js"));
|
|
208
206
|
}
|
|
209
207
|
};
|
|
210
|
-
config
|
|
211
|
-
return { ...userConfig, ...defaultConfig };
|
|
208
|
+
return { ...config, ...defaultConfig };
|
|
212
209
|
}
|
|
213
210
|
var electronProcess;
|
|
214
211
|
var manualRestart = false;
|
|
@@ -250,21 +247,15 @@ function getViteConfig(config, allConfig) {
|
|
|
250
247
|
const { root, minify } = store;
|
|
251
248
|
const defaultConfig = {
|
|
252
249
|
base: "./",
|
|
253
|
-
|
|
254
|
-
server: { host: "0.0.0.0" },
|
|
250
|
+
...config,
|
|
255
251
|
build: {
|
|
256
|
-
|
|
257
|
-
target: "esnext",
|
|
252
|
+
...config?.build,
|
|
258
253
|
minify: minify && "esbuild",
|
|
259
|
-
|
|
260
|
-
emptyOutDir: true,
|
|
261
|
-
...config?.build
|
|
254
|
+
outDir: (0, import_path4.resolve)(root, allConfig.resourceDir || "dist/resource" /* resourceDir */)
|
|
262
255
|
},
|
|
263
|
-
|
|
256
|
+
root: allConfig.renderDir || "render" /* renderDir */,
|
|
257
|
+
publicDir: (0, import_path4.resolve)(root, allConfig.publicDir || "public" /* publicDir */)
|
|
264
258
|
};
|
|
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
259
|
return defaultConfig;
|
|
269
260
|
}
|
|
270
261
|
|
|
@@ -283,17 +274,17 @@ async function getElectronupConfig(config) {
|
|
|
283
274
|
}
|
|
284
275
|
|
|
285
276
|
// src/transform/getExportConfig.ts
|
|
286
|
-
var exportElectronupConfig = (config) => {
|
|
277
|
+
var exportElectronupConfig = async (config) => {
|
|
287
278
|
const typeStr = typeof config;
|
|
288
279
|
if (typeStr === "function") {
|
|
289
|
-
const option = config({ command: store.command, root: store.root });
|
|
280
|
+
const option = await config({ command: store.command, root: store.root });
|
|
290
281
|
return option;
|
|
291
282
|
}
|
|
292
283
|
if (typeStr === "object")
|
|
293
284
|
return config;
|
|
294
285
|
throw new Error("electronup \u914D\u7F6E\u9519\u8BEF,\u89E3\u6790\u5931\u8D25\uFF01");
|
|
295
286
|
};
|
|
296
|
-
var electronupConfig = (config) => getElectronupConfig(exportElectronupConfig(config));
|
|
287
|
+
var electronupConfig = async (config) => getElectronupConfig(await exportElectronupConfig(config));
|
|
297
288
|
|
|
298
289
|
// src/runner/watch.ts
|
|
299
290
|
var import_portfinder = require("portfinder");
|
|
@@ -445,7 +436,7 @@ cli.command("[config-file]", "start dev server").alias("dev").option("-p , --por
|
|
|
445
436
|
store.minify = !!minify;
|
|
446
437
|
watch(option);
|
|
447
438
|
});
|
|
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 \
|
|
439
|
+
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
440
|
const {
|
|
450
441
|
mode,
|
|
451
442
|
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;
|