@platformatic/config
Advanced tools
Comparing version 0.16.0 to 0.17.0
25
index.js
'use strict' | ||
const { basename, extname, join, resolve, dirname } = require('path') | ||
const { basename, join, resolve, dirname } = require('path') | ||
const { readFile, access } = require('fs/promises') | ||
@@ -8,7 +8,5 @@ const EventEmitter = require('events') | ||
const fastifyPlugin = require('./lib/plugin') | ||
const YAML = require('yaml') | ||
const TOML = require('@iarna/toml') | ||
const JSON5 = require('json5') | ||
const dotenv = require('dotenv') | ||
const { FileWatcher } = require('@platformatic/utils') | ||
const { getParser } = require('@platformatic/metaconfig') | ||
@@ -29,3 +27,3 @@ class ConfigManager extends EventEmitter { | ||
allowToWatch.push(basename(this.fullPath)) | ||
this._parser = this._getParser() | ||
this._parser = getParser(this.fullPath) | ||
@@ -80,19 +78,2 @@ this.fileWatcher = new FileWatcher({ | ||
_getParser () { | ||
switch (extname(this.fullPath)) { | ||
case '.yaml': | ||
case '.yml': | ||
return YAML.parse | ||
case '.json': | ||
return JSON.parse | ||
case '.json5': | ||
return JSON5.parse | ||
case '.toml': | ||
case '.tml': | ||
return TOML.parse | ||
default: | ||
throw new Error('Invalid config file extension. Only yml, yaml, json, json5, toml, tml are supported.') | ||
} | ||
} | ||
purgeEnv (providedEnvironment) { | ||
@@ -99,0 +80,0 @@ const env = { |
{ | ||
"name": "@platformatic/config", | ||
"version": "0.16.0", | ||
"version": "0.17.0", | ||
"description": "Platformatic DB Config Manager", | ||
@@ -17,15 +17,16 @@ "main": "index.js", | ||
"devDependencies": { | ||
"fastify": "^4.10.2", | ||
"fastify": "^4.13.0", | ||
"snazzy": "^9.0.0", | ||
"standard": "^17.0.0", | ||
"tap": "^16.3.2" | ||
"json5": "^2.2.3", | ||
"yaml": "^2.2.1", | ||
"@iarna/toml": "^2.2.5", | ||
"tap": "^16.3.4" | ||
}, | ||
"dependencies": { | ||
"@iarna/toml": "^2.2.5", | ||
"ajv": "^8.11.2", | ||
"ajv": "^8.12.0", | ||
"dotenv": "^16.0.3", | ||
"json5": "^2.2.2", | ||
"pupa": "^3.1.0", | ||
"yaml": "^2.1.3", | ||
"@platformatic/utils": "0.16.0" | ||
"@platformatic/utils": "0.17.0", | ||
"@platformatic/metaconfig": "0.17.0" | ||
}, | ||
@@ -32,0 +33,0 @@ "scripts": { |
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
5
43297
7
1095
+ Added@platformatic/metaconfig@0.17.0(transitive)
+ Added@platformatic/utils@0.17.0(transitive)
+ Addedrfdc@1.4.1(transitive)
- Removed@iarna/toml@^2.2.5
- Removedjson5@^2.2.2
- Removedyaml@^2.1.3
- Removed@platformatic/utils@0.16.0(transitive)
Updated@platformatic/utils@0.17.0
Updatedajv@^8.12.0