@rpcbase/cli 0.88.0 → 0.90.0

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 (2) hide show
  1. package/package.json +3 -2
  2. package/src/index.js +36 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/cli",
3
- "version": "0.88.0",
3
+ "version": "0.90.0",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -28,7 +28,8 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "axios": "1.9.0",
31
- "dotenv": "16.5.0",
31
+ "dotenv": "17.0.0",
32
+ "dotenv-expand": "12.0.2",
32
33
  "validator": "13.15.0",
33
34
  "yargs": "17.7.2"
34
35
  }
package/src/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import yargs from "yargs/yargs"
4
- import { hideBin } from 'yargs/helpers'
5
- import dotenv from 'dotenv'
6
- import fs from 'fs'
7
- import {deploy} from "./cmd-deploy.js"
8
- import {ssh} from "./cmd-ssh.js"
9
- import {waitFor} from "./cmd-wait-for/index.js"
4
+ import { hideBin } from "yargs/helpers"
5
+ import dotenv from "dotenv"
6
+ import { expand } from "dotenv-expand"
7
+ import fs from "fs"
8
+ import { deploy } from "./cmd-deploy.js"
9
+ import { ssh } from "./cmd-ssh.js"
10
+ import { waitFor } from "./cmd-wait-for/index.js"
10
11
 
11
12
  yargs(hideBin(process.argv))
12
13
  .option("env", {
@@ -16,37 +17,36 @@ yargs(hideBin(process.argv))
16
17
  global: true,
17
18
  default: ["process.env"],
18
19
  coerce: (envFiles) => {
19
- if (!envFiles || envFiles.length === 0) return {};
20
+ if (!envFiles || envFiles.length === 0) return {}
20
21
 
21
- const envVars = {};
22
+ const envVars = {}
22
23
 
23
- envFiles.forEach(filePath => {
24
+ envFiles.forEach((filePath) => {
24
25
  if (fs.existsSync(filePath)) {
25
- const parsed = dotenv.parse(fs.readFileSync(filePath));
26
- Object.assign(envVars, parsed);
26
+ const parsedFile = dotenv.parse(fs.readFileSync(filePath))
27
+ const expanded = expand({ parsed: parsedFile }).parsed
28
+ Object.assign(envVars, expanded)
27
29
  } else if (filePath !== "process.env") {
28
- console.warn(`Warning: Environment file ${filePath} not found.`);
30
+ console.warn(`Warning: Environment file ${filePath} not found.`)
29
31
  }
30
- });
32
+ })
31
33
 
32
- // Then apply process.env variables to override file-based variables
33
- Object.assign(envVars, process.env);
34
+ Object.assign(envVars, process.env)
34
35
 
35
- return envVars;
36
- }
36
+ return envVars
37
+ },
37
38
  })
38
39
  .command(
39
40
  "test",
40
41
  "test command",
41
42
  (yargs) => {
42
- return yargs
43
- .option("verbose", {
44
- alias: "v",
45
- describe: "Run with verbose logging",
46
- type: "boolean",
47
- });
43
+ return yargs.option("verbose", {
44
+ alias: "v",
45
+ describe: "Run with verbose logging",
46
+ type: "boolean",
47
+ })
48
48
  },
49
- async(argv) => {
49
+ async (argv) => {
50
50
  console.log("IT WORKS!")
51
51
  },
52
52
  )
@@ -65,9 +65,9 @@ yargs(hideBin(process.argv))
65
65
  describe: "Exclude additional files from the rsync command",
66
66
  type: "array",
67
67
  default: [],
68
- });
68
+ })
69
69
  },
70
- async(argv) => {
70
+ async (argv) => {
71
71
  await deploy(argv)
72
72
  },
73
73
  )
@@ -86,14 +86,19 @@ yargs(hideBin(process.argv))
86
86
  type: "boolean",
87
87
  })
88
88
  },
89
- async(argv) => {
89
+ async (argv) => {
90
90
  await ssh(argv)
91
91
  },
92
92
  )
93
- .command("wait-for", "Waits for the specified service to become available", () => {}, (argv) => {
94
- waitFor()
95
- })
93
+ .command(
94
+ "wait-for",
95
+ "Waits for the specified service to become available",
96
+ () => {},
97
+ (argv) => {
98
+ waitFor()
99
+ },
100
+ )
96
101
  .demandCommand(1, "You need to specify a command")
97
102
  // .strict()
98
103
  .help()
99
- .parse();
104
+ .parse()