@chain-registry/cli 1.30.5 → 1.31.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
@@ -89,7 +89,7 @@ Options:
89
89
  - `--outputDir`: Directory to output the generated TypeScript files.
90
90
  - `--registryDir`: Path to the chain registry directory.
91
91
  - `--strictTypeSafety`: Enables strict TypeScript type definitions.
92
- - `--useCamelCase`: Converts JSON schema properties to camelCase in the generated TypeScript files.
92
+ - `--camelCase`: Converts JSON schema properties to camelCase in the generated TypeScript files.
93
93
 
94
94
  ## Related
95
95
 
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.commands = void 0;
4
4
  const workflows_1 = require("@chain-registry/workflows");
5
5
  const fs_1 = require("fs");
6
+ const utils_1 = require("../../utils");
6
7
  const commands = async (argv, prompter, _options) => {
7
- const { registryDir, outputDir, strictTypeSafety, useCamelCase } = await prompter.prompt(argv, [
8
+ const { registryDir, outputDir, strictTypeSafety, camelCase } = await prompter.prompt(argv, [
8
9
  {
9
10
  type: 'text',
10
11
  name: 'registryDir',
@@ -23,7 +24,7 @@ const commands = async (argv, prompter, _options) => {
23
24
  },
24
25
  {
25
26
  type: 'confirm',
26
- name: 'useCamelCase',
27
+ name: 'camelCase',
27
28
  default: true,
28
29
  useDefault: false
29
30
  }
@@ -38,7 +39,8 @@ const commands = async (argv, prompter, _options) => {
38
39
  registry,
39
40
  schemaTSOptions: {
40
41
  strictTypeSafety,
41
- useCamelCase
42
+ camelCase,
43
+ camelCaseFn: utils_1.toCamelCase
42
44
  }
43
45
  });
44
46
  generator.generateTypes();
package/commands/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.commands = void 0;
4
+ const help_1 = require("../help");
4
5
  const codegen_1 = require("./codegen");
5
6
  const info_1 = require("./info");
6
7
  const validate_1 = require("./validate");
7
- const help_1 = require("../help");
8
8
  const commands = async (argv, prompter, _options) => {
9
9
  let command;
10
10
  if (argv._.length > 0) {
@@ -1,7 +1,8 @@
1
1
  import { Registry, SchemaTypeGenerator } from '@chain-registry/workflows';
2
2
  import { existsSync } from 'fs';
3
+ import { toCamelCase } from '../../utils';
3
4
  export const commands = async (argv, prompter, _options) => {
4
- const { registryDir, outputDir, strictTypeSafety, useCamelCase } = await prompter.prompt(argv, [
5
+ const { registryDir, outputDir, strictTypeSafety, camelCase } = await prompter.prompt(argv, [
5
6
  {
6
7
  type: 'text',
7
8
  name: 'registryDir',
@@ -20,7 +21,7 @@ export const commands = async (argv, prompter, _options) => {
20
21
  },
21
22
  {
22
23
  type: 'confirm',
23
- name: 'useCamelCase',
24
+ name: 'camelCase',
24
25
  default: true,
25
26
  useDefault: false
26
27
  }
@@ -35,7 +36,8 @@ export const commands = async (argv, prompter, _options) => {
35
36
  registry,
36
37
  schemaTSOptions: {
37
38
  strictTypeSafety,
38
- useCamelCase
39
+ camelCase,
40
+ camelCaseFn: toCamelCase
39
41
  }
40
42
  });
41
43
  generator.generateTypes();
@@ -1,7 +1,7 @@
1
+ import { getUsage } from '../help';
1
2
  import { commands as codegen } from './codegen';
2
3
  import { commands as info } from './info';
3
4
  import { commands as validate } from './validate';
4
- import { getUsage } from '../help';
5
5
  export const commands = async (argv, prompter, _options) => {
6
6
  let command;
7
7
  if (argv._.length > 0) {
package/esm/help.js CHANGED
@@ -38,7 +38,7 @@ ${header('COMMANDS')}
38
38
  ${normal('Specifies the path to the chain registry directory.')}
39
39
  ${option('--strictTypeSafety')}
40
40
  ${normal('Enables strict TypeScript type definitions.')}
41
- ${option('--useCamelCase')}
41
+ ${option('--camelCase')}
42
42
  ${normal('Converts JSON schema properties to camelCase in the generated TypeScript files.')}
43
43
 
44
44
  ${header('EXAMPLES')}
package/esm/utils.js CHANGED
@@ -10,3 +10,13 @@ export function getVersion() {
10
10
  const pkg = readAndParsePackageJson();
11
11
  return pkg.version;
12
12
  }
13
+ // MARKED AS NOT DRY
14
+ export function toCamelCase(key) {
15
+ return key
16
+ // First, remove all leading non-alphabet characters except $
17
+ .replace(/^[^a-zA-Z$]+/, '')
18
+ // Convert what follows a separator into upper case
19
+ .replace(/[-_\s]+(.)?/g, (_, c) => c ? c.toUpperCase() : '')
20
+ // Ensure the first character of the result is always lowercase
21
+ .replace(/^./, (c) => c.toLowerCase());
22
+ }
package/help.js CHANGED
@@ -44,7 +44,7 @@ ${header('COMMANDS')}
44
44
  ${normal('Specifies the path to the chain registry directory.')}
45
45
  ${option('--strictTypeSafety')}
46
46
  ${normal('Enables strict TypeScript type definitions.')}
47
- ${option('--useCamelCase')}
47
+ ${option('--camelCase')}
48
48
  ${normal('Converts JSON schema properties to camelCase in the generated TypeScript files.')}
49
49
 
50
50
  ${header('EXAMPLES')}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chain-registry/cli",
3
- "version": "1.30.5",
3
+ "version": "1.31.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",
@@ -33,8 +33,8 @@
33
33
  "test:watch": "jest --watch"
34
34
  },
35
35
  "dependencies": {
36
- "@chain-registry/interfaces": "^0.29.5",
37
- "@chain-registry/workflows": "^1.30.5",
36
+ "@chain-registry/interfaces": "^0.30.0",
37
+ "@chain-registry/workflows": "^1.31.0",
38
38
  "chalk": "^4.1.0",
39
39
  "deepmerge": "^4.3.1",
40
40
  "inquirerer": "1.8.0",
@@ -47,8 +47,5 @@
47
47
  "cosmos",
48
48
  "interchain"
49
49
  ],
50
- "devDependencies": {
51
- "strfy-js": "^2.2.2"
52
- },
53
- "gitHead": "63df544ec7e864f893bdc7a4605a1666ca292da3"
50
+ "gitHead": "54c2809401437ddad8eea7d120b47cbfa334acce"
54
51
  }
package/utils.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export declare function displayVersion(): void;
2
2
  export declare function getVersion(): string;
3
+ export declare function toCamelCase(key: string): string;
package/utils.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getVersion = exports.displayVersion = void 0;
6
+ exports.toCamelCase = exports.getVersion = exports.displayVersion = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const package_1 = require("./package");
9
9
  // Function to display the version information
@@ -18,3 +18,14 @@ function getVersion() {
18
18
  return pkg.version;
19
19
  }
20
20
  exports.getVersion = getVersion;
21
+ // MARKED AS NOT DRY
22
+ function toCamelCase(key) {
23
+ return key
24
+ // First, remove all leading non-alphabet characters except $
25
+ .replace(/^[^a-zA-Z$]+/, '')
26
+ // Convert what follows a separator into upper case
27
+ .replace(/[-_\s]+(.)?/g, (_, c) => c ? c.toUpperCase() : '')
28
+ // Ensure the first character of the result is always lowercase
29
+ .replace(/^./, (c) => c.toLowerCase());
30
+ }
31
+ exports.toCamelCase = toCamelCase;