Update dependencies

This commit is contained in:
grandeljay 2022-05-29 11:24:36 +02:00
parent 48e8c8a1af
commit 95d054f9b4
7555 changed files with 144369 additions and 196135 deletions

View file

@ -1,37 +1,29 @@
/* global process */
'use strict'
var fs = require('fs')
var path = require('path')
var findup = require('@choojs/findup')
var stripJSONComments = require('strip-json-comments')
var config = {}
var configSources = ['package.json', '.rtlcssrc', '.rtlcss.json']
const fs = require('fs')
const path = require('path')
const findUp = require('find-up')
const stripJSONComments = require('strip-json-comments')
let config = {}
const configSources = ['package.json', '.rtlcssrc', '.rtlcss.json']
const environments = [
process.env.USERPROFILE,
process.env.HOMEPATH,
process.env.HOME
]
const readConfig = (configFilePath) => {
return JSON.parse(stripJSONComments(fs.readFileSync(configFilePath, 'utf-8').trim()))
}
module.exports.load = (configFilePath, cwd, overrides) => {
module.exports.load = function (configFilePath, cwd, overrides) {
if (configFilePath) {
return override(readConfig(configFilePath), overrides)
return override(
JSON.parse(
stripJSONComments(
fs.readFileSync(configFilePath, 'utf-8').trim())), overrides)
}
const directory = cwd || process.cwd()
var directory = cwd || process.cwd()
config = loadConfig(directory)
if (!config) {
for (const environment of environments) {
if (!environment) {
var evns = [process.env.USERPROFILE, process.env.HOMEPATH, process.env.HOME]
for (var x = 0; x < evns.length; x++) {
if (!evns[x]) {
continue
}
config = loadConfig(environment)
config = loadConfig(evns[x])
if (config) {
break
}
@ -41,27 +33,27 @@ module.exports.load = (configFilePath, cwd, overrides) => {
if (config) {
override(config, overrides)
}
return config
}
function loadConfig (cwd) {
for (const source of configSources) {
let foundPath
function loadConfig (dir) {
for (var x = 0; x < configSources.length; x++) {
var found
var source = configSources[x]
try {
foundPath = findUp.sync(source, { cwd })
found = findup.sync(dir, source)
} catch (e) {
continue
}
if (foundPath) {
const configFilePath = path.normalize(foundPath)
if (found) {
var configFilePath = path.normalize(path.join(found, source))
try {
config = readConfig(configFilePath)
config = JSON.parse(
stripJSONComments(
fs.readFileSync(configFilePath, 'utf-8').trim()))
} catch (e) {
throw new Error(`${e} ${configFilePath}`)
throw new Error(e + ' ' + configFilePath)
}
if (source === 'package.json') {
@ -77,16 +69,13 @@ function loadConfig (cwd) {
function override (to, from) {
if (to && from) {
for (const p in from) {
if (Object.prototype.hasOwnProperty.call(from, p)) {
if (Object.prototype.hasOwnProperty.call(to, p) && typeof to[p] === 'object') {
override(to[p], from[p])
} else {
to[p] = from[p]
}
for (var p in from) {
if (typeof to[p] === 'object') {
override(to[p], from[p])
} else {
to[p] = from[p]
}
}
}
return to
}