@lmjs/cli 1.0.43 → 1.0.45
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/lib/fcs.js +58 -40
- package/package.json +1 -1
package/lib/fcs.js
CHANGED
|
@@ -252,44 +252,44 @@ function getAllFiles(dirPath, arrayOfFiles = {}, mini = false) {
|
|
|
252
252
|
.split("\\")
|
|
253
253
|
.join("/")
|
|
254
254
|
).toString("base64");
|
|
255
|
-
if (mini) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
} else {
|
|
255
|
+
// if (mini) {
|
|
256
|
+
// var result = _min(fs.readFileSync(filePath, { encoding: "utf8" }), {
|
|
257
|
+
// removeAttributeQuotes: false,
|
|
258
|
+
// caseSensitive: true,
|
|
259
|
+
// collapseWhitespace: true,
|
|
260
|
+
// collapseInlineTagWhitespace: true,
|
|
261
|
+
// conservativeCollapse: true,
|
|
262
|
+
// removeComments: true,
|
|
263
|
+
// minifyJS: true,
|
|
264
|
+
// minifyCSS: false,
|
|
265
|
+
// processConditionalComments: true,
|
|
266
|
+
// collapseBooleanAttributes: false,
|
|
267
|
+
// decodeEntities: false,
|
|
268
|
+
// html5: true,
|
|
269
|
+
// includeAutoGeneratedTags: true,
|
|
270
|
+
// keepClosingSlash: true,
|
|
271
|
+
// maxLineLength: null,
|
|
272
|
+
// minifyURLs: false,
|
|
273
|
+
// preserveLineBreaks: false,
|
|
274
|
+
// preventAttributesEscaping: false,
|
|
275
|
+
// processScripts: ["text/html"],
|
|
276
|
+
// quoteCharacter: "",
|
|
277
|
+
// removeEmptyAttributes: true,
|
|
278
|
+
// removeEmptyElements: false,
|
|
279
|
+
// removeOptionalTags: true,
|
|
280
|
+
// removeRedundantAttributes: true,
|
|
281
|
+
// removeScriptTypeAttributes: false,
|
|
282
|
+
// removeStyleLinkTypeAttributes: true,
|
|
283
|
+
// removeTagWhitespace: false,
|
|
284
|
+
// sortAttributes: false,
|
|
285
|
+
// sortClassName: false,
|
|
286
|
+
// trimCustomFragments: true,
|
|
287
|
+
// useShortDoctype: true,
|
|
288
|
+
// continueOnParseError: true
|
|
289
|
+
// });
|
|
290
|
+
// } else {
|
|
291
291
|
var result = fs.readFileSync(filePath, { encoding: "utf8" });
|
|
292
|
-
}
|
|
292
|
+
// }
|
|
293
293
|
arrayOfFiles[fileKey] = result;
|
|
294
294
|
}
|
|
295
295
|
});
|
|
@@ -364,6 +364,22 @@ function validURL(string) {
|
|
|
364
364
|
|
|
365
365
|
exports.validURL = validURL;
|
|
366
366
|
|
|
367
|
+
|
|
368
|
+
let getPairs = (obj, keys = []) =>
|
|
369
|
+
Object.entries(obj).reduce((pairs, [key, value]) => {
|
|
370
|
+
if (typeof value === 'object')
|
|
371
|
+
pairs.push(...getPairs(value, [...keys, key]));
|
|
372
|
+
else
|
|
373
|
+
pairs.push([[...keys, key], value]);
|
|
374
|
+
return pairs;
|
|
375
|
+
}, []);
|
|
376
|
+
|
|
377
|
+
function pairIt(obj) {
|
|
378
|
+
return getPairs(obj).map(([[key0, ...keysRest], value]) =>
|
|
379
|
+
`${key0}${keysRest.map(a => `[${a}]`).join('')}=${value}`)
|
|
380
|
+
.join('&');
|
|
381
|
+
}
|
|
382
|
+
|
|
367
383
|
var API = {
|
|
368
384
|
get: async function (u, d, h, a) {
|
|
369
385
|
return await this.req(u, d, h, "GET", a);
|
|
@@ -381,16 +397,18 @@ var API = {
|
|
|
381
397
|
return await this.req(u, d, h, "PATCH", a);
|
|
382
398
|
},
|
|
383
399
|
req: async function (u, d, h, m, a, f) {
|
|
400
|
+
|
|
384
401
|
var urled = validURL(u) ? u : config.apis[a ?? 0].baseURL + u;
|
|
385
402
|
if (m.toString().toLowerCase() == 'get') {
|
|
386
|
-
if (urled.indexOf('?') > -1) urled = urled + "&" +
|
|
387
|
-
else urled = urled + "?" +
|
|
403
|
+
if (urled.indexOf('?') > -1) urled = urled + "&" + pairIt(d ?? {});
|
|
404
|
+
else urled = urled + "?" + pairIt(d ?? {});
|
|
388
405
|
}
|
|
389
406
|
let resa = await fetch(urled, {
|
|
390
407
|
method: m.toString().toLowerCase(),
|
|
391
408
|
body: m.toString().toLowerCase() == 'get' ? null : JSON.stringify(d ?? {}),
|
|
392
409
|
headers: h ?? config.apis[a ?? 0].headers,
|
|
393
410
|
});
|
|
411
|
+
|
|
394
412
|
if (f) return resa;
|
|
395
413
|
let res = await resa.text();
|
|
396
414
|
try {
|
|
@@ -464,7 +482,7 @@ function processCommands(cmd) {
|
|
|
464
482
|
} else if (command == "build") {
|
|
465
483
|
let cmds = process.argv;
|
|
466
484
|
_bp(cmds);
|
|
467
|
-
}
|
|
485
|
+
} else if (command == "-v" || command == "-version") {
|
|
468
486
|
console.log("LumenJS version " + require('../package.json').version);
|
|
469
487
|
} else {
|
|
470
488
|
console.log("LumenJS CLI's command not found!");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmjs/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.45",
|
|
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",
|