@lmjs/cli 1.0.5 → 1.0.7

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.
Files changed (3) hide show
  1. package/index.js +0 -5
  2. package/lib/app.js +1 -114
  3. package/package.json +3 -4
package/index.js CHANGED
@@ -98,15 +98,11 @@ async function buildProject(cmds) {
98
98
  spinner.fail("Error getting a unique token for your project!");
99
99
  spinner.fail("Build Failed! Try again later.");
100
100
  return;
101
- } else {
102
- // make the build happen :)
103
101
  }
104
102
 
105
103
  beaCode += `
106
104
  var _beaTn = "` + token_ + `";
107
105
  `;
108
- // let kkk = await axios.get(BEA_Libs.BEAJS + "/prod");
109
- // beaCode += kkk.data;
110
106
  }
111
107
  beaCode += kkk;
112
108
  spinner.start('Packing & Cleaning...');
@@ -152,7 +148,6 @@ async function buildProject(cmds) {
152
148
  fcs.cd(dest + path.sep + "css");
153
149
  fcs.cd(dest + path.sep + "images");
154
150
 
155
- // fcs.copyDir(projectPath + path.sep + `src` + path.sep + `css`, dest + path.sep + "css");
156
151
  fcs.copyDir(projectPath + path.sep + "src" + path.sep + "js", dest + path.sep + "js", "_beajsBuild");
157
152
  fcs.copyDir(projectPath + path.sep + "src" + path.sep + "css", dest + path.sep + "css", "_beajsBuild");
158
153
  fcs.copyDir(projectPath + path.sep + "src" + path.sep + "images", dest + path.sep + "images", "_beajsBuild");
package/lib/app.js CHANGED
@@ -13,20 +13,14 @@ function toArrayBuffer(buffer) {
13
13
  return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
14
14
  }
15
15
  uws.App().ws('/*', {
16
-
17
- /* There are many common helper features */
18
16
  idleTimeout: 8,
19
17
  maxBackpressure: 1024 * 1024,
20
18
  maxPayloadLength: 16 * 1024 * 1024,
21
19
  compression: uws.SHARED_COMPRESSOR,
22
-
23
- /* Handlers */
24
20
  open: (ws) => {
25
- // console.log('A WebSocket connected!');
26
21
  ws.subscribe('/home/rat');
27
22
  },
28
23
  message: async (ws, message, isBinary) => {
29
- /* Ok is false if backpressure was built up, wait for drain */
30
24
  try {
31
25
  const buffer = Buffer.from(message);
32
26
  const data = JSON.parse(buffer.toString());
@@ -64,12 +58,10 @@ uws.App().ws('/*', {
64
58
  } catch (e) {
65
59
  _data.payload = { "code": 108, "error": e.message, "type": "RequestError" };
66
60
  if (ws.isSubscribed('/home/rat')) ws.send(JSON.stringify(_data), false, true);
67
- // ws.publish('/home/rat', JSON.stringify(_data));
68
61
  }
69
62
  return;
70
63
  }
71
64
 
72
- // ws.publish('/home/rat', JSON.stringify(_data));
73
65
  if (ws.isSubscribed('/home/rat')) ws.send(JSON.stringify(_data), false, true);
74
66
 
75
67
  }
@@ -78,10 +70,8 @@ uws.App().ws('/*', {
78
70
  }
79
71
  },
80
72
  drain: (ws) => {
81
- // console.log('WebSocket backpressure: ' + ws.getBufferedAmount());
82
73
  },
83
74
  close: (ws, code, message) => {
84
- // console.log('WebSocket closed');
85
75
  }
86
76
 
87
77
  }).get('/*', async (res, req) => {
@@ -105,32 +95,6 @@ uws.App().ws('/*', {
105
95
  }
106
96
  } else filePath = path.sep + 'index.html';
107
97
 
108
- // const mime = mime.lookup(pubDir + filePath) || 'application/octet-stream';
109
- // // res.writeHeader('Content-Type', mime);
110
- // const stream = fs.createReadStream(pubDir + filePath, { encoding: 'utf8' });
111
- // stream.on('data', function (chunk) {
112
- // console.log(chunk);
113
- // });
114
- // stream.on("error", () => {
115
- // // error : file does not exist, etc.
116
- // res.writeHeader("content-type", "text/plain");
117
- // // res.statusCode = 404;
118
- // res.end("ouuups, problem :/");
119
- // });
120
-
121
- // // res.writeHeader("content-type", mime);
122
- // stream.on("open", () => {
123
- // // good
124
- // // mime is your font / file mime-type
125
- // // res.statusCode = 200;
126
- // stream.pipe(res);
127
- // });
128
- // res.end();
129
- // return;
130
-
131
-
132
-
133
-
134
98
  let readStream;
135
99
  let paths = req.getUrl();
136
100
  const acceptEncoding = req.getHeader('accept-encoding');
@@ -149,8 +113,6 @@ uws.App().ws('/*', {
149
113
  res.aborted = true;
150
114
  });
151
115
  // write the headers and respond
152
- // write the headers and respond
153
-
154
116
 
155
117
  res.cork(() => {
156
118
  const mimeT = mime.lookup(pubDir + filePath) || 'application/octet-stream';
@@ -167,12 +129,6 @@ uws.App().ws('/*', {
167
129
  if (!res.aborted) res.end(readStream);
168
130
  });
169
131
 
170
- // const mimeType = mime.lookup(pubDir + filePath) || 'application/octet-stream';
171
-
172
- // if (!res.aborted) {
173
- // res.writeHeader('Content-Type', mimeType);
174
- // res.end(fs.readFileSync(pubDir + filePath, "utf8"));
175
- // }
176
132
  return;
177
133
  }).any('/*', (res, req) => {
178
134
  res.end('Nothing to see here!');
@@ -188,73 +144,4 @@ uws.App().ws('/*', {
188
144
  console.log('Failed to run LumenJS server');
189
145
  }
190
146
 
191
- });
192
- // app.use('/', express.static(`${process.cwd()}` + path.sep + `src`));
193
-
194
- // io.on('connection', function (socket) {
195
- // socket.on("request", async function (_data, _body, cb) {
196
- // try {
197
- // let res = await axios({
198
- // method: _data['method'].toString().toLowerCase(),
199
- // url: fcs.validURL(_data['path']) ? _data['path'] : (config.apis[_data['api'] ?? 0].baseURL + _data['path']),
200
- // data: _body ?? {},
201
- // headers: _data['headers'] ?? config.apis[_data['api'] ?? 0].headers
202
- // });
203
- // cb(res.data);
204
- // } catch (e) {
205
- // cb({ "code": 108, "error": e.message, "type": "RequestError" });
206
- // }
207
- // });
208
- // socket.on("getview", function (msg, cb) {
209
- // try {
210
- // cb(_views[msg]);
211
- // } catch (e) {
212
- // }
213
- // });
214
- // socket.on("getcomp", function (msg, cb) {
215
- // try {
216
- // cb(_comps[msg]);
217
- // } catch (e) {
218
- // }
219
- // });
220
- // socket.on("getfiles", function (cb) {
221
- // try {
222
- // cb({
223
- // "views": _views,
224
- // "comps": _comps
225
- // });
226
- // } catch (e) {
227
- // }
228
- // });
229
- // });
230
-
231
- // global.axios = axios;
232
- // global.fs = fs;
233
- // global.path = path;
234
-
235
- // var API = fcs.API;
236
- // global.API = API;
237
-
238
- // if(fs.existsSync(`${process.cwd()}` + path.sep + `src` + path.sep + `app.js`)){
239
- // require(`${process.cwd()}` + path.sep + `src` + path.sep + `app.js`);
240
- // }
241
-
242
- // app.get('*', function (req, res) {
243
- // let nodes = req.params[0].split("/");
244
- // if (nodes.length) nodes.shift();
245
- // res.sendFile(`${process.cwd()}` + path.sep + `src` + path.sep + ((fs.existsSync(`${process.cwd()}` + path.sep + `src` + path.sep + `views` + path.sep + nodes[0] + `.view`)) ? 'index' : '404') + `.html`);
246
- // return;
247
- // });
248
-
249
- // app.post('*', function (req, res) {
250
- // let nodes = req.params[0].split("/");
251
- // if (nodes.length) nodes.shift();
252
- // res.sendFile(`${process.cwd()}` + path.sep + `src` + path.sep + ((fs.existsSync(`${process.cwd()}` + path.sep + `src` + path.sep + `views` + path.sep + nodes[0] + `.view`)) ? 'index' : '404') + `.html`);
253
- // return;
254
- // });
255
-
256
- // server.listen(config.server.port, function () {
257
- // console.log(`LumenJS server running at http://${config.server.host}:${config.server.port}/`);
258
- // _views = fcs.getAllFiles(`${process.cwd()}` + path.sep + `src` + path.sep + `views` + path.sep);
259
- // _comps = fcs.getAllFiles(`${process.cwd()}` + path.sep + `src` + path.sep + `comps` + path.sep);
260
- // });
147
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lmjs/cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
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": {
@@ -36,15 +36,14 @@
36
36
  "lumen bea"
37
37
  ],
38
38
  "dependencies": {
39
- "@peer5/uwebsockets.js": "^20.8.0",
40
39
  "axios": "^0.27.2",
41
- "cssnano": "^5.1.11",
42
40
  "ftp-deploy": "^2.4.3",
43
41
  "multer": "^1.4.5-lts.1",
44
42
  "nodemon": "^2.0.16",
45
43
  "ora": "^6.1.2",
46
44
  "semver": "^7.3.7",
47
- "uglify-js": "^3.16.0"
45
+ "uglify-js": "^3.16.0",
46
+ "uWebSockets.js": "uNetworking/uWebSockets.js#v20.10.0"
48
47
  },
49
48
  "engines": {
50
49
  "node": ">=12.0.0"