@ahqstore/cli 1.0.0-rc5 → 1.0.0-rc7

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/install.js +43 -0
  2. package/package.json +7 -2
  3. package/src/cli.js +11 -4
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" || (platform == "darwin" && 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahqstore/cli",
3
- "version": "1.0.0-rc5",
3
+ "version": "1.0.0-rc7",
4
4
  "description": "The AHQ Store CLI",
5
5
  "type": "module",
6
6
  "main": "./src/cli.js",
@@ -8,8 +8,13 @@
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/ahqstore/cli.git"
10
10
  },
11
- "scripts": {},
11
+ "scripts": {
12
+ "postinstall": "node install.js"
13
+ },
12
14
  "dependencies": {
15
+ "@ahqstore/cli-rs-linux": "1.0.0-rc3",
16
+ "@ahqstore/cli-rs-win32": "1.0.0-rc3",
17
+ "@ahqstore/cli-rs-darwin": "1.0.0-rc3",
13
18
  "chalk": "^5.3.0"
14
19
  },
15
20
  "keywords": [
package/src/cli.js CHANGED
@@ -1,6 +1,13 @@
1
1
  #! /usr/bin/env node
2
- import { Chalk } from "chalk";
2
+ const platform = process.platform;
3
+ const args = process.argv.slice(2) || [];
3
4
 
4
- const chalk = new Chalk();
5
-
6
- console.log(chalk.green("Hello"));
5
+ (async () => {
6
+ if (platform == "win32") {
7
+ (await import("@ahqstore/cli-rs-win32")).nodeEntrypoint(args);
8
+ } else if (platform == "darwin") {
9
+ (await import("@ahqstore/cli-rs-darwin")).nodeEntrypoint(args);
10
+ } else {
11
+ (await import("@ahqstore/cli-rs-linux")).nodeEntrypoint(args);
12
+ }
13
+ })();