not-node 6.3.70 → 6.3.72

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": "not-node",
3
- "version": "6.3.70",
3
+ "version": "6.3.72",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/const.js ADDED
@@ -0,0 +1,13 @@
1
+ const DEFAULT_PATH_TMP = "../../tmp";
2
+ const DEFAULT_PATH_STATIC = "../static";
3
+ const DEFAULT_PATH_MODULES = "./modules";
4
+ const DEFAULT_PATH_WS = "./ws";
5
+ const DEFAULT_PATH_DB_DUMPS = "../../db.dumps";
6
+
7
+ module.exports = {
8
+ DEFAULT_PATH_WS,
9
+ DEFAULT_PATH_MODULES,
10
+ DEFAULT_PATH_STATIC,
11
+ DEFAULT_PATH_TMP,
12
+ DEFAULT_PATH_DB_DUMPS,
13
+ };
@@ -24,10 +24,20 @@ module.exports = class InitApp {
24
24
  master.setEnv("validationEnv", options.validationEnv);
25
25
  master.setEnv("hostname", config.get("hostname"));
26
26
  master.setEnv("server", `https://` + config.get("host"));
27
- master.setEnv("appPath", config.get("appPath"));
27
+ master.setEnv(
28
+ "appPath",
29
+ master.getAbsolutePath(config.get("path.app"))
30
+ );
31
+ master.setEnv(
32
+ "dbDumpsPath",
33
+ master.getAbsolutePath(config.get("path.dbDumps"))
34
+ );
35
+ master.setEnv(
36
+ "tmpPath",
37
+ master.getAbsolutePath(config.get("path.tmp"))
38
+ );
28
39
  master.setEnv("name", master.getManifest().name);
29
40
  master.setEnv("fullServerName", config.get("fullServerName"));
30
- master.setEnv("dbDumpsPath", config.get("dbDumpsPath"));
31
41
  master.setEnv(
32
42
  "rolesPriority",
33
43
  master.getManifest().targets.server.roles
@@ -1,5 +1,12 @@
1
1
  const log = require("not-log")(module, "not-node//init//env");
2
2
  const { tryDirAsync } = require("../../common");
3
+ const {
4
+ DEFAULT_PATH_WS,
5
+ DEFAULT_PATH_MODULES,
6
+ DEFAULT_PATH_STATIC,
7
+ DEFAULT_PATH_TMP,
8
+ DEFAULT_PATH_DB_DUMPS,
9
+ } = require("../../const");
3
10
 
4
11
  module.exports = class InitENV {
5
12
  static getProxyPort(config) {
@@ -39,24 +46,40 @@ module.exports = class InitENV {
39
46
  await emit("env.pre", { config, options, master });
40
47
  config.set(
41
48
  "staticPath",
42
- master.getAbsolutePath(config.get("path:static") || "static")
49
+ master.getAbsolutePath(
50
+ config.get("path:static", DEFAULT_PATH_STATIC)
51
+ )
43
52
  );
44
53
  config.set(
45
54
  "modulesPath",
46
- master.getAbsolutePath(config.get("path:modules") || "modules")
55
+ master.getAbsolutePath(
56
+ config.get("path:modules", DEFAULT_PATH_MODULES)
57
+ )
47
58
  );
59
+
60
+ config.set(
61
+ "tmpPath",
62
+ master.getAbsolutePath(config.get("path:tmp", DEFAULT_PATH_TMP))
63
+ );
64
+
48
65
  config.set(
49
66
  "dbDumpsPath",
50
67
  master.getAbsolutePath(
51
- config.get("path:dbDumps") || "../../db.dumps"
68
+ config.get("path:dbDumps", DEFAULT_PATH_DB_DUMPS)
52
69
  )
53
70
  );
54
71
  config.set("appPath", options.pathToApp);
55
72
  config.set("npmPath", options.pathToNPM);
56
73
  config.set("fullServerName", InitENV.getFullServerName(config));
57
74
  if (config.get("path:ws")) {
58
- log?.log("wsPath", master.getAbsolutePath(config.get("path:ws")));
59
- config.set("wsPath", master.getAbsolutePath(config.get("path:ws")));
75
+ log?.log(
76
+ "wsPath",
77
+ master.getAbsolutePath(config.get("path:ws", DEFAULT_PATH_WS))
78
+ );
79
+ config.set(
80
+ "wsPath",
81
+ master.getAbsolutePath(config.get("path:ws", DEFAULT_PATH_WS))
82
+ );
60
83
  }
61
84
  await InitENV.checkPaths(master, config);
62
85
  await emit("env.post", { config, options, master });
package/test/init/app.js CHANGED
@@ -35,6 +35,9 @@ module.exports = ({ expect }) => {
35
35
  getMongoose() {
36
36
  return fakeMongoose;
37
37
  },
38
+ getAbsolutePath(val) {
39
+ return val;
40
+ },
38
41
  };
39
42
 
40
43
  await InitApp.createApp({
@@ -81,6 +84,9 @@ module.exports = ({ expect }) => {
81
84
  getMongoose() {
82
85
  return fakeMongoose;
83
86
  },
87
+ getAbsolutePath(val) {
88
+ return val;
89
+ },
84
90
  };
85
91
 
86
92
  await InitApp.createApp({
@@ -132,6 +138,9 @@ module.exports = ({ expect }) => {
132
138
  return fakeManifest;
133
139
  },
134
140
  setEnv() {},
141
+ getAbsolutePath(val) {
142
+ return val;
143
+ },
135
144
  };
136
145
 
137
146
  await InitApp.setAppEnvs({
@@ -406,6 +415,9 @@ module.exports = ({ expect }) => {
406
415
  getManifest() {
407
416
  return fakeManifest;
408
417
  },
418
+ getAbsolutePath(val) {
419
+ return val;
420
+ },
409
421
  };
410
422
  try {
411
423
  await new InitApp().run({