@rpcbase/cli 0.32.0 → 0.34.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"license": "SSPL-1.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"rb": "./bin.js"
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"bluebird": "3.7.2",
|
|
13
|
-
"concurrently": "
|
|
13
|
+
"concurrently": "8.2.1",
|
|
14
14
|
"debug": "4.3.4",
|
|
15
|
-
"dotenv": "16.
|
|
15
|
+
"dotenv": "16.3.1",
|
|
16
16
|
"picocolors": "1.0.0",
|
|
17
|
-
"semver": "7.
|
|
18
|
-
"validator": "13.
|
|
19
|
-
"yargs": "17.
|
|
17
|
+
"semver": "7.5.4",
|
|
18
|
+
"validator": "13.11.0",
|
|
19
|
+
"yargs": "17.7.2"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -11,26 +11,8 @@ const verify_env = require("./verify_env")
|
|
|
11
11
|
const verify_project = async(run_configs) => {
|
|
12
12
|
let result_errors = []
|
|
13
13
|
|
|
14
|
-
console.log("WARNING VERIFY_PROJECT IS BROKEN, SKIPPING FOR NOW")
|
|
15
|
-
return result_errors
|
|
16
|
-
|
|
17
|
-
|
|
18
14
|
const project_root_dir = get_root_dir(run_configs)
|
|
19
15
|
|
|
20
|
-
// check if all installed packages match semver in package json file
|
|
21
|
-
const deps_errors = _flatten(
|
|
22
|
-
await Promise.map(run_configs.map(({working_dir}) => working_dir), verify_packages_installed(project_root_dir))
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
if (deps_errors.length > 0) {
|
|
26
|
-
let error_str = `${colors.red("error:")} the following packages are missing from your ${colors.bold("node_modules")}\n`
|
|
27
|
-
deps_errors.forEach((err) => {
|
|
28
|
-
error_str += ` ${err}\n`
|
|
29
|
-
})
|
|
30
|
-
error_str += `\n run ${colors.bold("yarn install")} to ensure dependencies are installed\n`
|
|
31
|
-
result_errors.push(error_str)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
16
|
// get env file from server and validate required services and ports
|
|
35
17
|
const env_errors = await verify_env(project_root_dir)
|
|
36
18
|
if (env_errors.length > 0) {
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
const path = require("path")
|
|
3
|
-
const fs = require("fs")
|
|
4
|
-
const util = require("util")
|
|
5
|
-
const colors = require("picocolors")
|
|
6
|
-
const semverSatisfies = require("semver/functions/satisfies")
|
|
7
|
-
|
|
8
|
-
const exec = util.promisify(require("child_process").exec)
|
|
9
|
-
|
|
10
|
-
const LIST_CMD = "npm ls --depth=0 --json || true"
|
|
11
|
-
|
|
12
|
-
const get_installed_pkgs = async(wd) => {
|
|
13
|
-
const {stdout: npm_out, stderr} = await exec(LIST_CMD, {cwd: wd})
|
|
14
|
-
|
|
15
|
-
let npm_json
|
|
16
|
-
try {
|
|
17
|
-
npm_json = JSON.parse(npm_out)
|
|
18
|
-
} catch (err) {
|
|
19
|
-
console.log("failed to parse npm_json:")
|
|
20
|
-
console.log(npm_json)
|
|
21
|
-
console.log("STDERR:", stderr)
|
|
22
|
-
throw err
|
|
23
|
-
}
|
|
24
|
-
const deps = npm_json.dependencies || {}
|
|
25
|
-
|
|
26
|
-
const result = {}
|
|
27
|
-
Object.keys(deps).forEach((k) => {
|
|
28
|
-
result[k] = deps[k].version
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
return result
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// check that packages in node_modules match package.json with semver
|
|
36
|
-
const verify_packages_installed = (root_dir) => async(wd) => {
|
|
37
|
-
const rel_dir = path.relative(root_dir, wd)
|
|
38
|
-
|
|
39
|
-
const pack_path = path.join(wd, "./package.json")
|
|
40
|
-
const pack = JSON.parse(fs.readFileSync(pack_path))
|
|
41
|
-
const deps = pack.dependencies || {}
|
|
42
|
-
|
|
43
|
-
const installed = await get_installed_pkgs(wd)
|
|
44
|
-
|
|
45
|
-
const result_errors = []
|
|
46
|
-
|
|
47
|
-
Object.keys(deps).forEach((k) => {
|
|
48
|
-
if (!installed[k]) {
|
|
49
|
-
result_errors.push(`${colors.yellow(k)} is missing in ${colors.bold(rel_dir + "/")}`)
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
return result_errors
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
module.exports = verify_packages_installed
|