🐛 change ps1 to node

This commit is contained in:
Tw93
2023-08-28 17:24:01 +08:00
parent c216a725e2
commit 7b027edb6a
2 changed files with 23 additions and 11 deletions

View File

@@ -110,9 +110,14 @@ jobs:
node_modules/pake-cli/src-tauri/target/
key: ${{ inputs.platform }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }}
- name: Install dependencies
run: |
npm install shelljs
npm install axios
- name: build with pake-cli
run: |
node ./script/build_with_pake_cli.js
node ./script/build_with_pake_cli.mjs
env:
URL: ${{ inputs.url }}
NAME: ${{ inputs.name }}

View File

@@ -1,9 +1,16 @@
const shell = require('shelljs');
const axios = require('axios');
const fs = require('fs');
const path = require('path');
import { exec, cd, mv } from 'shelljs';
import axios from 'axios';
import { promises as fs } from 'fs';
import { fileURLToPath } from 'url';
import path, { dirname } from 'path';
console.log("Welcome to use Pake Cli~");
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
console.log("Welcome to use Pake Cli");
console.log("\n=======================");
console.log("build for app");
console.log("Node.js info in your localhost ", process.version);
console.log("\n=======================\n");
console.log("\n=======================");
@@ -19,7 +26,7 @@ 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');
cd('node_modules/pake-cli');
let params = `node cli.js ${process.env.URL} --name ${process.env.NAME}`;
if (process.env.ICON) {
@@ -45,7 +52,7 @@ if (process.env.FULLSCREEN === 'true') {
}
if (process.env.MULTI_ARCH === 'true') {
shell.exec('rustup target add aarch64-apple-darwin');
exec('rustup target add aarch64-apple-darwin');
params = `${params} --multi-arch`;
}
@@ -67,11 +74,11 @@ if (process.platform === 'darwin') {
console.log("Pake parameters is: ", params);
console.log("compile....");
shell.exec(params);
exec(params);
if (!fs.existsSync('output')) {
fs.mkdirSync('output');
}
shell.mv(`${process.env.NAME}.*`, 'output/');
mv(`${process.env.NAME}.*`, 'output/');
console.log("Build Success");
shell.cd('../..');
cd('../..');