pake-cli 0.0.1-beta.12 → 0.0.1-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/builders/MacBuilder.ts +8 -4
- package/dist/cli.js +7 -5
- package/package.json +3 -2
|
@@ -8,6 +8,8 @@ import appRootPath from 'app-root-path';
|
|
|
8
8
|
import { shellExec } from '@/utils/shell.js';
|
|
9
9
|
import tauriConf from '../../src-tauri/tauri.conf.json';
|
|
10
10
|
import { dir } from 'tmp-promise';
|
|
11
|
+
import { packageDirectory } from 'pkg-dir';
|
|
12
|
+
import { fileURLToPath } from 'url';
|
|
11
13
|
|
|
12
14
|
export default class MacBuilder implements IBuilder {
|
|
13
15
|
async prepare() {
|
|
@@ -55,12 +57,14 @@ export default class MacBuilder implements IBuilder {
|
|
|
55
57
|
const configJsonPath = `${dirPath}/config.json`;
|
|
56
58
|
await fs.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf), 'utf-8'));
|
|
57
59
|
|
|
58
|
-
const
|
|
60
|
+
const npmDirectory = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
61
|
+
const code = await shellExec(`${path.join(npmDirectory, 'node_modules/@tauri-apps/cli/tauri.js')} build --config ${configJsonPath} --target universal-apple-darwin`);
|
|
59
62
|
const dmgName = `${name}_${'0.2.0'}_universal.dmg`;
|
|
60
|
-
|
|
63
|
+
const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
|
|
64
|
+
await fs.copyFile(appPath, path.resolve(dmgName));
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
getBuildedAppPath(dmgName: string) {
|
|
64
|
-
return
|
|
67
|
+
getBuildedAppPath(npmDirectory: string, dmgName: string) {
|
|
68
|
+
return path.join(npmDirectory, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
|
|
65
69
|
}
|
|
66
70
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Commander from 'commander';
|
|
2
2
|
import { program } from 'commander';
|
|
3
|
-
import url from 'url';
|
|
3
|
+
import url, { fileURLToPath } from 'url';
|
|
4
4
|
import isurl from 'is-url';
|
|
5
5
|
import crypto from 'crypto';
|
|
6
6
|
import axios from 'axios';
|
|
@@ -359,13 +359,15 @@ class MacBuilder {
|
|
|
359
359
|
const { path: dirPath } = yield dir();
|
|
360
360
|
const configJsonPath = `${dirPath}/config.json`;
|
|
361
361
|
yield fs.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf), 'utf-8'));
|
|
362
|
-
|
|
362
|
+
const npmDirectory = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
363
|
+
yield shellExec(`${path.join(npmDirectory, 'node_modules/@tauri-apps/cli/tauri.js')} build --config ${configJsonPath} --target universal-apple-darwin`);
|
|
363
364
|
const dmgName = `${name}_${'0.2.0'}_universal.dmg`;
|
|
364
|
-
|
|
365
|
+
const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
|
|
366
|
+
yield fs.copyFile(appPath, path.resolve(dmgName));
|
|
365
367
|
});
|
|
366
368
|
}
|
|
367
|
-
getBuildedAppPath(dmgName) {
|
|
368
|
-
return
|
|
369
|
+
getBuildedAppPath(npmDirectory, dmgName) {
|
|
370
|
+
return path.join(npmDirectory, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
|
|
369
371
|
}
|
|
370
372
|
}
|
|
371
373
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pake-cli",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.14",
|
|
4
4
|
"description": "用 Rust 来打包你的 App,底层使用 Tauri,当前支持微信读书、Flomo、Vercel",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pake": "./cli.js"
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@tauri-apps/api": "^1.0.2",
|
|
29
|
+
"@tauri-apps/cli": "^1.0.2",
|
|
29
30
|
"app-root-path": "^3.1.0",
|
|
30
31
|
"axios": "^1.1.3",
|
|
31
32
|
"commander": "^9.4.1",
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
"is-url": "^1.2.4",
|
|
35
36
|
"ora": "^6.1.2",
|
|
36
37
|
"page-icon": "^0.4.0",
|
|
38
|
+
"pkg-dir": "^7.0.0",
|
|
37
39
|
"png2icons": "^2.0.1",
|
|
38
40
|
"prompts": "^2.4.2",
|
|
39
41
|
"shelljs": "^0.8.5",
|
|
@@ -44,7 +46,6 @@
|
|
|
44
46
|
"@rollup/plugin-commonjs": "^23.0.2",
|
|
45
47
|
"@rollup/plugin-json": "^5.0.1",
|
|
46
48
|
"@rollup/plugin-typescript": "^9.0.2",
|
|
47
|
-
"@tauri-apps/cli": "^1.0.2",
|
|
48
49
|
"@types/is-url": "^1.2.30",
|
|
49
50
|
"@types/page-icon": "^0.3.4",
|
|
50
51
|
"@types/prompts": "^2.4.1",
|