🐛 GitHub action cli packaging issue fixed
This commit is contained in:
11
.github/workflows/pake-cli.yaml
vendored
11
.github/workflows/pake-cli.yaml
vendored
@@ -113,18 +113,11 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-node-
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
- name: Cache pake-cli installation
|
|
||||||
uses: actions/cache@v4
|
|
||||||
id: pake_cache
|
|
||||||
with:
|
|
||||||
path: node_modules/pake-cli
|
|
||||||
key: ${{ runner.os }}-pake-cli-${{ hashFiles('**/package.json') }}-${{ inputs.multi_arch }}
|
|
||||||
|
|
||||||
- name: Install pake-cli
|
- name: Install pake-cli
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "Installing pake-cli..."
|
echo "Installing latest pake-cli..."
|
||||||
npm install pake-cli --no-package-lock
|
npm install pake-cli@latest --no-package-lock
|
||||||
|
|
||||||
# Verify installation
|
# Verify installation
|
||||||
if [ ! -d "node_modules/pake-cli" ]; then
|
if [ ! -d "node_modules/pake-cli" ]; then
|
||||||
|
|||||||
11
bin/builders/BaseBuilder.ts
vendored
11
bin/builders/BaseBuilder.ts
vendored
@@ -169,18 +169,25 @@ export default abstract class BaseBuilder {
|
|||||||
fullCommand += ' --bundles app';
|
fullCommand += ' --bundles app';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add features
|
||||||
|
const features = ['cli-build'];
|
||||||
|
|
||||||
// Add macos-proxy feature for modern macOS (Darwin 23+ = macOS 14+)
|
// Add macos-proxy feature for modern macOS (Darwin 23+ = macOS 14+)
|
||||||
if (IS_MAC) {
|
if (IS_MAC) {
|
||||||
const macOSVersion = this.getMacOSMajorVersion();
|
const macOSVersion = this.getMacOSMajorVersion();
|
||||||
if (macOSVersion >= 23) {
|
if (macOSVersion >= 23) {
|
||||||
fullCommand += ' --features macos-proxy';
|
features.push('macos-proxy');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (features.length > 0) {
|
||||||
|
fullCommand += ` --features ${features.join(',')}`;
|
||||||
|
}
|
||||||
|
|
||||||
return fullCommand;
|
return fullCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getMacOSMajorVersion(): number {
|
protected getMacOSMajorVersion(): number {
|
||||||
try {
|
try {
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const release = os.release();
|
const release = os.release();
|
||||||
|
|||||||
33
bin/builders/MacBuilder.ts
vendored
33
bin/builders/MacBuilder.ts
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
import path from 'path';
|
||||||
import tauriConfig from '@/helpers/tauriConfig';
|
import tauriConfig from '@/helpers/tauriConfig';
|
||||||
import { PakeAppOptions } from '@/types';
|
import { PakeAppOptions } from '@/types';
|
||||||
import BaseBuilder from './BaseBuilder';
|
import BaseBuilder from './BaseBuilder';
|
||||||
@@ -33,9 +34,35 @@ export default class MacBuilder extends BaseBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected getBuildCommand(): string {
|
protected getBuildCommand(): string {
|
||||||
return this.options.multiArch
|
if (this.options.multiArch) {
|
||||||
? 'npm run build:mac'
|
const baseCommand = this.options.debug
|
||||||
: super.getBuildCommand();
|
? 'npm run tauri build -- --debug'
|
||||||
|
: 'npm run tauri build --';
|
||||||
|
|
||||||
|
// Use temporary config directory to avoid modifying source files
|
||||||
|
const configPath = path.join(
|
||||||
|
'src-tauri',
|
||||||
|
'.pake',
|
||||||
|
'tauri.conf.json',
|
||||||
|
);
|
||||||
|
let fullCommand = `${baseCommand} --target universal-apple-darwin -c "${configPath}"`;
|
||||||
|
|
||||||
|
// Add features
|
||||||
|
const features = ['cli-build'];
|
||||||
|
|
||||||
|
// Add macos-proxy feature for modern macOS (Darwin 23+ = macOS 14+)
|
||||||
|
const macOSVersion = this.getMacOSMajorVersion();
|
||||||
|
if (macOSVersion >= 23) {
|
||||||
|
features.push('macos-proxy');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (features.length > 0) {
|
||||||
|
fullCommand += ` --features ${features.join(',')}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fullCommand;
|
||||||
|
}
|
||||||
|
return super.getBuildCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getBasePath(): string {
|
protected getBasePath(): string {
|
||||||
|
|||||||
16
bin/helpers/tauriConfig.ts
vendored
16
bin/helpers/tauriConfig.ts
vendored
@@ -1,8 +1,14 @@
|
|||||||
import pakeConf from '../../src-tauri/pake.json';
|
import path from 'path';
|
||||||
import CommonConf from '../../src-tauri/tauri.conf.json';
|
import fsExtra from 'fs-extra';
|
||||||
import WinConf from '../../src-tauri/tauri.windows.conf.json';
|
import { npmDirectory } from '@/utils/dir';
|
||||||
import MacConf from '../../src-tauri/tauri.macos.conf.json';
|
|
||||||
import LinuxConf from '../../src-tauri/tauri.linux.conf.json';
|
// Load configs from npm package directory, not from project source
|
||||||
|
const tauriSrcDir = path.join(npmDirectory, 'src-tauri');
|
||||||
|
const pakeConf = fsExtra.readJSONSync(path.join(tauriSrcDir, 'pake.json'));
|
||||||
|
const CommonConf = fsExtra.readJSONSync(path.join(tauriSrcDir, 'tauri.conf.json'));
|
||||||
|
const WinConf = fsExtra.readJSONSync(path.join(tauriSrcDir, 'tauri.windows.conf.json'));
|
||||||
|
const MacConf = fsExtra.readJSONSync(path.join(tauriSrcDir, 'tauri.macos.conf.json'));
|
||||||
|
const LinuxConf = fsExtra.readJSONSync(path.join(tauriSrcDir, 'tauri.linux.conf.json'));
|
||||||
|
|
||||||
const platformConfigs = {
|
const platformConfigs = {
|
||||||
win32: WinConf,
|
win32: WinConf,
|
||||||
|
|||||||
19
script/build_with_pake_cli.js
vendored
19
script/build_with_pake_cli.js
vendored
@@ -47,6 +47,25 @@ const main = async () => {
|
|||||||
console.log("Cleaned previous .pake directory for fresh build");
|
console.log("Cleaned previous .pake directory for fresh build");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Also clean any potential target directories that might contain cached configs
|
||||||
|
const targetDirs = [
|
||||||
|
"src-tauri/target",
|
||||||
|
"src-tauri/target/debug",
|
||||||
|
"src-tauri/target/release",
|
||||||
|
"src-tauri/target/universal-apple-darwin"
|
||||||
|
];
|
||||||
|
|
||||||
|
targetDirs.forEach(dir => {
|
||||||
|
if (fs.existsSync(dir)) {
|
||||||
|
// Only remove .pake subdirectories, not the entire target directory
|
||||||
|
const targetPakeDir = path.join(dir, ".pake");
|
||||||
|
if (fs.existsSync(targetPakeDir)) {
|
||||||
|
fs.rmSync(targetPakeDir, { recursive: true, force: true });
|
||||||
|
console.log(`Cleaned .pake directory in ${dir}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Build CLI parameters
|
// Build CLI parameters
|
||||||
let params = [
|
let params = [
|
||||||
"dist/cli.js",
|
"dist/cli.js",
|
||||||
|
|||||||
Reference in New Issue
Block a user