pake-cli 0.0.1-beta.13 → 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.
@@ -9,6 +9,7 @@ import { shellExec } from '@/utils/shell.js';
9
9
  import tauriConf from '../../src-tauri/tauri.conf.json';
10
10
  import { dir } from 'tmp-promise';
11
11
  import { packageDirectory } from 'pkg-dir';
12
+ import { fileURLToPath } from 'url';
12
13
 
13
14
  export default class MacBuilder implements IBuilder {
14
15
  async prepare() {
@@ -56,8 +57,7 @@ export default class MacBuilder implements IBuilder {
56
57
  const configJsonPath = `${dirPath}/config.json`;
57
58
  await fs.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf), 'utf-8'));
58
59
 
59
- const npmDirectory = await packageDirectory();
60
- console.log(npmDirectory)
60
+ const npmDirectory = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
61
61
  const code = await shellExec(`${path.join(npmDirectory, 'node_modules/@tauri-apps/cli/tauri.js')} build --config ${configJsonPath} --target universal-apple-darwin`);
62
62
  const dmgName = `${name}_${'0.2.0'}_universal.dmg`;
63
63
  const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
@@ -65,6 +65,6 @@ export default class MacBuilder implements IBuilder {
65
65
  }
66
66
 
67
67
  getBuildedAppPath(npmDirectory: string, dmgName: string) {
68
- return path.join(appRootPath.path, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
68
+ return path.join(npmDirectory, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
69
69
  }
70
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';
@@ -14,8 +14,6 @@ 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';
19
17
 
20
18
  /******************************************************************************
21
19
  Copyright (c) Microsoft Corporation.
@@ -361,8 +359,7 @@ class MacBuilder {
361
359
  const { path: dirPath } = yield dir();
362
360
  const configJsonPath = `${dirPath}/config.json`;
363
361
  yield fs.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf), 'utf-8'));
364
- const npmDirectory = yield packageDirectory();
365
- console.log(npmDirectory);
362
+ const npmDirectory = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
366
363
  yield shellExec(`${path.join(npmDirectory, 'node_modules/@tauri-apps/cli/tauri.js')} build --config ${configJsonPath} --target universal-apple-darwin`);
367
364
  const dmgName = `${name}_${'0.2.0'}_universal.dmg`;
368
365
  const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
@@ -370,7 +367,7 @@ class MacBuilder {
370
367
  });
371
368
  }
372
369
  getBuildedAppPath(npmDirectory, dmgName) {
373
- return path.join(appRootPath.path, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
370
+ return path.join(npmDirectory, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
374
371
  }
375
372
  }
376
373
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "0.0.1-beta.13",
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",
@@ -45,7 +46,6 @@
45
46
  "@rollup/plugin-commonjs": "^23.0.2",
46
47
  "@rollup/plugin-json": "^5.0.1",
47
48
  "@rollup/plugin-typescript": "^9.0.2",
48
- "@tauri-apps/cli": "^1.0.2",
49
49
  "@types/is-url": "^1.2.30",
50
50
  "@types/page-icon": "^0.3.4",
51
51
  "@types/prompts": "^2.4.1",