pake-cli 2.6.1 → 3.0.0-beta
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 +29 -63
- package/dist/cli.js +143 -173
- package/dist/dev.js +152 -173
- package/dist/dev.js.map +1 -1
- package/package.json +9 -9
- package/src-tauri/Cargo.lock +1728 -2149
- package/src-tauri/Cargo.toml +15 -11
- package/src-tauri/capabilities/default.json +18 -0
- package/src-tauri/gen/schemas/acl-manifests.json +1 -0
- package/src-tauri/gen/schemas/capabilities.json +1 -0
- package/src-tauri/gen/schemas/desktop-schema.json +2326 -0
- package/src-tauri/gen/schemas/macOS-schema.json +2326 -0
- package/src-tauri/icons/icon.png +0 -0
- package/src-tauri/icons/xiaoyuzhou.icns +0 -0
- package/src-tauri/pake.json +4 -2
- package/src-tauri/src/app/config.rs +2 -0
- package/src-tauri/src/app/invoke.rs +13 -12
- package/src-tauri/src/app/menu.rs +25 -20
- package/src-tauri/src/app/window.rs +14 -9
- package/src-tauri/src/inject/custom.js +0 -6
- package/src-tauri/src/inject/event.js +30 -28
- package/src-tauri/src/inject/style.js +14 -1
- package/src-tauri/src/lib.rs +133 -0
- package/src-tauri/src/main.rs +1 -88
- package/src-tauri/src/util.rs +7 -5
- package/src-tauri/tauri.conf.json +12 -29
- package/src-tauri/tauri.linux.conf.json +14 -14
- package/src-tauri/tauri.macos.conf.json +17 -20
- package/src-tauri/tauri.windows.conf.json +17 -20
- package/src-tauri/.pake/pake.json +0 -29
- package/src-tauri/.pake/tauri.conf.json +0 -75
- package/src-tauri/.pake/tauri.macos.conf.json +0 -29
package/dist/dev.js
CHANGED
|
@@ -9,7 +9,7 @@ import crypto from 'crypto';
|
|
|
9
9
|
import prompts from 'prompts';
|
|
10
10
|
import ora from 'ora';
|
|
11
11
|
import { fileTypeFromBuffer } from 'file-type';
|
|
12
|
-
import psl from 'psl';
|
|
12
|
+
import * as psl from 'psl';
|
|
13
13
|
import 'is-url';
|
|
14
14
|
import shelljs from 'shelljs';
|
|
15
15
|
import dns from 'dns';
|
|
@@ -23,27 +23,28 @@ const DEFAULT_PAKE_OPTIONS = {
|
|
|
23
23
|
width: 1200,
|
|
24
24
|
fullscreen: false,
|
|
25
25
|
resizable: true,
|
|
26
|
-
|
|
26
|
+
hideTitleBar: false,
|
|
27
27
|
alwaysOnTop: false,
|
|
28
|
+
darkMode: false,
|
|
28
29
|
disabledWebShortcuts: false,
|
|
29
30
|
activationShortcut: '',
|
|
30
31
|
userAgent: '',
|
|
31
32
|
showSystemTray: false,
|
|
32
33
|
multiArch: false,
|
|
33
34
|
targets: 'deb',
|
|
34
|
-
|
|
35
|
+
useLocalFile: false,
|
|
35
36
|
systemTrayIcon: '',
|
|
37
|
+
proxyUrl: "",
|
|
36
38
|
debug: false,
|
|
37
39
|
inject: [],
|
|
38
|
-
|
|
40
|
+
installerLanguage: 'en-US',
|
|
39
41
|
};
|
|
40
42
|
// Just for cli development
|
|
41
43
|
const DEFAULT_DEV_PAKE_OPTIONS = {
|
|
42
44
|
...DEFAULT_PAKE_OPTIONS,
|
|
43
45
|
url: 'https://weread.qq.com',
|
|
44
46
|
name: 'WeRead',
|
|
45
|
-
|
|
46
|
-
transparent: true,
|
|
47
|
+
hideTitleBar: true,
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
const logger = {
|
|
@@ -68,7 +69,7 @@ const logger = {
|
|
|
68
69
|
const currentModulePath = fileURLToPath(import.meta.url);
|
|
69
70
|
// Resolve the parent directory of the current module
|
|
70
71
|
const npmDirectory = path.join(path.dirname(currentModulePath), '..');
|
|
71
|
-
const tauriConfigDirectory = path.join(npmDirectory, 'src-tauri'
|
|
72
|
+
const tauriConfigDirectory = path.join(npmDirectory, 'src-tauri');
|
|
72
73
|
|
|
73
74
|
const { platform: platform$2 } = process;
|
|
74
75
|
const IS_MAC = platform$2 === 'darwin';
|
|
@@ -226,12 +227,13 @@ var windows = [
|
|
|
226
227
|
{
|
|
227
228
|
url: "https://weread.qq.com",
|
|
228
229
|
url_type: "web",
|
|
229
|
-
|
|
230
|
+
hide_title_bar: true,
|
|
230
231
|
fullscreen: false,
|
|
231
232
|
width: 1200,
|
|
232
233
|
height: 780,
|
|
233
234
|
resizable: true,
|
|
234
235
|
always_on_top: false,
|
|
236
|
+
dark_mode: false,
|
|
235
237
|
activation_shortcut: "",
|
|
236
238
|
disabled_web_shortcuts: false
|
|
237
239
|
}
|
|
@@ -246,139 +248,121 @@ var system_tray = {
|
|
|
246
248
|
linux: true,
|
|
247
249
|
windows: true
|
|
248
250
|
};
|
|
251
|
+
var system_tray_path = "icons/icon.png";
|
|
249
252
|
var inject = [
|
|
250
253
|
];
|
|
254
|
+
var proxy_url = "";
|
|
251
255
|
var pakeConf = {
|
|
252
256
|
windows: windows,
|
|
253
257
|
user_agent: user_agent,
|
|
254
258
|
system_tray: system_tray,
|
|
255
|
-
|
|
259
|
+
system_tray_path: system_tray_path,
|
|
260
|
+
inject: inject,
|
|
261
|
+
proxy_url: proxy_url
|
|
256
262
|
};
|
|
257
263
|
|
|
258
|
-
var
|
|
264
|
+
var productName$1 = "WeRead";
|
|
265
|
+
var identifier = "com.pake.weread";
|
|
266
|
+
var version = "2.0.0";
|
|
267
|
+
var plugins = {
|
|
268
|
+
};
|
|
269
|
+
var app = {
|
|
259
270
|
security: {
|
|
260
|
-
csp: null
|
|
261
|
-
dangerousRemoteDomainIpcAccess: [
|
|
262
|
-
{
|
|
263
|
-
domain: "weread.qq.com",
|
|
264
|
-
windows: [
|
|
265
|
-
"pake"
|
|
266
|
-
],
|
|
267
|
-
enableTauriAPI: true
|
|
268
|
-
}
|
|
269
|
-
]
|
|
271
|
+
csp: null
|
|
270
272
|
},
|
|
271
|
-
|
|
272
|
-
|
|
273
|
+
trayIcon: {
|
|
274
|
+
iconPath: "png/weread_512.png",
|
|
275
|
+
iconAsTemplate: false,
|
|
276
|
+
id: "pake-tray"
|
|
273
277
|
},
|
|
274
|
-
|
|
275
|
-
iconPath: "png/icon_512.png",
|
|
276
|
-
iconAsTemplate: false
|
|
277
|
-
},
|
|
278
|
-
allowlist: {
|
|
279
|
-
all: true,
|
|
280
|
-
fs: {
|
|
281
|
-
all: true,
|
|
282
|
-
scope: [
|
|
283
|
-
"$DOWNLOAD/*"
|
|
284
|
-
]
|
|
285
|
-
}
|
|
286
|
-
}
|
|
278
|
+
withGlobalTauri: true
|
|
287
279
|
};
|
|
288
280
|
var build = {
|
|
289
|
-
withGlobalTauri: true,
|
|
290
|
-
devPath: "../dist",
|
|
291
|
-
distDir: "../dist",
|
|
292
281
|
beforeBuildCommand: "",
|
|
282
|
+
frontendDist: "../dist",
|
|
293
283
|
beforeDevCommand: ""
|
|
294
284
|
};
|
|
295
285
|
var CommonConf = {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
version:
|
|
299
|
-
|
|
300
|
-
|
|
286
|
+
productName: productName$1,
|
|
287
|
+
identifier: identifier,
|
|
288
|
+
version: version,
|
|
289
|
+
plugins: plugins,
|
|
290
|
+
app: app,
|
|
301
291
|
build: build
|
|
302
292
|
};
|
|
303
293
|
|
|
304
|
-
var
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
],
|
|
332
|
-
template: "assets/main.wxs"
|
|
333
|
-
}
|
|
294
|
+
var bundle$2 = {
|
|
295
|
+
icon: [
|
|
296
|
+
"png/weread_256.ico",
|
|
297
|
+
"png/weread_32.ico"
|
|
298
|
+
],
|
|
299
|
+
active: true,
|
|
300
|
+
category: "DeveloperTool",
|
|
301
|
+
copyright: "",
|
|
302
|
+
externalBin: [
|
|
303
|
+
],
|
|
304
|
+
longDescription: "",
|
|
305
|
+
resources: [
|
|
306
|
+
"png/weread_32.ico"
|
|
307
|
+
],
|
|
308
|
+
shortDescription: "",
|
|
309
|
+
targets: [
|
|
310
|
+
"msi"
|
|
311
|
+
],
|
|
312
|
+
windows: {
|
|
313
|
+
certificateThumbprint: null,
|
|
314
|
+
digestAlgorithm: "sha256",
|
|
315
|
+
timestampUrl: "",
|
|
316
|
+
wix: {
|
|
317
|
+
language: [
|
|
318
|
+
"en-US"
|
|
319
|
+
],
|
|
320
|
+
template: "assets/main.wxs"
|
|
334
321
|
}
|
|
335
322
|
}
|
|
336
323
|
};
|
|
337
324
|
var WinConf = {
|
|
338
|
-
|
|
325
|
+
bundle: bundle$2
|
|
339
326
|
};
|
|
340
327
|
|
|
341
|
-
var
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
328
|
+
var bundle$1 = {
|
|
329
|
+
icon: [
|
|
330
|
+
"icons/weread.icns"
|
|
331
|
+
],
|
|
332
|
+
active: true,
|
|
333
|
+
category: "DeveloperTool",
|
|
334
|
+
copyright: "",
|
|
335
|
+
externalBin: [
|
|
336
|
+
],
|
|
337
|
+
longDescription: "",
|
|
338
|
+
macOS: {
|
|
339
|
+
entitlements: null,
|
|
340
|
+
exceptionDomain: null,
|
|
341
|
+
frameworks: [
|
|
351
342
|
],
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
resources: [
|
|
362
|
-
],
|
|
363
|
-
shortDescription: "",
|
|
364
|
-
targets: [
|
|
365
|
-
"dmg"
|
|
366
|
-
]
|
|
367
|
-
}
|
|
343
|
+
providerShortName: null,
|
|
344
|
+
signingIdentity: null
|
|
345
|
+
},
|
|
346
|
+
resources: [
|
|
347
|
+
],
|
|
348
|
+
shortDescription: "",
|
|
349
|
+
targets: [
|
|
350
|
+
"dmg"
|
|
351
|
+
]
|
|
368
352
|
};
|
|
369
353
|
var MacConf = {
|
|
370
|
-
|
|
354
|
+
bundle: bundle$1
|
|
371
355
|
};
|
|
372
356
|
|
|
373
|
-
var
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
357
|
+
var productName = "weread";
|
|
358
|
+
var bundle = {
|
|
359
|
+
icon: [
|
|
360
|
+
"png/weread_512.png"
|
|
361
|
+
],
|
|
362
|
+
active: true,
|
|
363
|
+
category: "DeveloperTool",
|
|
364
|
+
copyright: "",
|
|
365
|
+
linux: {
|
|
382
366
|
deb: {
|
|
383
367
|
depends: [
|
|
384
368
|
"curl",
|
|
@@ -387,21 +371,22 @@ var tauri = {
|
|
|
387
371
|
files: {
|
|
388
372
|
"/usr/share/applications/com-pake-weread.desktop": "assets/com-pake-weread.desktop"
|
|
389
373
|
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
externalBin: [
|
|
377
|
+
],
|
|
378
|
+
longDescription: "",
|
|
379
|
+
resources: [
|
|
380
|
+
],
|
|
381
|
+
shortDescription: "",
|
|
382
|
+
targets: [
|
|
383
|
+
"deb",
|
|
384
|
+
"appimage"
|
|
385
|
+
]
|
|
402
386
|
};
|
|
403
387
|
var LinuxConf = {
|
|
404
|
-
|
|
388
|
+
productName: productName,
|
|
389
|
+
bundle: bundle
|
|
405
390
|
};
|
|
406
391
|
|
|
407
392
|
const platformConfigs = {
|
|
@@ -413,11 +398,15 @@ const { platform: platform$1 } = process;
|
|
|
413
398
|
// @ts-ignore
|
|
414
399
|
const platformConfig = platformConfigs[platform$1];
|
|
415
400
|
let tauriConfig = {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
401
|
+
...CommonConf,
|
|
402
|
+
bundle: platformConfig.bundle,
|
|
403
|
+
app: {
|
|
404
|
+
...CommonConf.app,
|
|
405
|
+
trayIcon: {
|
|
406
|
+
...CommonConf.app.trayIcon,
|
|
407
|
+
...(platformConfig?.app?.trayIcon ?? {}),
|
|
408
|
+
},
|
|
419
409
|
},
|
|
420
|
-
package: CommonConf.package,
|
|
421
410
|
build: CommonConf.build,
|
|
422
411
|
pake: pakeConf,
|
|
423
412
|
};
|
|
@@ -506,30 +495,37 @@ async function combineFiles(files, output) {
|
|
|
506
495
|
const contents = files.map(file => {
|
|
507
496
|
const fileContent = fs.readFileSync(file);
|
|
508
497
|
if (file.endsWith('.css')) {
|
|
509
|
-
return "window.addEventListener('DOMContentLoaded', (_event) => { const css = `" +
|
|
498
|
+
return ("window.addEventListener('DOMContentLoaded', (_event) => { const css = `" +
|
|
499
|
+
fileContent +
|
|
500
|
+
"`; const style = document.createElement('style'); style.innerHTML = css; document.head.appendChild(style); });");
|
|
510
501
|
}
|
|
511
|
-
return "window.addEventListener('DOMContentLoaded', (_event) => { " + fileContent +
|
|
502
|
+
return "window.addEventListener('DOMContentLoaded', (_event) => { " + fileContent + ' });';
|
|
512
503
|
});
|
|
513
504
|
fs.writeFileSync(output, contents.join('\n'));
|
|
514
505
|
return files;
|
|
515
506
|
}
|
|
516
507
|
|
|
517
508
|
async function mergeConfig(url, options, tauriConf) {
|
|
518
|
-
const { width, height, fullscreen,
|
|
509
|
+
const { width, height, fullscreen, hideTitleBar, alwaysOnTop, darkMode, disabledWebShortcuts, activationShortcut, userAgent, showSystemTray, systemTrayIcon, useLocalFile, identifier, name, resizable = true, inject, proxyUrl, installerLanguage, } = options;
|
|
519
510
|
const { platform } = process;
|
|
520
511
|
// Set Windows parameters.
|
|
521
512
|
const tauriConfWindowOptions = {
|
|
522
513
|
width,
|
|
523
514
|
height,
|
|
524
515
|
fullscreen,
|
|
525
|
-
transparent,
|
|
526
|
-
alwaysOnTop,
|
|
527
|
-
disabledWebShortcuts,
|
|
528
516
|
resizable,
|
|
517
|
+
hide_title_bar: hideTitleBar,
|
|
518
|
+
activation_shortcut: activationShortcut,
|
|
519
|
+
always_on_top: alwaysOnTop,
|
|
520
|
+
dark_mode: darkMode,
|
|
521
|
+
disabled_web_shortcuts: disabledWebShortcuts,
|
|
529
522
|
};
|
|
530
523
|
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
|
|
531
524
|
tauriConf.package.productName = name;
|
|
532
525
|
tauriConf.tauri.bundle.identifier = identifier;
|
|
526
|
+
if (platform == "win32") {
|
|
527
|
+
tauriConf.tauri.bundle.windows.wix.language[0] = installerLanguage;
|
|
528
|
+
}
|
|
533
529
|
//Judge the type of URL, whether it is a file or a website.
|
|
534
530
|
const pathExists = await fsExtra.pathExists(url);
|
|
535
531
|
if (pathExists) {
|
|
@@ -539,7 +535,7 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
539
535
|
const dirName = path.dirname(url);
|
|
540
536
|
const distDir = path.join(npmDirectory, 'dist');
|
|
541
537
|
const distBakDir = path.join(npmDirectory, 'dist_bak');
|
|
542
|
-
if (!
|
|
538
|
+
if (!useLocalFile) {
|
|
543
539
|
const urlPath = path.join(distDir, fileName);
|
|
544
540
|
await fsExtra.copy(url, urlPath);
|
|
545
541
|
}
|
|
@@ -556,24 +552,6 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
556
552
|
}
|
|
557
553
|
else {
|
|
558
554
|
tauriConf.pake.windows[0].url_type = 'web';
|
|
559
|
-
// Set the secure domain for calling window.__TAURI__ to the application domain that has been set.
|
|
560
|
-
tauriConf.tauri.security.dangerousRemoteDomainIpcAccess = [
|
|
561
|
-
{
|
|
562
|
-
domain: new URL(url).hostname,
|
|
563
|
-
windows: ['pake'],
|
|
564
|
-
enableTauriAPI: true,
|
|
565
|
-
},
|
|
566
|
-
];
|
|
567
|
-
}
|
|
568
|
-
if (safeDomain.length > 0) {
|
|
569
|
-
tauriConf.tauri.security.dangerousRemoteDomainIpcAccess = [
|
|
570
|
-
...tauriConf.tauri.security.dangerousRemoteDomainIpcAccess,
|
|
571
|
-
...safeDomain.map(domain => ({
|
|
572
|
-
domain,
|
|
573
|
-
windows: ['pake'],
|
|
574
|
-
enableTauriAPI: true,
|
|
575
|
-
})),
|
|
576
|
-
];
|
|
577
555
|
}
|
|
578
556
|
const platformMap = {
|
|
579
557
|
win32: 'windows',
|
|
@@ -587,10 +565,10 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
587
565
|
tauriConf.pake.system_tray[currentPlatform] = showSystemTray;
|
|
588
566
|
// Processing targets are currently only open to Linux.
|
|
589
567
|
if (platform === 'linux') {
|
|
590
|
-
delete tauriConf.
|
|
591
|
-
const validTargets = ['all', 'deb', 'appimage'];
|
|
568
|
+
delete tauriConf.bundle.linux.deb.files;
|
|
569
|
+
const validTargets = ['all', 'deb', 'appimage', 'rpm'];
|
|
592
570
|
if (validTargets.includes(options.targets)) {
|
|
593
|
-
tauriConf.
|
|
571
|
+
tauriConf.bundle.targets = options.targets === 'all' ? ['deb', 'appimage', 'rpm'] : [options.targets];
|
|
594
572
|
}
|
|
595
573
|
else {
|
|
596
574
|
logger.warn(`✼ The target must be one of ${validTargets.join(', ')}, the default 'deb' will be used.`);
|
|
@@ -625,15 +603,15 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
625
603
|
if (customIconExt !== iconInfo.fileExt) {
|
|
626
604
|
updateIconPath = false;
|
|
627
605
|
logger.warn(`✼ ${iconInfo.message}, but you give ${customIconExt}`);
|
|
628
|
-
tauriConf.
|
|
606
|
+
tauriConf.bundle.icon = [iconInfo.defaultIcon];
|
|
629
607
|
}
|
|
630
608
|
else {
|
|
631
609
|
const iconPath = path.join(npmDirectory, 'src-tauri/', iconInfo.path);
|
|
632
|
-
tauriConf.
|
|
610
|
+
tauriConf.bundle.resources = [iconInfo.path];
|
|
633
611
|
await fsExtra.copy(options.icon, iconPath);
|
|
634
612
|
}
|
|
635
613
|
if (updateIconPath) {
|
|
636
|
-
tauriConf.
|
|
614
|
+
tauriConf.bundle.icon = [options.icon];
|
|
637
615
|
}
|
|
638
616
|
else {
|
|
639
617
|
logger.warn(`✼ Icon will remain as default.`);
|
|
@@ -641,10 +619,10 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
641
619
|
}
|
|
642
620
|
else {
|
|
643
621
|
logger.warn('✼ Custom icon path may be invalid, default icon will be used instead.');
|
|
644
|
-
tauriConf.
|
|
622
|
+
tauriConf.bundle.icon = [iconInfo.defaultIcon];
|
|
645
623
|
}
|
|
646
624
|
// Set tray icon path.
|
|
647
|
-
let trayIconPath = platform === 'darwin' ? 'png/icon_512.png' : tauriConf.
|
|
625
|
+
let trayIconPath = platform === 'darwin' ? 'png/icon_512.png' : tauriConf.bundle.icon[0];
|
|
648
626
|
if (systemTrayIcon.length > 0) {
|
|
649
627
|
try {
|
|
650
628
|
await fsExtra.pathExists(systemTrayIcon);
|
|
@@ -665,7 +643,9 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
665
643
|
logger.warn(`✼ Default system tray icon will remain unchanged.`);
|
|
666
644
|
}
|
|
667
645
|
}
|
|
668
|
-
tauriConf.
|
|
646
|
+
tauriConf.app.trayIcon.iconPath = trayIconPath;
|
|
647
|
+
tauriConf.pake.system_tray_path = trayIconPath;
|
|
648
|
+
delete tauriConf.app.trayIcon;
|
|
669
649
|
const injectFilePath = path.join(npmDirectory, `src-tauri/src/inject/custom.js`);
|
|
670
650
|
// inject js or css files
|
|
671
651
|
if (inject?.length > 0) {
|
|
@@ -673,7 +653,7 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
673
653
|
logger.error('The injected file must be in either CSS or JS format.');
|
|
674
654
|
return;
|
|
675
655
|
}
|
|
676
|
-
const files = inject.map(filepath => path.isAbsolute(filepath) ? filepath : path.join(process.cwd(), filepath));
|
|
656
|
+
const files = inject.map(filepath => (path.isAbsolute(filepath) ? filepath : path.join(process.cwd(), filepath)));
|
|
677
657
|
tauriConf.pake.inject = files;
|
|
678
658
|
await combineFiles(files, injectFilePath);
|
|
679
659
|
}
|
|
@@ -681,6 +661,7 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
681
661
|
tauriConf.pake.inject = [];
|
|
682
662
|
await fsExtra.writeFile(injectFilePath, '');
|
|
683
663
|
}
|
|
664
|
+
tauriConf.pake.proxy_url = proxyUrl || "";
|
|
684
665
|
// Save config file.
|
|
685
666
|
const platformConfigPaths = {
|
|
686
667
|
win32: 'tauri.windows.conf.json',
|
|
@@ -688,16 +669,13 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
688
669
|
linux: 'tauri.linux.conf.json',
|
|
689
670
|
};
|
|
690
671
|
const configPath = path.join(tauriConfigDirectory, platformConfigPaths[platform]);
|
|
691
|
-
const bundleConf = {
|
|
672
|
+
const bundleConf = { bundle: tauriConf.bundle };
|
|
673
|
+
console.log('pakeConfig', tauriConf.pake);
|
|
692
674
|
await fsExtra.outputJSON(configPath, bundleConf, { spaces: 4 });
|
|
693
675
|
const pakeConfigPath = path.join(tauriConfigDirectory, 'pake.json');
|
|
694
676
|
await fsExtra.outputJSON(pakeConfigPath, tauriConf.pake, { spaces: 4 });
|
|
695
677
|
let tauriConf2 = JSON.parse(JSON.stringify(tauriConf));
|
|
696
678
|
delete tauriConf2.pake;
|
|
697
|
-
delete tauriConf2.tauri.bundle;
|
|
698
|
-
{
|
|
699
|
-
tauriConf2.tauri.bundle = bundleConf.tauri.bundle;
|
|
700
|
-
}
|
|
701
679
|
const configJsonPath = path.join(tauriConfigDirectory, 'tauri.conf.json');
|
|
702
680
|
await fsExtra.outputJSON(configJsonPath, tauriConf2, { spaces: 4 });
|
|
703
681
|
}
|
|
@@ -712,7 +690,7 @@ class BaseBuilder {
|
|
|
712
690
|
const tauriTargetPathExists = await fsExtra.pathExists(tauriTargetPath);
|
|
713
691
|
if (!IS_MAC && !tauriTargetPathExists) {
|
|
714
692
|
logger.warn('✼ The first use requires installing system dependencies.');
|
|
715
|
-
logger.warn('✼ See more in https://tauri.app/
|
|
693
|
+
logger.warn('✼ See more in https://tauri.app/guides/getting-started/prerequisites.');
|
|
716
694
|
}
|
|
717
695
|
if (!checkRustInstalled()) {
|
|
718
696
|
const res = await prompts({
|
|
@@ -778,7 +756,8 @@ class BaseBuilder {
|
|
|
778
756
|
return this.options.debug ? 'npm run build:debug' : 'npm run build';
|
|
779
757
|
}
|
|
780
758
|
getBasePath() {
|
|
781
|
-
|
|
759
|
+
const basePath = this.options.debug ? 'debug' : 'release';
|
|
760
|
+
return `src-tauri/target/${basePath}/bundle/`;
|
|
782
761
|
}
|
|
783
762
|
getBuildAppPath(npmDirectory, fileName, fileType) {
|
|
784
763
|
return path.join(npmDirectory, this.getBasePath(), fileType.toLowerCase(), `${fileName}.${fileType}`);
|
|
@@ -799,7 +778,7 @@ class MacBuilder extends BaseBuilder {
|
|
|
799
778
|
else {
|
|
800
779
|
arch = process.arch === 'arm64' ? 'aarch64' : process.arch;
|
|
801
780
|
}
|
|
802
|
-
return `${name}_${tauriConfig.
|
|
781
|
+
return `${name}_${tauriConfig.version}_${arch}`;
|
|
803
782
|
}
|
|
804
783
|
getBuildCommand() {
|
|
805
784
|
return this.options.multiArch ? 'npm run build:mac' : super.getBuildCommand();
|
|
@@ -819,8 +798,8 @@ class WinBuilder extends BaseBuilder {
|
|
|
819
798
|
getFileName() {
|
|
820
799
|
const { name } = this.options;
|
|
821
800
|
const { arch } = process;
|
|
822
|
-
const language = tauriConfig.
|
|
823
|
-
return `${name}_${tauriConfig.
|
|
801
|
+
const language = tauriConfig.bundle.windows.wix.language[0];
|
|
802
|
+
return `${name}_${tauriConfig.version}_${arch}_${language}`;
|
|
824
803
|
}
|
|
825
804
|
}
|
|
826
805
|
|
|
@@ -831,7 +810,7 @@ class LinuxBuilder extends BaseBuilder {
|
|
|
831
810
|
getFileName() {
|
|
832
811
|
const { name } = this.options;
|
|
833
812
|
const arch = process.arch === 'x64' ? 'amd64' : process.arch;
|
|
834
|
-
return `${name}_${tauriConfig.
|
|
813
|
+
return `${name}_${tauriConfig.version}_${arch}`;
|
|
835
814
|
}
|
|
836
815
|
// Customize it, considering that there are all targets.
|
|
837
816
|
async build(url) {
|