pake-cli 0.0.1-beta.11 → 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(`${path.join(appRootPath.path, '/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) {
67
+ getBuildedAppPath(npmDirectory: string, dmgName: string) {
64
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
@@ -15,6 +15,7 @@ import prompts from 'prompts';
15
15
  import ora from 'ora';
16
16
  import shelljs from 'shelljs';
17
17
  import appRootPath from 'app-root-path';
18
+ import { packageDirectory } from 'pkg-dir';
18
19
 
19
20
  /******************************************************************************
20
21
  Copyright (c) Microsoft Corporation.
@@ -360,12 +361,15 @@ class MacBuilder {
360
361
  const { path: dirPath } = yield dir();
361
362
  const configJsonPath = `${dirPath}/config.json`;
362
363
  yield fs.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf), 'utf-8'));
363
- yield shellExec(`${path.join(appRootPath.path, '/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`);
364
367
  const dmgName = `${name}_${'0.2.0'}_universal.dmg`;
365
- yield fs.copyFile(this.getBuildedAppPath(dmgName), path.resolve(dmgName));
368
+ const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
369
+ yield fs.copyFile(appPath, path.resolve(dmgName));
366
370
  });
367
371
  }
368
- getBuildedAppPath(dmgName) {
372
+ getBuildedAppPath(npmDirectory, dmgName) {
369
373
  return path.join(appRootPath.path, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
370
374
  }
371
375
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "0.0.1-beta.11",
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",