not-node 6.5.41 → 6.5.42
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/bin/not-builder.js +27 -16
- package/package.json +1 -1
- package/src/cli/actions/project.mjs +17 -6
- package/src/cli/lib/fs.mjs +12 -4
- package/src/cli/lib/module.server.mjs +1 -1
- package/src/cli/lib/opts.mjs +2 -8
- package/tmpl/dirs/front.mjs +11 -7
- package/tmpl/files/app/package.ejs +5 -3
- package/tmpl/files/app/project.manifest.ejs +5 -5
package/bin/not-builder.js
CHANGED
|
@@ -690,23 +690,34 @@ async function build_Server(pathToRoot, roles, targetName, targetManifest) {
|
|
|
690
690
|
console.log("config path", configName);
|
|
691
691
|
config = lib.getConfReader(configName);
|
|
692
692
|
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
693
|
+
async function render() {
|
|
694
|
+
//searchig for targets
|
|
695
|
+
if (
|
|
696
|
+
config.get("targets") &&
|
|
697
|
+
Object.keys(config.get("targets")).length > 0
|
|
698
|
+
) {
|
|
699
|
+
//cycling through targets
|
|
700
|
+
for (let target in config.get("targets")) {
|
|
701
|
+
let targetConfig = config.get("targets")[target];
|
|
702
|
+
if (targetConfig && targetConfig.builder) {
|
|
703
|
+
//if target type is server
|
|
704
|
+
switch (targetConfig.builder) {
|
|
705
|
+
case "server":
|
|
706
|
+
await build_Server(
|
|
707
|
+
path.dirname(configName),
|
|
708
|
+
targetConfig.roles,
|
|
709
|
+
target,
|
|
710
|
+
targetConfig
|
|
711
|
+
);
|
|
712
|
+
break;
|
|
713
|
+
}
|
|
709
714
|
}
|
|
710
715
|
}
|
|
711
716
|
}
|
|
712
717
|
}
|
|
718
|
+
|
|
719
|
+
render()
|
|
720
|
+
.then(() => {
|
|
721
|
+
process.exit(0);
|
|
722
|
+
})
|
|
723
|
+
.catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isAbsolute, resolve } from "node:path";
|
|
1
|
+
import { isAbsolute, resolve, join } from "node:path";
|
|
2
2
|
|
|
3
3
|
import { Option } from "commander";
|
|
4
4
|
import inquirer from "inquirer";
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
makeScriptExecutable,
|
|
11
11
|
installPackages,
|
|
12
12
|
buildClientSideScripts,
|
|
13
|
+
findAllFields,
|
|
13
14
|
} from "../lib/fs.mjs";
|
|
14
15
|
|
|
15
16
|
import { postStartupInstructions } from "../lib/messages.mjs";
|
|
@@ -77,6 +78,7 @@ export default (program, { CWD }) => {
|
|
|
77
78
|
console.log("creating site in", siteDir);
|
|
78
79
|
const ProjectConfig = {
|
|
79
80
|
path: dir,
|
|
81
|
+
sitePath: siteDir,
|
|
80
82
|
};
|
|
81
83
|
//
|
|
82
84
|
ProjectConfig.AppName = await Readers.AppName(
|
|
@@ -122,16 +124,25 @@ export default (program, { CWD }) => {
|
|
|
122
124
|
await createDir(dir);
|
|
123
125
|
await createDirContent(dir, ProjectStructure, ProjectConfig);
|
|
124
126
|
await createProjectToolsAndConfigs(dir, ProjectConfig);
|
|
125
|
-
const PATH_MODULES_SERVER =
|
|
126
|
-
|
|
127
|
+
const PATH_MODULES_SERVER = join(
|
|
128
|
+
ProjectConfig.sitePath,
|
|
127
129
|
Options.DEFAULT_SERVER_MODULES_SUB_PATH
|
|
128
130
|
);
|
|
129
|
-
const PATH_MODULES_FRONT =
|
|
130
|
-
|
|
131
|
+
const PATH_MODULES_FRONT = join(
|
|
132
|
+
ProjectConfig.sitePath,
|
|
131
133
|
Options.DEFAULT_FRONT_MODULES_SUB_PATH
|
|
132
134
|
);
|
|
135
|
+
const modulesDir = join(
|
|
136
|
+
siteDir,
|
|
137
|
+
Options.DEFAULT_SERVER_MODULES_SUB_PATH
|
|
138
|
+
);
|
|
139
|
+
const allFields = await findAllFields(dir, modulesDir);
|
|
133
140
|
while (await Readers.isUserNeedCreateServerModule(inquirer)) {
|
|
134
|
-
await createServerModule(
|
|
141
|
+
await createServerModule(
|
|
142
|
+
PATH_MODULES_SERVER,
|
|
143
|
+
ProjectConfig,
|
|
144
|
+
allFields
|
|
145
|
+
);
|
|
135
146
|
}
|
|
136
147
|
if (await Readers.isUserNeedFrontModuleBootstrap(inquirer)) {
|
|
137
148
|
await createBootstrapFrontModule(
|
package/src/cli/lib/fs.mjs
CHANGED
|
@@ -136,7 +136,7 @@ function makeScriptExecutable(pathToTargetScript) {
|
|
|
136
136
|
});
|
|
137
137
|
npmInstall.on("exit", (code) => {
|
|
138
138
|
if (code == 0) {
|
|
139
|
-
resolve();
|
|
139
|
+
resolve(true);
|
|
140
140
|
} else {
|
|
141
141
|
reject(`chmod +x ${pathToTargetScript} ${code}`);
|
|
142
142
|
}
|
|
@@ -156,7 +156,7 @@ function installPackages(siteDir) {
|
|
|
156
156
|
});
|
|
157
157
|
npmInstall.on("exit", (code) => {
|
|
158
158
|
if (code == 0) {
|
|
159
|
-
resolve();
|
|
159
|
+
resolve(true);
|
|
160
160
|
} else {
|
|
161
161
|
reject(`NPM install exited with code ${code}`);
|
|
162
162
|
}
|
|
@@ -171,12 +171,16 @@ function buildClientSideScripts(siteDir) {
|
|
|
171
171
|
cwd: siteDir,
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
+
npmInstall.stdout.on("data", (data) => {
|
|
175
|
+
Logger.log(data.toString());
|
|
176
|
+
});
|
|
177
|
+
|
|
174
178
|
npmInstall.stderr.on("data", (data) => {
|
|
175
179
|
Logger.error(data.toString());
|
|
176
180
|
});
|
|
177
181
|
npmInstall.on("exit", (code) => {
|
|
178
182
|
if (code == 0) {
|
|
179
|
-
resolve();
|
|
183
|
+
resolve(true);
|
|
180
184
|
} else {
|
|
181
185
|
reject(`npm run build job exited with code ${code}`);
|
|
182
186
|
}
|
|
@@ -269,7 +273,11 @@ async function findAllFieldsInGlobalNodeModules() {
|
|
|
269
273
|
const result = [];
|
|
270
274
|
for (let globalLib of Options.DEFAULT_GLOBAL_NPM_LIB) {
|
|
271
275
|
const dirname = join(globalLib, "node_modules");
|
|
272
|
-
|
|
276
|
+
try {
|
|
277
|
+
result.push(...(await findAllFieldsInModules(dirname)));
|
|
278
|
+
} catch {
|
|
279
|
+
Logger.log("No fields in ", dirname);
|
|
280
|
+
}
|
|
273
281
|
}
|
|
274
282
|
return result;
|
|
275
283
|
}
|
|
@@ -89,7 +89,7 @@ async function createServerModule(modules_dir, config, availableFields = []) {
|
|
|
89
89
|
availableFields,
|
|
90
90
|
};
|
|
91
91
|
await createDir(moduleDir);
|
|
92
|
-
|
|
92
|
+
console.log(JSON.stringify(moduleConfig, null, 4));
|
|
93
93
|
await createDirContent(
|
|
94
94
|
moduleDir,
|
|
95
95
|
ProjectSubStructures["module.server"],
|
package/src/cli/lib/opts.mjs
CHANGED
|
@@ -16,18 +16,12 @@ class Options {
|
|
|
16
16
|
|
|
17
17
|
#DEFAULT_SERVER_MODULES_SUB_PATH = "./app/server/modules";
|
|
18
18
|
get DEFAULT_SERVER_MODULES_SUB_PATH() {
|
|
19
|
-
return
|
|
20
|
-
this.DEFAULT_SITE_PATH,
|
|
21
|
-
this.#DEFAULT_SERVER_MODULES_SUB_PATH
|
|
22
|
-
);
|
|
19
|
+
return this.#DEFAULT_SERVER_MODULES_SUB_PATH;
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
#DEFAULT_FRONT_MODULES_SUB_PATH = "./app/front/src";
|
|
26
23
|
get DEFAULT_FRONT_MODULES_SUB_PATH() {
|
|
27
|
-
return
|
|
28
|
-
this.DEFAULT_SITE_PATH,
|
|
29
|
-
this.#DEFAULT_FRONT_MODULES_SUB_PATH
|
|
30
|
-
);
|
|
24
|
+
return this.#DEFAULT_FRONT_MODULES_SUB_PATH;
|
|
31
25
|
}
|
|
32
26
|
|
|
33
27
|
#PATH_TMPL = resolve(__dirname, "../../../tmpl/files");
|
package/tmpl/dirs/front.mjs
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
build: {},
|
|
3
3
|
src: {},
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
tmpl: {
|
|
5
|
+
content: {
|
|
6
|
+
"index.!.js": {
|
|
7
|
+
tmpl: "app/front/index.!.ejs",
|
|
8
|
+
args: ["not_node_reporter"],
|
|
9
|
+
},
|
|
10
|
+
"rollup.!.js": {
|
|
11
|
+
tmpl: "app/front/rollup.!.ejs",
|
|
12
|
+
args: [],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
11
15
|
},
|
|
12
16
|
"build.env.js": {
|
|
13
17
|
tmpl: "app/front/build.env.ejs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"redis": "*",
|
|
33
33
|
"pug":"*",
|
|
34
|
-
"not-node": "*",
|
|
34
|
+
"not-node": "*",
|
|
35
35
|
<% for(let moduleName of modules){ %>"<%- moduleName %>":"*",
|
|
36
36
|
<% } %>
|
|
37
37
|
"dotenv": "*"
|
|
@@ -45,6 +45,8 @@
|
|
|
45
45
|
"@rollup/plugin-commonjs": "^22.0.1",
|
|
46
46
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
47
47
|
"@rollup/plugin-json": "^4.1.0",
|
|
48
|
+
"@babel/plugin-proposal-class-properties": "*",
|
|
49
|
+
"@babel/plugin-proposal-private-methods" : "*",
|
|
48
50
|
"babel-core": "*",
|
|
49
51
|
"babel-polyfill": "*",
|
|
50
52
|
"babel-preset-es2015-rollup": "*",
|
|
@@ -54,7 +56,7 @@
|
|
|
54
56
|
"ink-docstrap": "^1.3.2",
|
|
55
57
|
"jsdoc": "^3.6.11",
|
|
56
58
|
"mocha": "^10.0.0",
|
|
57
|
-
"ndb": "^1.1.5",
|
|
59
|
+
"ndb": "^1.1.5",
|
|
58
60
|
"nyc": "^15.1.0",
|
|
59
61
|
"rollup": "^2.77.2",
|
|
60
62
|
"rollup-plugin-postcss": "^4.0.2",
|
|
@@ -68,4 +70,4 @@
|
|
|
68
70
|
"svelte": "*",
|
|
69
71
|
"yargs": "^17.5.1"
|
|
70
72
|
}
|
|
71
|
-
}
|
|
73
|
+
}
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
"name": "<%- AppName %>",
|
|
6
6
|
"roles": [<% roles.forEach(function(role, index){ %>"<%- role %>"<%- (roles.length - 1 > index)?',':'' %><% }); %>],
|
|
7
7
|
"builder": "server",
|
|
8
|
-
"root": "app/front/",
|
|
9
|
-
"src": "app/front/",
|
|
8
|
+
"root": "app/front/tmpl",
|
|
9
|
+
"src": "app/front/tmpl",
|
|
10
10
|
"build": "app/front/build/",
|
|
11
|
-
"index": "app/front/index.!.
|
|
12
|
-
"rollup": "app/front/rollup.!.
|
|
11
|
+
"index": "app/front/tmpl/index.!.mjs",
|
|
12
|
+
"rollup": "app/front/tmpl/rollup.!.mjs",
|
|
13
13
|
"modules": {
|
|
14
14
|
"serverModulesDir": "app/server/modules",
|
|
15
15
|
"frontModulesDir": "app/front/src",
|
|
16
16
|
"npm": {
|
|
17
17
|
<% modules.forEach(function(module, index){ %>"<%- module %>": {}<%- (modules.length - 1 > index)?',':'' %>
|
|
18
|
-
<% }); %>
|
|
18
|
+
<% }); %>
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|