@lmjs/cli 1.0.31 → 1.0.32

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 +6 -22
  2. package/lib/fcs.js +36 -2
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -6,7 +6,6 @@ const FtpDeploy = require("ftp-deploy");
6
6
  const ftpDeploy = new FtpDeploy();
7
7
 
8
8
  const fcs = require("./lib/fcs.js");
9
- var UglifyJS = require("uglify-js");
10
9
 
11
10
  exports.processCommand = processCommands;
12
11
  exports.startServer = startServer;
@@ -141,7 +140,7 @@ var _vcData = {
141
140
  };
142
141
  `;
143
142
  vt += " " + String(indexJs);
144
- let f1 = await axios.get("https://s.beacdn.com/beajs/f1", {});
143
+ let f1 = await API.get("https://s.beacdn.com/beajs/f1", {});
145
144
 
146
145
  spinner
147
146
  .succeed("Gathering Required Resources")
@@ -157,20 +156,12 @@ var _vcData = {
157
156
  let token_ = r.token;
158
157
  let js_ = "";
159
158
 
160
- var js2 =
159
+ var configData =
161
160
  `
162
161
  exports.config = ` +
163
162
  JSON.stringify(config) +
164
163
  `;
165
164
  `;
166
- let configData = UglifyJS.minify(js2, {
167
- mangle: {
168
- reserved: ["_vcdata", "_ws"],
169
- },
170
- output: {
171
- beautify: true,
172
- },
173
- });
174
165
 
175
166
  if (cmds.indexOf("--serverless") >= 0) {
176
167
  js_ +=
@@ -180,14 +171,7 @@ var _beaTn = "` +
180
171
  `";
181
172
  `;
182
173
  }
183
- js_ += String(f1.data) + " " + r.js;
184
-
185
- let js__ = UglifyJS.minify(js_, {
186
- mangle: {
187
- toplevel: true,
188
- reserved: ["_vcdata", "_ws"],
189
- },
190
- });
174
+ js_ += String(f1) + " " + r.js;
191
175
 
192
176
  if (token_ == "") {
193
177
  spinner.fail("Error getting a unique token for production!");
@@ -236,7 +220,7 @@ var _beaTn = "` +
236
220
 
237
221
  fs.writeFileSync(
238
222
  dest + path.sep + "js" + path.sep + "bea.js",
239
- String(js__.code)
223
+ String(js_)
240
224
  );
241
225
  fs.writeFileSync(
242
226
  dest + path.sep + "css" + path.sep + "bea.css",
@@ -314,7 +298,7 @@ var _beaTn = "` +
314
298
 
315
299
  fs.writeFileSync(
316
300
  dest + path.sep + "src" + path.sep + "js" + path.sep + "bea.js",
317
- String(String(js__.code))
301
+ String(js_)
318
302
  );
319
303
  fs.writeFileSync(
320
304
  dest + path.sep + "src" + path.sep + "css" + path.sep + "bea.css",
@@ -326,7 +310,7 @@ var _beaTn = "` +
326
310
  .split('<script src="/index.js" type="text/javascript"></script>')
327
311
  .join("")
328
312
  );
329
- fs.writeFileSync(dest + path.sep + "config.js", String(configData.code));
313
+ fs.writeFileSync(dest + path.sep + "config.js", String(configData));
330
314
  }
331
315
 
332
316
  if (cmds.indexOf("--deploy") >= 0) {
package/lib/fcs.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const axios = require("axios").default;
2
2
  const path = require("path");
3
3
  const fs = require("fs");
4
+ var minify = require("html-minifier").minify;
4
5
 
5
6
  const BEA_Libs = {
6
7
  BEACSS: "https://s.beacdn.com/beacss/latest",
@@ -18,7 +19,7 @@ function _mini(st) {
18
19
  // st[key] = st[key].replace(" let ", " ;let ");
19
20
  // st[key] = st[key].replace(" const ", " ;const ");
20
21
  st[key] = st[key].replace(/(\t)/g, "");
21
- st[key] = st[key].replace(/\s\s+/g, " ");
22
+ // st[key] = st[key].replace(/\s\s+/g, " ");
22
23
  }
23
24
  return st;
24
25
  }
@@ -38,7 +39,40 @@ function getAllFiles(dirPath, arrayOfFiles) {
38
39
  .split("\\")
39
40
  .join("/")
40
41
  ).toString("base64");
41
- arrayOfFiles[fileKey] = fs.readFileSync(filePath, { encoding: "utf8" });
42
+ var result = minify(fs.readFileSync(filePath, { encoding: "utf8" }), {
43
+ removeAttributeQuotes: false,
44
+ caseSensitive: true,
45
+ collapseWhitespace: true,
46
+ collapseInlineTagWhitespace: true,
47
+ conservativeCollapse: true,
48
+ minifyJS: true,
49
+ minifyCSS: false,
50
+ removeComments: true,
51
+ processConditionalComments: true,
52
+ collapseBooleanAttributes: true,
53
+ decodeEntities: true,
54
+ html5: true,
55
+ includeAutoGeneratedTags: false,
56
+ keepClosingSlash: true,
57
+ maxLineLength: null,
58
+ minifyURLs: "",
59
+ preserveLineBreaks: false,
60
+ preventAttributesEscaping: false,
61
+ processScripts: ["text/html"],
62
+ quoteCharacter: "",
63
+ removeEmptyAttributes: true,
64
+ removeEmptyElements: false,
65
+ removeOptionalTags: true,
66
+ removeRedundantAttributes: true,
67
+ removeScriptTypeAttributes: true,
68
+ removeStyleLinkTypeAttributes: true,
69
+ removeTagWhitespace: false,
70
+ sortAttributes: false,
71
+ sortClassName: true,
72
+ trimCustomFragments: true,
73
+ useShortDoctype: true,
74
+ });
75
+ arrayOfFiles[fileKey] = result;
42
76
  }
43
77
  });
44
78
  return _mini(arrayOfFiles);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lmjs/cli",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
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": {
@@ -37,7 +37,7 @@
37
37
  "lumen bea"
38
38
  ],
39
39
  "dependencies": {
40
- "@lmjs/core": "^1.0.3"
40
+ "@lmjs/core": "^1.0.5"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=12.0.0"