@chain-registry/cli 1.27.0 → 1.29.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/README.md CHANGED
@@ -5,14 +5,91 @@
5
5
  </p>
6
6
 
7
7
  <p align="center" width="100%">
8
- <a href="https://github.com/cosmology-tech/chain-registry/actions/cli/run-tests.yml">
9
- <img height="20" src="https://github.com/cosmology-tech/chain-registry/actions/cli/run-tests.yml/badge.svg" />
8
+ <a href="https://github.com/cosmology-tech/chain-registry/actions/workflows/run-tests.yml">
9
+ <img height="20" src="https://github.com/cosmology-tech/chain-registry/actions/workflows/run-tests.yml/badge.svg" />
10
10
  </a>
11
11
  <a href="https://github.com/cosmology-tech/chain-registry/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
12
- <a href="https://www.npmjs.com/package/@chain-registry/cli"><img height="20" src="https://img.shields.io/github/package-json/v/cosmology-tech/chain-registry?filename=packages%2Fcli%2Fpackage.json"></a>
12
+ <a href="https://www.npmjs.com/package/@chain-registry/cli"><img height="20" src="https://img.shields.io/github/package-json/v/cosmology-tech/chain-registry?filename=workflows%2Fcli%2Fpackage.json"></a>
13
13
  </p>
14
14
 
