pake-cli 1.3.1 → 2.0.0-alpha6
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 +26 -22
- package/dist/about_pake.html +16 -0
- package/dist/cli.js +389 -86
- package/package.json +3 -2
- package/src-tauri/.cargo/cn_config.bak +14 -0
- package/src-tauri/Cargo.lock +1420 -586
- package/src-tauri/Cargo.toml +13 -14
- package/src-tauri/pake.json +28 -0
- package/src-tauri/src/app/config.rs +63 -0
- package/src-tauri/src/app/invoke.rs +47 -0
- package/src-tauri/src/app/menu.rs +114 -0
- package/src-tauri/src/app/mod.rs +4 -0
- package/src-tauri/src/app/window.rs +49 -0
- package/src-tauri/src/inject/component.js +143 -0
- package/src-tauri/src/inject/event.js +175 -0
- package/src-tauri/src/{pake.js → inject/style.js} +41 -141
- package/src-tauri/src/main.rs +58 -268
- package/src-tauri/src/util.rs +78 -0
- package/src-tauri/tauri.conf.json +26 -29
- package/src-tauri/tauri.linux.conf.json +18 -30
- package/dist/index.html +0 -22
- package/dist/script.js +0 -7
package/dist/cli.js
CHANGED
|
@@ -3,9 +3,11 @@ import { program } from 'commander';
|
|
|
3
3
|
import log from 'loglevel';
|
|
4
4
|
import url, { fileURLToPath } from 'url';
|
|
5
5
|
import isurl from 'is-url';
|
|
6
|
+
import fs from 'fs';
|
|
6
7
|
import prompts from 'prompts';
|
|
7
8
|
import path from 'path';
|
|
8
|
-
import fs from 'fs/promises';
|
|
9
|
+
import fs$1 from 'fs/promises';
|
|
10
|
+
import fs2 from 'fs-extra';
|
|
9
11
|
import chalk from 'chalk';
|
|
10
12
|
import crypto from 'crypto';
|
|
11
13
|
import axios from 'axios';
|
|
@@ -13,6 +15,9 @@ import { fileTypeFromBuffer } from 'file-type';
|
|
|
13
15
|
import { dir } from 'tmp-promise';
|
|
14
16
|
import ora from 'ora';
|
|
15
17
|
import shelljs from 'shelljs';
|
|
18
|
+
import { exec } from 'child_process';
|
|
19
|
+
import { promisify } from 'util';
|
|
20
|
+
import dns from 'dns';
|
|
16
21
|
import updateNotifier from 'update-notifier';
|
|
17
22
|
|
|
18
23
|
/******************************************************************************
|
|
@@ -47,9 +52,14 @@ const DEFAULT_PAKE_OPTIONS = {
|
|
|
47
52
|
fullscreen: false,
|
|
48
53
|
resizable: true,
|
|
49
54
|
transparent: false,
|
|
50
|
-
|
|
55
|
+
userAgent: '',
|
|
56
|
+
showMenu: false,
|
|
57
|
+
showSystemTray: false,
|
|
51
58
|
multiArch: false,
|
|
52
|
-
targets:
|
|
59
|
+
targets: 'deb',
|
|
60
|
+
iterCopyFile: false,
|
|
61
|
+
systemTrayIcon: '',
|
|
62
|
+
debug: false,
|
|
53
63
|
};
|
|
54
64
|
|
|
55
65
|
const tlds = [
|
|
@@ -1553,7 +1563,7 @@ function getDomain(inputUrl) {
|
|
|
1553
1563
|
if (i === 0 || // 'asia.com' (last remaining must be the SLD)
|
|
1554
1564
|
i < ln - 2 || // TLDs only span 2 levels
|
|
1555
1565
|
part.length < minLength || // 'www.cn.com' (valid TLD as second-level domain)
|
|
1556
|
-
tlds.indexOf(part) < 0 //
|
|
1566
|
+
tlds.indexOf(part) < 0 // officialy not a TLD
|
|
1557
1567
|
) {
|
|
1558
1568
|
return part;
|
|
1559
1569
|
}
|
|
@@ -1573,23 +1583,28 @@ function normalizeUrl(urlToNormalize) {
|
|
|
1573
1583
|
return urlWithProtocol;
|
|
1574
1584
|
}
|
|
1575
1585
|
else {
|
|
1576
|
-
throw new Error(`
|
|
1586
|
+
throw new Error(`Your url "${urlWithProtocol}" is invalid`);
|
|
1577
1587
|
}
|
|
1578
1588
|
}
|
|
1579
1589
|
|
|
1580
1590
|
function validateNumberInput(value) {
|
|
1581
1591
|
const parsedValue = Number(value);
|
|
1582
1592
|
if (isNaN(parsedValue)) {
|
|
1583
|
-
throw new Commander.InvalidArgumentError('
|
|
1593
|
+
throw new Commander.InvalidArgumentError('Not a number.');
|
|
1584
1594
|
}
|
|
1585
1595
|
return parsedValue;
|
|
1586
1596
|
}
|
|
1587
1597
|
function validateUrlInput(url) {
|
|
1588
|
-
|
|
1589
|
-
|
|
1598
|
+
if (!fs.existsSync(url)) {
|
|
1599
|
+
try {
|
|
1600
|
+
return normalizeUrl(url);
|
|
1601
|
+
}
|
|
1602
|
+
catch (error) {
|
|
1603
|
+
throw new Commander.InvalidArgumentError(error.message);
|
|
1604
|
+
}
|
|
1590
1605
|
}
|
|
1591
|
-
|
|
1592
|
-
|
|
1606
|
+
else {
|
|
1607
|
+
return url;
|
|
1593
1608
|
}
|
|
1594
1609
|
}
|
|
1595
1610
|
|
|
@@ -1626,7 +1641,7 @@ function promptText(message, initial) {
|
|
|
1626
1641
|
}
|
|
1627
1642
|
function mergeTauriConfig(url, options, tauriConf) {
|
|
1628
1643
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1629
|
-
const { width, height, fullscreen, transparent, resizable, identifier, name, } = options;
|
|
1644
|
+
const { width, height, fullscreen, transparent, resizable, userAgent, showMenu, showSystemTray, systemTrayIcon, iterCopyFile, identifier, name, } = options;
|
|
1630
1645
|
const tauriConfWindowOptions = {
|
|
1631
1646
|
width,
|
|
1632
1647
|
height,
|
|
@@ -1644,20 +1659,111 @@ function mergeTauriConfig(url, options, tauriConf) {
|
|
|
1644
1659
|
process.exit();
|
|
1645
1660
|
}
|
|
1646
1661
|
}
|
|
1647
|
-
if (process.platform === "win32") {
|
|
1662
|
+
if (process.platform === "win32" || process.platform === "darwin") {
|
|
1648
1663
|
const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/);
|
|
1649
1664
|
if (!reg.test(name) || reg.exec(name)[0].length != name.length) {
|
|
1650
1665
|
logger.error("package name is illegal, it must be letters, numbers, and it must contain the letters");
|
|
1651
|
-
logger.error("E.g 123pan,123Pan
|
|
1666
|
+
logger.error("E.g 123pan,123Pan Pan123,weread, WeRead, WERead");
|
|
1652
1667
|
process.exit();
|
|
1653
1668
|
}
|
|
1654
1669
|
}
|
|
1655
|
-
|
|
1670
|
+
// logger.warn(JSON.stringify(tauriConf.pake.windows, null, 4));
|
|
1671
|
+
Object.assign(tauriConf.pake.windows[0], Object.assign({ url }, tauriConfWindowOptions));
|
|
1656
1672
|
tauriConf.package.productName = name;
|
|
1657
1673
|
tauriConf.tauri.bundle.identifier = identifier;
|
|
1658
|
-
|
|
1674
|
+
// 判断一下url类型,是文件还是网站
|
|
1675
|
+
// 如果是文件,并且开启了递归拷贝功能,则需要将该文件以及所在文件夹下的所有文件拷贝到src目录下,否则只拷贝单个文件。
|
|
1676
|
+
const url_exists = yield fs$1.stat(url)
|
|
1659
1677
|
.then(() => true)
|
|
1660
1678
|
.catch(() => false);
|
|
1679
|
+
if (url_exists) {
|
|
1680
|
+
logger.warn("you input may a local file");
|
|
1681
|
+
tauriConf.pake.windows[0].url_type = "local";
|
|
1682
|
+
const file_name = path.basename(url);
|
|
1683
|
+
const dir_name = path.dirname(url);
|
|
1684
|
+
if (!iterCopyFile) {
|
|
1685
|
+
const url_path = path.join(npmDirectory, "dist/", file_name);
|
|
1686
|
+
yield fs$1.copyFile(url, url_path);
|
|
1687
|
+
}
|
|
1688
|
+
else {
|
|
1689
|
+
const old_dir = path.join(npmDirectory, "dist/");
|
|
1690
|
+
const new_dir = path.join(npmDirectory, "dist_bak/");
|
|
1691
|
+
fs2.moveSync(old_dir, new_dir, { "overwrite": true });
|
|
1692
|
+
fs2.copySync(dir_name, old_dir, { "overwrite": true });
|
|
1693
|
+
// logger.warn("dir name", dir_name);
|
|
1694
|
+
// 将dist_bak里面的cli.js和about_pake.html拷贝回去
|
|
1695
|
+
const cli_path = path.join(new_dir, "cli.js");
|
|
1696
|
+
const cli_path_target = path.join(old_dir, "cli.js");
|
|
1697
|
+
const about_pake_path = path.join(new_dir, "about_pake.html");
|
|
1698
|
+
const about_patk_path_target = path.join(old_dir, "about_pake.html");
|
|
1699
|
+
fs$1.copyFile(cli_path, cli_path_target);
|
|
1700
|
+
fs$1.copyFile(about_pake_path, about_patk_path_target);
|
|
1701
|
+
}
|
|
1702
|
+
tauriConf.pake.windows[0].url = file_name;
|
|
1703
|
+
tauriConf.pake.windows[0].url_type = "local";
|
|
1704
|
+
}
|
|
1705
|
+
else {
|
|
1706
|
+
tauriConf.pake.windows[0].url_type = "web";
|
|
1707
|
+
}
|
|
1708
|
+
// 处理user-agent
|
|
1709
|
+
if (userAgent.length > 0) {
|
|
1710
|
+
if (process.platform === "win32") {
|
|
1711
|
+
tauriConf.pake.user_agent.windows = userAgent;
|
|
1712
|
+
}
|
|
1713
|
+
if (process.platform === "linux") {
|
|
1714
|
+
tauriConf.pake.user_agent.linux = userAgent;
|
|
1715
|
+
}
|
|
1716
|
+
if (process.platform === "darwin") {
|
|
1717
|
+
tauriConf.pake.user_agent.macos = userAgent;
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
// 处理菜单栏
|
|
1721
|
+
if (showMenu) {
|
|
1722
|
+
if (process.platform === "win32") {
|
|
1723
|
+
tauriConf.pake.menu.windows = true;
|
|
1724
|
+
}
|
|
1725
|
+
if (process.platform === "linux") {
|
|
1726
|
+
tauriConf.pake.menu.linux = true;
|
|
1727
|
+
}
|
|
1728
|
+
if (process.platform === "darwin") {
|
|
1729
|
+
tauriConf.pake.menu.macos = true;
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
else {
|
|
1733
|
+
if (process.platform === "win32") {
|
|
1734
|
+
tauriConf.pake.menu.windows = false;
|
|
1735
|
+
}
|
|
1736
|
+
if (process.platform === "linux") {
|
|
1737
|
+
tauriConf.pake.menu.linux = false;
|
|
1738
|
+
}
|
|
1739
|
+
if (process.platform === "darwin") {
|
|
1740
|
+
tauriConf.pake.menu.macos = false;
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
// 处理托盘
|
|
1744
|
+
if (showSystemTray) {
|
|
1745
|
+
if (process.platform === "win32") {
|
|
1746
|
+
tauriConf.pake.system_tray.windows = true;
|
|
1747
|
+
}
|
|
1748
|
+
if (process.platform === "linux") {
|
|
1749
|
+
tauriConf.pake.system_tray.linux = true;
|
|
1750
|
+
}
|
|
1751
|
+
if (process.platform === "darwin") {
|
|
1752
|
+
tauriConf.pake.system_tray.macos = true;
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
else {
|
|
1756
|
+
if (process.platform === "win32") {
|
|
1757
|
+
tauriConf.pake.system_tray.windows = false;
|
|
1758
|
+
}
|
|
1759
|
+
if (process.platform === "linux") {
|
|
1760
|
+
tauriConf.pake.system_tray.linux = false;
|
|
1761
|
+
}
|
|
1762
|
+
if (process.platform === "darwin") {
|
|
1763
|
+
tauriConf.pake.system_tray.macos = false;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
// 处理targets 暂时只对linux开放
|
|
1661
1767
|
if (process.platform === "linux") {
|
|
1662
1768
|
delete tauriConf.tauri.bundle.deb.files;
|
|
1663
1769
|
if (["all", "deb", "appimage"].includes(options.targets)) {
|
|
@@ -1667,6 +1773,10 @@ function mergeTauriConfig(url, options, tauriConf) {
|
|
|
1667
1773
|
logger.warn("targets must be 'all', 'deb', 'appimage', we will use default 'all'");
|
|
1668
1774
|
}
|
|
1669
1775
|
}
|
|
1776
|
+
// 处理应用图标
|
|
1777
|
+
const exists = yield fs$1.stat(options.icon)
|
|
1778
|
+
.then(() => true)
|
|
1779
|
+
.catch(() => false);
|
|
1670
1780
|
if (exists) {
|
|
1671
1781
|
let updateIconPath = true;
|
|
1672
1782
|
let customIconExt = path.extname(options.icon).toLowerCase();
|
|
@@ -1674,22 +1784,25 @@ function mergeTauriConfig(url, options, tauriConf) {
|
|
|
1674
1784
|
if (customIconExt === ".ico") {
|
|
1675
1785
|
const ico_path = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}_32.ico`);
|
|
1676
1786
|
tauriConf.tauri.bundle.resources = [`png/${name.toLowerCase()}_32.ico`];
|
|
1677
|
-
yield fs.copyFile(options.icon, ico_path);
|
|
1787
|
+
yield fs$1.copyFile(options.icon, ico_path);
|
|
1678
1788
|
}
|
|
1679
1789
|
else {
|
|
1680
1790
|
updateIconPath = false;
|
|
1681
1791
|
logger.warn(`icon file in Windows must be 256 * 256 pix with .ico type, but you give ${customIconExt}`);
|
|
1792
|
+
tauriConf.tauri.bundle.icon = ["png/icon_256.ico"];
|
|
1682
1793
|
}
|
|
1683
1794
|
}
|
|
1684
1795
|
if (process.platform === "linux") {
|
|
1685
1796
|
if (customIconExt != ".png") {
|
|
1686
1797
|
updateIconPath = false;
|
|
1687
1798
|
logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`);
|
|
1799
|
+
tauriConf.tauri.bundle.icon = ["png/icon_512.png"];
|
|
1688
1800
|
}
|
|
1689
1801
|
}
|
|
1690
1802
|
if (process.platform === "darwin" && customIconExt !== ".icns") {
|
|
1691
1803
|
updateIconPath = false;
|
|
1692
1804
|
logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`);
|
|
1805
|
+
tauriConf.tauri.bundle.icon = ["icons/icon.icns"];
|
|
1693
1806
|
}
|
|
1694
1807
|
if (updateIconPath) {
|
|
1695
1808
|
tauriConf.tauri.bundle.icon = [options.icon];
|
|
@@ -1700,22 +1813,51 @@ function mergeTauriConfig(url, options, tauriConf) {
|
|
|
1700
1813
|
}
|
|
1701
1814
|
else {
|
|
1702
1815
|
logger.warn("the custom icon path may not exists. we will use default icon to replace it");
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1816
|
+
if (process.platform === "win32") {
|
|
1817
|
+
tauriConf.tauri.bundle.icon = ["png/icon_256.ico"];
|
|
1818
|
+
}
|
|
1819
|
+
if (process.platform === "linux") {
|
|
1820
|
+
tauriConf.tauri.bundle.icon = ["png/icon_512.png"];
|
|
1821
|
+
}
|
|
1822
|
+
if (process.platform === "darwin") {
|
|
1823
|
+
tauriConf.tauri.bundle.icon = ["icons/icon.icns"];
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
// 处理托盘自定义图标
|
|
1827
|
+
let useDefaultIcon = true; // 是否使用默认托盘图标
|
|
1828
|
+
if (systemTrayIcon.length > 0) {
|
|
1829
|
+
const icon_exists = yield fs$1.stat(systemTrayIcon)
|
|
1830
|
+
.then(() => true)
|
|
1831
|
+
.catch(() => false);
|
|
1832
|
+
if (icon_exists) {
|
|
1833
|
+
// 需要判断图标格式,默认只支持ico和png两种
|
|
1834
|
+
let iconExt = path.extname(systemTrayIcon).toLowerCase();
|
|
1835
|
+
if (iconExt == ".png" || iconExt == ".icon") {
|
|
1836
|
+
useDefaultIcon = false;
|
|
1837
|
+
const trayIcoPath = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}${iconExt}`);
|
|
1838
|
+
tauriConf.tauri.systemTray.iconPath = `png/${name.toLowerCase()}${iconExt}`;
|
|
1839
|
+
yield fs$1.copyFile(systemTrayIcon, trayIcoPath);
|
|
1712
1840
|
}
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1841
|
+
else {
|
|
1842
|
+
logger.warn(`file type for system tray icon mut be .ico or .png , but you give ${iconExt}`);
|
|
1843
|
+
logger.warn(`system tray icon file will not change with default.`);
|
|
1716
1844
|
}
|
|
1717
1845
|
}
|
|
1846
|
+
else {
|
|
1847
|
+
logger.warn(`${systemTrayIcon} not exists!`);
|
|
1848
|
+
logger.warn(`system tray icon file will not change with default.`);
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
// 处理托盘默认图标
|
|
1852
|
+
if (useDefaultIcon) {
|
|
1853
|
+
if (process.platform === "linux" || process.platform === "win32") {
|
|
1854
|
+
tauriConf.tauri.systemTray.iconPath = tauriConf.tauri.bundle.icon[0];
|
|
1855
|
+
}
|
|
1856
|
+
else {
|
|
1857
|
+
tauriConf.tauri.systemTray.iconPath = "png/icon_512.png";
|
|
1858
|
+
}
|
|
1718
1859
|
}
|
|
1860
|
+
// 保存配置文件
|
|
1719
1861
|
let configPath = "";
|
|
1720
1862
|
switch (process.platform) {
|
|
1721
1863
|
case "win32": {
|
|
@@ -1732,9 +1874,15 @@ function mergeTauriConfig(url, options, tauriConf) {
|
|
|
1732
1874
|
}
|
|
1733
1875
|
}
|
|
1734
1876
|
let bundleConf = { tauri: { bundle: tauriConf.tauri.bundle } };
|
|
1735
|
-
yield fs.writeFile(configPath, Buffer.from(JSON.stringify(bundleConf, null,
|
|
1877
|
+
yield fs$1.writeFile(configPath, Buffer.from(JSON.stringify(bundleConf, null, 4), 'utf-8'));
|
|
1878
|
+
const pakeConfigPath = path.join(npmDirectory, 'src-tauri/pake.json');
|
|
1879
|
+
yield fs$1.writeFile(pakeConfigPath, Buffer.from(JSON.stringify(tauriConf.pake, null, 4), 'utf-8'));
|
|
1880
|
+
// logger.info("tauri config", JSON.stringify(tauriConf.build));
|
|
1881
|
+
let tauriConf2 = JSON.parse(JSON.stringify(tauriConf));
|
|
1882
|
+
delete tauriConf2.pake;
|
|
1883
|
+
delete tauriConf2.tauri.bundle;
|
|
1736
1884
|
const configJsonPath = path.join(npmDirectory, 'src-tauri/tauri.conf.json');
|
|
1737
|
-
yield fs.writeFile(configJsonPath, Buffer.from(JSON.stringify(
|
|
1885
|
+
yield fs$1.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf2, null, 4), 'utf-8'));
|
|
1738
1886
|
});
|
|
1739
1887
|
}
|
|
1740
1888
|
|
|
@@ -1766,7 +1914,7 @@ function handleIcon(options, url) {
|
|
|
1766
1914
|
}
|
|
1767
1915
|
function getDefaultIcon() {
|
|
1768
1916
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1769
|
-
logger.info('You
|
|
1917
|
+
logger.info('You have not provided an app icon, use the default icon.(use --icon option to assign an icon)');
|
|
1770
1918
|
let iconPath = 'src-tauri/icons/icon.icns';
|
|
1771
1919
|
if (IS_WIN) {
|
|
1772
1920
|
iconPath = 'src-tauri/png/icon_256.ico';
|
|
@@ -1777,6 +1925,38 @@ function getDefaultIcon() {
|
|
|
1777
1925
|
return path.join(npmDirectory, iconPath);
|
|
1778
1926
|
});
|
|
1779
1927
|
}
|
|
1928
|
+
// export async function getIconFromPageUrl(url: string) {
|
|
1929
|
+
// const icon = await pageIcon(url);
|
|
1930
|
+
// console.log(icon);
|
|
1931
|
+
// if (icon.ext === '.ico') {
|
|
1932
|
+
// const a = await ICO.parse(icon.data);
|
|
1933
|
+
// icon.data = Buffer.from(a[0].buffer);
|
|
1934
|
+
// }
|
|
1935
|
+
// const iconDir = (await dir()).path;
|
|
1936
|
+
// const iconPath = path.join(iconDir, `/icon.icns`);
|
|
1937
|
+
// const out = png2icons.createICNS(icon.data, png2icons.BILINEAR, 0);
|
|
1938
|
+
// await fs.writeFile(iconPath, out);
|
|
1939
|
+
// return iconPath;
|
|
1940
|
+
// }
|
|
1941
|
+
// export async function getIconFromMacosIcons(name: string) {
|
|
1942
|
+
// const data = {
|
|
1943
|
+
// query: name,
|
|
1944
|
+
// filters: 'approved:true',
|
|
1945
|
+
// hitsPerPage: 10,
|
|
1946
|
+
// page: 1,
|
|
1947
|
+
// };
|
|
1948
|
+
// const res = await axios.post('https://p1txh7zfb3-2.algolianet.com/1/indexes/macOSicons/query?x-algolia-agent=Algolia%20for%20JavaScript%20(4.13.1)%3B%20Browser', data, {
|
|
1949
|
+
// headers: {
|
|
1950
|
+
// 'x-algolia-api-key': '0ba04276e457028f3e11e38696eab32c',
|
|
1951
|
+
// 'x-algolia-application-id': 'P1TXH7ZFB3',
|
|
1952
|
+
// },
|
|
1953
|
+
// });
|
|
1954
|
+
// if (!res.data.hits.length) {
|
|
1955
|
+
// return '';
|
|
1956
|
+
// } else {
|
|
1957
|
+
// return downloadIcon(res.data.hits[0].icnsUrl);
|
|
1958
|
+
// }
|
|
1959
|
+
// }
|
|
1780
1960
|
function downloadIcon(iconUrl) {
|
|
1781
1961
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1782
1962
|
let iconResponse;
|
|
@@ -1801,7 +1981,7 @@ function downloadIcon(iconUrl) {
|
|
|
1801
1981
|
}
|
|
1802
1982
|
const { path } = yield dir();
|
|
1803
1983
|
const iconPath = `${path}/icon.${fileDetails.ext}`;
|
|
1804
|
-
yield fs.writeFile(iconPath, iconData);
|
|
1984
|
+
yield fs$1.writeFile(iconPath, iconData);
|
|
1805
1985
|
return iconPath;
|
|
1806
1986
|
});
|
|
1807
1987
|
}
|
|
@@ -1809,8 +1989,16 @@ function downloadIcon(iconUrl) {
|
|
|
1809
1989
|
function handleOptions(options, url) {
|
|
1810
1990
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1811
1991
|
const appOptions = Object.assign(Object.assign({}, options), { identifier: '' });
|
|
1992
|
+
const url_exists = yield fs$1.stat(url)
|
|
1993
|
+
.then(() => true)
|
|
1994
|
+
.catch(() => false);
|
|
1812
1995
|
if (!appOptions.name) {
|
|
1813
|
-
|
|
1996
|
+
if (!url_exists) {
|
|
1997
|
+
appOptions.name = yield promptText('please input your application name', getDomain(url));
|
|
1998
|
+
}
|
|
1999
|
+
else {
|
|
2000
|
+
appOptions.name = yield promptText('please input your application name', "");
|
|
2001
|
+
}
|
|
1814
2002
|
}
|
|
1815
2003
|
appOptions.identifier = getIdentifier(appOptions.name, url);
|
|
1816
2004
|
appOptions.icon = yield handleIcon(appOptions);
|
|
@@ -1831,7 +2019,50 @@ function shellExec(command) {
|
|
|
1831
2019
|
});
|
|
1832
2020
|
}
|
|
1833
2021
|
|
|
1834
|
-
const
|
|
2022
|
+
const resolve = promisify(dns.resolve);
|
|
2023
|
+
function isChinaDomain(domain) {
|
|
2024
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2025
|
+
try {
|
|
2026
|
+
// 解析域名为IP地址
|
|
2027
|
+
const [ip] = yield resolve(domain);
|
|
2028
|
+
return yield isChinaIP(ip);
|
|
2029
|
+
}
|
|
2030
|
+
catch (error) {
|
|
2031
|
+
// 域名无法解析,返回false
|
|
2032
|
+
return false;
|
|
2033
|
+
}
|
|
2034
|
+
});
|
|
2035
|
+
}
|
|
2036
|
+
function isChinaIP(ip) {
|
|
2037
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2038
|
+
return new Promise((resolve, reject) => {
|
|
2039
|
+
exec(`ping -c 1 -w 1 ${ip}`, (error, stdout, stderr) => {
|
|
2040
|
+
if (error) {
|
|
2041
|
+
// 命令执行出错,返回false
|
|
2042
|
+
resolve(false);
|
|
2043
|
+
}
|
|
2044
|
+
else {
|
|
2045
|
+
// 解析输出信息,提取延迟值
|
|
2046
|
+
const match = stdout.match(/time=(\d+\.\d+) ms/);
|
|
2047
|
+
const latency = match ? parseFloat(match[1]) : 0;
|
|
2048
|
+
// 判断延迟是否超过100ms
|
|
2049
|
+
resolve(latency > 100);
|
|
2050
|
+
}
|
|
2051
|
+
});
|
|
2052
|
+
});
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
const is_china = isChinaDomain("sh.rustup.rs");
|
|
2057
|
+
let RustInstallScriptFocMac = "";
|
|
2058
|
+
if (is_china) {
|
|
2059
|
+
RustInstallScriptFocMac =
|
|
2060
|
+
'export RUSTUP_DIST_SERVER="https://rsproxy.cn" && export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup" && curl --proto "=https" --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh';
|
|
2061
|
+
}
|
|
2062
|
+
else {
|
|
2063
|
+
RustInstallScriptFocMac =
|
|
2064
|
+
"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y";
|
|
2065
|
+
}
|
|
1835
2066
|
const RustInstallScriptForWin = 'winget install --id Rustlang.Rustup';
|
|
1836
2067
|
function installRust() {
|
|
1837
2068
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1841,7 +2072,7 @@ function installRust() {
|
|
|
1841
2072
|
spinner.succeed();
|
|
1842
2073
|
}
|
|
1843
2074
|
catch (error) {
|
|
1844
|
-
console.error('
|
|
2075
|
+
console.error('install rust return code', error.message);
|
|
1845
2076
|
spinner.fail();
|
|
1846
2077
|
process.exit(1);
|
|
1847
2078
|
}
|
|
@@ -1852,24 +2083,22 @@ function checkRustInstalled() {
|
|
|
1852
2083
|
}
|
|
1853
2084
|
|
|
1854
2085
|
var tauri$3 = {
|
|
1855
|
-
windows: [
|
|
1856
|
-
{
|
|
1857
|
-
url: "https://weread.qq.com/",
|
|
1858
|
-
transparent: true,
|
|
1859
|
-
fullscreen: false,
|
|
1860
|
-
width: 1200,
|
|
1861
|
-
height: 780,
|
|
1862
|
-
resizable: true
|
|
1863
|
-
}
|
|
1864
|
-
],
|
|
1865
2086
|
security: {
|
|
1866
2087
|
csp: null
|
|
1867
2088
|
},
|
|
1868
2089
|
updater: {
|
|
1869
2090
|
active: false
|
|
2091
|
+
},
|
|
2092
|
+
systemTray: {
|
|
2093
|
+
iconPath: "png/weread_512.png",
|
|
2094
|
+
iconAsTemplate: true
|
|
2095
|
+
},
|
|
2096
|
+
allowlist: {
|
|
2097
|
+
all: true
|
|
1870
2098
|
}
|
|
1871
2099
|
};
|
|
1872
2100
|
var build = {
|
|
2101
|
+
withGlobalTauri: true,
|
|
1873
2102
|
devPath: "../dist",
|
|
1874
2103
|
distDir: "../dist",
|
|
1875
2104
|
beforeBuildCommand: "",
|
|
@@ -1884,6 +2113,39 @@ var CommonConf = {
|
|
|
1884
2113
|
build: build
|
|
1885
2114
|
};
|
|
1886
2115
|
|
|
2116
|
+
var windows = [
|
|
2117
|
+
{
|
|
2118
|
+
url: "https://weread.qq.com/",
|
|
2119
|
+
transparent: true,
|
|
2120
|
+
fullscreen: false,
|
|
2121
|
+
width: 1200,
|
|
2122
|
+
height: 780,
|
|
2123
|
+
resizable: true,
|
|
2124
|
+
url_type: "web"
|
|
2125
|
+
}
|
|
2126
|
+
];
|
|
2127
|
+
var user_agent = {
|
|
2128
|
+
macos: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15",
|
|
2129
|
+
linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
|
|
2130
|
+
windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
|
|
2131
|
+
};
|
|
2132
|
+
var menu = {
|
|
2133
|
+
macos: true,
|
|
2134
|
+
linux: false,
|
|
2135
|
+
windows: false
|
|
2136
|
+
};
|
|
2137
|
+
var system_tray = {
|
|
2138
|
+
macos: false,
|
|
2139
|
+
linux: true,
|
|
2140
|
+
windows: true
|
|
2141
|
+
};
|
|
2142
|
+
var pakeConf = {
|
|
2143
|
+
windows: windows,
|
|
2144
|
+
user_agent: user_agent,
|
|
2145
|
+
menu: menu,
|
|
2146
|
+
system_tray: system_tray
|
|
2147
|
+
};
|
|
2148
|
+
|
|
1887
2149
|
var tauri$2 = {
|
|
1888
2150
|
bundle: {
|
|
1889
2151
|
icon: [
|
|
@@ -1964,16 +2226,8 @@ var tauri = {
|
|
|
1964
2226
|
copyright: "",
|
|
1965
2227
|
deb: {
|
|
1966
2228
|
depends: [
|
|
1967
|
-
"libwebkit2gtk-4.0-dev",
|
|
1968
|
-
"build-essential",
|
|
1969
2229
|
"curl",
|
|
1970
|
-
"wget"
|
|
1971
|
-
"libssl-dev",
|
|
1972
|
-
"libgtk-3-dev",
|
|
1973
|
-
"libayatana-appindicator3-dev",
|
|
1974
|
-
"librsvg2-dev",
|
|
1975
|
-
"gnome-video-effects",
|
|
1976
|
-
"gnome-video-effects-extra"
|
|
2230
|
+
"wget"
|
|
1977
2231
|
],
|
|
1978
2232
|
files: {
|
|
1979
2233
|
"/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"
|
|
@@ -1997,7 +2251,9 @@ var LinuxConf = {
|
|
|
1997
2251
|
|
|
1998
2252
|
let tauriConf = {
|
|
1999
2253
|
package: CommonConf.package,
|
|
2000
|
-
tauri: CommonConf.tauri
|
|
2254
|
+
tauri: CommonConf.tauri,
|
|
2255
|
+
build: CommonConf.build,
|
|
2256
|
+
pake: pakeConf
|
|
2001
2257
|
};
|
|
2002
2258
|
switch (process.platform) {
|
|
2003
2259
|
case "win32": {
|
|
@@ -2030,7 +2286,7 @@ class MacBuilder {
|
|
|
2030
2286
|
yield installRust();
|
|
2031
2287
|
}
|
|
2032
2288
|
else {
|
|
2033
|
-
log.error('Error: Pake need Rust to package your webapp
|
|
2289
|
+
log.error('Error: Pake need Rust to package your webapp!!!');
|
|
2034
2290
|
process.exit(2);
|
|
2035
2291
|
}
|
|
2036
2292
|
});
|
|
@@ -2042,11 +2298,28 @@ class MacBuilder {
|
|
|
2042
2298
|
yield mergeTauriConfig(url, options, tauriConf);
|
|
2043
2299
|
let dmgName;
|
|
2044
2300
|
if (options.multiArch) {
|
|
2045
|
-
|
|
2301
|
+
const isChina = isChinaDomain("www.npmjs.com");
|
|
2302
|
+
if (isChina) {
|
|
2303
|
+
// crates.io也顺便换源
|
|
2304
|
+
const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo");
|
|
2305
|
+
const project_cn_conf = path.join(rust_project_dir, "cn_config.bak");
|
|
2306
|
+
const project_conf = path.join(rust_project_dir, "config");
|
|
2307
|
+
fs$1.copyFile(project_cn_conf, project_conf);
|
|
2308
|
+
yield shellExec(`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com && npm run build:mac`);
|
|
2309
|
+
}
|
|
2310
|
+
else {
|
|
2311
|
+
yield shellExec(`cd "${npmDirectory}" && npm install && npm run build:mac`);
|
|
2312
|
+
}
|
|
2046
2313
|
dmgName = `${name}_${tauriConf.package.version}_universal.dmg`;
|
|
2047
2314
|
}
|
|
2048
2315
|
else {
|
|
2049
|
-
|
|
2316
|
+
const isChina = isChinaDomain("www.npmjs.com");
|
|
2317
|
+
if (isChina) {
|
|
2318
|
+
yield shellExec(`cd ${npmDirectory} && npm install --registry=https://registry.npmmirror.com && npm run build`);
|
|
2319
|
+
}
|
|
2320
|
+
else {
|
|
2321
|
+
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
|
|
2322
|
+
}
|
|
2050
2323
|
let arch = "x64";
|
|
2051
2324
|
if (process.arch === "arm64") {
|
|
2052
2325
|
arch = "aarch64";
|
|
@@ -2058,8 +2331,8 @@ class MacBuilder {
|
|
|
2058
2331
|
}
|
|
2059
2332
|
const appPath = this.getBuildAppPath(npmDirectory, dmgName, options.multiArch);
|
|
2060
2333
|
const distPath = path.resolve(`${name}.dmg`);
|
|
2061
|
-
yield fs.copyFile(appPath, distPath);
|
|
2062
|
-
yield fs.unlink(appPath);
|
|
2334
|
+
yield fs$1.copyFile(appPath, distPath);
|
|
2335
|
+
yield fs$1.unlink(appPath);
|
|
2063
2336
|
logger.success('Build success!');
|
|
2064
2337
|
logger.success('You can find the app installer in', distPath);
|
|
2065
2338
|
});
|
|
@@ -2104,19 +2377,30 @@ class WinBuilder {
|
|
|
2104
2377
|
logger.debug('PakeAppOptions', options);
|
|
2105
2378
|
const { name } = options;
|
|
2106
2379
|
yield mergeTauriConfig(url, options, tauriConf);
|
|
2107
|
-
|
|
2380
|
+
const isChina = isChinaDomain("www.npmjs.com");
|
|
2381
|
+
if (isChina) {
|
|
2382
|
+
// crates.io也顺便换源
|
|
2383
|
+
const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo");
|
|
2384
|
+
const project_cn_conf = path.join(rust_project_dir, "cn_config.bak");
|
|
2385
|
+
const project_conf = path.join(rust_project_dir, "config");
|
|
2386
|
+
fs$1.copyFile(project_cn_conf, project_conf);
|
|
2387
|
+
yield shellExec(`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com && npm run build`);
|
|
2388
|
+
}
|
|
2389
|
+
else {
|
|
2390
|
+
yield shellExec(`cd "${npmDirectory}" && npm install && npm run build`);
|
|
2391
|
+
}
|
|
2108
2392
|
const language = tauriConf.tauri.bundle.windows.wix.language[0];
|
|
2109
2393
|
const arch = process.arch;
|
|
2110
2394
|
const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`;
|
|
2111
|
-
const appPath = this.
|
|
2395
|
+
const appPath = this.getBuildedAppPath(npmDirectory, msiName);
|
|
2112
2396
|
const distPath = path.resolve(`${name}.msi`);
|
|
2113
|
-
yield fs.copyFile(appPath, distPath);
|
|
2114
|
-
yield fs.unlink(appPath);
|
|
2397
|
+
yield fs$1.copyFile(appPath, distPath);
|
|
2398
|
+
yield fs$1.unlink(appPath);
|
|
2115
2399
|
logger.success('Build success!');
|
|
2116
2400
|
logger.success('You can find the app installer in', distPath);
|
|
2117
2401
|
});
|
|
2118
2402
|
}
|
|
2119
|
-
|
|
2403
|
+
getBuildedAppPath(npmDirectory, dmgName) {
|
|
2120
2404
|
return path.join(npmDirectory, 'src-tauri/target/release/bundle/msi', dmgName);
|
|
2121
2405
|
}
|
|
2122
2406
|
}
|
|
@@ -2149,7 +2433,18 @@ class LinuxBuilder {
|
|
|
2149
2433
|
logger.debug('PakeAppOptions', options);
|
|
2150
2434
|
const { name } = options;
|
|
2151
2435
|
yield mergeTauriConfig(url, options, tauriConf);
|
|
2152
|
-
|
|
2436
|
+
const isChina = isChinaDomain("www.npmjs.com");
|
|
2437
|
+
if (isChina) {
|
|
2438
|
+
// crates.io也顺便换源
|
|
2439
|
+
const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo");
|
|
2440
|
+
const project_cn_conf = path.join(rust_project_dir, "cn_config.bak");
|
|
2441
|
+
const project_conf = path.join(rust_project_dir, "config");
|
|
2442
|
+
fs$1.copyFile(project_cn_conf, project_conf);
|
|
2443
|
+
yield shellExec(`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com && npm run build`);
|
|
2444
|
+
}
|
|
2445
|
+
else {
|
|
2446
|
+
yield shellExec(`cd "${npmDirectory}" && npm install && npm run build`);
|
|
2447
|
+
}
|
|
2153
2448
|
let arch;
|
|
2154
2449
|
if (process.arch === "x64") {
|
|
2155
2450
|
arch = "amd64";
|
|
@@ -2161,8 +2456,8 @@ class LinuxBuilder {
|
|
|
2161
2456
|
const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
|
|
2162
2457
|
const appPath = this.getBuildAppPath(npmDirectory, "deb", debName);
|
|
2163
2458
|
const distPath = path.resolve(`${name}.deb`);
|
|
2164
|
-
yield fs.copyFile(appPath, distPath);
|
|
2165
|
-
yield fs.unlink(appPath);
|
|
2459
|
+
yield fs$1.copyFile(appPath, distPath);
|
|
2460
|
+
yield fs$1.unlink(appPath);
|
|
2166
2461
|
logger.success('Build Deb success!');
|
|
2167
2462
|
logger.success('You can find the deb app installer in', distPath);
|
|
2168
2463
|
}
|
|
@@ -2170,8 +2465,8 @@ class LinuxBuilder {
|
|
|
2170
2465
|
const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
|
|
2171
2466
|
const appImagePath = this.getBuildAppPath(npmDirectory, "appimage", appImageName);
|
|
2172
2467
|
const distAppPath = path.resolve(`${name}.AppImage`);
|
|
2173
|
-
yield fs.copyFile(appImagePath, distAppPath);
|
|
2174
|
-
yield fs.unlink(appImagePath);
|
|
2468
|
+
yield fs$1.copyFile(appImagePath, distAppPath);
|
|
2469
|
+
yield fs$1.unlink(appImagePath);
|
|
2175
2470
|
logger.success('Build AppImage success!');
|
|
2176
2471
|
logger.success('You can find the AppImage app installer in', distAppPath);
|
|
2177
2472
|
}
|
|
@@ -2198,7 +2493,7 @@ class BuilderFactory {
|
|
|
2198
2493
|
}
|
|
2199
2494
|
|
|
2200
2495
|
var name = "pake-cli";
|
|
2201
|
-
var version = "
|
|
2496
|
+
var version = "2.0.0-alpha6";
|
|
2202
2497
|
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。";
|
|
2203
2498
|
var engines = {
|
|
2204
2499
|
node: ">=16.0.0"
|
|
@@ -2230,7 +2525,6 @@ var files = [
|
|
|
2230
2525
|
var scripts = {
|
|
2231
2526
|
start: "npm run dev",
|
|
2232
2527
|
dev: "npm run tauri dev",
|
|
2233
|
-
"dev:debug": "npm run tauri dev -- --features devtools",
|
|
2234
2528
|
build: "npm run tauri build --release",
|
|
2235
2529
|
"build:mac": "npm run tauri build -- --target universal-apple-darwin",
|
|
2236
2530
|
"build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh",
|
|
@@ -2250,6 +2544,7 @@ var dependencies = {
|
|
|
2250
2544
|
chalk: "^5.1.2",
|
|
2251
2545
|
commander: "^9.4.1",
|
|
2252
2546
|
"file-type": "^18.0.0",
|
|
2547
|
+
"fs-extra": "^11.1.0",
|
|
2253
2548
|
"is-url": "^1.2.4",
|
|
2254
2549
|
loglevel: "^1.8.1",
|
|
2255
2550
|
ora: "^6.1.2",
|
|
@@ -2264,6 +2559,7 @@ var devDependencies = {
|
|
|
2264
2559
|
"@rollup/plugin-json": "^5.0.1",
|
|
2265
2560
|
"@rollup/plugin-terser": "^0.1.0",
|
|
2266
2561
|
"@rollup/plugin-typescript": "^9.0.2",
|
|
2562
|
+
"@types/fs-extra": "^9.0.13",
|
|
2267
2563
|
"@types/is-url": "^1.2.30",
|
|
2268
2564
|
"@types/page-icon": "^0.3.4",
|
|
2269
2565
|
"@types/prompts": "^2.4.1",
|
|
@@ -2297,26 +2593,31 @@ var packageJson = {
|
|
|
2297
2593
|
|
|
2298
2594
|
function checkUpdateTips() {
|
|
2299
2595
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2300
|
-
updateNotifier({ pkg: packageJson }).notify(
|
|
2596
|
+
updateNotifier({ pkg: packageJson }).notify();
|
|
2301
2597
|
});
|
|
2302
2598
|
}
|
|
2303
2599
|
|
|
2304
|
-
program.version(packageJson.version).description('A
|
|
2600
|
+
program.version(packageJson.version).description('A cli application can package a web page to desktop application.');
|
|
2305
2601
|
program
|
|
2306
2602
|
.showHelpAfterError()
|
|
2307
|
-
.argument('[url]', 'the web
|
|
2308
|
-
.option('
|
|
2309
|
-
.option('
|
|
2310
|
-
.option('
|
|
2311
|
-
.option('
|
|
2312
|
-
.option('-
|
|
2313
|
-
.option('
|
|
2314
|
-
.option('
|
|
2315
|
-
.option('-
|
|
2603
|
+
.argument('[url]', 'the web url you want to package', validateUrlInput)
|
|
2604
|
+
.option('--name <string>', 'application name')
|
|
2605
|
+
.option('--icon <string>', 'application icon', DEFAULT_PAKE_OPTIONS.icon)
|
|
2606
|
+
.option('--height <number>', 'window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height)
|
|
2607
|
+
.option('--width <number>', 'window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width)
|
|
2608
|
+
.option('--no-resizable', 'whether the window can be resizable', DEFAULT_PAKE_OPTIONS.resizable)
|
|
2609
|
+
.option('--fullscreen', 'makes the packaged app start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
|
|
2610
|
+
.option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent)
|
|
2611
|
+
.option('--user-agent <string>', 'custom user agent', DEFAULT_PAKE_OPTIONS.userAgent)
|
|
2612
|
+
.option('--show-menu', 'show menu in app', DEFAULT_PAKE_OPTIONS.showMenu)
|
|
2613
|
+
.option('--show-system-tray', 'show system tray in app', DEFAULT_PAKE_OPTIONS.showSystemTray)
|
|
2614
|
+
.option('--system-tray-icon <string>', 'custom system tray icon', DEFAULT_PAKE_OPTIONS.systemTrayIcon)
|
|
2615
|
+
.option('--iter-copy-file', 'copy all static file to pake app when url is a local file', DEFAULT_PAKE_OPTIONS.iterCopyFile)
|
|
2316
2616
|
.option('-m, --multi-arch', "available for Mac only, and supports both Intel and M1", DEFAULT_PAKE_OPTIONS.multiArch)
|
|
2317
|
-
.option('--targets <string>',
|
|
2617
|
+
.option('--targets <string>', 'only for linux, default is "deb", option "appaimge" or "all"(deb & appimage)', DEFAULT_PAKE_OPTIONS.targets)
|
|
2618
|
+
.option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent)
|
|
2318
2619
|
.action((url, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2319
|
-
|
|
2620
|
+
checkUpdateTips();
|
|
2320
2621
|
if (!url) {
|
|
2321
2622
|
// 直接 pake 不需要出现url提示
|
|
2322
2623
|
program.help();
|
|
@@ -2327,7 +2628,9 @@ program
|
|
|
2327
2628
|
}
|
|
2328
2629
|
const builder = BuilderFactory.create();
|
|
2329
2630
|
yield builder.prepare();
|
|
2631
|
+
// logger.warn("you input url is ", url);
|
|
2330
2632
|
const appOptions = yield handleOptions(options, url);
|
|
2331
|
-
|
|
2633
|
+
// logger.info(JSON.stringify(appOptions, null, 4));
|
|
2634
|
+
builder.build(url, appOptions);
|
|
2332
2635
|
}));
|
|
2333
2636
|
program.parse();
|