@ahqstore/cli 0.10.6 → 0.10.9

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.
package/Cargo.toml CHANGED
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  edition = "2021"
3
3
  name = "ahqstore_cli_rs"
4
- version = "0.10.6"
4
+ version = "0.10.9"
5
5
  description = "AHQ Store CLI"
6
6
  repository = "https://github.com/ahqstore/cli"
7
7
  homepage = "https://github.com/ahqstore/cli"
@@ -35,6 +35,7 @@ image = { version = "0.25", default-features = false, features = [
35
35
  "png",
36
36
  ] }
37
37
  rand = "0.9"
38
+ semver = "1.0.26"
38
39
 
39
40
  [target.'cfg(unix)'.dependencies]
40
41
  openssl-sys = { version = "0.9", features = ["vendored"] }
package/README.md CHANGED
@@ -2,38 +2,87 @@
2
2
 
3
3
  Read more about it [here](https://ahqstore.github.io)
4
4
 
5
- # Changelog
5
+ This is the Official AHQ Store CLI and the CLI with the most number of ports.
6
+ The original CLI has been written in rust lang and we're quite excited to tell you how versatile this tool actually is. This tool is **OFFICIALLY** available and maintained for :
6
7
 
7
- ## 0.6.0 **(m)** 05-Sep-2024 10:37PM IST
8
+ - [Crates.io (Original)](https://crates.io/crates/ahqstore_cli_rs)
9
+ - [npmjs (Port)](https://www.npmjs.com/package/@ahqstore/cli)
10
+ - [jsr (Port)](https://jsr.io/@ahqstore/cli)
11
+ - [PyPi (Port)](https://pypi.org/project/ahqstore-cli/)
12
+ - [Nuget (Port)](https://www.nuget.org/packages/AHQStoreCLI)
13
+ - [Golang (Port; Not Tested)](https://github.com/ahqstore/cli/tree/main/go)
8
14
 
9
- - Introduced ahqstore-types apps validation
10
- - Now you can view schemas in [docs.rs](https://docs.rs/ahqstore_cli_rs)
11
- - Update Dependencies
15
+ All the platforms use the same codebase (the rust codebase). We're making use of the C-Abi to
16
+ make the CLI compatible to the following languages/runtimes:
12
17
 
13
- ## 0.5.5 03-Sep-2024 10:20PM IST
18
+ - Cargo
19
+ - NodeJS
20
+ - Deno
21
+ - Bun
22
+ - Python
23
+ - .NET C#
24
+ - Golang
14
25
 
15
- - update ahqstore-types
26
+ # Usage
16
27
 
17
- ## 0.5.4 01-Sep-2024 10:07PM IST
28
+ Head over to https://ahqstore.github.io/guide/cli/ for usage references!
18
29
 
19
- - **[CRITICAL]** Fixes invalid config files being generated
30
+ # Installation
20
31
 
21
- ## 0.5.1 23-Aug-2024 10:09PM IST
32
+ ## Rust
22
33
 
23
- - Fix NPM Publish error
34
+ There are two ways to install in Rust Lang, `cargo install` and `cargo binstall`
24
35
 
25
- ## 0.5.0 **(I)** 23-Aug-2024 10:05PM IST
36
+ ## cargo install (official)
26
37
 
27
- - Update to the new resources scheme (ahqstore-types v3.1.0)
28
- - Update Dependencies
38
+ ```sh
39
+ cargo install ahqstore_cli_rs
40
+ ```
29
41
 
30
- ## 0.4.x **(m)**
42
+ ### cargo binstall
31
43
 
32
- - Update to ahqstore-types 2.3.0
44
+ ```sh
45
+ cargo binstall ahqstore_cli_rs
46
+ ```
33
47
 
34
- **NOTE:**
48
+ ## NodeJS
35
49
 
36
- - **I** Internal Breaking Changes
37
- - **m** Minor Breaking / Minor Addition Changes
38
- - **B** Breaking Changes
39
- - **P** Patch Changes
50
+ ```sh
51
+ npm i -g @ahqstore/cli
52
+ ```
53
+
54
+ ## Deno
55
+
56
+ ### Using npmjs
57
+
58
+ ```sh
59
+ deno install -g npm:@ahqstore/cli
60
+ ```
61
+
62
+ ### Using JSR
63
+
64
+ ```sh
65
+ deno install -A -f -g -n ahqstore https://jsr.io/@ahqstore/cli/0.10.9/js/cli.js
66
+ ```
67
+
68
+ ## Bun
69
+
70
+ ```sh
71
+ bun install -g @ahqstore/cli
72
+ ```
73
+
74
+ ## Python
75
+
76
+ ```sh
77
+ pip install ahqstore-cli
78
+ ```
79
+
80
+ ## GoLang
81
+
82
+ To be yet figured out
83
+
84
+ ## .NET C#
85
+
86
+ ```sh
87
+ dotnet tool install --global AHQStoreCLI
88
+ ```
package/js/cli.js CHANGED
@@ -1,9 +1,12 @@
1
1
  #! /usr/bin/env node
2
2
  // @ts-check
3
3
 
4
- import { join } from "node:path";
4
+ /* @ts-self-types="./types.d.ts" */
5
+
6
+ import { join, dirname } from "node:path";
5
7
  import { existsSync, mkdirSync, rmSync } from "node:fs";
6
8
  import { argv, env, platform } from "node:process";
9
+ import { fileURLToPath } from 'node:url';
7
10
 
8
11
  import { downloadModuleWithProgress } from "./download.js";
9
12
 
@@ -12,7 +15,12 @@ import c from "ansi-colors";
12
15
  import koffi from "koffi";
13
16
 
14
17
  import pkg from "../package.json" with { type: "json" };
18
+ import { homedir } from "node:os";
15
19
 
20
+ /**
21
+ * This function is internal and should not be used
22
+ * @returns {{ prefix: string; suffix: string; }}
23
+ */
16
24
  export function getPrefixSuffix() {
17
25
  let prefix = "";
18
26
  let suffix = "";
@@ -39,7 +47,9 @@ export function getPrefixSuffix() {
39
47
  }
40
48
 
41
49
  /**
50
+ * This function is internal and should not be used
42
51
  * @param {string} name
52
+ * @returns {string}
43
53
  */
44
54
  function getLibraryFilename(name) {
45
55
  const { prefix, suffix } = getPrefixSuffix();
@@ -47,7 +57,18 @@ function getLibraryFilename(name) {
47
57
  return `${prefix}${name}${suffix}`;
48
58
  }
49
59
 
50
- const dylibDir = join(import.meta.dirname, "lib");
60
+ let __dirname = `${homedir()}/ahqstore-js`;
61
+
62
+ try {
63
+ __dirname = dirname(fileURLToPath(import.meta.url));
64
+ } catch (e) {
65
+ try {
66
+ mkdirSync(`${__dirname}`);
67
+ mkdirSync(`${__dirname}/lib`);
68
+ } catch (e) {}
69
+ }
70
+
71
+ const dylibDir = join(__dirname, "lib");
51
72
  const dylib = join(dylibDir, getLibraryFilename("ahqstore_cli_rs"));
52
73
 
53
74
  if (!(existsSync(dylibDir) && existsSync(dylib))) {
package/js/download.js CHANGED
@@ -16,6 +16,10 @@ const bar = new SingleBar({
16
16
  hideCursor: true,
17
17
  });
18
18
 
19
+ /**
20
+ * This function is internal and should not be used
21
+ * @returns {string}
22
+ */
19
23
  function getDownload() {
20
24
  const { prefix, suffix } = getPrefixSuffix();
21
25
 
@@ -23,14 +27,14 @@ function getDownload() {
23
27
  }
24
28
 
25
29
  /**
26
- *
30
+ * This function is internal and should not be used
27
31
  * @param {number} ms
28
32
  * @returns {Promise<undefined>}
29
33
  */
30
34
  const delay = (ms) => new Promise((resolve) => setTimeout(() => resolve(undefined), ms));
31
35
 
32
36
  /**
33
- *
37
+ * This function is internal and should not be used
34
38
  * @param {string} file
35
39
  * @returns {Promise<undefined>}
36
40
  */
package/js/types.d.ts ADDED
File without changes
package/jsr.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "https://jsr.io/schema/config-file.v1.json",
3
+ "name": "@ahqstore/cli",
4
+ "version": "0.10.9",
5
+ "license": "MIT",
6
+ "exports": {
7
+ ".": "./js/cli.js"
8
+ },
9
+ "publish": {
10
+ "include": ["./js/**/**", "package.json", "README.md"]
11
+ }
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahqstore/cli",
3
- "version": "0.10.6",
3
+ "version": "0.10.9",
4
4
  "description": "AHQ Store Official CLI, A port of the rust version to NodeJS",
5
5
  "keywords": [
6
6
  "cli",
@@ -21,7 +21,7 @@
21
21
  "bin": {
22
22
  "ahqstore": "./js/cli.js"
23
23
  },
24
- "readme": "README.md",
24
+ "readme": "./README.md",
25
25
  "scripts": {
26
26
  "postinstall": "node js/postinstall.js"
27
27
  },
@@ -32,5 +32,8 @@
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=22"
35
+ },
36
+ "devDependencies": {
37
+ "jsr": "^0.13.5"
35
38
  }
36
39
  }