@percy/config 1.0.0-beta.69 → 1.0.0-beta.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/defaults.js CHANGED
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = getDefaults;
6
+ exports.default = void 0;
7
+ exports.getDefaults = getDefaults;
7
8
 
8
9
  var _utils = require("./utils");
9
10
 
@@ -45,4 +46,7 @@ function getDefaults(overrides = {}) {
45
46
  // override default array instead of merging
46
47
  return isArray(next) && [path, next];
47
48
  });
48
- }
49
+ }
50
+
51
+ var _default = getDefaults;
52
+ exports.default = _default;
package/dist/index.js CHANGED
@@ -3,7 +3,85 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "addMigration", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _migrate.addMigration;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "addSchema", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _validate.addSchema;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "cache", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _load.cache;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "clearMigrations", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _migrate.clearMigrations;
28
+ }
29
+ });
6
30
  exports.default = void 0;
31
+ Object.defineProperty(exports, "explorer", {
32
+ enumerable: true,
33
+ get: function () {
34
+ return _load.explorer;
35
+ }
36
+ });
37
+ Object.defineProperty(exports, "getDefaults", {
38
+ enumerable: true,
39
+ get: function () {
40
+ return _defaults.default;
41
+ }
42
+ });
43
+ Object.defineProperty(exports, "load", {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _load.default;
47
+ }
48
+ });
49
+ Object.defineProperty(exports, "migrate", {
50
+ enumerable: true,
51
+ get: function () {
52
+ return _migrate.default;
53
+ }
54
+ });
55
+ Object.defineProperty(exports, "normalize", {
56
+ enumerable: true,
57
+ get: function () {
58
+ return _normalize.default;
59
+ }
60
+ });
61
+ Object.defineProperty(exports, "resetSchema", {
62
+ enumerable: true,
63
+ get: function () {
64
+ return _validate.resetSchema;
65
+ }
66
+ });
67
+ Object.defineProperty(exports, "search", {
68
+ enumerable: true,
69
+ get: function () {
70
+ return _load.search;
71
+ }
72
+ });
73
+ Object.defineProperty(exports, "stringify", {
74
+ enumerable: true,
75
+ get: function () {
76
+ return _stringify.default;
77
+ }
78
+ });
79
+ Object.defineProperty(exports, "validate", {
80
+ enumerable: true,
81
+ get: function () {
82
+ return _validate.default;
83
+ }
84
+ });
7
85
 
8
86
  var _load = _interopRequireWildcard(require("./load"));
9
87
 
@@ -23,7 +101,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
23
101
 
24
102
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
103
 
