@lmjs/cli 1.0.36 → 1.0.38

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 (2) hide show
  1. package/lib/fcs.js +46 -52
  2. package/package.json +1 -1
package/lib/fcs.js CHANGED
@@ -237,25 +237,11 @@ function create(conf) {
237
237
  }
238
238
  }
239
239
 
240
- function _mini(st) {
241
- for (const key in st) {
242
- st[key] = st[key].replace(/\/\*[\s\S]*?\*\/|(?<=[^:])\/\/.*|^\/\/.*/g, "");
243
- // st[key] = st[key].replace(/(\r?\n|\n)/g, "");
244
- // st[key] = st[key].replace(" var ", " ;var ");
245
- // st[key] = st[key].replace(" let ", " ;let ");
246
- // st[key] = st[key].replace(" const ", " ;const ");
247
- st[key] = st[key].replace(/(\t)/g, "");
248
- // st[key] = st[key].replace(/\s\s+/g, " ");
249
- }
250
- return st;
251
- }
252
-
253
- function getAllFiles(dirPath, arrayOfFiles) {
240
+ function getAllFiles(dirPath, arrayOfFiles = {}, mini = false) {
254
241
  files = fs.readdirSync(dirPath);
255
- arrayOfFiles = arrayOfFiles || {};
256
242
  files.forEach(function (file) {
257
243
  if (fs.statSync(dirPath + path.sep + file).isDirectory()) {
258
- arrayOfFiles = getAllFiles(dirPath + path.sep + file, arrayOfFiles);
244
+ arrayOfFiles = getAllFiles(dirPath + path.sep + file, arrayOfFiles, mini);
259
245
  } else {
260
246
  let filePath = path.join(dirPath, path.sep, file);
261
247
  let fileKey = Buffer.from(
@@ -265,43 +251,47 @@ function getAllFiles(dirPath, arrayOfFiles) {
265
251
  .split("\\")
266
252
  .join("/")
267
253
  ).toString("base64");
268
- var result = _min(fs.readFileSync(filePath, { encoding: "utf8" }), {
269
- removeAttributeQuotes: false,
270
- caseSensitive: true,
271
- collapseWhitespace: true,
272
- collapseInlineTagWhitespace: true,
273
- conservativeCollapse: true,
274
- minifyJS: true,
275
- minifyCSS: false,
276
- removeComments: true,
277
- processConditionalComments: true,
278
- collapseBooleanAttributes: true,
279
- decodeEntities: true,
280
- html5: true,
281
- includeAutoGeneratedTags: false,
282
- keepClosingSlash: true,
283
- maxLineLength: null,
284
- minifyURLs: "",
285
- preserveLineBreaks: false,
286
- preventAttributesEscaping: false,
287
- processScripts: ["text/html"],
288
- quoteCharacter: "",
289
- removeEmptyAttributes: true,
290
- removeEmptyElements: false,
291
- removeOptionalTags: true,
292
- removeRedundantAttributes: true,
293
- removeScriptTypeAttributes: true,
294
- removeStyleLinkTypeAttributes: true,
295
- removeTagWhitespace: false,
296
- sortAttributes: false,
297
- sortClassName: false,
298
- trimCustomFragments: true,
299
- useShortDoctype: true,
300
- });
254
+ if (mini) {
255
+ var result = _min(fs.readFileSync(filePath, { encoding: "utf8" }), {
256
+ removeAttributeQuotes: false,
257
+ caseSensitive: true,
258
+ collapseWhitespace: true,
259
+ collapseInlineTagWhitespace: true,
260
+ conservativeCollapse: true,
261
+ removeComments: true,
262
+ minifyJS: true,
263
+ minifyCSS: false,
264
+ processConditionalComments: true,
265
+ collapseBooleanAttributes: true,
266
+ decodeEntities: true,
267
+ html5: true,
268
+ includeAutoGeneratedTags: false,
269
+ keepClosingSlash: true,
270
+ maxLineLength: null,
271
+ minifyURLs: "",
272
+ preserveLineBreaks: false,
273
+ preventAttributesEscaping: false,
274
+ processScripts: ["text/html"],
275
+ quoteCharacter: "",
276
+ removeEmptyAttributes: true,
277
+ removeEmptyElements: false,
278
+ removeOptionalTags: true,
279
+ removeRedundantAttributes: true,
280
+ removeScriptTypeAttributes: true,
281
+ removeStyleLinkTypeAttributes: true,
282
+ removeTagWhitespace: false,
283
+ sortAttributes: false,
284
+ sortClassName: false,
285
+ trimCustomFragments: true,
286
+ useShortDoctype: true,
287
+ });
288
+ } else {
289
+ var result = fs.readFileSync(filePath, { encoding: "utf8" });
290
+ }
301
291
  arrayOfFiles[fileKey] = result;
302
292
  }
303
293
  });
304
- return _mini(arrayOfFiles);
294
+ return arrayOfFiles;
305
295
  }
306
296
 
307
297
  function copyDir(src, dest, projectName) {
@@ -483,10 +473,14 @@ async function _bp(cmds) {
483
473
  var dest = projectPath + path.sep + "dist";
484
474
 
485
475
  let _views = getAllFiles(
486
- `${process.cwd()}` + path.sep + `src` + path.sep + `views` + path.sep
476
+ `${process.cwd()}` + path.sep + `src` + path.sep + `views` + path.sep,
477
+ {},
478
+ true
487
479
  );
488
480
  let _tpls = getAllFiles(
489
- `${process.cwd()}` + path.sep + `src` + path.sep + `tpls` + path.sep
481
+ `${process.cwd()}` + path.sep + `src` + path.sep + `tpls` + path.sep,
482
+ {},
483
+ true
490
484
  );
491
485
 
492
486
  var indexCode = fs.readFileSync(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lmjs/cli",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "description": "Command line interface for super fast LumenJS development. 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
  "bin": {
6
6
  "lm": "./bin/commands.js",