15
- TODO
15
+ The `@chain-registry/cli` is a powerful command-line interface designed to interact with the Chain Registry, allowing users to fetch information, validate data, and generate TypeScript interfaces directly from JSON schemas.
16
+
17
+ ## Features
18
+
19
+ 🔍 **Info**: Retrieve detailed information about chains, assets, and asset lists.
20
+
21
+ ✅ **Validate**: Check the integrity and validity of the registry data against its schemas.
22
+
23
+ 🛠️ **Codegen**: Generate TypeScript definitions for use in development, ensuring type safety and adherence to the schema definitions.
24
+
25
+ ## Installation
26
+
27
+ To get started with `@chain-registry/cli`, install it via npm or yarn:
28
+
29
+ ```js
30
+ npm install @chain-registry/cli
31
+ # or
32
+ yarn add @chain-registry/cli
33
+ ```
34
+
35
+ ## Table of Contents
36
+
37
+ - [Features](#features)
38
+ - [Installation](#installation)
39
+ - [Command Details](#command-details)
40
+ - [Info](#info)
41
+ - [Validate](#validate)
42
+ - [Codegen](#codegen)
43
+ - [Related Projects](#related)
44
+ - [Credits](#credits)
45
+ - [Disclaimer](#disclaimer)
46
+
47
+ ## Command Details
48
+
49
+ ### Info
50
+
51
+ Fetch and display information about entities in the chain registry:
52
+
53
+ ```sh
54
+ chain-registry info
55
+ ```
56
+
57
+ Options:
58
+
59
+ - `chain`: Fetch information specific to a chain.
60
+ - `asset-list`: Fetch asset lists associated with a specific chain.
61
+ - `asset`: Fetch detailed information about a specific asset.
62
+ - `--registryDir`: Path to the chain registry directory.
63
+
64
+ ### Validate
65
+
66
+ Validate the data in the registry against the provided JSON schemas:
67
+
68
+ ```sh
69
+ chain-registry validate
70
+ ```
71
+
72
+ Options:
73
+
74
+ - `--registryDir`: Path to the chain registry directory (required).
75
+ - `--useStrict`: Enables strict mode in the schema validation process, ensuring that only explicitly permitted properties are present in the data (default: false).
76
+ - `--allErrors`: Configures the validator to return all errors found during validation instead of stopping at the first error (default: true).
77
+ - `--useDefaults`: Applies default values defined in the schema during validation, filling in missing data as needed (default: true).
78
+
79
+ ### Codegen
80
+
81
+ Generate TypeScript interfaces for the registry:
82
+
83
+ ```sh
84
+ chain-registry codegen --outputDir ./src --registryDir /path/to/registry
85
+ ```
86
+
87
+ Options:
88
+
89
+ - `--outputDir`: Directory to output the generated TypeScript files.
90
+ - `--registryDir`: Path to the chain registry directory.
91
+ - `--strictTypeSafety`: Enables strict TypeScript type definitions.
92
+ - `--useCamelCase`: Converts JSON schema properties to camelCase in the generated TypeScript files.
16
93
 
17
94
  ## Related
18
95
 
@@ -8,7 +8,29 @@ const commands = async (argv, prompter, _options) => {
8
8
  {
9
9
  type: 'text',
10
10
  name: 'registryDir',
11
- message: 'provide a registryDir:'
11
+ message: 'provide a registryDir:',
12
+ required: true,
13
+ },
14
+ {
15
+ type: 'confirm',
16
+ name: 'useStrict',
17
+ required: true,
18
+ useDefault: true,
19
+ default: false
20
+ },
21
+ {
22
+ type: 'confirm',
23
+ name: 'allErrors',
24
+ required: true,
25
+ useDefault: true,
26
+ default: true
27
+ },
28
+ {
29
+ type: 'confirm',
30
+ name: 'useDefaults',
31
+ required: true,
32
+ useDefault: true,
33
+ default: true
12
34
  }
13
35
  ]);
14
36
  if (!(0, fs_1.existsSync)(argv.registryDir)) {
@@ -16,7 +38,11 @@ const commands = async (argv, prompter, _options) => {
16
38
  throw new Error('bad registry path!');
17
39
  }
18
40
  const registry = new workflows_1.Registry(argv.registryDir);
19
- const validator = new workflows_1.SchemaValidator(registry);
41
+ const validator = new workflows_1.SchemaValidator(registry, {
42
+ allErrors,
43
+ useDefaults,
44
+ useStrict
45
+ });
20
46
  validator.validateAllData(true);
21
47
  return argv;
22
48
  };
@@ -5,7 +5,29 @@ export const commands = async (argv, prompter, _options) => {
5
5
  {
6
6
  type: 'text',
7
7
  name: 'registryDir',
8
- message: 'provide a registryDir:'
8
+ message: 'provide a registryDir:',
9
+ required: true,
10
+ },
11
+ {
12
+ type: 'confirm',
13
+ name: 'useStrict',
14
+ required: true,
15
+ useDefault: true,
16
+ default: false
17
+ },
18
+ {
19
+ type: 'confirm',
20
+ name: 'allErrors',
21
+ required: true,
22
+ useDefault: true,
23
+ default: true
24
+ },
25
+ {
26
+ type: 'confirm',
27
+ name: 'useDefaults',
28
+ required: true,
29
+ useDefault: true,
30
+ default: true
9
31
  }
10
32
  ]);
11
33
  if (!existsSync(argv.registryDir)) {
@@ -13,7 +35,11 @@ export const commands = async (argv, prompter, _options) => {
13
35
  throw new Error('bad registry path!');
14
36
  }
15
37
  const registry = new Registry(argv.registryDir);
16
- const validator = new SchemaValidator(registry);
38
+ const validator = new SchemaValidator(registry, {
39
+ allErrors,
40
+ useDefaults,
41
+ useStrict
42
+ });
17
43
  validator.validateAllData(true);
18
44
  return argv;
19
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chain-registry/cli",
3
- "version": "1.27.0",
3
+ "version": "1.29.0",
4
4
  "description": "Chain Registry CLI",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "homepage": "https://github.com/cosmology-tech/chain-registry",
@@ -9,7 +9,8 @@
9
9
  "module": "esm/index.js",
10
10
  "types": "index.d.ts",
11
11
  "bin": {
12
- "registry": "cli.js"
12
+ "registry": "cli.js",
13
+ "chain-registry": "cli.js"
13
14
  },
14
15
  "publishConfig": {
15
16
  "access": "public",
@@ -32,8 +33,8 @@
32
33
  "test:watch": "jest --watch"
33
34
  },
34
35
  "dependencies": {
35
- "@chain-registry/interfaces": "^0.26.0",
36
- "@chain-registry/workflows": "^1.27.0",
36
+ "@chain-registry/interfaces": "^0.28.0",
37
+ "@chain-registry/workflows": "^1.29.0",
37
38
  "chalk": "^4.1.0",
38
39
  "deepmerge": "^4.3.1",
39
40
  "inquirerer": "1.8.0",
@@ -46,5 +47,8 @@
46
47
  "cosmos",
47
48
  "interchain"
48
49
  ],
49
- "gitHead": "bef55160d9bd8290980354c99963da3f3b12b94e"
50
+ "devDependencies": {
51
+ "strfy-js": "^2.2.2"
52
+ },
53
+ "gitHead": "df00cf702adec71eeaf5238046cc39e88a305f49"
50
54
  }