@chain-registry/workflows 1.41.0 → 1.42.0

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/esm/registry.js CHANGED
@@ -103,17 +103,23 @@ export class Registry {
103
103
  ignore: IGNORE_ROOT_DIRS.map(dir => `${this.basePath}/${dir}/**/*`)
104
104
  })
105
105
  .map(path => {
106
- const content = JSON.parse(readFileSync(path, 'utf-8'));
107
- if (!this.isJsonSchema(content))
108
- return;
109
- // https://stackoverflow.com/questions/69133771/ajv-no-schema-with-key-or-ref-https-json-schema-org-draft-07-schema
110
- content.$schema = content.$schema.replace(/https/, 'http');
111
- types[basename(content.$schema)] = true;
112
- return {
113
- $schemaFile: basename(content.$schema),
114
- path,
115
- content
116
- };
106
+ try {
107
+ const content = JSON.parse(readFileSync(path, 'utf-8'));
108
+ if (!this.isJsonSchema(content))
109
+ return;
110
+ // https://stackoverflow.com/questions/69133771/ajv-no-schema-with-key-or-ref-https-json-schema-org-draft-07-schema
111
+ content.$schema = content.$schema.replace(/https/, 'http');
112
+ types[basename(content.$schema)] = true;
113
+ return {
114
+ $schemaFile: basename(content.$schema),
115
+ path,
116
+ content
117
+ };
118
+ }
119
+ catch (error) {
120
+ // Throw a custom error with a clear message including the file path
121
+ throw new Error(`Failed to parse JSON. The file at "${path}" is not valid JSON.`);
122
+ }
117
123
  }).filter(Boolean);
118
124
  // filter out schemas (e.g. draft-04/schema )
119
125
  const schemas = this.definitions.filter(schema => this.isSchema(schema.content)).filter(Boolean);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chain-registry/workflows",
3
- "version": "1.41.0",
3
+ "version": "1.42.0",
4
4
  "description": "Chain Registry Workflows",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "homepage": "https://github.com/cosmology-tech/chain-registry",
@@ -31,7 +31,7 @@
31
31
  "@types/sha.js": "^2.4.0"
32
32
  },
33
33
  "dependencies": {
34
- "@chain-registry/interfaces": "^0.40.0",
34
+ "@chain-registry/interfaces": "^0.41.0",
35
35
  "ajv": "^8.12.0",
36
36
  "ajv-formats": "^3.0.1",
37
37
  "bignumber.js": "9.1.2",
@@ -51,5 +51,5 @@
51
51
  "cosmos",
52
52
  "interchain"
53
53
  ],
54
- "gitHead": "dbadb4695ee1308638cd4b37685ecdcb00c7d694"
54
+ "gitHead": "33eb7317dabe560105ed2ababa9232b0e256721a"
55
55
  }
package/registry.js CHANGED
@@ -106,17 +106,23 @@ class Registry {
106
106
  ignore: IGNORE_ROOT_DIRS.map(dir => `${this.basePath}/${dir}/**/*`)
107
107
  })
108
108
  .map(path => {
109
- const content = JSON.parse((0, fs_1.readFileSync)(path, 'utf-8'));
110
- if (!this.isJsonSchema(content))
111
- return;
112
- // https://stackoverflow.com/questions/69133771/ajv-no-schema-with-key-or-ref-https-json-schema-org-draft-07-schema
113
- content.$schema = content.$schema.replace(/https/, 'http');
114
- types[(0, path_1.basename)(content.$schema)] = true;
115
- return {
116
- $schemaFile: (0, path_1.basename)(content.$schema),
117
- path,
118
- content
119
- };
109
+ try {
110
+ const content = JSON.parse((0, fs_1.readFileSync)(path, 'utf-8'));
111
+ if (!this.isJsonSchema(content))
112
+ return;
113
+ // https://stackoverflow.com/questions/69133771/ajv-no-schema-with-key-or-ref-https-json-schema-org-draft-07-schema
114
+ content.$schema = content.$schema.replace(/https/, 'http');
115
+ types[(0, path_1.basename)(content.$schema)] = true;
116
+ return {
117
+ $schemaFile: (0, path_1.basename)(content.$schema),
118
+ path,
119
+ content
120
+ };
121
+ }
122
+ catch (error) {
123
+ // Throw a custom error with a clear message including the file path
124
+ throw new Error(`Failed to parse JSON. The file at "${path}" is not valid JSON.`);
125
+ }
120
126
  }).filter(Boolean);
121
127
  // filter out schemas (e.g. draft-04/schema )
122
128
  const schemas = this.definitions.filter(schema => this.isSchema(schema.content)).filter(Boolean);