✨ udpate ps1 to node js
This commit is contained in:
3
.github/workflows/pake-cli.yaml
vendored
3
.github/workflows/pake-cli.yaml
vendored
@@ -111,9 +111,8 @@ jobs:
|
||||
key: ${{ inputs.platform }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }}
|
||||
|
||||
- name: build with pake-cli
|
||||
shell: pwsh
|
||||
run: |
|
||||
pwsh ./script/build_with_pake_cli.ps1
|
||||
node ./script/build_with_pake_cli.js
|
||||
env:
|
||||
URL: ${{ inputs.url }}
|
||||
NAME: ${{ inputs.name }}
|
||||
|
||||
77
script/build_with_pake_cli.js
vendored
Normal file
77
script/build_with_pake_cli.js
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
const shell = require('shelljs');
|
||||
const axios = require('axios');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
console.log("Welcome to use Pake Cli~");
|
||||
console.log("\n=======================\n");
|
||||
|
||||
console.log("\n=======================");
|
||||
console.log("pake parameters is: ");
|
||||
console.log("url: ", process.env.URL);
|
||||
console.log("name: ", process.env.NAME);
|
||||
console.log("icon: ", process.env.ICON);
|
||||
console.log("height: ", process.env.HEIGHT);
|
||||
console.log("width: ", process.env.WIDTH);
|
||||
console.log("transparent: ", process.env.TRANSPARENT);
|
||||
console.log("resize: ", process.env.RESIZE);
|
||||
console.log("is multi arch? only for Mac: ", process.env.MULTI_ARCH);
|
||||
console.log("targets type? only for Linux: ", process.env.TARGETS);
|
||||
console.log("===========================\n");
|
||||
|
||||
shell.cd('node_modules/pake-cli');
|
||||
let params = `node cli.js ${process.env.URL} --name ${process.env.NAME}`;
|
||||
|
||||
if (process.env.ICON) {
|
||||
const iconPath = path.join(__dirname, 'icon');
|
||||
axios({
|
||||
method: 'get',
|
||||
url: process.env.ICON,
|
||||
responseType: 'stream'
|
||||
}).then(function (response) {
|
||||
response.data.pipe(fs.createWriteStream(iconPath));
|
||||
params = `${params} --icon ${iconPath}`;
|
||||
});
|
||||
}
|
||||
|
||||
params = `${params} --height ${process.env.HEIGHT} --width ${process.env.WIDTH}`;
|
||||
|
||||
if (process.env.TRANSPARENT === 'true') {
|
||||
params = `${params} --transparent`;
|
||||
}
|
||||
|
||||
if (process.env.FULLSCREEN === 'true') {
|
||||
params = `${params} --resize`;
|
||||
}
|
||||
|
||||
if (process.env.MULTI_ARCH === 'true') {
|
||||
shell.exec('rustup target add aarch64-apple-darwin');
|
||||
params = `${params} --multi-arch`;
|
||||
}
|
||||
|
||||
if (process.env.TARGETS) {
|
||||
params = `${params} --targets ${process.env.TARGETS}`;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
params = `${params} --show-system-tray`;
|
||||
}
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
params = `${params} --show-system-tray`;
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
params = `${params} --show-menu`;
|
||||
}
|
||||
|
||||
console.log("Pake parameters is: ", params);
|
||||
console.log("compile....");
|
||||
shell.exec(params);
|
||||
|
||||
if (!fs.existsSync('output')) {
|
||||
fs.mkdirSync('output');
|
||||
}
|
||||
shell.mv(`${process.env.NAME}.*`, 'output/');
|
||||
console.log("Build Success");
|
||||
shell.cd('../..');
|
||||
8
script/build_with_pake_cli.ps1
vendored
8
script/build_with_pake_cli.ps1
vendored
@@ -1,4 +1,4 @@
|
||||
Write-Host "Welcome to use Powershell"
|
||||
Write-Host "Welcome to use Powershell"
|
||||
Write-Host "`n======================="
|
||||
Write-Host "build for windows"
|
||||
Write-Host "make ture powershell == 7.2.10"
|
||||
@@ -15,7 +15,6 @@ Write-Host "icon: " $env:ICON
|
||||
Write-Host "height: " $env:HEIGHT
|
||||
Write-Host "width: " $env:WIDTH
|
||||
Write-Host "transparent: " $env:TRANSPARENT
|
||||
# Write-Host "fullscreen: " $env:FULLSCREEN
|
||||
Write-Host "resize: " $env:RESIZE
|
||||
Write-Host "is multi arch? only for Mac: " $env:MULTI_ARCH
|
||||
Write-Host "targets type? only for Linux: " $env:TARGETS
|
||||
@@ -50,11 +49,6 @@ if ("$env:TRANSPARENT" -eq "true") {
|
||||
${Params}="${Params} --transparent"
|
||||
}
|
||||
|
||||
# fullscreen
|
||||
# if ("$env:FULLSCREEN" -eq "true") {
|
||||
# ${Params}="${Params} --fullscreen"
|
||||
# }
|
||||
|
||||
# resize
|
||||
if ("$env:FULLSCREEN" -eq "true" ) {
|
||||
${Params}="${Params} --resize"
|
||||
|
||||
Reference in New Issue
Block a user