@backstage/config-loader
Advanced tools
Comparing version 0.3.0 to 0.4.0
# @backstage/config-loader | ||
## 0.4.0 | ||
### Minor Changes | ||
- 4e7091759: Fix typo of "visibility" in config schema reference | ||
If you have defined a config element named `visiblity`, you | ||
will need to fix the spelling to `visibility`. For more info, | ||
see https://backstage.io/docs/conf/defining#visibility. | ||
### Patch Changes | ||
- b4488ddb0: Added a type alias for PositionError = GeolocationPositionError | ||
## 0.3.0 | ||
@@ -4,0 +18,0 @@ |
@@ -5,13 +5,18 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var path = require('path'); | ||
var yaml2 = _interopDefault(require('yaml')); | ||
var yaml2 = require('yaml'); | ||
var yup = require('yup'); | ||
var Ajv = _interopDefault(require('ajv')); | ||
var mergeAllOf = _interopDefault(require('json-schema-merge-allof')); | ||
var Ajv = require('ajv'); | ||
var mergeAllOf = require('json-schema-merge-allof'); | ||
var config = require('@backstage/config'); | ||
var fs = _interopDefault(require('fs-extra')); | ||
var fs = require('fs-extra'); | ||
var typescriptJsonSchema = require('typescript-json-schema'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var yaml2__default = /*#__PURE__*/_interopDefaultLegacy(yaml2); | ||
var Ajv__default = /*#__PURE__*/_interopDefaultLegacy(Ajv); | ||
var mergeAllOf__default = /*#__PURE__*/_interopDefaultLegacy(mergeAllOf); | ||
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs); | ||
function isObject(obj) { | ||
@@ -28,3 +33,3 @@ if (typeof obj !== "object") { | ||
const configYaml = await ctx.readFile(filePath); | ||
const config2 = yaml2.parse(configYaml); | ||
const config2 = yaml2__default['default'].parse(configYaml); | ||
const context = path.basename(filePath); | ||
@@ -163,4 +168,4 @@ async function transform(obj, path2) { | ||
".json": async (content) => JSON.parse(content), | ||
".yaml": async (content) => yaml2.parse(content), | ||
".yml": async (content) => yaml2.parse(content) | ||
".yaml": async (content) => yaml2__default['default'].parse(content), | ||
".yml": async (content) => yaml2__default['default'].parse(content) | ||
}; | ||
@@ -206,3 +211,3 @@ async function readSecret(data, ctx) { | ||
const visibilityByPath = new Map(); | ||
const ajv2 = new Ajv({ | ||
const ajv2 = new Ajv__default['default']({ | ||
allErrors: true, | ||
@@ -230,3 +235,3 @@ schemas: { | ||
}); | ||
const merged = mergeAllOf({allOf: schemas.map((_) => _.value)}, { | ||
const merged = mergeAllOf__default['default']({allOf: schemas.map((_) => _.value)}, { | ||
ignoreAdditionalProperties: true, | ||
@@ -275,3 +280,3 @@ resolvers: { | ||
const tsSchemaPaths = Array(); | ||
const currentDir = await fs.realpath(process.cwd()); | ||
const currentDir = await fs__default['default'].realpath(process.cwd()); | ||
async function processItem({name, parentPath}) { | ||
@@ -291,3 +296,3 @@ var _a, _b; | ||
} | ||
const pkg = await fs.readJson(pkgPath); | ||
const pkg = await fs__default['default'].readJson(pkgPath); | ||
const depNames = [ | ||
@@ -313,3 +318,3 @@ ...Object.keys((_a = pkg.dependencies) != null ? _a : {}), | ||
const path2 = path.resolve(path.dirname(pkgPath), pkg.configSchema); | ||
const value = await fs.readJson(path2); | ||
const value = await fs__default['default'].readJson(path2); | ||
schemas.push({ | ||
@@ -431,3 +436,3 @@ value, | ||
return { | ||
process(configs, {visiblity, valueTransform} = {}) { | ||
process(configs, {visibility, valueTransform} = {}) { | ||
const result = validate(configs); | ||
@@ -440,6 +445,6 @@ if (result.errors) { | ||
let processedConfigs = configs; | ||
if (visiblity) { | ||
if (visibility) { | ||
processedConfigs = processedConfigs.map(({data, context}) => ({ | ||
context, | ||
data: filterByVisibility(data, visiblity, result.visibilityByPath, valueTransform) | ||
data: filterByVisibility(data, visibility, result.visibilityByPath, valueTransform) | ||
})); | ||
@@ -471,3 +476,3 @@ } else if (valueTransform) { | ||
async readFile(path2) { | ||
return fs.readFile(path.resolve(this.options.rootPath, path2), "utf8"); | ||
return fs__default['default'].readFile(path.resolve(this.options.rootPath, path2), "utf8"); | ||
} | ||
@@ -485,7 +490,7 @@ async readSecret(_path, desc) { | ||
const localConfig = path.resolve(configRoot, "app-config.local.yaml"); | ||
if (await fs.pathExists(localConfig)) { | ||
if (await fs__default['default'].pathExists(localConfig)) { | ||
configPaths.push(localConfig); | ||
} | ||
const envFile = `app-config.${options.env}.yaml`; | ||
if (await fs.pathExists(path.resolve(configRoot, envFile))) { | ||
if (await fs__default['default'].pathExists(path.resolve(configRoot, envFile))) { | ||
console.error(`Env config file '${envFile}' is not loaded as APP_ENV and NODE_ENV-based config loading has been removed`); | ||
@@ -492,0 +497,0 @@ console.error(`To load the config file, use --config <path>, listing every config file that you want to load`); |
@@ -47,3 +47,3 @@ import { AppConfig, JsonObject } from '@backstage/config'; | ||
*/ | ||
visiblity?: ConfigVisibility[]; | ||
visibility?: ConfigVisibility[]; | ||
/** | ||
@@ -50,0 +50,0 @@ * A transform function that can be used to transform primitive configuration values |
@@ -417,3 +417,3 @@ import { basename, extname, sep, relative, resolve, dirname, isAbsolute } from 'path'; | ||
return { | ||
process(configs, {visiblity, valueTransform} = {}) { | ||
process(configs, {visibility, valueTransform} = {}) { | ||
const result = validate(configs); | ||
@@ -426,6 +426,6 @@ if (result.errors) { | ||
let processedConfigs = configs; | ||
if (visiblity) { | ||
if (visibility) { | ||
processedConfigs = processedConfigs.map(({data, context}) => ({ | ||
context, | ||
data: filterByVisibility(data, visiblity, result.visibilityByPath, valueTransform) | ||
data: filterByVisibility(data, visibility, result.visibilityByPath, valueTransform) | ||
})); | ||
@@ -432,0 +432,0 @@ } else if (valueTransform) { |
{ | ||
"name": "@backstage/config-loader", | ||
"description": "Config loading functionality used by Backstage backend, and CLI", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"private": false, | ||
@@ -39,3 +39,3 @@ "publishConfig": { | ||
"json-schema-merge-allof": "^0.7.0", | ||
"typescript-json-schema": "^0.43.0", | ||
"typescript-json-schema": "^0.45.0", | ||
"yaml": "^1.9.2", | ||
@@ -56,4 +56,4 @@ "yup": "^0.29.3" | ||
], | ||
"gitHead": "8803fec70ded7945f08fd07bccbd0bb35f2fd33c", | ||
"gitHead": "90fbdd8c36118269c8919e1311cf1d5ba0ce55b2", | ||
"module": "dist/index.esm.js" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1055
135761
+ Addedcliui@7.0.4(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedtypescript@4.9.5(transitive)
+ Addedtypescript-json-schema@0.45.1(transitive)
+ Addedwrap-ansi@7.0.0(transitive)
+ Addedy18n@5.0.8(transitive)
+ Addedyargs@16.2.0(transitive)
+ Addedyargs-parser@20.2.9(transitive)
- Removedcamelcase@5.3.1(transitive)
- Removedcliui@6.0.0(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedfind-up@4.1.0(transitive)
- Removedglob@7.1.7(transitive)
- Removedlocate-path@5.0.0(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@4.1.0(transitive)
- Removedp-try@2.2.0(transitive)
- Removedpath-exists@4.0.0(transitive)
- Removedrequire-main-filename@2.0.0(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedtypescript@4.0.8(transitive)
- Removedtypescript-json-schema@0.43.0(transitive)
- Removedwhich-module@2.0.1(transitive)
- Removedwrap-ansi@6.2.0(transitive)
- Removedy18n@4.0.3(transitive)
- Removedyargs@15.4.1(transitive)
- Removedyargs-parser@18.1.3(transitive)