@axway/amplify-config
Advanced tools
Comparing version 1.3.0 to 2.0.0
@@ -7,4 +7,12 @@ "use strict"; | ||
exports.loadConfig = loadConfig; | ||
Object.defineProperty(exports, "Config", { | ||
enumerable: true, | ||
get: function () { | ||
return _configKit.default; | ||
} | ||
}); | ||
exports.default = exports.configFile = void 0; | ||
var _configKit = _interopRequireDefault(require("config-kit")); | ||
var _os = _interopRequireDefault(require("os")); | ||
@@ -14,2 +22,4 @@ | ||
var _appcdPath = require("appcd-path"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -28,6 +38,6 @@ | ||
* @param {Object} [opts] - An object with various options. | ||
* @param {String} [opts.configFile] - Path to the config file to load as the reference. | ||
* @param {String} [opts.userConfigFile=~/.axway/amplify-cli.json] - Path to the user defined | ||
* config file. If the file does not exist, an empty object will be written | ||
* @returns {Config} An appcd-config instance | ||
* @param {Object} [opts.config] - A object to initialize the config with. Note that if a | ||
* `configFile` is also specified, this `config` is applied AFTER the config file has been loaded. | ||
* @param {String} [opts.configFile] - The path to a .js or .json config file to load. | ||
* @returns {Config} | ||
*/ | ||
@@ -38,26 +48,16 @@ | ||
function loadConfig({ | ||
configFile: appConfigFile, | ||
userConfigFile | ||
} = {}) { | ||
const { | ||
existsSync, | ||
outputJSONSync | ||
} = require('fs-extra'); | ||
const Config = require('appcd-config').default; | ||
if (!userConfigFile) { | ||
userConfigFile = configFile; | ||
function loadConfig(opts = {}) { | ||
// validate the config options | ||
if (opts.config && (typeof opts.config !== 'object' || Array.isArray(opts.config))) { | ||
throw new TypeError('Expected config to be an object'); | ||
} | ||
if (!existsSync(userConfigFile)) { | ||
outputJSONSync(userConfigFile, {}); | ||
if (opts.configFile && typeof opts.configFile !== 'string') { | ||
throw new TypeError('Expected config file to be a string'); | ||
} | ||
const cfg = new Config({ | ||
configFile: appConfigFile | ||
const cfg = new _configKit.default({ | ||
data: opts.config, | ||
file: (0, _appcdPath.expandPath)(opts.configFile || configFile) | ||
}); | ||
cfg.userConfigFile = userConfigFile; | ||
cfg.loadUserConfig(userConfigFile); | ||
return cfg; | ||
@@ -68,2 +68,2 @@ } | ||
exports.default = _default; | ||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbIkVycm9yIiwicHJlcGFyZVN0YWNrVHJhY2UiLCJyZXF1aXJlIiwiY29uZmlnRmlsZSIsInBhdGgiLCJqb2luIiwib3MiLCJob21lZGlyIiwibG9hZENvbmZpZyIsImFwcENvbmZpZ0ZpbGUiLCJ1c2VyQ29uZmlnRmlsZSIsImV4aXN0c1N5bmMiLCJvdXRwdXRKU09OU3luYyIsIkNvbmZpZyIsImRlZmF1bHQiLCJjZmciLCJsb2FkVXNlckNvbmZpZyJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFLQTs7QUFDQTs7OztBQU5BO0FBQ0EsSUFBSSxDQUFDQSxLQUFLLENBQUNDLGlCQUFYLEVBQThCO0FBQzdCQyxFQUFBQSxPQUFPLENBQUMsNkJBQUQsQ0FBUDtBQUNBOztBQUtNLE1BQU1DLFVBQVUsR0FBR0MsY0FBS0MsSUFBTCxDQUFVQyxZQUFHQyxPQUFILEVBQVYsRUFBd0IsUUFBeEIsRUFBa0Msa0JBQWxDLENBQW5CO0FBRVA7Ozs7Ozs7Ozs7Ozs7O0FBVU8sU0FBU0MsVUFBVCxDQUFvQjtBQUFFTCxFQUFBQSxVQUFVLEVBQUVNLGFBQWQ7QUFBNkJDLEVBQUFBO0FBQTdCLElBQWdELEVBQXBFLEVBQXdFO0FBQzlFLFFBQU07QUFBRUMsSUFBQUEsVUFBRjtBQUFjQyxJQUFBQTtBQUFkLE1BQWlDVixPQUFPLENBQUMsVUFBRCxDQUE5Qzs7QUFDQSxRQUFNVyxNQUFNLEdBQUdYLE9BQU8sQ0FBQyxjQUFELENBQVAsQ0FBd0JZLE9BQXZDOztBQUVBLE1BQUks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9hZENvbmZpZztcblxuZXhwb3J0IHsgQ29uZmlnIH07XG4iXSwiZmlsZSI6ImluZGV4LmpzIn0= |
{ | ||
"name": "@axway/amplify-config", | ||
"version": "1.3.0", | ||
"version": "2.0.0", | ||
"publishConfig": { | ||
@@ -27,8 +27,9 @@ "access": "public" | ||
"dependencies": { | ||
"appcd-config": "^1.3.1", | ||
"fs-extra": "^8.1.0", | ||
"source-map-support": "^0.5.13" | ||
"appcd-path": "^2.0.0", | ||
"config-kit": "^1.0.0", | ||
"fs-extra": "^9.0.0", | ||
"source-map-support": "^0.5.19" | ||
}, | ||
"devDependencies": { | ||
"appcd-gulp": "^2.2.0" | ||
"appcd-gulp": "^3.0.0" | ||
}, | ||
@@ -39,6 +40,6 @@ "homepage": "https://github.com/appcelerator/amplify-tooling#readme", | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"node": ">=10.13.0" | ||
}, | ||
"main": "./dist/index", | ||
"gitHead": "9ffc1fbd088d5f059f358a68d3483f0244d39f71" | ||
"gitHead": "eefa21264fb5f89697020e22db1087ce0f8116e3" | ||
} |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
7786
1
4
+ Addedappcd-path@^2.0.0
+ Addedconfig-kit@^1.0.0
+ Added@hapi/hoek@9.3.0(transitive)
+ Added@hapi/topo@5.1.0(transitive)
+ Added@sideway/address@4.1.5(transitive)
+ Added@sideway/formula@3.0.1(transitive)
+ Added@sideway/pinpoint@2.0.0(transitive)
+ Added@xmldom/xmldom@0.7.13(transitive)
+ Addedappcd-path@2.0.8(transitive)
+ Addedat-least-node@1.0.0(transitive)
+ Addedcallsites@3.1.0(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedconfig-kit@1.7.2(transitive)
+ Addeddetect-indent@6.1.0(transitive)
+ Addedfs-extra@9.1.0(transitive)
+ Addedimport-fresh@3.3.0(transitive)
+ Addedjoi@17.13.3(transitive)
+ Addedjsonfile@6.1.0(transitive)
+ Addedparent-module@1.0.1(transitive)
+ Addedresolve-from@4.0.0(transitive)
+ Addedsnooplogg@3.0.2(transitive)
+ Addedsupports-color@8.1.1(transitive)
+ Addeduniversalify@2.0.1(transitive)
- Removedappcd-config@^1.3.1
- Removed@babel/code-frame@7.26.2(transitive)
- Removed@babel/generator@7.26.2(transitive)
- Removed@babel/helper-string-parser@7.25.9(transitive)
- Removed@babel/helper-validator-identifier@7.25.9(transitive)
- Removed@babel/parser@7.26.2(transitive)
- Removed@babel/template@7.25.9(transitive)
- Removed@babel/traverse@7.25.9(transitive)
- Removed@babel/types@7.26.0(transitive)
- Removed@jridgewell/gen-mapping@0.3.5(transitive)
- Removed@jridgewell/resolve-uri@3.1.2(transitive)
- Removed@jridgewell/set-array@1.2.1(transitive)
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@jridgewell/trace-mapping@0.3.25(transitive)
- Removedappcd-config@1.3.1(transitive)
- Removedappcd-fs@1.1.10(transitive)
- Removedappcd-logger@2.0.5(transitive)
- Removedappcd-path@1.1.10(transitive)
- Removedchalk@3.0.0(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddoctrine@3.0.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfs-extra@8.1.0(transitive)
- Removedgawk@4.7.1(transitive)
- Removedglobals@11.12.0(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedjsesc@3.0.2(transitive)
- Removedjsonfile@4.0.0(transitive)
- Removedms@2.1.3(transitive)
- Removedpicocolors@1.1.1(transitive)
- Removedsnooplogg@2.3.3(transitive)
- Removeduniversalify@0.1.2(transitive)
Updatedfs-extra@^9.0.0
Updatedsource-map-support@^0.5.19