@lmjs/cli 1.0.35 → 1.0.37

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 +61 -51
  2. package/package.json +1 -1
package/lib/fcs.js CHANGED
@@ -250,12 +250,11 @@ function _mini(st) {
250
250
  return st;
251
251
  }
252
252
 
253
- function getAllFiles(dirPath, arrayOfFiles) {
253
+ function getAllFiles(dirPath, arrayOfFiles = {}, mini = false) {
254
254
  files = fs.readdirSync(dirPath);
255
- arrayOfFiles = arrayOfFiles || {};
256
255
  files.forEach(function (file) {
257
256
  if (fs.statSync(dirPath + path.sep + file).isDirectory()) {
258
- arrayOfFiles = getAllFiles(dirPath + path.sep + file, arrayOfFiles);
257
+ arrayOfFiles = getAllFiles(dirPath + path.sep + file, arrayOfFiles, mini);
259
258
  } else {
260
259
  let filePath = path.join(dirPath, path.sep, file);
261
260
  let fileKey = Buffer.from(
@@ -265,43 +264,48 @@ function getAllFiles(dirPath, arrayOfFiles) {
265
264
  .split("\\")
266
265
  .join("/")
267
266
  ).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
- });
267
+ if (mini) {
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
+ });
301
+ } else {
302
+ var result = fs.readFileSync(filePath, { encoding: "utf8" });
303
+ }
301
304
  arrayOfFiles[fileKey] = result;
302
305
  }
303
306
  });
304
- return _mini(arrayOfFiles);
307
+ if(mini) return _mini(arrayOfFiles);
308
+ return arrayOfFiles;
305
309
  }
306
310
 
307
311
  function copyDir(src, dest, projectName) {
@@ -483,10 +487,14 @@ async function _bp(cmds) {
483
487
  var dest = projectPath + path.sep + "dist";
484
488
 
485
489
  let _views = getAllFiles(
486
- `${process.cwd()}` + path.sep + `src` + path.sep + `views` + path.sep
490
+ `${process.cwd()}` + path.sep + `src` + path.sep + `views` + path.sep,
491
+ {},
492
+ true
487
493
  );
488
494
  let _tpls = getAllFiles(
489
- `${process.cwd()}` + path.sep + `src` + path.sep + `tpls` + path.sep
495
+ `${process.cwd()}` + path.sep + `src` + path.sep + `tpls` + path.sep,
496
+ {},
497
+ true
490
498
  );
491
499
 
492
500
  var indexCode = fs.readFileSync(
@@ -599,8 +607,12 @@ var _beaTn = "` +
599
607
  dest + path.sep + "js" + path.sep + "app." + _dT + ".js"
600
608
  );
601
609
  fs.renameSync(
602
- dest + path.sep + "js" + path.sep + "bea.js",
603
- dest + path.sep + "js" + path.sep + "app." + _dT + ".css"
610
+ dest + path.sep + "css" + path.sep + "bea.css",
611
+ dest + path.sep + "css" + path.sep + "app." + _dT + ".css"
612
+ );
613
+ fs.renameSync(
614
+ dest + path.sep + "css" + path.sep + "styles.css",
615
+ dest + path.sep + "css" + path.sep + "styles." + _dT + ".css"
604
616
  );
605
617
 
606
618
  fs.writeFileSync(
@@ -611,7 +623,7 @@ var _beaTn = "` +
611
623
  .split("/js/bea.js")
612
624
  .join("/js/app." + _dT + ".js")
613
625
  .split("/css/styles.css")
614
- .join("/css/styles.css?v" + new Date().getTime())
626
+ .join("/css/styles." + _dT + ".css")
615
627
  .split("/css/bea.css")
616
628
  .join("/css/app." + _dT + ".css")
617
629
  );
@@ -678,8 +690,12 @@ var _beaTn = "` +
678
690
  dest + path.sep + "src" + path.sep + "js" + path.sep + "app." + _dT + ".js"
679
691
  );
680
692
  fs.renameSync(
681
- dest + path.sep + "src" + path.sep + "js" + path.sep + "bea.js",
682
- dest + path.sep + "src" + path.sep + "js" + path.sep + "app." + _dT + ".css"
693
+ dest + path.sep + "src" + path.sep + "css" + path.sep + "bea.css",
694
+ dest + path.sep + "src" + path.sep + "css" + path.sep + "app." + _dT + ".css"
695
+ );
696
+ fs.renameSync(
697
+ dest + path.sep + "src" + path.sep + "css" + path.sep + "styles.css",
698
+ dest + path.sep + "src" + path.sep + "css" + path.sep + "styles." + _dT + ".css"
683
699
  );
684
700
 
685
701
  fs.writeFileSync(
@@ -690,17 +706,11 @@ var _beaTn = "` +
690
706
  .split("/js/bea.js")
691
707
  .join("/js/app." + _dT + ".js")
692
708
  .split("/css/styles.css")
693
- .join("/css/styles.css?v" + new Date().getTime())
709
+ .join("/css/styles." + _dT + ".css")
694
710
  .split("/css/bea.css")
695
711
  .join("/css/app." + _dT + ".css")
696
712
  );
697
713
 
698
- fs.writeFileSync(
699
- dest + path.sep + "src" + path.sep + "index.html",
700
- String(indexCode)
701
- .split('<script src="/index.js" type="text/javascript"></script>')
702
- .join("")
703
- );
704
714
  fs.writeFileSync(dest + path.sep + "config.js", String(configData));
705
715
  }
706
716
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lmjs/cli",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
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",