@nmshd/connector-tui 0.0.2 → 0.0.3

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 CHANGED
@@ -22,3 +22,12 @@ If you want to execute this TUI as a package you can install it using `npm i -g
22
22
 
23
23
  1. (only for the first time) `npm install` and copy `.env.example` to `.env` and fill in the values.
24
24
  2. `npm start`
25
+
26
+ ## Command line arguments
27
+
28
+ ```txt
29
+ --version Show version number [boolean]
30
+ -e, --env location of the env file relative to cwd
31
+ [string] [default: ".env"]
32
+ -h, --help Show help [boolean]
33
+ ```
package/dist/index.js CHANGED
@@ -1,7 +1,19 @@
1
1
  import chalk from "chalk";
2
2
  import dotenv from "dotenv";
3
+ import path from "path";
4
+ import yargs from "yargs";
5
+ import { hideBin } from "yargs/helpers";
3
6
  import { ConnectorTUI } from "./ConnectorTUI";
4
- dotenv.config();
7
+ const argv = await yargs(hideBin(process.argv))
8
+ .option("env", {
9
+ alias: "e",
10
+ description: "location of the env file relative to cwd",
11
+ type: "string",
12
+ default: ".env",
13
+ })
14
+ .help()
15
+ .alias("help", "h").argv;
16
+ dotenv.config({ path: path.resolve(process.cwd(), argv.env) });
5
17
  if (typeof process.env.BASE_URL === "undefined" || typeof process.env.API_KEY === "undefined") {
6
18
  console.log(chalk.red("Please provide a BASE_URL and API_KEY in your .env file or as environment variables."));
7
19
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nmshd/connector-tui",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "repository": "github:nmshd/connector-tui",
5
5
  "license": "MIT",
6
6
  "author": "j&s-soft GmbH",
@@ -16,10 +16,10 @@
16
16
  ".env.example"
17
17
  ],
18
18
  "scripts": {
19
- "lint:prettier": "prettier --check ./src",
20
- "lint:eslint": "eslint --ext .ts ./src",
21
- "lint": "npm run lint:prettier && npm run lint:eslint",
22
19
  "build": "tsc",
20
+ "lint": "npm run lint:prettier && npm run lint:eslint",
21
+ "lint:eslint": "eslint --ext .ts ./src",
22
+ "lint:prettier": "prettier --check ./src",
23
23
  "start": "clear && ts-node --esm --experimental-specifier-resolution node ./src/index.ts",
24
24
  "test": "echo 'no test specified'"
25
25
  },
@@ -29,7 +29,8 @@
29
29
  "dotenv": "^16.0.3",
30
30
  "luxon": "^3.1.0",
31
31
  "prompts": "^2.4.2",
32
- "qrcode-terminal": "^0.12.0"
32
+ "qrcode-terminal": "^0.12.0",
33
+ "yargs": "^17.6.2"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@js-soft/eslint-config-ts": "^1.6.1",
@@ -38,6 +39,7 @@
38
39
  "@types/node": "^18.11.9",
39
40
  "@types/prompts": "^2.4.1",
40
41
  "@types/qrcode-terminal": "^0.12.0",
42
+ "@types/yargs": "^17.0.13",
41
43
  "eslint": "^8.26.0",
42
44
  "prettier": "^2.7.1",
43
45
  "ts-node": "^10.9.1",