更新rust代码中的名称为conf中变量
This commit is contained in:
2
bin/builders/common.ts
vendored
2
bin/builders/common.ts
vendored
@@ -42,7 +42,7 @@ export async function mergeTauriConfig(
|
|||||||
tauriConf.tauri.bundle.identifier = identifier;
|
tauriConf.tauri.bundle.identifier = identifier;
|
||||||
tauriConf.tauri.bundle.icon = [options.icon];
|
tauriConf.tauri.bundle.icon = [options.icon];
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
const ico_path = path.join(npmDirectory, 'src-tauri/png/weread_32.ico');
|
const ico_path = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}_32.ico`);
|
||||||
await fs.copyFile(options.icon, ico_path);
|
await fs.copyFile(options.icon, ico_path);
|
||||||
}
|
}
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
|
|||||||
4
dist/cli.js
vendored
4
dist/cli.js
vendored
@@ -1619,7 +1619,7 @@ function mergeTauriConfig(url, options, tauriConf) {
|
|||||||
tauriConf.tauri.bundle.identifier = identifier;
|
tauriConf.tauri.bundle.identifier = identifier;
|
||||||
tauriConf.tauri.bundle.icon = [options.icon];
|
tauriConf.tauri.bundle.icon = [options.icon];
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
const ico_path = path.join(npmDirectory, 'src-tauri/png/weread_32.ico');
|
const ico_path = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}_32.ico`);
|
||||||
yield fs.copyFile(options.icon, ico_path);
|
yield fs.copyFile(options.icon, ico_path);
|
||||||
}
|
}
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
@@ -2144,7 +2144,7 @@ class BuilderFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var name = "pake-cli";
|
var name = "pake-cli";
|
||||||
var version = "1.0.0-beta.1";
|
var version = "0.1.0";
|
||||||
var description = "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.";
|
var description = "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.";
|
||||||
var bin = {
|
var bin = {
|
||||||
pake: "./cli.js"
|
pake: "./cli.js"
|
||||||
|
|||||||
3
script/build.bat
vendored
3
script/build.bat
vendored
@@ -54,8 +54,6 @@ for /f "skip=1 tokens=1-4 delims=," %%i in (app.csv) do (
|
|||||||
::replace pacakge name
|
::replace pacakge name
|
||||||
.\script\sd.exe !old_title! !title! src-tauri\tauri.conf.json
|
.\script\sd.exe !old_title! !title! src-tauri\tauri.conf.json
|
||||||
.\script\sd.exe !old_name! !name! src-tauri\tauri.windows.conf.json
|
.\script\sd.exe !old_name! !name! src-tauri\tauri.windows.conf.json
|
||||||
echo update ico with 32x32 pictue
|
|
||||||
.\script\sd.exe !old_name! !name! src-tauri\src\main.rs
|
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
::update package info
|
::update package info
|
||||||
@@ -97,4 +95,3 @@ echo "output dir is output\windows"
|
|||||||
.\script\sd.exe %url% %init_url% src-tauri\tauri.conf.json
|
.\script\sd.exe %url% %init_url% src-tauri\tauri.conf.json
|
||||||
.\script\sd.exe %title% %init_title% src-tauri\tauri.conf.json
|
.\script\sd.exe %title% %init_title% src-tauri\tauri.conf.json
|
||||||
.\script\sd.exe %name% %init_name% src-tauri\tauri.windows.conf.json
|
.\script\sd.exe %name% %init_name% src-tauri\tauri.windows.conf.json
|
||||||
.\script\sd.exe %name% %init_name% src-tauri\src\main.rs
|
|
||||||
|
|||||||
4
script/build.sh
vendored
4
script/build.sh
vendored
@@ -69,8 +69,8 @@ do
|
|||||||
# replace package info
|
# replace package info
|
||||||
$sd "${old_url}" "${url}" src-tauri/tauri.conf.json
|
$sd "${old_url}" "${url}" src-tauri/tauri.conf.json
|
||||||
$sd "${old_name}" "${package_name}" src-tauri/tauri.conf.json
|
$sd "${old_name}" "${package_name}" src-tauri/tauri.conf.json
|
||||||
echo "update ico with 32x32 pictue"
|
# echo "update ico with 32x32 pictue"
|
||||||
$sd "${old_name}" "${package_name}" src-tauri/src/main.rs
|
# $sd "${old_name}" "${package_name}" src-tauri/src/main.rs
|
||||||
|
|
||||||
# for apple, need replace title
|
# for apple, need replace title
|
||||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ fn main() -> wry::Result<()> {
|
|||||||
..
|
..
|
||||||
} = windows_config.unwrap_or_default();
|
} = windows_config.unwrap_or_default();
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
let (package_name, windows_config) = get_windows_config();
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
let WindowConfig {
|
let WindowConfig {
|
||||||
url,
|
url,
|
||||||
width,
|
width,
|
||||||
@@ -102,7 +104,7 @@ fn main() -> wry::Result<()> {
|
|||||||
resizable,
|
resizable,
|
||||||
fullscreen,
|
fullscreen,
|
||||||
..
|
..
|
||||||
} = get_windows_config().unwrap_or_default();
|
} = windows_config.unwrap_or_default();
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let WindowConfig {
|
let WindowConfig {
|
||||||
url,
|
url,
|
||||||
@@ -112,7 +114,7 @@ fn main() -> wry::Result<()> {
|
|||||||
transparent,
|
transparent,
|
||||||
fullscreen,
|
fullscreen,
|
||||||
..
|
..
|
||||||
} = get_windows_config().unwrap_or_default();
|
} = get_windows_config().1.unwrap_or_default();
|
||||||
let event_loop = EventLoop::new();
|
let event_loop = EventLoop::new();
|
||||||
|
|
||||||
let common_window = WindowBuilder::new()
|
let common_window = WindowBuilder::new()
|
||||||
@@ -125,7 +127,12 @@ fn main() -> wry::Result<()> {
|
|||||||
})
|
})
|
||||||
.with_inner_size(wry::application::dpi::LogicalSize::new(width, height));
|
.with_inner_size(wry::application::dpi::LogicalSize::new(width, height));
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let icon = load_icon(std::path::Path::new("png/weread_32.ico"));
|
let package_name = package_name.expect("can't get package name in config file").to_lowercase();
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
let icon_path = format!("png/{}_32.ico", package_name);
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
let icon = load_icon(std::path::Path::new(&icon_path));
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let window = common_window
|
let window = common_window
|
||||||
|
|||||||
Reference in New Issue
Block a user