@ahqstore/cli 0.0.1

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/README.md ADDED
File without changes
package/install.js ADDED
@@ -0,0 +1,43 @@
1
+ import { Chalk } from "chalk";
2
+ const chalk = new Chalk();
3
+
4
+ const platform = process.platform;
5
+
6
+ const sep = "---------------------------------";
7
+
8
+ console.log(sep);
9
+ console.log(` AHQ Store CLI`);
10
+ console.log(sep);
11
+
12
+ const info = chalk.blue(chalk.bold("INFO:"));
13
+ const warn = chalk.yellow(chalk.bold("WARN:"));
14
+ const errr = chalk.red(chalk.bold("ERRR:"));
15
+ const success = chalk.green(chalk.bold("PASS:"));
16
+
17
+ console.log(`${warn} Checking Operating System`);
18
+ console.log(`${info} ${platform}`);
19
+
20
+ if (platform === "win32" || platform === "linux" || platform == "darwin") {
21
+ console.log(`${success} OS Valid!`);
22
+ } else {
23
+ console.log(`${errr} OS Invalid!`);
24
+ console.log("NOT OK");
25
+ throw new Error(`Invalid Platform ${platform}`);
26
+ }
27
+
28
+ const arch = process.arch;
29
+
30
+ console.log(`${warn} Checking Architecture`);
31
+ console.log(`${info} ${arch}`);
32
+
33
+ if (arch == "x64" || arch == "arm64") {
34
+ console.log(`${success} Arch Validated`);
35
+ } else {
36
+ console.log(`${errr} Arch Invalid`);
37
+ console.log("NOT OK");
38
+ throw new Error(`Invalid Architecture ${arch}`);
39
+ }
40
+
41
+ console.log(sep);
42
+ console.log("Postinstall Script Successful");
43
+ console.log(sep);
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@ahqstore/cli",
3
+ "version": "0.0.1",
4
+ "description": "The AHQ Store CLI",
5
+ "type": "module",
6
+ "main": "./src/cli.js",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ahqstore/cli.git"
10
+ },
11
+ "scripts": {
12
+ "postinstall": "node install.js"
13
+ },
14
+ "dependencies": {
15
+ "@ahqstore/cli-rs-win32-x64": "0.0.1",
16
+ "@ahqstore/cli-rs-darwin-x64": "0.0.1",
17
+ "@ahqstore/cli-rs-darwin-arm64": "0.0.1",
18
+ "@ahqstore/cli-rs-linux-x64": "0.0.1",
19
+ "@ahqstore/cli-rs-linux-arm64": "0.0.1",
20
+ "chalk": "^5.3.0"
21
+ },
22
+ "keywords": [
23
+ "Cli",
24
+ "DeveloperTool"
25
+ ],
26
+ "author": "AHQ Softwares",
27
+ "license": "MIT",
28
+ "bin": {
29
+ "ahqstore": "src/cli.js"
30
+ },
31
+ "bugs": {
32
+ "url": "https://github.com/ahqstore/cli/issues"
33
+ },
34
+ "homepage": "https://github.com/ahqstore/cli#readme"
35
+ }
package/src/cli.js ADDED
@@ -0,0 +1,21 @@
1
+ #! /usr/bin/env node
2
+ import { Chalk } from "chalk";
3
+
4
+ const { platform, arch } = process;
5
+ const args = process.argv.slice(2) || [];
6
+
7
+ (async () => {
8
+ try {
9
+ (await import(`@ahqstore/cli-rs-${platform}-${arch}`)).nodeEntrypoint(args);
10
+ } catch (e) {
11
+ const chalk = new Chalk();
12
+ console.log(chalk.red(e));
13
+ console.log(
14
+ chalk.red(
15
+ chalk.bold(
16
+ "Error running cli, consider using cargo version\ncargo install ahqstore_cli_rs"
17
+ )
18
+ )
19
+ );
20
+ }
21
+ })();