pake-cli 2.4.0-beta → 2.4.0

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
@@ -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.4.0-beta";
23
+ var version = "2.4.0";
24
24
  var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
25
25
  var engines = {
26
26
  node: ">=16.0.0"
@@ -127,7 +127,7 @@ var windows = [
127
127
  {
128
128
  url: "https://weread.qq.com",
129
129
  url_type: "web",
130
- transparent: true,
130
+ hide_title_bar: true,
131
131
  fullscreen: false,
132
132
  width: 1200,
133
133
  height: 780,
@@ -474,17 +474,18 @@ async function combineFiles(files, output) {
474
474
  }
475
475
 
476
476
  async function mergeConfig(url, options, tauriConf) {
477
- const { width, height, fullscreen, transparent, alwaysOnTop, disabledWebShortcuts, 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;
478
478
  const { platform } = process;
479
479
  // Set Windows parameters.
480
480
  const tauriConfWindowOptions = {
481
481
  width,
482
482
  height,
483
483
  fullscreen,
484
- transparent,
485
- alwaysOnTop,
486
- disabledWebShortcuts,
487
484
  resizable,
485
+ hide_title_bar: hideTitleBar,
486
+ activation_shortcut: activationShortcut,
487
+ always_on_top: alwaysOnTop,
488
+ disabled_web_shortcuts: disabledWebShortcuts,
488
489
  };
489
490
  Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
490
491
  tauriConf.package.productName = name;
@@ -734,7 +735,8 @@ class BaseBuilder {
734
735
  return this.options.debug ? 'npm run build:debug' : 'npm run build';
735
736
  }
736
737
  getBasePath() {
737
- return 'src-tauri/target/release/bundle/';
738
+ const basePath = this.options.debug ? 'debug' : 'release';
739
+ return `src-tauri/target/${basePath}/bundle/`;
738
740
  }
739
741
  getBuildAppPath(npmDirectory, fileName, fileType) {
740
742
  return path.join(npmDirectory, this.getBasePath(), fileType.toLowerCase(), `${fileName}.${fileType}`);
@@ -828,7 +830,7 @@ const DEFAULT_PAKE_OPTIONS = {
828
830
  width: 1200,
829
831
  fullscreen: false,
830
832
  resizable: true,
831
- transparent: false,
833
+ hideTitleBar: false,
832
834
  alwaysOnTop: false,
833
835
  disabledWebShortcuts: false,
834
836
  activationShortcut: '',
@@ -1023,7 +1025,7 @@ program
1023
1025
  .option('--width <number>', 'Window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width)
1024
1026
  .option('--height <number>', 'Window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height)
1025
1027
  .option('--fullscreen', 'Start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
1026
- .option('--hide-title-bar', 'Only for Mac, hide title bar', DEFAULT_PAKE_OPTIONS.transparent)
1028
+ .option('--hide-title-bar', 'Only for Mac, hide title bar', DEFAULT_PAKE_OPTIONS.hideTitleBar)
1027
1029
  .option('--activation-shortcut <string>', 'Shortcut key to active App', DEFAULT_PAKE_OPTIONS.activationShortcut)
1028
1030
  .option('--multi-arch', 'Only for Mac, supports both Intel and M1', DEFAULT_PAKE_OPTIONS.multiArch)
1029
1031
  .option('--inject [injects...]', 'Injection of .js or .css Files', DEFAULT_PAKE_OPTIONS.inject)
@@ -1035,7 +1037,6 @@ program
1035
1037
  .addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts').default(DEFAULT_PAKE_OPTIONS.disabledWebShortcuts).hideHelp())
1036
1038
  .addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT_PAKE_OPTIONS.showSystemTray).hideHelp())
1037
1039
  .addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT_PAKE_OPTIONS.systemTrayIcon).hideHelp())
1038
- .addOption(new Option('--transparent', 'Only for Mac, hide title bar').default(DEFAULT_PAKE_OPTIONS.transparent).hideHelp())
1039
1040
  .version(packageJson.version, '-v, --version', 'Output the current version')
1040
1041
  .action(async (url, options) => {
1041
1042
  await checkUpdateTips();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "2.4.0-beta",
3
+ "version": "2.4.0",
4
4
  "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
5
5
  "engines": {
6
6
  "node": ">=16.0.0"
@@ -3,7 +3,7 @@
3
3
  {
4
4
  "url": "https://weread.qq.com",
5
5
  "url_type": "web",
6
- "transparent": true,
6
+ "hide_title_bar": true,
7
7
  "fullscreen": false,
8
8
  "width": 1200,
9
9
  "height": 780,
@@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
3
3
  #[derive(Debug, Serialize, Deserialize)]
4
4
  pub struct WindowConfig {
5
5
  pub url: String,
6
- pub transparent: bool,
6
+ pub hide_title_bar: bool,
7
7
  pub fullscreen: bool,
8
8
  pub width: f64,
9
9
  pub height: f64,
@@ -42,7 +42,7 @@ pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Wind
42
42
 
43
43
  #[cfg(target_os = "macos")]
44
44
  {
45
- let title_bar_style = if window_config.transparent {
45
+ let title_bar_style = if window_config.hide_title_bar {
46
46
  TitleBarStyle::Overlay
47
47
  } else {
48
48
  TitleBarStyle::Visible
@@ -412,7 +412,7 @@ window.addEventListener('DOMContentLoaded', _event => {
412
412
  }
413
413
  `;
414
414
  const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
415
- if (window['pakeConfig']?.transparent && isMac) {
415
+ if (window['pakeConfig']?.hide_title_bar && isMac) {
416
416
  const topPaddingStyleElement = document.createElement('style');
417
417
  topPaddingStyleElement.innerHTML = topPaddingCSS;
418
418
  document.head.appendChild(topPaddingStyleElement);