Comparing version 0.10.3 to 0.10.4
@@ -54,2 +54,3 @@ "use strict"; | ||
this._clearDistributionDirectoryOnRecompile = false; | ||
this._customLogger = null; | ||
/*----------------------------------------------------------------------------- | ||
@@ -92,3 +93,3 @@ * Paths (default values) | ||
removeComments: true, | ||
target: "ES2015" | ||
target: 'ES2015', | ||
}, | ||
@@ -131,2 +132,5 @@ }, | ||
} | ||
get customLogger() { | ||
return this._customLogger; | ||
} | ||
get sourceDirectoryPath() { | ||
@@ -177,3 +181,3 @@ return this.getPrefixedDirectoryPath(this._sourceDirectoryPath); | ||
mergeConfigurationAndVerify(config) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z; | ||
this._globals = lodash_1.default.defaultsDeep((_a = config.entities) === null || _a === void 0 ? void 0 : _a.globals, this._globals); | ||
@@ -191,9 +195,10 @@ this._partials = lodash_1.default.defaultsDeep((_b = config.entities) === null || _b === void 0 ? void 0 : _b.partials, this._partials); | ||
(_l = config.clearDistributionDirectoryOnRecompile) !== null && _l !== void 0 ? _l : this._clearDistributionDirectoryOnRecompile; | ||
this.defaultDirectoriesPrefix = (_o = (_m = config.paths) === null || _m === void 0 ? void 0 : _m.defaultDirectoriesPrefix) !== null && _o !== void 0 ? _o : this.defaultDirectoriesPrefix; | ||
this._sourceDirectoryPath.custom = (_q = (_p = config.paths) === null || _p === void 0 ? void 0 : _p.sourceDirectoryPath) !== null && _q !== void 0 ? _q : this._sourceDirectoryPath.custom; | ||
this._customLogger = (_m = config.customLogger) !== null && _m !== void 0 ? _m : this._customLogger; | ||
this.defaultDirectoriesPrefix = (_p = (_o = config.paths) === null || _o === void 0 ? void 0 : _o.defaultDirectoriesPrefix) !== null && _p !== void 0 ? _p : this.defaultDirectoriesPrefix; | ||
this._sourceDirectoryPath.custom = (_r = (_q = config.paths) === null || _q === void 0 ? void 0 : _q.sourceDirectoryPath) !== null && _r !== void 0 ? _r : this._sourceDirectoryPath.custom; | ||
this._distributionDirectoryPath.custom = | ||
(_s = (_r = config.paths) === null || _r === void 0 ? void 0 : _r.distributionDirectoryPath) !== null && _s !== void 0 ? _s : this._distributionDirectoryPath.custom; | ||
this._globalsDirectoryPath.custom = (_u = (_t = config.paths) === null || _t === void 0 ? void 0 : _t.globalsDirectoryPath) !== null && _u !== void 0 ? _u : this._globalsDirectoryPath.custom; | ||
this._partialsDirectoryPath.custom = (_w = (_v = config.paths) === null || _v === void 0 ? void 0 : _v.partialsDirectoryPath) !== null && _w !== void 0 ? _w : this._partialsDirectoryPath.custom; | ||
this._helpersDirectoryPath.custom = (_y = (_x = config.paths) === null || _x === void 0 ? void 0 : _x.helpersDirectoryPath) !== null && _y !== void 0 ? _y : this._helpersDirectoryPath.custom; | ||
(_t = (_s = config.paths) === null || _s === void 0 ? void 0 : _s.distributionDirectoryPath) !== null && _t !== void 0 ? _t : this._distributionDirectoryPath.custom; | ||
this._globalsDirectoryPath.custom = (_v = (_u = config.paths) === null || _u === void 0 ? void 0 : _u.globalsDirectoryPath) !== null && _v !== void 0 ? _v : this._globalsDirectoryPath.custom; | ||
this._partialsDirectoryPath.custom = (_x = (_w = config.paths) === null || _w === void 0 ? void 0 : _w.partialsDirectoryPath) !== null && _x !== void 0 ? _x : this._partialsDirectoryPath.custom; | ||
this._helpersDirectoryPath.custom = (_z = (_y = config.paths) === null || _y === void 0 ? void 0 : _y.helpersDirectoryPath) !== null && _z !== void 0 ? _z : this._helpersDirectoryPath.custom; | ||
this._filesConfiguration = lodash_1.default.defaultsDeep(config.files, this._filesConfiguration); | ||
@@ -200,0 +205,0 @@ this.validateConfiguration(); |
@@ -12,12 +12,14 @@ "use strict"; | ||
log(...strings) { | ||
progressBar_1.default.isRunning && console.log(); | ||
var _a; | ||
const logger = (_a = configuration_1.default.customLogger) !== null && _a !== void 0 ? _a : console; | ||
progressBar_1.default.isRunning && logger.log(); | ||
if (configuration_1.default.ansiLogging) { | ||
console.log(...strings); | ||
logger.log(strings.join(' ')); | ||
} | ||
else { | ||
console.log((0, strip_ansi_1.default)(strings.join(' '))); | ||
logger.log((0, strip_ansi_1.default)(strings.join(' '))); | ||
} | ||
}, | ||
logWithPadding(...strings) { | ||
return this.log(' ', ...strings); | ||
this.log(' ', ...strings); | ||
}, | ||
@@ -28,37 +30,13 @@ warning(...strings) { | ||
} | ||
progressBar_1.default.isRunning && console.log(); | ||
if (configuration_1.default.ansiLogging) { | ||
console.log(chalk_1.default.yellowBright('WARN '), ...strings); | ||
} | ||
else { | ||
console.log('WARN ', (0, strip_ansi_1.default)(strings.join(' '))); | ||
} | ||
this.log(chalk_1.default.yellowBright('WARN '), ...strings); | ||
}, | ||
info(...strings) { | ||
progressBar_1.default.isRunning && console.log(); | ||
if (configuration_1.default.ansiLogging) { | ||
console.log(chalk_1.default.greenBright('INFO '), ...strings); | ||
} | ||
else { | ||
console.log('INFO ', (0, strip_ansi_1.default)(strings.join(' '))); | ||
} | ||
this.log(chalk_1.default.greenBright('INFO '), ...strings); | ||
}, | ||
error(...strings) { | ||
progressBar_1.default.isRunning && console.log(); | ||
if (configuration_1.default.ansiLogging) { | ||
console.log(chalk_1.default.redBright('ERR '), ...strings); | ||
} | ||
else { | ||
console.log('ERR ', (0, strip_ansi_1.default)(strings.join(' '))); | ||
} | ||
this.log(chalk_1.default.redBright('ERR '), ...strings); | ||
}, | ||
debug(...strings) { | ||
progressBar_1.default.isRunning && console.log(); | ||
if (configuration_1.default.ansiLogging) { | ||
console.log(chalk_1.default.yellowBright('DEBUG'), ...strings); | ||
} | ||
else { | ||
console.log('DEBUG', (0, strip_ansi_1.default)(strings.join(' '))); | ||
} | ||
this.log(chalk_1.default.yellowBright('DEBUG'), ...strings); | ||
}, | ||
}; |
@@ -12,7 +12,6 @@ "use strict"; | ||
const start = Date.now(); | ||
logger_1.default.info(chalk_1.default.magentaBright('SYMPLY::GENERATE'), chalk_1.default.greenBright('[START]')); | ||
if (Object.keys(configuration).length > 0) { | ||
configuration_1.default.mergeConfigurationAndVerify(configuration); | ||
logger_1.default.info(`Configuration object verified and merged.`); | ||
} | ||
logger_1.default.info(chalk_1.default.magentaBright('SYMPLY::GENERATE'), chalk_1.default.greenBright('[START]')); | ||
const configurationFromFile = configuration_1.default.loadConfigurationFromConfigFile(); | ||
@@ -19,0 +18,0 @@ if (configurationFromFile) { |
{ | ||
"name": "symply", | ||
"version": "0.10.3", | ||
"version": "0.10.4", | ||
"description": "A simple static site generator.", | ||
@@ -23,3 +23,4 @@ "author": "Oleg Legun <oleg.legun@gmail.com>", | ||
"cloc": "cloc --exclude-dir=node_modules,dist --exclude-ext=json .", | ||
"test": "npm run compile && tape test/**/*.js | tap-spec" | ||
"test:unit": "npm run compile && tape test/unit/**/*.js | tap-spec", | ||
"test:e2e": "npm run compile && tape test/e2e/**/*.test.js | tap-spec" | ||
}, | ||
@@ -26,0 +27,0 @@ "dependencies": { |
@@ -87,4 +87,12 @@ /* eslint-disable */ | ||
clearDistributionDirectoryOnRecompile: boolean | ||
/** | ||
* Change default `console` logger to any custom one. | ||
*/ | ||
customLogger: CustomLogger | ||
} | ||
export interface CustomLogger { | ||
log(message?: string): void | ||
} | ||
export interface ConfigurableDirectoryPath { | ||
@@ -91,0 +99,0 @@ default: string |
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
228350
2383