pake-cli 2.3.8 → 2.4.0-beta1

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
@@ -171,7 +171,7 @@ npm install -g pake-cli
171
171
  pake url [OPTIONS]...
172
172
 
173
173
  # Feel free to play with Pake! It might take a while to prepare the environment the first time you launch Pake.
174
- pake https://weekly.tw93.fun --name Weekly --transparent
174
+ pake https://weekly.tw93.fun --name Weekly --hide-title-bar
175
175
  ```
176
176
 
177
177
  If you are new to the command line, you can compile packages online with _GitHub Actions_. See the [Tutorial](<https://github.com/tw93/Pake/wiki/Online-Compilation-(used-by-ordinary-users)>) for more information.
@@ -197,7 +197,7 @@ npm run build
197
197
 
198
198
  1. You can refer to the [codebase structure](https://github.com/tw93/Pake/wiki/Description-of-Pake's-code-structure) before working on Pake, which will help you much in development.
199
199
  2. Modify the `url` and `productName` fields in the `pake.json` file under the src-tauri directory, the "domain" field in the `tauri.config.json` file needs to be modified synchronously, as well as the `icon` and `identifier` fields in the `tauri.xxx.conf.json` file. You can select an `icon` from the `icons` directory or download one from [macOSicons](https://macosicons.com/#/) to match your product needs.
200
- 3. For configurations on window properties, you can modify the `pake.json` file to change the value of `width`, `height`, `fullscreen` (or not), `resizable` (or not) of the `windows` property. To adapt to the immersive header on Mac, change `transparent` to `true`, look for the `Header` element, and add the `padding-top` property.
200
+ 3. For configurations on window properties, you can modify the `pake.json` file to change the value of `width`, `height`, `fullscreen` (or not), `resizable` (or not) of the `windows` property. To adapt to the immersive header on Mac, change `hideTitleBar` to `true`, look for the `Header` element, and add the `padding-top` property.
201
201
  4. For advanced usages such as style rewriting, advertisement removal, JS injection, container message communication, and user-defined shortcut keys, see [Advanced Usage of Pake](https://github.com/tw93/Pake/wiki/Advanced-Usage-of-Pake).
202
202
 
203
203
  ## Developers
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import chalk from 'chalk';
2
- import { InvalidArgumentError, program } from 'commander';
2
+ import { InvalidArgumentError, program, Option } from 'commander';
3
3
  import log from 'loglevel';
4
4
  import path from 'path';
5
5
  import fsExtra from 'fs-extra';
@@ -20,7 +20,7 @@ import psl from 'psl';
20
20
  import isUrl from 'is-url';
21
21
 
22
22
  var name = "pake-cli";
23
- var version = "2.3.8";
23
+ var version = "2.4.0-beta1";
24
24
  var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
25
25
  var engines = {
26
26
  node: ">=16.0.0"
@@ -126,12 +126,15 @@ var packageJson = {
126
126
  var windows = [
127
127
  {
128
128
  url: "https://weread.qq.com",
129
- transparent: true,
129
+ url_type: "web",
130
+ hide_title_bar: true,
130
131
  fullscreen: false,
131
132
  width: 1200,
132
133
  height: 780,
133
134
  resizable: true,
134
- url_type: "web"
135
+ always_on_top: false,
136
+ activation_shortcut: "",
137
+ disabled_web_shortcuts: false
135
138
  }
136
139
  ];
137
140
  var user_agent = {
@@ -471,15 +474,18 @@ async function combineFiles(files, output) {
471
474
  }
472
475
 
473
476
  async function mergeConfig(url, options, tauriConf) {
474
- const { width, height, fullscreen, transparent, userAgent, showSystemTray, systemTrayIcon, iterCopyFile, identifier, name, resizable = true, inject, safeDomain, } = options;
477
+ const { width, height, fullscreen, hideTitleBar, alwaysOnTop, disabledWebShortcuts, activationShortcut, userAgent, showSystemTray, systemTrayIcon, iterCopyFile, identifier, name, resizable = true, inject, safeDomain, } = options;
475
478
  const { platform } = process;
476
479
  // Set Windows parameters.
477
480
  const tauriConfWindowOptions = {
478
481
  width,
479
482
  height,
480
483
  fullscreen,
481
- transparent,
482
484
  resizable,
485
+ hide_title_bar: hideTitleBar,
486
+ activation_shortcut: activationShortcut,
487
+ always_on_top: alwaysOnTop,
488
+ disabled_web_shortcuts: disabledWebShortcuts,
483
489
  };
484
490
  Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
485
491
  tauriConf.package.productName = name;
@@ -682,7 +688,7 @@ class BaseBuilder {
682
688
  const isChina = await isChinaDomain('www.npmjs.com');
683
689
  const spinner = getSpinner('Installing package...');
684
690
  const rustProjectDir = path.join(tauriSrcPath, '.cargo');
685
- const projectConf = path.join(rustProjectDir, 'config');
691
+ const projectConf = path.join(rustProjectDir, 'config.toml');
686
692
  await fsExtra.ensureDir(rustProjectDir);
687
693
  if (isChina) {
688
694
  logger.info('✺ Located in China, using npm/rsProxy CN mirror.');
@@ -729,7 +735,8 @@ class BaseBuilder {
729
735
  return this.options.debug ? 'npm run build:debug' : 'npm run build';
730
736
  }
731
737
  getBasePath() {
732
- return 'src-tauri/target/release/bundle/';
738
+ const basePath = this.options.debug ? 'debug' : 'release';
739
+ return `src-tauri/target/${basePath}/bundle/`;
733
740
  }
734
741
  getBuildAppPath(npmDirectory, fileName, fileType) {
735
742
  return path.join(npmDirectory, this.getBasePath(), fileType.toLowerCase(), `${fileName}.${fileType}`);
@@ -823,7 +830,10 @@ const DEFAULT_PAKE_OPTIONS = {
823
830
  width: 1200,
824
831
  fullscreen: false,
825
832
  resizable: true,
826
- transparent: false,
833
+ hideTitleBar: false,
834
+ alwaysOnTop: false,
835
+ disabledWebShortcuts: false,
836
+ activationShortcut: '',
827
837
  userAgent: '',
828
838
  showSystemTray: false,
829
839
  multiArch: false,
@@ -1014,17 +1024,19 @@ program
1014
1024
  .option('--icon <string>', 'Application icon', DEFAULT_PAKE_OPTIONS.icon)
1015
1025
  .option('--width <number>', 'Window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width)
1016
1026
  .option('--height <number>', 'Window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height)
1017
- .option('--transparent', 'Only for Mac, hide title bar', DEFAULT_PAKE_OPTIONS.transparent)
1018
1027
  .option('--fullscreen', 'Start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
1019
- .option('--user-agent <string>', 'Custom user agent', DEFAULT_PAKE_OPTIONS.userAgent)
1020
- .option('--show-system-tray', 'Show system tray in app', DEFAULT_PAKE_OPTIONS.showSystemTray)
1021
- .option('--system-tray-icon <string>', 'Custom system tray icon', DEFAULT_PAKE_OPTIONS.systemTrayIcon)
1022
- .option('--iter-copy-file', 'Copy files when URL is a local file', DEFAULT_PAKE_OPTIONS.iterCopyFile)
1028
+ .option('--hide-title-bar', 'Only for Mac, hide title bar', DEFAULT_PAKE_OPTIONS.hideTitleBar)
1029
+ .option('--activation-shortcut <string>', 'Shortcut key to active App', DEFAULT_PAKE_OPTIONS.activationShortcut)
1023
1030
  .option('--multi-arch', 'Only for Mac, supports both Intel and M1', DEFAULT_PAKE_OPTIONS.multiArch)
1024
- .option('--targets <string>', 'Only for Linux, option "deb" or "appimage"', DEFAULT_PAKE_OPTIONS.targets)
1025
1031
  .option('--inject [injects...]', 'Injection of .js or .css Files', DEFAULT_PAKE_OPTIONS.inject)
1026
1032
  .option('--safe-domain [domains...]', 'Domains that Require Security Configuration"', DEFAULT_PAKE_OPTIONS.safeDomain)
1027
- .option('--debug', 'Debug mode', DEFAULT_PAKE_OPTIONS.debug)
1033
+ .option('--debug', 'Debug build and more output', DEFAULT_PAKE_OPTIONS.debug)
1034
+ .addOption(new Option('--user-agent <string>', 'Custom user agent').default(DEFAULT_PAKE_OPTIONS.userAgent).hideHelp())
1035
+ .addOption(new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT_PAKE_OPTIONS.targets).hideHelp())
1036
+ .addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT_PAKE_OPTIONS.alwaysOnTop).hideHelp())
1037
+ .addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts').default(DEFAULT_PAKE_OPTIONS.disabledWebShortcuts).hideHelp())
1038
+ .addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT_PAKE_OPTIONS.showSystemTray).hideHelp())
1039
+ .addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT_PAKE_OPTIONS.systemTrayIcon).hideHelp())
1028
1040
  .version(packageJson.version, '-v, --version', 'Output the current version')
1029
1041
  .action(async (url, options) => {
1030
1042
  await checkUpdateTips();