@squared-functions/module
Advanced tools
Comparing version 0.9.7 to 0.9.8
46
index.js
@@ -1,2 +0,2 @@ | ||
/* @squared-functions/module 0.9.6 | ||
/* @squared-functions/module 0.9.8 | ||
https://github.com/anpham6/squared-functions */ | ||
@@ -9,2 +9,3 @@ | ||
const fs = require("fs"); | ||
const uuid = require("uuid"); | ||
const chalk = require("chalk"); | ||
@@ -16,13 +17,13 @@ let SETTINGS = {}; | ||
LOG_TYPE[LOG_TYPE["SYSTEM"] = 1] = "SYSTEM"; | ||
LOG_TYPE[LOG_TYPE["CHROME"] = 2] = "CHROME"; | ||
LOG_TYPE[LOG_TYPE["COMPRESS"] = 4] = "COMPRESS"; | ||
LOG_TYPE[LOG_TYPE["IMAGE"] = 8] = "IMAGE"; | ||
LOG_TYPE[LOG_TYPE["NODE"] = 16] = "NODE"; | ||
LOG_TYPE[LOG_TYPE["WATCH"] = 32] = "WATCH"; | ||
LOG_TYPE[LOG_TYPE["CLOUD_STORAGE"] = 64] = "CLOUD_STORAGE"; | ||
LOG_TYPE[LOG_TYPE["CLOUD_DATABASE"] = 128] = "CLOUD_DATABASE"; | ||
LOG_TYPE[LOG_TYPE["TIME_ELAPSED"] = 256] = "TIME_ELAPSED"; | ||
LOG_TYPE[LOG_TYPE["NODE"] = 2] = "NODE"; | ||
LOG_TYPE[LOG_TYPE["PROCESS"] = 4] = "PROCESS"; | ||
LOG_TYPE[LOG_TYPE["COMPRESS"] = 8] = "COMPRESS"; | ||
LOG_TYPE[LOG_TYPE["WATCH"] = 16] = "WATCH"; | ||
LOG_TYPE[LOG_TYPE["CLOUD_STORAGE"] = 32] = "CLOUD_STORAGE"; | ||
LOG_TYPE[LOG_TYPE["CLOUD_DATABASE"] = 64] = "CLOUD_DATABASE"; | ||
LOG_TYPE[LOG_TYPE["TIME_ELAPSED"] = 128] = "TIME_ELAPSED"; | ||
})(LOG_TYPE = exports.LOG_TYPE || (exports.LOG_TYPE = {})); | ||
const Module = class { | ||
constructor() { | ||
this.tempDir = 'temp'; | ||
[this.major, this.minor, this.patch] = process.version.substring(1).split('.').map(value => +value); | ||
@@ -65,4 +66,4 @@ } | ||
} | ||
getTempDir() { | ||
return process.cwd() + path.sep + 'temp' + path.sep; | ||
getTempDir(subDir, filename = '') { | ||
return process.cwd() + path.sep + this.tempDir + path.sep + (subDir ? uuid.v4() + path.sep : '') + (filename.startsWith('.') ? uuid.v4() : '') + filename; | ||
} | ||
@@ -85,3 +86,2 @@ joinPosix(...paths) { | ||
writeTimeElapsed(title, value, time, options = {}) { | ||
options.hintColor || (options.hintColor = 'magenta'); | ||
this.formatMessage(LOG_TYPE.TIME_ELAPSED, title, ['Completed', (Date.now() - time) / 1000 + 's'], value, options); | ||
@@ -104,22 +104,21 @@ } | ||
break; | ||
case LOG_TYPE.CHROME: | ||
if (SETTINGS.chrome === false) { | ||
case LOG_TYPE.PROCESS: | ||
if (SETTINGS.process === false) { | ||
return; | ||
} | ||
options.titleColor || (options.titleColor = 'magenta'); | ||
break; | ||
case LOG_TYPE.COMPRESS: | ||
if (SETTINGS.compress === false) { | ||
case LOG_TYPE.NODE: | ||
if (SETTINGS.node === false) { | ||
return; | ||
} | ||
options.titleColor || (options.titleColor = 'black'); | ||
options.titleBgColor || (options.titleBgColor = 'bgWhite'); | ||
options.hintColor || (options.hintColor = 'yellow'); | ||
break; | ||
case LOG_TYPE.IMAGE: | ||
if (SETTINGS.image === false) { | ||
case LOG_TYPE.COMPRESS: | ||
if (SETTINGS.compress === false) { | ||
return; | ||
} | ||
break; | ||
case LOG_TYPE.NODE: | ||
if (SETTINGS.node === false) { | ||
return; | ||
} | ||
break; | ||
case LOG_TYPE.WATCH: | ||
@@ -144,2 +143,3 @@ if (SETTINGS.watch === false) { | ||
} | ||
options.hintColor || (options.hintColor = 'magenta'); | ||
break; | ||
@@ -146,0 +146,0 @@ default: |
{ | ||
"name": "@squared-functions/module", | ||
"version": "0.9.7", | ||
"version": "0.9.8", | ||
"description": "Module extension class for squared-functions", | ||
@@ -18,5 +18,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"@squared-functions/types": "^0.9.7", | ||
"@squared-functions/types": "^0.9.8", | ||
"uuid": "^8.3.2", | ||
"chalk": "^4.1.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9359
3
+ Addeduuid@^8.3.2
+ Addeduuid@8.3.2(transitive)