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

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() {
@@ -52,12 +53,10 @@ export default class MacBuilder implements IBuilder {
52
53
  tauriConf.tauri.bundle.identifier = identifier;
53
54
  tauriConf.tauri.bundle.icon = [options.icon];
54
55
 
55
- const { path: dirPath } = await dir();
56
- const configJsonPath = `${dirPath}/config.json`;
56
+ const npmDirectory = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
57
+ const configJsonPath = path.join(npmDirectory, 'src-tauri/tauri.conf.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)
61
60
  const code = await shellExec(`${path.join(npmDirectory, 'node_modules/@tauri-apps/cli/tauri.js')} build --config ${configJsonPath} --target universal-apple-darwin`);
62
61
  const dmgName = `${name}_${'0.2.0'}_universal.dmg`;
63
62
  const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
@@ -65,6 +64,6 @@ export default class MacBuilder implements IBuilder {
65
64
  }
66
65
 
67
66
  getBuildedAppPath(npmDirectory: string, dmgName: string) {
68
- return path.join(appRootPath.path, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
67
+ return path.join(npmDirectory, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
69
68
  }
70
69
  }
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.
@@ -358,11 +356,9 @@ class MacBuilder {
358
356
  tauriConf.package.productName = name;
359
357
  tauriConf.tauri.bundle.identifier = identifier;
360
358
  tauriConf.tauri.bundle.icon = [options.icon];
361
- const { path: dirPath } = yield dir();
362
- const configJsonPath = `${dirPath}/config.json`;
359
+ const npmDirectory = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
360
+ const configJsonPath = path.join(npmDirectory, 'src-tauri/tauri.conf.json');
363
361
  yield fs.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf), 'utf-8'));
364
- const npmDirectory = yield packageDirectory();
365
- console.log(npmDirectory);
366
362
  yield shellExec(`${path.join(npmDirectory, 'node_modules/@tauri-apps/cli/tauri.js')} build --config ${configJsonPath} --target universal-apple-darwin`);
367
363
  const dmgName = `${name}_${'0.2.0'}_universal.dmg`;
368
364
  const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
@@ -370,7 +366,7 @@ class MacBuilder {
370
366
  });
371
367
  }
372
368
  getBuildedAppPath(npmDirectory, dmgName) {
373
- return path.join(appRootPath.path, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
369
+ return path.join(npmDirectory, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
374
370
  }
375
371
  }
376
372
 
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.15",
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",