Skip to content

Commit

Permalink
🐛 change ps1 to node
Browse files Browse the repository at this point in the history
  • Loading branch information
tw93 committed Aug 28, 2023
1 parent c216a72 commit 7b027ed
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/pake-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
27 changes: 17 additions & 10 deletions script/build_with_pake_cli.js → script/build_with_pake_cli.mjs
Original file line number Diff line number Diff line change
@@ -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=======================");
Expand All @@ -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) {
Expand All @@ -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`;
}

Expand All @@ -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('../..');

0 comments on commit 7b027ed

Please sign in to comment.