Skip to content

Commit 4685d3f

Browse files
committed
🐛 Fix the problem of packaging bash under Windows
1 parent fe10dc7 commit 4685d3f

File tree

4 files changed

+45
-48
lines changed

4 files changed

+45
-48
lines changed

.github/workflows/pake-cli.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ jobs:
121121
key: ${{ runner.os }}-pake-cli-${{ hashFiles('**/package.json') }}
122122

123123
- name: Install pake-cli and script dependencies
124+
shell: bash
124125
run: |
125126
if [ ! -d "node_modules/pake-cli" ]; then
126127
echo "Installing pake-cli..."

dist/cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import sharp from 'sharp';
2222
import * as psl from 'psl';
2323

2424
var name = "pake-cli";
25-
var version$1 = "3.2.1";
25+
var version$1 = "3.2.2";
2626
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
2727
var engines = {
2828
node: ">=16.0.0"
@@ -662,7 +662,7 @@ class BaseBuilder {
662662
return process.platform === 'win32' ? 600000 : 300000;
663663
}
664664
getBuildTimeout() {
665-
return 300000; // 5 minutes for build process
665+
return 900000; // 15 minutes for all builds
666666
}
667667
async prepare() {
668668
const tauriSrcPath = path.join(npmDirectory, 'src-tauri');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pake-cli",
3-
"version": "3.2.1",
3+
"version": "3.2.2",
44
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
55
"engines": {
66
"node": ">=16.0.0"

script/build_with_pake_cli.js

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -21,45 +21,6 @@ const logConfiguration = () => {
2121
console.log("===========================\n");
2222
};
2323

24-
// Build parameters construction
25-
const buildParameters = () => {
26-
const params = [
27-
"dist/cli.js",
28-
process.env.URL,
29-
"--name",
30-
process.env.NAME,
31-
"--height",
32-
process.env.HEIGHT,
33-
"--width",
34-
process.env.WIDTH,
35-
];
36-
37-
if (process.env.HIDE_TITLE_BAR === "true" && process.platform === "darwin") {
38-
params.push("--hide-title-bar");
39-
}
40-
41-
if (process.env.FULLSCREEN === "true") {
42-
params.push("--fullscreen");
43-
}
44-
45-
if (process.env.MULTI_ARCH === "true" && process.platform === "darwin") {
46-
// We'll handle rustup separately since it's a different command
47-
params.push("--multi-arch");
48-
}
49-
50-
if (process.env.TARGETS && process.platform === "linux") {
51-
params.push("--targets", process.env.TARGETS);
52-
}
53-
54-
if (process.platform === "win32" || process.platform === "linux") {
55-
params.push("--show-system-tray");
56-
}
57-
58-
return params;
59-
};
60-
61-
// Icon will be handled directly by CLI
62-
6324
// Main execution
6425
const main = async () => {
6526
try {
@@ -68,9 +29,40 @@ const main = async () => {
6829
const cliPath = path.join(process.cwd(), "node_modules/pake-cli");
6930
process.chdir(cliPath);
7031

71-
let params = buildParameters();
32+
// Build CLI parameters
33+
let params = [
34+
"dist/cli.js",
35+
process.env.URL,
36+
"--name",
37+
process.env.NAME,
38+
"--height",
39+
process.env.HEIGHT,
40+
"--width",
41+
process.env.WIDTH,
42+
];
43+
44+
if (
45+
process.env.HIDE_TITLE_BAR === "true" &&
46+
process.platform === "darwin"
47+
) {
48+
params.push("--hide-title-bar");
49+
}
50+
51+
if (process.env.FULLSCREEN === "true") {
52+
params.push("--fullscreen");
53+
}
7254

73-
// Multi-arch target is now handled in GitHub Actions workflow
55+
if (process.env.MULTI_ARCH === "true" && process.platform === "darwin") {
56+
params.push("--multi-arch");
57+
}
58+
59+
if (process.env.TARGETS && process.platform === "linux") {
60+
params.push("--targets", process.env.TARGETS);
61+
}
62+
63+
if (process.platform === "win32" || process.platform === "linux") {
64+
params.push("--show-system-tray");
65+
}
7466

7567
// Add icon parameter if provided - CLI will handle download and conversion
7668
if (process.env.ICON && process.env.ICON !== "") {
@@ -84,8 +76,9 @@ const main = async () => {
8476
console.log("Pake parameters:", params.join(" "));
8577
console.log("Compiling....");
8678

87-
// Execute the CLI command
88-
await execa("node", params, { stdio: "inherit" });
79+
// Execute the CLI command with extended timeout
80+
const timeout = 900000; // 15 minutes for all builds
81+
await execa("node", params, { stdio: "inherit", timeout });
8982

9083
// Create output directory if it doesn't exist
9184
if (!fs.existsSync("output")) {
@@ -117,7 +110,8 @@ const main = async () => {
117110
for (const file of bundleFiles) {
118111
const srcPath = path.join(buildPath, file);
119112
const destPath = path.join("output", path.basename(file));
120-
await execa("cp", [srcPath, destPath]);
113+
// Use fs.copyFileSync for cross-platform compatibility
114+
fs.copyFileSync(srcPath, destPath);
121115
}
122116
break; // Found files, no need to check other paths
123117
}
@@ -129,7 +123,9 @@ const main = async () => {
129123
let foundFiles = false;
130124
for (const file of files) {
131125
if (namePattern.test(file)) {
132-
await execa("mv", [file, path.join("output", file)]);
126+
// Use fs for cross-platform file operations
127+
const destPath = path.join("output", file);
128+
fs.renameSync(file, destPath);
133129
foundFiles = true;
134130
}
135131
}

0 commit comments

Comments
 (0)