@rpcbase/cli 0.89.0 → 0.91.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.
- package/package.json +5 -4
- package/src/index.js +36 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.91.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -27,9 +27,10 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"axios": "1.
|
|
31
|
-
"dotenv": "
|
|
32
|
-
"
|
|
30
|
+
"axios": "1.10.0",
|
|
31
|
+
"dotenv": "17.0.0",
|
|
32
|
+
"dotenv-expand": "12.0.2",
|
|
33
|
+
"validator": "13.15.15",
|
|
33
34
|
"yargs": "17.7.2"
|
|
34
35
|
}
|
|
35
36
|
}
|
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
|
|
5
|
-
import dotenv from
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
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
|
|
26
|
-
|
|
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
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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(
|
|
94
|
-
|
|
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()
|