pake-cli 1.0.0 → 1.2.1

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 CHANGED
@@ -60,10 +60,10 @@
60
60
  <td><img src=https://cdn.fliggy.com/upic/Ea5ZRw.png width=600/></td>
61
61
  </tr>
62
62
  <tr>
63
- <td>Code
64
- <a href="https://github.com/tw93/Pake/releases/latest/download/Code.dmg">Mac</a>
65
- <a href="https://github.com/tw93/Pake/releases/latest/download/Code_x64.msi">Windows</a>
66
- <a href="https://github.com/tw93/Pake/releases/latest/download/Code_amd64.deb">Linux</a>
63
+ <td>ZLibrary
64
+ <a href="https://github.com/tw93/Pake/releases/latest/download/ZLibrary.dmg">Mac</a>
65
+ <a href="https://github.com/tw93/Pake/releases/latest/download/ZLibrary_x64.msi">Windows</a>
66
+ <a href="https://github.com/tw93/Pake/releases/latest/download/ZLibrary_amd64.deb">Linux</a>
67
67
  </td>
68
68
  <td>Reference
69
69
  <a href="https://github.com/tw93/Pake/releases/latest/download/Reference.dmg">Mac</a>
@@ -72,7 +72,7 @@
72
72
  </td>
73
73
  </tr>
74
74
  <tr>
75
- <td><img src=https://cdn.fliggy.com/upic/EB1OYP.jpg width=600/></td>
75
+ <td><img src=https://cdn.fliggy.com/upic/XGilgr.png width=600/></td>
76
76
  <td><img src=https://cdn.fliggy.com/upic/KFsZIY.png width=600/></td>
77
77
  </tr>
78
78
  <tr>
@@ -95,7 +95,7 @@
95
95
 
96
96
  <details>
97
97
 
98
- <summary>🏂 更多应用如 Flomo / 语雀可去 <a href="https://github.com/tw93/Pake/releases">Release</a>下载,<b>此外点击可展开快捷键说明</b></summary>
98
+ <summary>🏂 更多应用如 Flomo / 语雀 / RunCode 可去 <a href="https://github.com/tw93/Pake/releases">Release</a>下载,<b>此外点击可展开快捷键说明</b></summary>
99
99
 
100
100
  <br/>
101
101
 
@@ -262,21 +262,28 @@ Pake 的发展离不开这些 Hacker 们,一起贡献了大量能力,也欢
262
262
  <sub><b>Dengju Deng</b></sub>
263
263
  </a>
264
264
  </td>
265
+ <td align="center">
266
+ <a href="https://github.com/Fechin">
267
+ <img src="https://avatars.githubusercontent.com/u/2541482?v=4" width="90;" alt="Fechin"/>
268
+ <br />
269
+ <sub><b>Fechin</b></sub>
270
+ </a>
271
+ </td>
265
272
  <td align="center">
266
273
  <a href="https://github.com/princemaple">
267
274
  <img src="https://avatars.githubusercontent.com/u/1329716?v=4" width="90;" alt="princemaple"/>
268
275
  <br />
269
276
  <sub><b>Po Chen</b></sub>
270
277
  </a>
271
- </td>
278
+ </td></tr>
279
+ <tr>
272
280
  <td align="center">
273
281
  <a href="https://github.com/houhoz">
274
282
  <img src="https://avatars.githubusercontent.com/u/19684376?v=4" width="90;" alt="houhoz"/>
275
283
  <br />
276
284
  <sub><b>Hyzhao</b></sub>
277
285
  </a>
278
- </td></tr>
279
- <tr>
286
+ </td>
280
287
  <td align="center">
281
288
  <a href="https://github.com/liusishan">
282
289
  <img src="https://avatars.githubusercontent.com/u/33129823?v=4" width="90;" alt="liusishan"/>
package/dist/cli.js CHANGED
@@ -15,35 +15,35 @@ import ora from 'ora';
15
15
  import shelljs from 'shelljs';
16
16
  import updateNotifier from 'update-notifier';
17
17
 
