not-node 6.3.67 → 6.3.69
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
package/src/common.js
CHANGED
|
@@ -248,6 +248,20 @@ module.exports.tryFileAsync = async (filePath) => {
|
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Asynchronously check dir existence and if it's really a file
|
|
253
|
+
* @param {string} dirPath full path to file
|
|
254
|
+
* @return {Promise<boolean>} true if path exists and it's a file
|
|
255
|
+
**/
|
|
256
|
+
module.exports.tryDirAsync = async (dirPath) => {
|
|
257
|
+
try {
|
|
258
|
+
const stat = await fs.promises.lstat(dirPath);
|
|
259
|
+
return stat && stat.isDirectory();
|
|
260
|
+
} catch (e) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
251
265
|
/**
|
|
252
266
|
* Trying to parse input to JSON or returns def
|
|
253
267
|
* @param {string} input string to be parsed
|
package/src/init/lib/env.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const log = require("not-log")(module, "not-node//init//env");
|
|
2
|
+
const { tryDirAsync } = require("../../common");
|
|
2
3
|
|
|
3
4
|
module.exports = class InitENV {
|
|
4
5
|
static getProxyPort(config) {
|
|
@@ -20,8 +21,21 @@ module.exports = class InitENV {
|
|
|
20
21
|
return name;
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
static async checkPaths(master, config) {
|
|
25
|
+
const paths = config.get("path");
|
|
26
|
+
if (paths) {
|
|
27
|
+
for (let pathName of Object.keys(paths)) {
|
|
28
|
+
if (await tryDirAsync(paths[pathName])) {
|
|
29
|
+
log?.error(
|
|
30
|
+
`config path (${pathName}) not exists: ${paths[pathName]}`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
23
37
|
async run({ config, options, master, emit }) {
|
|
24
|
-
log
|
|
38
|
+
log?.info("Setting up server environment variables...");
|
|
25
39
|
await emit("env.pre", { config, options, master });
|
|
26
40
|
config.set(
|
|
27
41
|
"staticPath",
|
|
@@ -41,9 +55,10 @@ module.exports = class InitENV {
|
|
|
41
55
|
config.set("npmPath", options.pathToNPM);
|
|
42
56
|
config.set("fullServerName", InitENV.getFullServerName(config));
|
|
43
57
|
if (config.get("path:ws")) {
|
|
44
|
-
log
|
|
58
|
+
log?.log("wsPath", master.getAbsolutePath(config.get("path:ws")));
|
|
45
59
|
config.set("wsPath", master.getAbsolutePath(config.get("path:ws")));
|
|
46
60
|
}
|
|
61
|
+
await InitENV.checkPaths(master, config);
|
|
47
62
|
await emit("env.post", { config, options, master });
|
|
48
63
|
}
|
|
49
64
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { MODULE_NAME } from "../../const.js";
|
|
2
2
|
import Validators from "../common/validators.js";
|
|
3
3
|
import { Frame } from "not-bulma";
|
|
4
|
+
import CRUDActionList from "not-bulma/src/frame/crud/actions/list";
|
|
5
|
+
|
|
4
6
|
const { notCRUD } = Frame;
|
|
5
7
|
|
|
6
8
|
const MODEL_NAME = "<%- ModelName %>";
|
|
@@ -53,27 +55,7 @@ class nc<%- ModelName %>Common extends notCRUD {
|
|
|
53
55
|
path: ":_id",
|
|
54
56
|
title: "Действия",
|
|
55
57
|
type: "button",
|
|
56
|
-
preprocessor: (value) =>
|
|
57
|
-
return [
|
|
58
|
-
{
|
|
59
|
-
action: ()=>this.goDetails(value),
|
|
60
|
-
title: "Подробнее",
|
|
61
|
-
size: "small",
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
action: ()=>this.goUpdate(value),
|
|
65
|
-
title: "Изменить",
|
|
66
|
-
size: "small",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
action: ()=>this.goDelete(value),
|
|
70
|
-
color: "danger",
|
|
71
|
-
title: "Удалить",
|
|
72
|
-
size: "small",
|
|
73
|
-
style: "outlined",
|
|
74
|
-
},
|
|
75
|
-
];
|
|
76
|
-
},
|
|
58
|
+
preprocessor: (value) => CRUDActionList.createActionsButtons(this, value),
|
|
77
59
|
},
|
|
78
60
|
],
|
|
79
61
|
});
|
|
@@ -82,8 +64,8 @@ class nc<%- ModelName %>Common extends notCRUD {
|
|
|
82
64
|
return this;
|
|
83
65
|
}
|
|
84
66
|
|
|
85
|
-
createDefault() {
|
|
86
|
-
let newRecord = this.getModel({
|
|
67
|
+
createDefault() {
|
|
68
|
+
let newRecord = this.getModel({
|
|
87
69
|
<% for (let fieldName of fields){ %><%- fieldName %>: undefined,
|
|
88
70
|
<% } %>
|
|
89
71
|
});
|