26
- // Export a single object that can be imported as PercyConfig
104
+ // mirror the namespace as the default export
27
105
  var _default = {
28
106
  load: _load.default,
29
107
  search: _load.search,
package/dist/load.js CHANGED
@@ -3,9 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.cache = void 0;
7
- exports.default = load;
8
- exports.explorer = void 0;
6
+ exports.explorer = exports.default = exports.cache = void 0;
7
+ exports.load = load;
9
8
  exports.search = search;
10
9
 
11
10
  var _path = require("path");
@@ -40,8 +39,12 @@ const explorer = (0, _cosmiconfig.cosmiconfigSync)('percy', {
40
39
  exports.explorer = explorer;
41
40
 
42
41
  function search(path) {
43
- let result = !path || (0, _fs.statSync)(path).isDirectory() ? explorer.search(path) : explorer.load(path);
44
- return result !== null && result !== void 0 && result.config ? result : {};
42
+ try {
43
+ let result = path && !(0, _fs.statSync)(path).isDirectory() ? explorer.load(path) : explorer.search(path);
44
+ return result || {};
45
+ } catch (error) {
46
+ if (error.code === 'ENOENT') return {};else throw error;
47
+ }
45
48
  } // Finds and loads a config file using cosmiconfig, merges it with optional
46
49
  // inputs, validates the combined config according to the schema, and returns
47
50
  // the combined config. Loaded config files are cached and reused on next load,
@@ -71,7 +74,7 @@ function load({
71
74
  try {
72
75
  let result = search(path);
73
76
 
74
- if (result.config) {
77
+ if (result !== null && result !== void 0 && result.config) {
75
78
  log[infoDebug](`Found config file: ${(0, _path.relative)('', result.filepath)}`);
76
79
  let version = parseInt(result.config.version, 10);
77
80
 
@@ -89,9 +92,11 @@ function load({
89
92
  }
90
93
  } else {
91
94
  log[infoDebug]('Config file not found');
95
+ if (bail) return;
92
96
  }
93
97
  } catch (error) {
94
98
  log[errorDebug](error);
99
+ if (bail) return;
95
100
  }
96
101
  } // normalize and merge with overrides then validate
97
102
 
@@ -116,4 +121,7 @@ function load({
116
121
 
117
122
 
118
123
  return (0, _defaults.default)(config);
119
- }
124
+ }
125
+
126
+ var _default = load;
127
+ exports.default = _default;
package/dist/migrate.js CHANGED
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.addMigration = addMigration;
7
7
  exports.clearMigrations = clearMigrations;
8
- exports.default = migrate;
8
+ exports.default = void 0;
9
+ exports.migrate = migrate;
9
10
 
10
11
  var _logger = _interopRequireDefault(require("@percy/logger"));
11
12
 
@@ -91,4 +92,7 @@ function migrate(config, schema = '/config') {
91
92
  }
92
93
 
93
94
  return config;
94
- }
95
+ }
96
+
97
+ var _default = migrate;
98
+ exports.default = _default;
package/dist/normalize.js CHANGED
@@ -3,7 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = normalize;
6
+ exports.camelcase = camelcase;
7
+ exports.default = void 0;
8
+ exports.kebabcase = kebabcase;
9
+ exports.normalize = normalize;
7
10
 
8
11
  var _validate = require("./validate");
9
12
 
@@ -46,4 +49,7 @@ function normalize(object, options) {
46
49
  });
47
50
  return [path];
48
51
  });
49
- }
52
+ }
53
+
54
+ var _default = normalize;
55
+ exports.default = _default;
package/dist/stringify.js CHANGED
@@ -3,8 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = stringify;
6
+ exports.default = void 0;
7
7
  exports.inspect = inspect;
8
+ exports.stringify = stringify;
8
9
 
9
10
  var _util = _interopRequireDefault(require("util"));
10
11
 
@@ -39,4 +40,7 @@ function stringify(format, config = (0, _defaults.default)()) {
39
40
  default:
40
41
  throw new Error(`Unsupported format: ${format}`);
41
42
  }
42
- }
43
+ }
44
+
45
+ var _default = stringify;
46
+ exports.default = _default;
package/dist/validate.js CHANGED
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.addSchema = addSchema;
7
- exports.default = validate;
7
+ exports.default = void 0;
8
8
  exports.getSchema = getSchema;
9
9
  exports.resetSchema = resetSchema;
10
+ exports.validate = validate;
10
11
 
11
12
  var _ajv = _interopRequireDefault(require("ajv"));
12
13
 
@@ -249,4 +250,7 @@ function validate(data, key = '/config') {
249
250
 
250
251
  return Array.from(errors.values());
251
252
  }
252
- }
253
+ }
254
+
255
+ var _default = validate;
256
+ exports.default = _default;
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@percy/config",
3
- "version": "1.0.0-beta.69",
3
+ "version": "1.0.0-beta.72",
4
4
  "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/percy/cli",
8
+ "directory": "packages/config"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
5
13
  "main": "dist/index.js",
6
14
  "types": "types/index.d.ts",
7
15
  "files": [
@@ -18,11 +26,8 @@
18
26
  "test:coverage": "yarn test --coverage",
19
27
  "test:types": "tsd"
20
28
  },
21
- "publishConfig": {
22
- "access": "public"
23
- },
24
29
  "dependencies": {
25
- "@percy/logger": "1.0.0-beta.69",
30
+ "@percy/logger": "1.0.0-beta.72",
26
31
  "ajv": "^8.6.2",
27
32
  "cosmiconfig": "^7.0.0",
28
33
  "yaml": "^1.10.0"
@@ -30,10 +35,5 @@
30
35
  "devDependencies": {
31
36
  "json-schema-typed": "^7.0.3"
32
37
  },
33
- "repository": {
34
- "type": "git",
35
- "url": "https://github.com/percy/cli",
36
- "directory": "packages/config"
37
- },
38
- "gitHead": "99b0617016a07c9d7d4ca37c1442011c904cf860"
38
+ "gitHead": "6219287e18a0cacb609d0c2696a5785abc9009b9"
39
39
  }