@rpcbase/cli 0.9.0 → 0.11.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.9.0",
3
+ "version": "0.11.0",
4
4
  "license": "SSPL-1.0",
5
5
  "bin": {
6
6
  "rb": "./bin.js"
@@ -10,10 +10,10 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "bluebird": "3.7.2",
13
- "chalk": "4.1.2",
14
13
  "concurrently": "7.2.1",
15
14
  "debug": "4.3.4",
16
15
  "dotenv": "16.0.1",
16
+ "picocolors": "1.0.0",
17
17
  "semver": "7.3.7",
18
18
  "validator": "13.7.0",
19
19
  "yargs": "17.5.1"
@@ -2,7 +2,7 @@
2
2
  const debug = require("debug")("rb-cli")
3
3
  const path = require("path")
4
4
  const fs = require("fs")
5
- const chalk = require("chalk")
5
+ const colors = require("picocolors")
6
6
  const concurrently = require("concurrently")
7
7
 
8
8
  const docker_runtime_check = require("./helpers/docker_runtime_check")
@@ -72,7 +72,7 @@ const default_command = async(args) => {
72
72
  })
73
73
  .catch((err) => {
74
74
  if (project_errors?.length > 0) {
75
- console.log(`\n${chalk.bold("exited due to configuration errors:")}`)
75
+ console.log(`\n${colors.bold("exited due to configuration errors:")}`)
76
76
  project_errors.forEach((err) => {
77
77
  console.log(err)
78
78
  })
package/src/errors.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /* @flow */
2
- const chalk = require("chalk")
2
+ const colors = require("picocolors")
3
3
 
4
4
  const ERRORS = {
5
- INVALID_CWD: `expected to run in ${chalk.cyan("client/")} or ${chalk.cyan("server/server/")} or project root directory`
5
+ INVALID_CWD: `expected to run in ${colors.cyan("client/")} or ${colors.cyan("server/server/")} or project root directory`
6
6
  }
7
7
 
8
8
  module.exports = ERRORS
@@ -1,7 +1,7 @@
1
1
  /* @flow */
2
2
  const {execSync} = require("child_process")
3
3
  const os = require("os")
4
- const chalk = require("chalk")
4
+ const colors = require("picocolors")
5
5
 
6
6
  const {FORCE_DOCKER} = process.env
7
7
 
@@ -15,7 +15,7 @@ const docker_runtime_check = () => {
15
15
  try {
16
16
  execSync("docker version -f json")
17
17
  } catch (err) {
18
- console.log(chalk.cyan.bold("docker"), "exited with error")
18
+ console.log(colors.cyan("docker"), "exited with error")
19
19
  process.exit(1)
20
20
  }
21
21
  }
@@ -1,8 +1,8 @@
1
1
  /* @flow */
2
- const chalk = require("chalk")
2
+ const colors = require("picocolors")
3
3
 
4
4
  const exit_with_message = (message = "", code = 1) => {
5
- console.log(chalk.red("error:"), message)
5
+ console.log(colors.red("error:"), message)
6
6
 
7
7
  // TODO: sentry(?) report error
8
8
 
@@ -1,7 +1,7 @@
1
1
  /* @flow */
2
2
  const path = require("path")
3
3
  const _ = require("lodash")
4
- const chalk = require("chalk")
4
+ const colors = require("picocolors")
5
5
  const Promise = require("bluebird")
6
6
 
7
7
  const verify_packages_installed = require("./verify_packages_installed")
@@ -34,18 +34,18 @@ const verify_project = async(run_configs) => {
34
34
  )
35
35
 
36
36
  if (deps_errors.length > 0) {
37
- let error_str = `${chalk.bold.red("error:")} the following packages are missing from your ${chalk.bold("node_modules")}\n`
37
+ let error_str = `${colors.red("error:")} the following packages are missing from your ${colors.bold("node_modules")}\n`
38
38
  deps_errors.forEach((err) => {
39
39
  error_str += ` ${err}\n`
40
40
  })
41
- error_str += `\n run ${chalk.bold("yarn install")} to ensure dependencies are installed\n`
41
+ error_str += `\n run ${colors.bold("yarn install")} to ensure dependencies are installed\n`
42
42
  result_errors.push(error_str)
43
43
  }
44
44
 
45
45
  // get env file from server and validate required services and ports
46
46
  const env_errors = await verify_env(project_root_dir)
47
47
  if (env_errors.length > 0) {
48
- let error_str = `${chalk.bold.red("error:")} ${chalk.bold(".env")} misconfigurations\n`
48
+ let error_str = `${colors.red("error:")} ${colors.bold(".env")} misconfigurations\n`
49
49
  env_errors.forEach((err) => {
50
50
  error_str += ` ${err}\n`
51
51
  })
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.rpcbase.com/schemas/thresholds.schema.json",
4
+ "title": "thresholds",
5
+ "type": "object",
6
+ "properties": {
7
+ "statements": {
8
+ "type": "number",
9
+ "minimum": 0,
10
+ "maximum": 100,
11
+ },
12
+ "branches": {
13
+ "type": "number",
14
+ "minimum": 0,
15
+ "maximum": 100,
16
+ },
17
+ "functions": {
18
+ "type": "number",
19
+ "minimum": 0,
20
+ "maximum": 100,
21
+ },
22
+ "lines": {
23
+ "type": "number",
24
+ "minimum": 0,
25
+ "maximum": 100,
26
+ }
27
+ }
28
+ }
@@ -1,14 +1,15 @@
1
1
  /* @flow */
2
2
  const fs = require("fs")
3
3
  const path = require("path")
4
- const chalk = require("chalk")
4
+
5
+ const colors = require("picocolors")
5
6
  const dotenv = require("dotenv")
6
7
  const validator = require("validator")
7
8
 
8
9
 
9
10
  const validate_port = (val) => {
10
11
  if (!validator.isPort(val)) {
11
- return `expected ${chalk.bold(val)} to be a valid port number`
12
+ return `expected ${colors.bold(val)} to be a valid port number`
12
13
  }
13
14
  }
14
15
 
@@ -31,7 +32,7 @@ const SERVICES = [
31
32
  "DATABASE_PORT": validate_port,
32
33
  "DATABASE_NAME": (val) => {
33
34
  if (!/^[$A-Z_][0-9A-Z_$-]*$/i.test(val)) {
34
- return `expected ${chalk.bold(`'${val}'`)} to be a valid database name`
35
+ return `expected ${colors.bold(`'${val}'`)} to be a valid database name`
35
36
  }
36
37
  }
37
38
  },
@@ -65,13 +66,13 @@ const verify_env = async(root_dir) => {
65
66
  const env_val = parsed_env[k]
66
67
 
67
68
  if (!env_val) {
68
- result_errors.push(`${chalk.yellow.bold(k)} is missing`)
69
+ result_errors.push(`${colors.yellow(k)} is missing`)
69
70
  return
70
71
  }
71
72
 
72
73
  const err = val_fn(env_val)
73
74
  if (err) {
74
- result_errors.push(`${chalk.yellow.bold(k)} ${err}`)
75
+ result_errors.push(`${colors.yellow(k)} ${err}`)
75
76
  }
76
77
  })
77
78
  })
@@ -2,7 +2,7 @@
2
2
  const path = require("path")
3
3
  const fs = require("fs")
4
4
  const util = require("util")
5
- const chalk = require("chalk")
5
+ const colors = require("picocolors")
6
6
  const semverSatisfies = require("semver/functions/satisfies")
7
7
 
8
8
  const exec = util.promisify(require("child_process").exec)
@@ -37,7 +37,7 @@ const verify_packages_installed = (root_dir) => async(wd) => {
37
37
 
38
38
  Object.keys(deps).forEach((k) => {
39
39
  if (!installed[k]) {
40
- result_errors.push(`${chalk.yellow.bold(k)} is missing in ${chalk.bold(rel_dir + "/")}`)
40
+ result_errors.push(`${colors.yellow(k)} is missing in ${colors.bold(rel_dir + "/")}`)
41
41
  }
42
42
  })
43
43