@rpcbase/server 0.250.0 → 0.252.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/boot/setup_env.js +0 -6
- package/boot/shared.js +2 -0
- package/cli/run_docker.js +1 -2
- package/package.json +1 -1
- package/src/helpers/expect_ext.js +42 -0
package/boot/setup_env.js
CHANGED
|
@@ -5,17 +5,11 @@ const dotenv = require("dotenv")
|
|
|
5
5
|
const wd = process.cwd()
|
|
6
6
|
|
|
7
7
|
const shared_env_path = path.join(wd, "../../.env")
|
|
8
|
-
const base_env_path = path.join(wd, "./.env.base")
|
|
9
8
|
const env_path = path.join(wd, "./.env")
|
|
10
9
|
|
|
11
10
|
const res_shared = dotenv.config({path: shared_env_path})
|
|
12
|
-
const res_base = dotenv.config({path: base_env_path})
|
|
13
11
|
const res = dotenv.config({path: env_path})
|
|
14
12
|
|
|
15
|
-
if (res_base.error) {
|
|
16
|
-
throw res_base.error
|
|
17
|
-
}
|
|
18
|
-
|
|
19
13
|
if (res.error) {
|
|
20
14
|
throw res.error
|
|
21
15
|
}
|
package/boot/shared.js
CHANGED
package/cli/run_docker.js
CHANGED
|
@@ -10,7 +10,6 @@ const is_ci = process.env.CI === "true"
|
|
|
10
10
|
const run_docker = async(infrastructure_dir, proj_prefix, args) => {
|
|
11
11
|
// env
|
|
12
12
|
const env_path = path.relative(infrastructure_dir, path.join(process.cwd(), "./.env"))
|
|
13
|
-
const base_env_path = path.relative(infrastructure_dir, path.join(process.cwd(), "./.env.base"))
|
|
14
13
|
|
|
15
14
|
const exists = (f) => {
|
|
16
15
|
const target_path = path.join(infrastructure_dir, f)
|
|
@@ -42,7 +41,7 @@ const run_docker = async(infrastructure_dir, proj_prefix, args) => {
|
|
|
42
41
|
|
|
43
42
|
|
|
44
43
|
const cmd = "docker compose"
|
|
45
|
-
const cmd_args = ["--env-file",
|
|
44
|
+
const cmd_args = ["--env-file", env_path, "-p", proj_prefix, ...compose_files, "up", ...opts]
|
|
46
45
|
|
|
47
46
|
console.log("CMD", cmd_args.join(" "))
|
|
48
47
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
const {expect} = require("expect")
|
|
3
|
+
|
|
4
|
+
const isMongoId = require("validator/lib/isMongoId")
|
|
5
|
+
const isEmail = require("validator/lib/isEmail")
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
expect.extend({
|
|
9
|
+
toBeMongoId: (actual) => {
|
|
10
|
+
const pass = isMongoId(actual)
|
|
11
|
+
|
|
12
|
+
if (pass) {
|
|
13
|
+
return {
|
|
14
|
+
message: () => `expected ${this.utils.printReceived(actual)} not to be a valid mongoId`,
|
|
15
|
+
pass: true,
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
return {
|
|
19
|
+
message: () => `expected ${this.utils.printReceived(actual)} to be a valid mongoId`,
|
|
20
|
+
pass: false,
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
toBeEmail: (actual) => {
|
|
25
|
+
const pass = isEmail(actual)
|
|
26
|
+
|
|
27
|
+
if (pass) {
|
|
28
|
+
return {
|
|
29
|
+
message: () =>
|
|
30
|
+
`expected ${this.utils.printReceived(actual)} not to be a valid email address`,
|
|
31
|
+
pass: true,
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
return {
|
|
35
|
+
message: () => `expected ${this.utils.printReceived(actual)} to be a valid email address`,
|
|
36
|
+
pass: false,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
global.expect = expect
|