🐛 Fix the problem of packaging bash under Windows
This commit is contained in:
1
.github/workflows/pake-cli.yaml
vendored
1
.github/workflows/pake-cli.yaml
vendored
@@ -121,6 +121,7 @@ jobs:
|
|||||||
key: ${{ runner.os }}-pake-cli-${{ hashFiles('**/package.json') }}
|
key: ${{ runner.os }}-pake-cli-${{ hashFiles('**/package.json') }}
|
||||||
|
|
||||||
- name: Install pake-cli and script dependencies
|
- name: Install pake-cli and script dependencies
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [ ! -d "node_modules/pake-cli" ]; then
|
if [ ! -d "node_modules/pake-cli" ]; then
|
||||||
echo "Installing pake-cli..."
|
echo "Installing pake-cli..."
|
||||||
|
|||||||
4
dist/cli.js
vendored
4
dist/cli.js
vendored
@@ -22,7 +22,7 @@ import sharp from 'sharp';
|
|||||||
import * as psl from 'psl';
|
import * as psl from 'psl';
|
||||||
|
|
||||||
var name = "pake-cli";
|
var name = "pake-cli";
|
||||||
var version$1 = "3.2.1";
|
var version$1 = "3.2.2";
|
||||||
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
|
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
|
||||||
var engines = {
|
var engines = {
|
||||||
node: ">=16.0.0"
|
node: ">=16.0.0"
|
||||||
@@ -662,7 +662,7 @@ class BaseBuilder {
|
|||||||
return process.platform === 'win32' ? 600000 : 300000;
|
return process.platform === 'win32' ? 600000 : 300000;
|
||||||
}
|
}
|
||||||
getBuildTimeout() {
|
getBuildTimeout() {
|
||||||
return 300000; // 5 minutes for build process
|
return 900000; // 15 minutes for all builds
|
||||||
}
|
}
|
||||||
async prepare() {
|
async prepare() {
|
||||||
const tauriSrcPath = path.join(npmDirectory, 'src-tauri');
|
const tauriSrcPath = path.join(npmDirectory, 'src-tauri');
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pake-cli",
|
"name": "pake-cli",
|
||||||
"version": "3.2.1",
|
"version": "3.2.2",
|
||||||
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
|
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0"
|
"node": ">=16.0.0"
|
||||||
|
|||||||
86
script/build_with_pake_cli.js
vendored
86
script/build_with_pake_cli.js
vendored
@@ -21,45 +21,6 @@ const logConfiguration = () => {
|
|||||||
console.log("===========================\n");
|
console.log("===========================\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
// Build parameters construction
|
|
||||||
const buildParameters = () => {
|
|
||||||
const params = [
|
|
||||||
"dist/cli.js",
|
|
||||||
process.env.URL,
|
|
||||||
"--name",
|
|
||||||
process.env.NAME,
|
|
||||||
"--height",
|
|
||||||
process.env.HEIGHT,
|
|
||||||
"--width",
|
|
||||||
process.env.WIDTH,
|
|
||||||
];
|
|
||||||
|
|
||||||
if (process.env.HIDE_TITLE_BAR === "true" && process.platform === "darwin") {
|
|
||||||
params.push("--hide-title-bar");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env.FULLSCREEN === "true") {
|
|
||||||
params.push("--fullscreen");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env.MULTI_ARCH === "true" && process.platform === "darwin") {
|
|
||||||
// We'll handle rustup separately since it's a different command
|
|
||||||
params.push("--multi-arch");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env.TARGETS && process.platform === "linux") {
|
|
||||||
params.push("--targets", process.env.TARGETS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.platform === "win32" || process.platform === "linux") {
|
|
||||||
params.push("--show-system-tray");
|
|
||||||
}
|
|
||||||
|
|
||||||
return params;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Icon will be handled directly by CLI
|
|
||||||
|
|
||||||
// Main execution
|
// Main execution
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -68,9 +29,40 @@ const main = async () => {
|
|||||||
const cliPath = path.join(process.cwd(), "node_modules/pake-cli");
|
const cliPath = path.join(process.cwd(), "node_modules/pake-cli");
|
||||||
process.chdir(cliPath);
|
process.chdir(cliPath);
|
||||||
|
|
||||||
let params = buildParameters();
|
// Build CLI parameters
|
||||||
|
let params = [
|
||||||
|
"dist/cli.js",
|
||||||
|
process.env.URL,
|
||||||
|
"--name",
|
||||||
|
process.env.NAME,
|
||||||
|
"--height",
|
||||||
|
process.env.HEIGHT,
|
||||||
|
"--width",
|
||||||
|
process.env.WIDTH,
|
||||||
|
];
|
||||||
|
|
||||||
// Multi-arch target is now handled in GitHub Actions workflow
|
if (
|
||||||
|
process.env.HIDE_TITLE_BAR === "true" &&
|
||||||
|
process.platform === "darwin"
|
||||||
|
) {
|
||||||
|
params.push("--hide-title-bar");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.FULLSCREEN === "true") {
|
||||||
|
params.push("--fullscreen");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.MULTI_ARCH === "true" && process.platform === "darwin") {
|
||||||
|
params.push("--multi-arch");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.TARGETS && process.platform === "linux") {
|
||||||
|
params.push("--targets", process.env.TARGETS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.platform === "win32" || process.platform === "linux") {
|
||||||
|
params.push("--show-system-tray");
|
||||||
|
}
|
||||||
|
|
||||||
// Add icon parameter if provided - CLI will handle download and conversion
|
// Add icon parameter if provided - CLI will handle download and conversion
|
||||||
if (process.env.ICON && process.env.ICON !== "") {
|
if (process.env.ICON && process.env.ICON !== "") {
|
||||||
@@ -84,8 +76,9 @@ const main = async () => {
|
|||||||
console.log("Pake parameters:", params.join(" "));
|
console.log("Pake parameters:", params.join(" "));
|
||||||
console.log("Compiling....");
|
console.log("Compiling....");
|
||||||
|
|
||||||
// Execute the CLI command
|
// Execute the CLI command with extended timeout
|
||||||
await execa("node", params, { stdio: "inherit" });
|
const timeout = 900000; // 15 minutes for all builds
|
||||||
|
await execa("node", params, { stdio: "inherit", timeout });
|
||||||
|
|
||||||
// Create output directory if it doesn't exist
|
// Create output directory if it doesn't exist
|
||||||
if (!fs.existsSync("output")) {
|
if (!fs.existsSync("output")) {
|
||||||
@@ -117,7 +110,8 @@ const main = async () => {
|
|||||||
for (const file of bundleFiles) {
|
for (const file of bundleFiles) {
|
||||||
const srcPath = path.join(buildPath, file);
|
const srcPath = path.join(buildPath, file);
|
||||||
const destPath = path.join("output", path.basename(file));
|
const destPath = path.join("output", path.basename(file));
|
||||||
await execa("cp", [srcPath, destPath]);
|
// Use fs.copyFileSync for cross-platform compatibility
|
||||||
|
fs.copyFileSync(srcPath, destPath);
|
||||||
}
|
}
|
||||||
break; // Found files, no need to check other paths
|
break; // Found files, no need to check other paths
|
||||||
}
|
}
|
||||||
@@ -129,7 +123,9 @@ const main = async () => {
|
|||||||
let foundFiles = false;
|
let foundFiles = false;
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (namePattern.test(file)) {
|
if (namePattern.test(file)) {
|
||||||
await execa("mv", [file, path.join("output", file)]);
|
// Use fs for cross-platform file operations
|
||||||
|
const destPath = path.join("output", file);
|
||||||
|
fs.renameSync(file, destPath);
|
||||||
foundFiles = true;
|
foundFiles = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user