diff --git a/.github/workflows/pake-cli.yaml b/.github/workflows/pake-cli.yaml index e9ee51b..fd4b899 100644 --- a/.github/workflows/pake-cli.yaml +++ b/.github/workflows/pake-cli.yaml @@ -118,18 +118,32 @@ jobs: id: pake_cache with: path: node_modules/pake-cli - key: ${{ runner.os }}-pake-cli-${{ hashFiles('**/package.json') }} + key: ${{ runner.os }}-pake-cli-${{ hashFiles('**/package.json') }}-${{ inputs.multi_arch }} - name: Install pake-cli and script dependencies shell: bash run: | + echo "Checking pake-cli installation..." if [ ! -d "node_modules/pake-cli" ]; then echo "Installing pake-cli..." - npm install pake-cli + npm install pake-cli --no-package-lock else echo "pake-cli found in cache" fi + + # Always install script dependencies + echo "Installing script dependencies..." npm install execa axios --no-package-lock + + # Verify installation + if [ ! -d "node_modules/pake-cli" ]; then + echo "Error: Failed to install pake-cli" + exit 1 + fi + + echo "Listing pake-cli contents:" + ls -la node_modules/pake-cli/ | head -5 + echo "pake-cli installation verified" - name: Rust cache restore uses: actions/cache/restore@v4.2.0 diff --git a/script/build_with_pake_cli.js b/script/build_with_pake_cli.js index 9539ce1..7925bd1 100644 --- a/script/build_with_pake_cli.js +++ b/script/build_with_pake_cli.js @@ -26,8 +26,35 @@ const main = async () => { logConfiguration(); const cliPath = path.join(process.cwd(), "node_modules/pake-cli"); + + // Check if pake-cli directory exists + if (!fs.existsSync(cliPath)) { + console.error("Error: pake-cli not found at", cliPath); + console.error("Please make sure pake-cli is installed: npm install pake-cli"); + process.exit(1); + } + process.chdir(cliPath); + // Clean up any previous configuration to ensure fresh build + const pakeDirPath = path.join("src-tauri", ".pake"); + + // Remove .pake directory to force fresh config generation + if (fs.existsSync(pakeDirPath)) { + fs.rmSync(pakeDirPath, { recursive: true, force: true }); + console.log("Cleaned previous .pake directory"); + } + + // Fix hardcoded default config in npm package + const defaultConfigPath = path.join("src-tauri", "tauri.conf.json"); + if (fs.existsSync(defaultConfigPath)) { + const defaultConfig = JSON.parse(fs.readFileSync(defaultConfigPath, 'utf8')); + defaultConfig.productName = process.env.NAME; + defaultConfig.identifier = `com.pake.${process.env.NAME.toLowerCase()}`; + fs.writeFileSync(defaultConfigPath, JSON.stringify(defaultConfig, null, 2)); + console.log(`Fixed default config: productName -> ${process.env.NAME}`); + } + // Build CLI parameters let params = [ "dist/cli.js", @@ -76,9 +103,8 @@ const main = async () => { console.log("Expected app name:", process.env.NAME); console.log("Compiling...."); - // Execute the CLI command with extended timeout - const timeout = 900000; // 15 minutes for all builds - await execa("node", params, { stdio: "inherit", timeout }); + // Execute the CLI command + await execa("node", params, { stdio: "inherit" }); // Create output directory and move built files if (!fs.existsSync("output")) {