mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Removed lodash usage from config utils
no issue - config utils are required early during boot and it requiring lodash added some unnecessary require+compile time - switched to using native JS for the few lodash methods we used
This commit is contained in:
parent
e97717a0cc
commit
8d4d6b6516
1 changed files with 3 additions and 4 deletions
|
@ -1,6 +1,5 @@
|
|||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const _ = require('lodash');
|
||||
|
||||
/**
|
||||
* transform all relative paths to absolute paths
|
||||
|
@ -11,11 +10,11 @@ const _ = require('lodash');
|
|||
* Path can be a "." to re-present current folder
|
||||
*/
|
||||
const makePathsAbsolute = function makePathsAbsolute(nconf, obj, parent) {
|
||||
_.each(obj, function (configValue, pathsKey) {
|
||||
if (_.isObject(configValue)) {
|
||||
Object.entries(obj).forEach(([pathsKey, configValue]) => {
|
||||
if (configValue && typeof configValue === 'object') {
|
||||
makePathsAbsolute(nconf, configValue, parent + ':' + pathsKey);
|
||||
} else if (
|
||||
_.isString(configValue) &&
|
||||
typeof configValue === 'string' &&
|
||||
(configValue.match(/\/+|\\+/) || configValue === '.') &&
|
||||
!path.isAbsolute(configValue)
|
||||
) {
|
||||
|
|
Loading…
Reference in a new issue