pake-cli 0.0.1-beta.12 → 0.0.1-beta.13

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.
@@ -8,6 +8,7 @@ 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';
11
12
 
12
13
  export default class MacBuilder implements IBuilder {
13
14
  async prepare() {
@@ -55,12 +56,15 @@ export default class MacBuilder implements IBuilder {
55
56
  const configJsonPath = `${dirPath}/config.json`;
56
57
  await fs.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf), 'utf-8'));
57
58
 
58
- const code = await shellExec('../node_modules/@tauri-apps/cli/tauri.js build --config ${configJsonPath} --target universal-apple-darwin');
59
+ const npmDirectory = await packageDirectory();
60
+ console.log(npmDirectory)
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
- await fs.copyFile(this.getBuildedAppPath(dmgName), path.resolve(dmgName));
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 `../src-tauri/target/universal-apple-darwin/release/bundle/dmg/${dmgName}`
67
+ getBuildedAppPath(npmDirectory: string, dmgName: string) {
68
+ return path.join(appRootPath.path, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
65
69
  }
66
70
  }
package/dist/cli.js CHANGED
@@ -14,6 +14,8 @@ import fs from 'fs/promises';
14
14
  import prompts from 'prompts';
15
15
  import ora from 'ora';
16
16
  import shelljs from 'shelljs';
17
+ import appRootPath from 'app-root-path';
18
+ import { packageDirectory } from 'pkg-dir';
17
19
 
18
20
  /******************************************************************************
19
21
  Copyright (c) Microsoft Corporation.
@@ -359,13 +361,16 @@ class MacBuilder {
359
361
  const { path: dirPath } = yield dir();
360
362
  const configJsonPath = `${dirPath}/config.json`;
361
363
  yield fs.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf), 'utf-8'));
362
- yield shellExec('../node_modules/@tauri-apps/cli/tauri.js build --config ${configJsonPath} --target universal-apple-darwin');
364
+ const npmDirectory = yield packageDirectory();
365
+ console.log(npmDirectory);
366
+ yield shellExec(`${path.join(npmDirectory, 'node_modules/@tauri-apps/cli/tauri.js')} build --config ${configJsonPath} --target universal-apple-darwin`);
363
367
  const dmgName = `${name}_${'0.2.0'}_universal.dmg`;
364
- yield fs.copyFile(this.getBuildedAppPath(dmgName), path.resolve(dmgName));
368
+ const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
369
+ yield fs.copyFile(appPath, path.resolve(dmgName));
365
370
  });
366
371
  }
367
- getBuildedAppPath(dmgName) {
368
- return `../src-tauri/target/universal-apple-darwin/release/bundle/dmg/${dmgName}`;
372
+ getBuildedAppPath(npmDirectory, dmgName) {
373
+ return path.join(appRootPath.path, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
369
374
  }
370
375
  }
371
376
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "0.0.1-beta.12",
3
+ "version": "0.0.1-beta.13",
4
4
  "description": "用 Rust 来打包你的 App,底层使用 Tauri,当前支持微信读书、Flomo、Vercel",
5
5
  "bin": {
6
6
  "pake": "./cli.js"
@@ -34,6 +34,7 @@
34
34
  "is-url": "^1.2.4",
35
35
  "ora": "^6.1.2",
36
36
  "page-icon": "^0.4.0",
37
+ "pkg-dir": "^7.0.0",
37
38
  "png2icons": "^2.0.1",
38
39
  "prompts": "^2.4.2",
39
40
  "shelljs": "^0.8.5",