18
- /******************************************************************************
19
- Copyright (c) Microsoft Corporation.
20
-
21
- Permission to use, copy, modify, and/or distribute this software for any
22
- purpose with or without fee is hereby granted.
23
-
24
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
25
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
27
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
28
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
29
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
30
- PERFORMANCE OF THIS SOFTWARE.
31
- ***************************************************************************** */
32
-
33
- function __awaiter(thisArg, _arguments, P, generator) {
34
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
35
- return new (P || (P = Promise))(function (resolve, reject) {
36
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
37
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
38
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
39
- step((generator = generator.apply(thisArg, _arguments || [])).next());
40
- });
18
+ /******************************************************************************
19
+ Copyright (c) Microsoft Corporation.
20
+
21
+ Permission to use, copy, modify, and/or distribute this software for any
22
+ purpose with or without fee is hereby granted.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
25
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
27
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
28
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
29
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
30
+ PERFORMANCE OF THIS SOFTWARE.
31
+ ***************************************************************************** */
32
+
33
+ function __awaiter(thisArg, _arguments, P, generator) {
34
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
35
+ return new (P || (P = Promise))(function (resolve, reject) {
36
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
37
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
38
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
39
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
40
+ });
41
41
  }
42
42
 
43
43
  const DEFAULT_PAKE_OPTIONS = {
44
44
  icon: '',
45
- height: 800,
46
- width: 1280,
45
+ height: 780,
46
+ width: 1200,
47
47
  fullscreen: false,
48
48
  resizable: true,
49
49
  transparent: false,
@@ -1632,6 +1632,24 @@ function mergeTauriConfig(url, options, tauriConf) {
1632
1632
  transparent,
1633
1633
  resizable,
1634
1634
  };
1635
+ // Package name is valid ?
1636
+ // for Linux, package name must be a-z, 0-9 or "-", not allow to A-Z and other
1637
+ if (process.platform === "linux") {
1638
+ const reg = new RegExp(/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/);
1639
+ if (!reg.test(name) || reg.exec(name)[0].length != name.length) {
1640
+ logger.error("package name is illegal, it must be lowercase letters, numbers, dashes, and it must contain the lowercase letters.");
1641
+ logger.error("E.g com-123-xxx, 123pan, pan123,weread, we-read");
1642
+ process.exit();
1643
+ }
1644
+ }
1645
+ if (process.platform === "win32" || process.platform === "darwin") {
1646
+ const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/);
1647
+ if (!reg.test(name) || reg.exec(name)[0].length != name.length) {
1648
+ logger.error("package name is illegal, it must be letters, numbers, and it must contain the letters");
1649
+ logger.error("E.g 123pan,123Pan,Pan123,weread,WeRead,WERead");
1650
+ process.exit();
1651
+ }
1652
+ }
1635
1653
  Object.assign(tauriConf.tauri.windows[0], Object.assign({ url }, tauriConfWindowOptions));
1636
1654
  tauriConf.package.productName = name;
1637
1655
  tauriConf.tauri.bundle.identifier = identifier;
@@ -1734,38 +1752,6 @@ function getDefaultIcon() {
1734
1752
  return path.join(npmDirectory, iconPath);
1735
1753
  });
1736
1754
  }
