@lmjs/cli 1.0.21 → 1.0.23
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/LICENSE +0 -0
- package/README.md +3 -3
- package/index.js +60 -54
- package/lib/app.js +5 -6
- package/lib/check-version.js +1 -1
- package/lib/fcs.js +23 -36
- package/lib/files/build/func.js +85 -49
- package/lib/files/build/package.json +1 -1
- package/lib/files/build/server.js +32 -1
- package/lib/files/build/src/favicon.ico +0 -0
- package/lib/files/build/src/robots.txt +0 -0
- package/lib/files/build/src/sitemap.xml +0 -0
- package/lib/files/build_serverless/.htaccess +0 -0
- package/lib/files/build_serverless/favicon.ico +0 -0
- package/lib/files/build_serverless/robots.txt +0 -0
- package/lib/files/build_serverless/sitemap.xml +0 -0
- package/lib/files/project/config.json +1 -31
- package/lib/files/project/src/404.html +0 -0
- package/lib/files/project/src/index.html +1 -2
- package/lib/files/project/src/index.js +0 -0
- package/lib/files/project/src/tpls/tpl1.tpl +1 -0
- package/lib/files/project/src/views/about.view +0 -0
- package/lib/files/project/src/views/contact.view +0 -0
- package/lib/files/project/src/views/home.view +0 -0
- package/lib/files/project/src/views/widgets/footer.view +0 -0
- package/lib/files/project/src/views/widgets/header.view +0 -0
- package/lib/files/project/src/views/widgets/nav.view +0 -0
- package/lib/files/sub_view.view +0 -0
- package/lib/files/tpl.tpl +1 -0
- package/lib/files/view.view +0 -0
- package/package.json +1 -1
- package/lib/files/comp.tpl +0 -1
- package/lib/files/project/src/comps/comp1.tpl +0 -1
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ LumenJS is a tiny robust reactive javascript framework for building scalable and
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
LumenJS comes along with MobiusCSS library which is a utility-first CSS framework packed with grid and table sectioning systems and classes like g, mt20, pv100, c and sq that can be composed to build any design, directly in your markup.
|
|
11
|
-
<a href="https://mobius.
|
|
11
|
+
<a href="https://mobius.lumenjs.com/" target="_blank">MobiusCSS Documentation</a>
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -50,9 +50,9 @@ lm create -s mysubview
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
Create A
|
|
53
|
+
Create A Template
|
|
54
54
|
```
|
|
55
|
-
lm create -c
|
|
55
|
+
lm create -c mytemplate
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
|
package/index.js
CHANGED
|
@@ -72,7 +72,7 @@ async function buildProject(cmds) {
|
|
|
72
72
|
var dest = projectPath + path.sep + 'dist';
|
|
73
73
|
|
|
74
74
|
let _views = fcs.getAllFiles(`${process.cwd()}` + path.sep + `src` + path.sep + `views` + path.sep);
|
|
75
|
-
let
|
|
75
|
+
let _tpls = fcs.getAllFiles(`${process.cwd()}` + path.sep + `src` + path.sep + `tpls` + path.sep);
|
|
76
76
|
var config = fcs.getConfig();
|
|
77
77
|
|
|
78
78
|
var indexCode = fs.readFileSync(projectPath + path.sep + `src` + path.sep + "index.html", "utf8");
|
|
@@ -86,9 +86,9 @@ async function buildProject(cmds) {
|
|
|
86
86
|
spinner.succeed("Gathering Required Resources");
|
|
87
87
|
var beaCode = "";
|
|
88
88
|
if (cmds.indexOf('--serverless') >= 0) {
|
|
89
|
-
spinner.start('
|
|
89
|
+
spinner.start('Signing & Securing App..');
|
|
90
90
|
|
|
91
|
-
let r = await API.post("https://
|
|
91
|
+
let r = await API.post("https://www.beaapis.com/1/beajs", {
|
|
92
92
|
"data": JSON.stringify(config.apis)
|
|
93
93
|
});
|
|
94
94
|
|
|
@@ -105,12 +105,12 @@ async function buildProject(cmds) {
|
|
|
105
105
|
`;
|
|
106
106
|
}
|
|
107
107
|
beaCode += kkk;
|
|
108
|
-
spinner.start('Packing & Cleaning...');
|
|
108
|
+
spinner.succeed("Signing & Securing App").start('Packing & Cleaning...');
|
|
109
109
|
|
|
110
110
|
beaCode += `
|
|
111
111
|
var _vcData = {
|
|
112
112
|
"views": `+ JSON.stringify(_views) + `,
|
|
113
|
-
"
|
|
113
|
+
"tpls": `+ JSON.stringify(_tpls) + `
|
|
114
114
|
};
|
|
115
115
|
`;
|
|
116
116
|
beaCode += `
|
|
@@ -155,54 +155,6 @@ async function buildProject(cmds) {
|
|
|
155
155
|
fs.writeFileSync(dest + path.sep + "js" + path.sep + "bea.js", String(zode.code));
|
|
156
156
|
fs.writeFileSync(dest + path.sep + "css" + path.sep + "bea.css", String(beaCSSCode));
|
|
157
157
|
fs.writeFileSync(dest + path.sep + "index.html", String(indexCode).split('<script src="/index.js" type="text/javascript"></script>').join("").split('/js/bea.js').join("/js/bea.js?v" + new Date().getTime()).split('/css/styles.css').join("/css/styles.css?v" + new Date().getTime()).split('/css/bea.css').join("/css/bea.css?v" + new Date().getTime()));
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (cmds.indexOf('--deploy') >= 0) {
|
|
161
|
-
spinner.succeed('Writing Files').start('Uploading To Server..');
|
|
162
|
-
const _config = {
|
|
163
|
-
user: config.ftp.username,
|
|
164
|
-
// Password optional, prompted if none given
|
|
165
|
-
password: config.ftp.password,
|
|
166
|
-
host: config.ftp.host,
|
|
167
|
-
port: config.ftp.port,
|
|
168
|
-
localRoot: dest,
|
|
169
|
-
remoteRoot: config.ftp.remotePath,
|
|
170
|
-
include: ["*", "**/*", ".*"], // this would upload everything except dot files
|
|
171
|
-
// include: ["*.js", "dist/*", ".*"],
|
|
172
|
-
// e.g. exclude sourcemaps, and ALL files in node_modules (including dot files)
|
|
173
|
-
exclude: config.ftp.ignore,
|
|
174
|
-
// delete ALL existing files at destination before uploading, if true
|
|
175
|
-
deleteRemote: false,
|
|
176
|
-
// Passive mode is forced (EPSV command is not sent)
|
|
177
|
-
forcePasv: true,
|
|
178
|
-
// use sftp or ftp
|
|
179
|
-
sftp: false,
|
|
180
|
-
};
|
|
181
|
-
// console.log(_config);
|
|
182
|
-
|
|
183
|
-
ftpDeploy.deploy(_config, function (err, res) {
|
|
184
|
-
if (err) {
|
|
185
|
-
console.log(err);
|
|
186
|
-
} else {
|
|
187
|
-
spinner.succeed("Finished Uploading To Server");
|
|
188
|
-
spinner.succeed("Done");
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
ftpDeploy.on("uploading", function (data) {
|
|
192
|
-
spinner.start(parseFloat(((data.transferredFileCount) * 100 / data.totalFilesCount).toFixed(2)) + '% ' + 'Uploading ' + data.filename + ' ');
|
|
193
|
-
});
|
|
194
|
-
// ftpDeploy.on("uploaded", function (data) {
|
|
195
|
-
// console.log(data); // same data as uploading event
|
|
196
|
-
// });
|
|
197
|
-
// ftpDeploy.on("log", function (data) {
|
|
198
|
-
// console.log(data); // same data as uploading event
|
|
199
|
-
// });
|
|
200
|
-
// ftpDeploy.on("upload-error", function (data) {
|
|
201
|
-
// console.log(data.err); // data will also include filename, relativePath, and other goodies
|
|
202
|
-
// });
|
|
203
|
-
|
|
204
|
-
} else
|
|
205
|
-
spinner.succeed('Writing Files').succeed("Done");
|
|
206
158
|
} else {
|
|
207
159
|
fcs.copyDir(`${__dirname}` + path.sep + `lib` + path.sep + `files` + path.sep + buildPath, dest);
|
|
208
160
|
fcs.copyDir(projectPath + path.sep + "src", dest + path.sep + "src", "_beajsBuild");
|
|
@@ -210,6 +162,14 @@ async function buildProject(cmds) {
|
|
|
210
162
|
fcs.cd(dest + path.sep + "src" + path.sep + "css");
|
|
211
163
|
fcs.cd(dest + path.sep + "src" + path.sep + "images");
|
|
212
164
|
|
|
165
|
+
let appFile = projectPath + path.sep + `src` + path.sep + "app.js";
|
|
166
|
+
if (fs.existsSync(appFile)) {
|
|
167
|
+
var appCode = fs.readFileSync(appFile, "utf8");
|
|
168
|
+
var serverJsCode = fs.readFileSync(`${__dirname}` + path.sep + `lib` + path.sep + `files` + path.sep + buildPath + path.sep + "server.js", "utf8");
|
|
169
|
+
fs.writeFileSync(dest + path.sep + "server.js", String(serverJsCode).split('//APP_HOLDER').join(appCode));
|
|
170
|
+
fs.unlinkSync(dest + path.sep + "src" + path.sep + "app.js");
|
|
171
|
+
}
|
|
172
|
+
|
|
213
173
|
// fcs.copyDir(projectPath + path.sep + `src` + path.sep + `css`, dest + path.sep + "src" + path.sep + "css");
|
|
214
174
|
fcs.copyDir(projectPath + path.sep + "src" + path.sep + "js", dest + path.sep + "src" + path.sep + "js", "_beajsBuild");
|
|
215
175
|
fcs.copyDir(projectPath + path.sep + "src" + path.sep + "css", dest + path.sep + "src" + path.sep + "css", "_beajsBuild");
|
|
@@ -220,9 +180,55 @@ async function buildProject(cmds) {
|
|
|
220
180
|
fs.writeFileSync(dest + path.sep + "src" + path.sep + "index.html", String(indexCode).split('<script src="/index.js" type="text/javascript"></script>').join(""));
|
|
221
181
|
fs.writeFileSync(dest + path.sep + "config.js", String(zode2.code));
|
|
222
182
|
|
|
223
|
-
spinner.succeed('Writing Files').succeed("Done");
|
|
224
183
|
}
|
|
225
184
|
|
|
185
|
+
if (cmds.indexOf('--deploy') >= 0) {
|
|
186
|
+
spinner.succeed('Writing Files').start('Uploading To Server..');
|
|
187
|
+
const _config = {
|
|
188
|
+
user: config.ftp.username,
|
|
189
|
+
// Password optional, prompted if none given
|
|
190
|
+
password: config.ftp.password,
|
|
191
|
+
host: config.ftp.host,
|
|
192
|
+
port: config.ftp.port,
|
|
193
|
+
localRoot: dest,
|
|
194
|
+
remoteRoot: config.ftp.remotePath,
|
|
195
|
+
include: ["*", "**/*", ".*"], // this would upload everything except dot files
|
|
196
|
+
// include: ["*.js", "dist/*", ".*"],
|
|
197
|
+
// e.g. exclude sourcemaps, and ALL files in node_modules (including dot files)
|
|
198
|
+
exclude: config.ftp.ignore,
|
|
199
|
+
// delete ALL existing files at destination before uploading, if true
|
|
200
|
+
deleteRemote: false,
|
|
201
|
+
// Passive mode is forced (EPSV command is not sent)
|
|
202
|
+
forcePasv: true,
|
|
203
|
+
// use sftp or ftp
|
|
204
|
+
sftp: false,
|
|
205
|
+
};
|
|
206
|
+
// console.log(_config);
|
|
207
|
+
|
|
208
|
+
ftpDeploy.deploy(_config, function (err, res) {
|
|
209
|
+
if (err) {
|
|
210
|
+
console.log(err);
|
|
211
|
+
} else {
|
|
212
|
+
spinner.succeed("Finished Uploading To Server");
|
|
213
|
+
spinner.succeed("Done");
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
ftpDeploy.on("uploading", function (data) {
|
|
217
|
+
spinner.start(parseFloat(((data.transferredFileCount) * 100 / data.totalFilesCount).toFixed(2)) + '% ' + 'Uploading ' + data.filename + ' ');
|
|
218
|
+
});
|
|
219
|
+
// ftpDeploy.on("uploaded", function (data) {
|
|
220
|
+
// console.log(data); // same data as uploading event
|
|
221
|
+
// });
|
|
222
|
+
// ftpDeploy.on("log", function (data) {
|
|
223
|
+
// console.log(data); // same data as uploading event
|
|
224
|
+
// });
|
|
225
|
+
// ftpDeploy.on("upload-error", function (data) {
|
|
226
|
+
// console.log(data.err); // data will also include filename, relativePath, and other goodies
|
|
227
|
+
// });
|
|
228
|
+
|
|
229
|
+
} else
|
|
230
|
+
spinner.succeed('Writing Files').succeed("Done");
|
|
231
|
+
|
|
226
232
|
});
|
|
227
233
|
|
|
228
234
|
}
|
package/lib/app.js
CHANGED
|
@@ -26,7 +26,7 @@ let session = expressSession({
|
|
|
26
26
|
|
|
27
27
|
var config = fcs.getConfig();
|
|
28
28
|
var _views = {};
|
|
29
|
-
var
|
|
29
|
+
var _tpls = {};
|
|
30
30
|
|
|
31
31
|
app.use(compression());
|
|
32
32
|
app.use(cookieParser());
|
|
@@ -40,7 +40,6 @@ app.use(upload.array());
|
|
|
40
40
|
|
|
41
41
|
wss.on('connection', (ws) => {
|
|
42
42
|
ws.on('message', async (message) => {
|
|
43
|
-
|
|
44
43
|
try {
|
|
45
44
|
const buffer = Buffer.from(message);
|
|
46
45
|
const data = JSON.parse(buffer.toString());
|
|
@@ -55,10 +54,10 @@ wss.on('connection', (ws) => {
|
|
|
55
54
|
if (data.e == "getfiles") {
|
|
56
55
|
_data['payload'] = {
|
|
57
56
|
"views": _views,
|
|
58
|
-
"
|
|
57
|
+
"tpls": _tpls
|
|
59
58
|
};
|
|
60
|
-
} else if (data.e == "
|
|
61
|
-
_data.payload =
|
|
59
|
+
} else if (data.e == "gettpl") {
|
|
60
|
+
_data.payload = _tpls[data.payload];
|
|
62
61
|
} else if (data.e == "getview") {
|
|
63
62
|
_data.payload = _views[data.payload];
|
|
64
63
|
} else if (data.e == "request") {
|
|
@@ -124,5 +123,5 @@ app.post('*', function (req, res) {
|
|
|
124
123
|
server.listen(config.server.port, function () {
|
|
125
124
|
console.log(`LumenJS server running at http://${config.server.host}:${config.server.port}/`);
|
|
126
125
|
_views = fcs.getAllFiles(`${process.cwd()}` + path.sep + `src` + path.sep + `views` + path.sep);
|
|
127
|
-
|
|
126
|
+
_tpls = fcs.getAllFiles(`${process.cwd()}` + path.sep + `src` + path.sep + `tpls` + path.sep);
|
|
128
127
|
});
|
package/lib/check-version.js
CHANGED
package/lib/fcs.js
CHANGED
|
@@ -37,45 +37,32 @@ exports.getConfig = function () {
|
|
|
37
37
|
"cert": "/certificate.cer"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
-
"project_info": {
|
|
41
|
-
"Title": "PROJECT_TITLE",
|
|
42
|
-
"Description": "PROJECT_DESCRIPTION",
|
|
43
|
-
"Keywords": "website,search,tags,goes,here",
|
|
44
|
-
"WebsiteURL": "https://www.example.com/",
|
|
45
|
-
"Favicon": "/images/favicon.ico",
|
|
46
|
-
"SocialMedia": {
|
|
47
|
-
"LI": "https://www.linkedin.com/",
|
|
48
|
-
"IG": "https://www.instagram.com/",
|
|
49
|
-
"FB": "https://www.facebook.com/"
|
|
50
|
-
},
|
|
51
|
-
"MetaTags": {
|
|
52
|
-
"og:url": "https://www.example.com/",
|
|
53
|
-
"og:title": "PROJECT_TITLE",
|
|
54
|
-
"og:type": "business.business",
|
|
55
|
-
"og:site_name": "PROJECT_TITLE",
|
|
56
|
-
"fb:admins": "592515154",
|
|
57
|
-
"fb:app_id": "138025696270006",
|
|
58
|
-
"og:description": "PROJECT_TITLE",
|
|
59
|
-
"og:image": "/images/example.png",
|
|
60
|
-
"business:contact_data:street_address": "Street Address.",
|
|
61
|
-
"business:contact_data:locality": "Tripoli",
|
|
62
|
-
"business:contact_data:postal_code": "1300",
|
|
63
|
-
"business:contact_data:country_name": "Lebanon",
|
|
64
|
-
"business:contact_data:email": "info@example.com",
|
|
65
|
-
"business:contact_data:phone_number": "+96171299411",
|
|
66
|
-
"business:contact_data:fax_number": "+96171299411",
|
|
67
|
-
"business:contact_data:website": "https://www.example.com/"
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
40
|
"apis": [
|
|
71
41
|
{
|
|
72
|
-
"baseURL": "https://
|
|
42
|
+
"baseURL": "https://www.beaapis.com/1",
|
|
73
43
|
"headers": {
|
|
74
44
|
"X-BEA-Application-ID": "YOUR_APPLICATION_ID",
|
|
75
45
|
"X-BEA-Authorization": "YOUR_REST_API_KEY"
|
|
76
46
|
}
|
|
77
47
|
}
|
|
78
|
-
]
|
|
48
|
+
],
|
|
49
|
+
"ftp": {
|
|
50
|
+
"host": "ftp_host",
|
|
51
|
+
"username": "ftp_username",
|
|
52
|
+
"password": "ftp_password",
|
|
53
|
+
"remotePath": "/",
|
|
54
|
+
"concurrency": 4,
|
|
55
|
+
"protocol": "ftp",
|
|
56
|
+
"port": 21,
|
|
57
|
+
"ignore": [],
|
|
58
|
+
"syncOption": {
|
|
59
|
+
"delete": false,
|
|
60
|
+
"ignoreExisting": false,
|
|
61
|
+
"skipCreate": false,
|
|
62
|
+
"update": true
|
|
63
|
+
},
|
|
64
|
+
"connectTimeout": 30000
|
|
65
|
+
}
|
|
79
66
|
};
|
|
80
67
|
let configPath = process.cwd() + path.sep + `config.json`;
|
|
81
68
|
if (fs.existsSync(configPath)) {
|
|
@@ -160,9 +147,9 @@ exports.create = function (conf) {
|
|
|
160
147
|
}
|
|
161
148
|
});
|
|
162
149
|
} else {
|
|
163
|
-
let file = t == "s" ? "sub_view.view" : (t == "c" ? "
|
|
164
|
-
let ident = t == "s" ? "SubView" : (t == "c" ? "
|
|
165
|
-
let dir = t == "c" ? "
|
|
150
|
+
let file = t == "s" ? "sub_view.view" : (t == "c" ? "tpl.tpl" : "view.view");
|
|
151
|
+
let ident = t == "s" ? "SubView" : (t == "c" ? "Template" : "View");
|
|
152
|
+
let dir = t == "c" ? "tpls" : "views";
|
|
166
153
|
let ext = t == "c" ? "tpl" : "view";
|
|
167
154
|
let html5 = Buffer.from(fs.readFileSync(`${__dirname}` + path.sep + `files` + path.sep + file).toString().split("[" + ident + 'Name' + "]").join(ucwords(n)));
|
|
168
155
|
var filePath = `${process.cwd()}` + path.sep + `src` + path.sep + dir + path.sep + `${n}.${ext}`;
|
|
@@ -185,7 +172,7 @@ function copyDir(src, dest, projectName) {
|
|
|
185
172
|
const destPath = path.join(dest.toString(), entry.name.toString());
|
|
186
173
|
if (entry.isDirectory()) {
|
|
187
174
|
if (projectName == "_beajsBuild") {
|
|
188
|
-
if (entry.name != "
|
|
175
|
+
if (entry.name != "tpls" && entry.name != "views" && entry.name != "css" && entry.name != "js") copyDir(srcPath, destPath, projectName);
|
|
189
176
|
}
|
|
190
177
|
else copyDir(srcPath, destPath, projectName);
|
|
191
178
|
} else {
|
package/lib/files/build/func.js
CHANGED
|
@@ -1,66 +1,102 @@
|
|
|
1
|
-
const axios = require(
|
|
2
|
-
const path = require("path")
|
|
3
|
-
const express = require(
|
|
4
|
-
var compression = require(
|
|
1
|
+
const axios = require("axios").default;
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const express = require("express");
|
|
4
|
+
var compression = require("compression");
|
|
5
5
|
const app = express();
|
|
6
|
-
const server = require(
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
6
|
+
const server = require("http").createServer(app);
|
|
7
|
+
|
|
8
|
+
var WebSocketServer = require("ws").Server;
|
|
9
|
+
var wss = new WebSocketServer({ server: server, path: "/" });
|
|
10
|
+
|
|
11
|
+
var cookieParser = require("cookie-parser");
|
|
12
|
+
var expressSession = require("express-session");
|
|
13
|
+
const bodyParser = require("body-parser");
|
|
14
|
+
var multer = require("multer");
|
|
15
|
+
const config = require("./config").config;
|
|
13
16
|
var upload = multer();
|
|
14
17
|
let session = expressSession({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
secret: "lumenjs",
|
|
19
|
+
resave: true,
|
|
20
|
+
saveUninitialized: true,
|
|
21
|
+
cookie: { maxAge: 9999000 },
|
|
19
22
|
});
|
|
20
23
|
|
|
21
|
-
function validURL(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
'(\\#[-a-z\\d_]*)?$', 'i');
|
|
28
|
-
return !!pattern.test(str);
|
|
24
|
+
function validURL(string) {
|
|
25
|
+
let url;
|
|
26
|
+
try {
|
|
27
|
+
url = new URL(string);
|
|
28
|
+
} catch (_) {
|
|
29
|
+
return false;
|
|
29
30
|
}
|
|
31
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.validURL = validURL;
|
|
30
35
|
|
|
31
36
|
exports.config = config;
|
|
32
37
|
exports.server = function () {
|
|
33
|
-
|
|
38
|
+
return server;
|
|
34
39
|
};
|
|
35
40
|
exports.app = function () {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
app.use(cookieParser());
|
|
42
|
+
app.use(session);
|
|
43
|
+
app.use(compression());
|
|
44
|
+
app.use(express.static(path.join(__dirname, "./src")));
|
|
45
|
+
app.set("etag", false);
|
|
46
|
+
app.use(bodyParser.urlencoded({ extended: true }));
|
|
47
|
+
app.use(bodyParser.json());
|
|
48
|
+
app.use(bodyParser.raw());
|
|
49
|
+
app.use(upload.array());
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
wss.on("connection", (ws) => {
|
|
52
|
+
ws.on("message", async (message) => {
|
|
53
|
+
try {
|
|
54
|
+
const buffer = Buffer.from(message);
|
|
55
|
+
const data = JSON.parse(buffer.toString());
|
|
56
|
+
|
|
57
|
+
if (data.hasOwnProperty("e")) {
|
|
58
|
+
var _data = {
|
|
59
|
+
e: data.e,
|
|
60
|
+
_iter: data._iter,
|
|
61
|
+
payload: {},
|
|
62
|
+
};
|
|
49
63
|
|
|
50
|
-
|
|
51
|
-
socket.on("request", async function (_data, _body, cb) {
|
|
64
|
+
if (data.e == "request") {
|
|
52
65
|
try {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
let pata = data.payload;
|
|
67
|
+
let __data = pata["data"];
|
|
68
|
+
let _body = pata["body"];
|
|
69
|
+
let res = await axios({
|
|
70
|
+
method: _body["method"].toString().toLowerCase(),
|
|
71
|
+
url: fcs.validURL(_body["path"])
|
|
72
|
+
? _body["path"]
|
|
73
|
+
: config.apis[_body["api"] ?? 0].baseURL + _body["path"],
|
|
74
|
+
data: __data ?? {},
|
|
75
|
+
headers:
|
|
76
|
+
_body["headers"] ?? config.apis[_body["api"] ?? 0].headers,
|
|
77
|
+
});
|
|
78
|
+
_data.payload = _body["full"]
|
|
79
|
+
? {
|
|
80
|
+
headers: res.headers,
|
|
81
|
+
data: res.data,
|
|
82
|
+
}
|
|
83
|
+
: res.data;
|
|
84
|
+
ws.send(JSON.stringify(_data));
|
|
60
85
|
} catch (e) {
|
|
61
|
-
|
|
86
|
+
_data.payload = {
|
|
87
|
+
code: 108,
|
|
88
|
+
error: e.message,
|
|
89
|
+
type: "RequestError",
|
|
90
|
+
};
|
|
91
|
+
ws.send(JSON.stringify(_data));
|
|
62
92
|
}
|
|
63
|
-
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
ws.send(JSON.stringify(_data));
|
|
97
|
+
}
|
|
98
|
+
} catch (e) {}
|
|
64
99
|
});
|
|
65
|
-
|
|
66
|
-
|
|
100
|
+
});
|
|
101
|
+
return app;
|
|
102
|
+
};
|
|
@@ -1,9 +1,40 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
+
const axios = require("axios").default;
|
|
2
3
|
const func = require('./func');
|
|
3
4
|
const app = func.app();
|
|
4
5
|
const server = func.server();
|
|
5
6
|
var config = func.config;
|
|
6
7
|
|
|
8
|
+
var API =
|
|
9
|
+
{
|
|
10
|
+
get: async function (u, d, h, a) {
|
|
11
|
+
return await this.req(u, d, h, "GET", a);
|
|
12
|
+
},
|
|
13
|
+
put: async function (u, d, h, a) {
|
|
14
|
+
return await this.req(u, d, h, "PUT", a);
|
|
15
|
+
},
|
|
16
|
+
post: async function (u, d, h, a) {
|
|
17
|
+
return await this.req(u, d, h, "POST", a);
|
|
18
|
+
},
|
|
19
|
+
delete: async function (u, d, h, a) {
|
|
20
|
+
return await this.req(u, d, h, "DELETE", a);
|
|
21
|
+
},
|
|
22
|
+
patch: async function (u, d, h, a) {
|
|
23
|
+
return await this.req(u, d, h, "PATCH", a);
|
|
24
|
+
},
|
|
25
|
+
req: async function (u, d, h, m, a) {
|
|
26
|
+
let res = await axios({
|
|
27
|
+
method: m.toString().toLowerCase(),
|
|
28
|
+
url: func.validURL(u) ? u : (config.apis[a ?? 0].baseURL + u),
|
|
29
|
+
data: d ?? {},
|
|
30
|
+
headers: h ?? config.apis[a ?? 0].headers
|
|
31
|
+
});
|
|
32
|
+
return res.data;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//APP_HOLDER
|
|
37
|
+
|
|
7
38
|
app.get('/', (req, res) => {
|
|
8
39
|
res.sendFile(path.join(__dirname, './src/index.html'));
|
|
9
40
|
});
|
|
@@ -23,5 +54,5 @@ app.post('*', function (req, res) {
|
|
|
23
54
|
});
|
|
24
55
|
|
|
25
56
|
server.listen(config.server.port, function () {
|
|
26
|
-
console.log(`
|
|
57
|
+
console.log(`LumenJS client server running at http://${config.server.host}:${config.server.port}/`);
|
|
27
58
|
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -9,39 +9,9 @@
|
|
|
9
9
|
"cert": "/certificate.cer"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
-
"project_info": {
|
|
13
|
-
"Title": "PROJECT_TITLE",
|
|
14
|
-
"Description": "PROJECT_DESCRIPTION",
|
|
15
|
-
"Keywords": "website,search,tags,goes,here",
|
|
16
|
-
"WebsiteURL": "https://www.example.com/",
|
|
17
|
-
"Favicon": "/images/favicon.ico",
|
|
18
|
-
"SocialMedia": {
|
|
19
|
-
"LI": "https://www.linkedin.com/",
|
|
20
|
-
"IG": "https://www.instagram.com/",
|
|
21
|
-
"FB": "https://www.facebook.com/"
|
|
22
|
-
},
|
|
23
|
-
"MetaTags": {
|
|
24
|
-
"og:url": "https://www.example.com/",
|
|
25
|
-
"og:title": "PROJECT_TITLE",
|
|
26
|
-
"og:type": "business.business",
|
|
27
|
-
"og:site_name": "PROJECT_TITLE",
|
|
28
|
-
"fb:admins": "592515154",
|
|
29
|
-
"fb:app_id": "138025696270006",
|
|
30
|
-
"og:description": "PROJECT_TITLE",
|
|
31
|
-
"og:image": "/images/example.png",
|
|
32
|
-
"business:contact_data:street_address": "Street Address.",
|
|
33
|
-
"business:contact_data:locality": "Tripoli",
|
|
34
|
-
"business:contact_data:postal_code": "1300",
|
|
35
|
-
"business:contact_data:country_name": "Lebanon",
|
|
36
|
-
"business:contact_data:email": "info@example.com",
|
|
37
|
-
"business:contact_data:phone_number": "+96171299411",
|
|
38
|
-
"business:contact_data:fax_number": "+96171299411",
|
|
39
|
-
"business:contact_data:website": "https://www.example.com/"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
12
|
"apis": [
|
|
43
13
|
{
|
|
44
|
-
"baseURL": "https://
|
|
14
|
+
"baseURL": "https://www.beaapis.com/1",
|
|
45
15
|
"headers": {
|
|
46
16
|
"X-BEA-Application-ID": "YOUR_APPLICATION_ID",
|
|
47
17
|
"X-BEA-Authorization": "YOUR_REST_API_KEY"
|
|
File without changes
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
17
17
|
<link href="/css/bea.css" rel="stylesheet" type="text/css" />
|
|
18
18
|
<link href="/css/styles.css" rel="stylesheet" type="text/css" />
|
|
19
|
-
<link href="https://
|
|
20
|
-
rel="stylesheet" />
|
|
19
|
+
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@6.9.96/css/materialdesignicons.min.css" rel="stylesheet" />
|
|
21
20
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
22
21
|
<!-- <link rel="icon" type="image/png" href="/favicon.png" /> -->
|
|
23
22
|
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Template 1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/files/sub_view.view
CHANGED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[TemplateName]
|
package/lib/files/view.view
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmjs/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "LumenJS is a tiny robust reactive javascript framework for building scalable and high-performant web applications and web user interfaces, be it simple or complex, with standard HTML, CSS and JavaScript",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
package/lib/files/comp.tpl
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[ComponentName]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Component 1
|