@toneflix/paystack-cli 0.1.3 → 0.1.4

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.
Files changed (3) hide show
  1. package/bin/cli.cjs +40 -4
  2. package/bin/cli.js +38 -4
  3. package/package.json +5 -5
package/bin/cli.cjs CHANGED
@@ -38,6 +38,10 @@ let __h3ravel_musket = require("@h3ravel/musket");
38
38
  __h3ravel_musket = __toESM(__h3ravel_musket);
39
39
  let ora = require("ora");
40
40
  ora = __toESM(ora);
41
+ let module$1 = require("module");
42
+ module$1 = __toESM(module$1);
43
+ let os = require("os");
44
+ os = __toESM(os);
41
45
  let crypto = require("crypto");
42
46
  crypto = __toESM(crypto);
43
47
  let __ngrok_ngrok = require("@ngrok/ngrok");
@@ -48,6 +52,7 @@ let db;
48
52
  const __dirname$1 = (0, path.dirname)((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
49
53
  const dirPath = path.default.normalize(path.default.join(__dirname$1, "..", "data"));
50
54
  (0, fs.mkdirSync)(dirPath, { recursive: true });
55
+ const useDbPath = () => [dirPath];
51
56
  /**
52
57
  * Hook to get or set the database instance.
53
58
  *
@@ -2575,10 +2580,7 @@ var Commands_default = () => {
2575
2580
  for (const param of schema.params) if (param.required && !this.argument(param.parameter)) return void this.newLine().error(`Missing required argument: ${param.parameter}`).newLine();
2576
2581
  const selected_integration = read("selected_integration")?.id;
2577
2582
  const user = read("user")?.id;
2578
- if (!selected_integration || !user) {
2579
- this.error("ERROR: You're not signed in, please run the [login] command before you begin").newLine();
2580
- return;
2581
- }
2583
+ if (!selected_integration || !user) return void this.error("ERROR: You're not signed in, please run the [login] command before you begin").newLine();
2582
2584
  this.newLine();
2583
2585
  const spinner = (0, ora.default)("Loading...\n").start();
2584
2586
  const [err, result] = await promiseWrapper(executeSchema(schema, {
@@ -2671,6 +2673,39 @@ var ConfigCommand = class extends __h3ravel_musket.Command {
2671
2673
  }
2672
2674
  };
2673
2675
 
2676
+ //#endregion
2677
+ //#region src/Commands/InfoCommand.ts
2678
+ var InfoCommand = class extends __h3ravel_musket.Command {
2679
+ signature = "info";
2680
+ description = "Display application runtime information.";
2681
+ async handle() {
2682
+ const require$1 = (0, module$1.createRequire)(require("url").pathToFileURL(__filename).href);
2683
+ const [_, setCommand] = useCommand();
2684
+ const [dbPath] = useDbPath();
2685
+ setCommand(this);
2686
+ init();
2687
+ const pkg = require$1("../../package.json");
2688
+ const spinner = (0, ora.default)("Gathering application information...\n").start();
2689
+ wait(500, () => {
2690
+ spinner.stop();
2691
+ dataRenderer({
2692
+ appVersion: pkg.version,
2693
+ platform: os.default.platform(),
2694
+ arch: os.default.arch(),
2695
+ cpus: os.default.cpus().length,
2696
+ hostname: os.default.hostname(),
2697
+ totalMemory: os.default.totalmem(),
2698
+ freeMemory: os.default.freemem(),
2699
+ uptime: os.default.uptime(),
2700
+ username: os.default.userInfo().username,
2701
+ database: dbPath + "/app.db",
2702
+ dependencies: Object.keys(pkg.dependencies).join(", ")
2703
+ });
2704
+ this.newLine();
2705
+ });
2706
+ }
2707
+ };
2708
+
2674
2709
  //#endregion
2675
2710
  //#region src/Commands/InitCommand.ts
2676
2711
  var InitCommand = class extends __h3ravel_musket.Command {
@@ -3304,6 +3339,7 @@ __h3ravel_musket.Kernel.init(new Application(), {
3304
3339
  console.error(config.debug ? exception : exception.message);
3305
3340
  },
3306
3341
  baseCommands: [
3342
+ InfoCommand,
3307
3343
  InitCommand,
3308
3344
  LoginCommand,
3309
3345
  LogoutCommand,
package/bin/cli.js CHANGED
@@ -7,6 +7,8 @@ import { Logger } from "@h3ravel/shared";
7
7
  import axios from "axios";
8
8
  import { Command, Kernel } from "@h3ravel/musket";
9
9
  import ora from "ora";
10
+ import { createRequire } from "module";
11
+ import os from "os";
10
12
  import crypto from "crypto";
11
13
  import ngrok from "@ngrok/ngrok";
12
14
 
@@ -15,6 +17,7 @@ let db;
15
17
  const __dirname = dirname(fileURLToPath(import.meta.url));
16
18
  const dirPath = path.normalize(path.join(__dirname, "..", "data"));
17
19
  mkdirSync(dirPath, { recursive: true });
20
+ const useDbPath = () => [dirPath];
18
21
  /**
19
22
  * Hook to get or set the database instance.
20
23
  *
@@ -2542,10 +2545,7 @@ var Commands_default = () => {
2542
2545
  for (const param of schema.params) if (param.required && !this.argument(param.parameter)) return void this.newLine().error(`Missing required argument: ${param.parameter}`).newLine();
2543
2546
  const selected_integration = read("selected_integration")?.id;
2544
2547
  const user = read("user")?.id;
2545
- if (!selected_integration || !user) {
2546
- this.error("ERROR: You're not signed in, please run the [login] command before you begin").newLine();
2547
- return;
2548
- }
2548
+ if (!selected_integration || !user) return void this.error("ERROR: You're not signed in, please run the [login] command before you begin").newLine();
2549
2549
  this.newLine();
2550
2550
  const spinner = ora("Loading...\n").start();
2551
2551
  const [err, result] = await promiseWrapper(executeSchema(schema, {
@@ -2638,6 +2638,39 @@ var ConfigCommand = class extends Command {
2638
2638
  }
2639
2639
  };
2640
2640
 
2641
+ //#endregion
2642
+ //#region src/Commands/InfoCommand.ts
2643
+ var InfoCommand = class extends Command {
2644
+ signature = "info";
2645
+ description = "Display application runtime information.";
2646
+ async handle() {
2647
+ const require = createRequire(import.meta.url);
2648
+ const [_, setCommand] = useCommand();
2649
+ const [dbPath] = useDbPath();
2650
+ setCommand(this);
2651
+ init();
2652
+ const pkg = require("../../package.json");
2653
+ const spinner = ora("Gathering application information...\n").start();
2654
+ wait(500, () => {
2655
+ spinner.stop();
2656
+ dataRenderer({
2657
+ appVersion: pkg.version,
2658
+ platform: os.platform(),
2659
+ arch: os.arch(),
2660
+ cpus: os.cpus().length,
2661
+ hostname: os.hostname(),
2662
+ totalMemory: os.totalmem(),
2663
+ freeMemory: os.freemem(),
2664
+ uptime: os.uptime(),
2665
+ username: os.userInfo().username,
2666
+ database: dbPath + "/app.db",
2667
+ dependencies: Object.keys(pkg.dependencies).join(", ")
2668
+ });
2669
+ this.newLine();
2670
+ });
2671
+ }
2672
+ };
2673
+
2641
2674
  //#endregion
2642
2675
  //#region src/Commands/InitCommand.ts
2643
2676
  var InitCommand = class extends Command {
@@ -3271,6 +3304,7 @@ Kernel.init(new Application(), {
3271
3304
  console.error(config.debug ? exception : exception.message);
3272
3305
  },
3273
3306
  baseCommands: [
3307
+ InfoCommand,
3274
3308
  InitCommand,
3275
3309
  LoginCommand,
3276
3310
  LogoutCommand,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@toneflix/paystack-cli",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "description": "Interact with the Paystack API, test webhooks locally, and manage your integration settings without leaving your command line.",
6
6
  "main": "bin/cli.js",
7
7
  "private": false,
@@ -37,18 +37,18 @@
37
37
  "toneflix"
38
38
  ],
39
39
  "dependencies": {
40
- "@eslint/js": "^9.39.2",
41
- "@eslint/markdown": "^7.5.1",
42
40
  "@h3ravel/musket": "^0.6.18",
43
41
  "@h3ravel/shared": "^0.28.4",
44
42
  "@ngrok/ngrok": "^1.7.0",
45
43
  "axios": "^1.13.2",
46
44
  "better-sqlite3": "^12.6.2",
47
45
  "ora": "^9.0.0",
48
- "tsdown": "^0.15.4",
49
- "typescript-eslint": "^8.53.0"
46
+ "tsdown": "^0.15.4"
50
47
  },
51
48
  "devDependencies": {
49
+ "@eslint/js": "^9.39.2",
50
+ "typescript-eslint": "^8.53.0",
51
+ "@eslint/markdown": "^7.5.1",
52
52
  "sass-embedded": "^1.90.0",
53
53
  "@changesets/cli": "^2.29.5",
54
54
  "@swc/core": "^1.6.1",