1737
- // export async function getIconFromPageUrl(url: string) {
1738
- // const icon = await pageIcon(url);
1739
- // console.log(icon);
1740
- // if (icon.ext === '.ico') {
1741
- // const a = await ICO.parse(icon.data);
1742
- // icon.data = Buffer.from(a[0].buffer);
1743
- // }
1744
- // const iconDir = (await dir()).path;
1745
- // const iconPath = path.join(iconDir, `/icon.icns`);
1746
- // const out = png2icons.createICNS(icon.data, png2icons.BILINEAR, 0);
1747
- // await fs.writeFile(iconPath, out);
1748
- // return iconPath;
1749
- // }
1750
- // export async function getIconFromMacosIcons(name: string) {
1751
- // const data = {
1752
- // query: name,
1753
- // filters: 'approved:true',
1754
- // hitsPerPage: 10,
1755
- // page: 1,
1756
- // };
1757
- // 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, {
1758
- // headers: {
1759
- // 'x-algolia-api-key': '0ba04276e457028f3e11e38696eab32c',
1760
- // 'x-algolia-application-id': 'P1TXH7ZFB3',
1761
- // },
1762
- // });
1763
- // if (!res.data.hits.length) {
1764
- // return '';
1765
- // } else {
1766
- // return downloadIcon(res.data.hits[0].icnsUrl);
1767
- // }
1768
- // }
1769
1755
  function downloadIcon(iconUrl) {
1770
1756
  return __awaiter(this, void 0, void 0, function* () {
1771
1757
  let iconResponse;
@@ -1961,7 +1947,9 @@ var tauri = {
1961
1947
  "libssl-dev",
1962
1948
  "libgtk-3-dev",
1963
1949
  "libayatana-appindicator3-dev",
1964
- "librsvg2-dev"
1950
+ "librsvg2-dev",
1951
+ "gnome-video-effects",
1952
+ "gnome-video-effects-extra"
1965
1953
  ],
1966
1954
  files: {
1967
1955
  "/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"
@@ -2018,7 +2006,7 @@ class MacBuilder {
2018
2006
  yield installRust();
2019
2007
  }
2020
2008
  else {
2021
- log.error('Error: Pake need Rust to package your webapp!!!');
2009
+ log.error('Error: Pake need Rust to package your webapp!');
2022
2010
  process.exit(2);
2023
2011
  }
2024
2012
  });
@@ -2028,16 +2016,10 @@ class MacBuilder {
2028
2016
  log.debug('PakeAppOptions', options);
2029
2017
  const { name } = options;
2030
2018
  yield mergeTauriConfig(url, options, tauriConf);
2031
- yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
2032
- let arch = "x64";
2033
- if (process.arch === "arm64") {
2034
- arch = "aarch64";
2035
- }
2036
- else {
2037
- arch = process.arch;
2038
- }
2039
- const dmgName = `${name}_${tauriConf.package.version}_${arch}.dmg`;
2040
- const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
2019
+ //这里直接使用 universal-apple-darwin 的打包,而非当前系统的包
2020
+ yield shellExec(`cd ${npmDirectory} && npm install && npm run build:mac`);
2021
+ const dmgName = `${name}_${tauriConf.package.version}_universal.dmg`;
2022
+ const appPath = this.getBuildAppPath(npmDirectory, dmgName);
2041
2023
  const distPath = path.resolve(`${name}.dmg`);
2042
2024
  yield fs.copyFile(appPath, distPath);
2043
2025
  yield fs.unlink(appPath);
@@ -2045,8 +2027,8 @@ class MacBuilder {
2045
2027
  logger.success('You can find the app installer in', distPath);
2046
2028
  });
2047
2029
  }
2048
- getBuildedAppPath(npmDirectory, dmgName) {
2049
- return path.join(npmDirectory, 'src-tauri/target/release/bundle/dmg', dmgName);
2030
+ getBuildAppPath(npmDirectory, dmgName) {
2031
+ return path.join(npmDirectory, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
2050
2032
  }
2051
2033
  }
2052
2034
 
@@ -2082,7 +2064,7 @@ class WinBuilder {
2082
2064
  const language = tauriConf.tauri.bundle.windows.wix.language[0];
2083
2065
  const arch = process.arch;
2084
2066
  const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`;
2085
- const appPath = this.getBuildedAppPath(npmDirectory, msiName);
2067
+ const appPath = this.getBuildAppPath(npmDirectory, msiName);
2086
2068
  const distPath = path.resolve(`${name}.msi`);
2087
2069
  yield fs.copyFile(appPath, distPath);
2088
2070
  yield fs.unlink(appPath);
@@ -2090,7 +2072,7 @@ class WinBuilder {
2090
2072
  logger.success('You can find the app installer in', distPath);
2091
2073
  });
2092
2074
  }
2093
- getBuildedAppPath(npmDirectory, dmgName) {
2075
+ getBuildAppPath(npmDirectory, dmgName) {
2094
2076
  return path.join(npmDirectory, 'src-tauri/target/release/bundle/msi', dmgName);
2095
2077
  }
2096
2078
  }
@@ -2124,7 +2106,7 @@ class LinuxBuilder {
2124
2106
  const { name } = options;
2125
2107
  yield mergeTauriConfig(url, options, tauriConf);
2126
2108
  yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
2127
- let arch = "";
2109
+ let arch;
2128
2110
  if (process.arch === "x64") {
2129
2111
  arch = "amd64";
2130
2112
  }
@@ -2132,21 +2114,21 @@ class LinuxBuilder {
2132
2114
  arch = process.arch;
2133
2115
  }
2134
2116
  const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
2135
- const appPath = this.getBuildedAppPath(npmDirectory, "deb", debName);
2117
+ const appPath = this.getBuildAppPath(npmDirectory, "deb", debName);
2136
2118
  const distPath = path.resolve(`${name}.deb`);
2137
2119
  yield fs.copyFile(appPath, distPath);
2138
2120
  yield fs.unlink(appPath);
2139
2121
  const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
2140
- const appImagePath = this.getBuildedAppPath(npmDirectory, "appimage", appImageName);
2122
+ const appImagePath = this.getBuildAppPath(npmDirectory, "appimage", appImageName);
2141
2123
  const distAppPath = path.resolve(`${name}.AppImage`);
2142
2124
  yield fs.copyFile(appImagePath, distAppPath);
2143
2125
  yield fs.unlink(appImagePath);
2144
2126
  logger.success('Build success!');
2145
2127
  logger.success('You can find the deb app installer in', distPath);
2146
- logger.success('You can find the Appimage app installer in', distAppPath);
2128
+ logger.success('You can find the AppImage app installer in', distAppPath);
2147
2129
  });
2148
2130
  }
2149
- getBuildedAppPath(npmDirectory, packageType, packageName) {
2131
+ getBuildAppPath(npmDirectory, packageType, packageName) {
2150
2132
  return path.join(npmDirectory, 'src-tauri/target/release/bundle/', packageType, packageName);
2151
2133
  }
2152
2134
  }
@@ -2167,8 +2149,11 @@ class BuilderFactory {
2167
2149
  }
2168
2150
 
2169
2151
  var name = "pake-cli";
2170
- var version = "0.1.2";
2152
+ var version = "1.2.1";
2171
2153
  var description = "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.";
2154
+ var engines = {
2155
+ node: "^14.13 || >=16.0.0"
2156
+ };
2172
2157
  var bin = {
2173
2158
  pake: "./cli.js"
2174
2159
  };
@@ -2180,6 +2165,14 @@ var author = {
2180
2165
  name: "Tw93",
2181
2166
  email: "tw93@qq.com"
2182
2167
  };
2168
+ var keywords = [
2169
+ "pake",
2170
+ "pake-cli",
2171
+ "rust",
2172
+ "tauri",
2173
+ "no-electron",
2174
+ "productivity"
2175
+ ];
2183
2176
  var files = [
2184
2177
  "dist",
2185
2178
  "src-tauri",
@@ -2190,19 +2183,20 @@ var scripts = {
2190
2183
  dev: "npm run tauri dev",
2191
2184
  "dev:debug": "npm run tauri dev -- --features devtools",
2192
2185
  build: "npm run tauri build --release",
2186
+ "build:mac": "npm run tauri build -- --target universal-apple-darwin",
2193
2187
  "build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh",
2194
2188
  "build:all-windows": ".\\script\\build.bat",
2195
2189
  tauri: "tauri",
2196
2190
  cli: "rollup -c rollup.config.js --watch",
2197
2191
  "cli:build": "cross-env NODE_ENV=production rollup -c rollup.config.js",
2198
- "cli:publish": "npm run cli:build && npm publish"
2192
+ prepublishOnly: "npm run cli:build"
2199
2193
  };
2200
2194
  var type = "module";
2201
2195
  var exports = "./dist/pake.js";
2202
2196
  var license = "MIT";
2203
2197
  var dependencies = {
2204
2198
  "@tauri-apps/api": "^1.2.0",
2205
- "@tauri-apps/cli": "^1.2.1",
2199
+ "@tauri-apps/cli": "^1.2.2",
2206
2200
  axios: "^1.1.3",
2207
2201
  chalk: "^5.1.2",
2208
2202
  commander: "^9.4.1",
@@ -2238,9 +2232,11 @@ var packageJson = {
2238
2232
  name: name,
2239
2233
  version: version,
2240
2234
  description: description,
2235
+ engines: engines,
2241
2236
  bin: bin,
2242
2237
  repository: repository,
2243
2238
  author: author,
2239
+ keywords: keywords,
2244
2240
  files: files,
2245
2241
  scripts: scripts,
2246
2242
  type: type,
@@ -2269,7 +2265,7 @@ program
2269
2265
  .option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent)
2270
2266
  .option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent)
2271
2267
  .action((url, options) => __awaiter(void 0, void 0, void 0, function* () {
2272
- checkUpdateTips();
2268
+ yield checkUpdateTips();
2273
2269
  if (!url) {
2274
2270
  // 直接 pake 不需要出现url提示
2275
2271
  program.help();
@@ -2281,6 +2277,6 @@ program
2281
2277
  const builder = BuilderFactory.create();
2282
2278
  yield builder.prepare();
2283
2279
  const appOptions = yield handleOptions(options, url);
2284
- builder.build(url, appOptions);
2280
+ yield builder.build(url, appOptions);
2285
2281
  }));
2286
2282
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "1.0.0",
3
+ "version": "1.2.1",
4
4
  "description": "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.",
5
5
  "engines": {
6
6
  "node": "^14.13 || >=16.0.0"
@@ -40,7 +40,7 @@
40
40
  "tauri": "tauri",
41
41
  "cli": "rollup -c rollup.config.js --watch",
42
42
  "cli:build": "cross-env NODE_ENV=production rollup -c rollup.config.js",
43
- "cli:publish": "npm run cli:build && npm publish"
43
+ "prepublishOnly": "npm run cli:build"
44
44
  },
45
45
  "type": "module",
46
46
  "exports": "./dist/pake.js",
Binary file
Binary file
Binary file
Binary file
@@ -51,10 +51,14 @@ window.addEventListener("DOMContentLoaded", (_event) => {
51
51
  display: none !important;
52
52
  }
53
53
 
54
- #page .main_header, .cb-layout-basic--navbar{
54
+ #page .main_header, .cb-layout-basic--navbar {
55
55
  padding-top: 20px;
56
56
  }
57
57
 
58
+ .chakra-ui-light #app .chakra-heading, .chakra-ui-dark #app .chakra-heading, .chakra-ui-light #app .chakra-stack, .chakra-ui-dark #app .chakra-stack {
59
+ padding-top: 10px;
60
+ }
61
+
58
62
  #__next .overflow-hidden .flex.flex-1.flex-col {
59
63
  padding-left: 0;
60
64
  }