@acala-network/chopsticks 0.13.0-1 → 0.13.1

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/cjs/cli.js CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  const _dotenv = require("dotenv");
6
6
  const _helpers = require("yargs/helpers");
7
+ const _zod = require("zod");
7
8
  const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
8
9
  const _yargs = /*#__PURE__*/ _interop_require_default(require("yargs"));
9
10
  const _chopstickscore = require("@acala-network/chopsticks-core");
@@ -17,14 +18,24 @@ function _interop_require_default(obj) {
17
18
  }
18
19
  (0, _dotenv.config)();
19
20
  const processArgv = async (argv)=>{
20
- if (argv.unsafeRpcMethods) {
21
- await (0, _index1.loadRpcMethodsByScripts)(argv.unsafeRpcMethods);
22
- }
23
- if (argv.config) {
24
- Object.assign(argv, _lodash.default.defaults(argv, await (0, _index.fetchConfig)(argv.config)));
25
- }
26
- if (_chopstickscore.environment.PORT) {
27
- argv.port = Number(_chopstickscore.environment.PORT);
21
+ try {
22
+ if (argv.unsafeRpcMethods) {
23
+ await (0, _index1.loadRpcMethodsByScripts)(argv.unsafeRpcMethods);
24
+ }
25
+ if (argv.config) {
26
+ Object.assign(argv, _lodash.default.defaults(argv, await (0, _index.fetchConfig)(argv.config)));
27
+ }
28
+ if (_chopstickscore.environment.PORT) {
29
+ argv.port = Number(_chopstickscore.environment.PORT);
30
+ }
31
+ } catch (error) {
32
+ if (error instanceof _zod.z.ZodError) {
33
+ throw new Error('Bad argv', {
34
+ cause: error.flatten().fieldErrors
35
+ });
36
+ } else {
37
+ throw error;
38
+ }
28
39
  }
29
40
  };
30
41
  const commands = (0, _yargs.default)((0, _helpers.hideBin)(process.argv)).scriptName('chopsticks').middleware(processArgv, false).command('*', 'Dev mode, fork off a chain', (yargs)=>yargs.config('config', 'Path to config file with default options', ()=>({})).options((0, _index.getYargsOptions)(_index.configSchema.shape)), async (argv)=>{
package/dist/esm/cli.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { config as dotenvConfig } from 'dotenv';
2
2
  import { hideBin } from 'yargs/helpers';
3
+ import { z } from 'zod';
3
4
  import _ from 'lodash';
4
5
  import yargs from 'yargs';
5
6
  import { connectParachains, connectVertical, environment } from '@acala-network/chopsticks-core';
@@ -8,14 +9,24 @@ import { loadRpcMethodsByScripts, pluginExtendCli } from './plugins/index.js';
8
9
  import { setupWithServer } from './index.js';
9
10
  dotenvConfig();
10
11
  const processArgv = async (argv)=>{
11
- if (argv.unsafeRpcMethods) {
12
- await loadRpcMethodsByScripts(argv.unsafeRpcMethods);
13
- }
14
- if (argv.config) {
15
- Object.assign(argv, _.defaults(argv, await fetchConfig(argv.config)));
16
- }
17
- if (environment.PORT) {
18
- argv.port = Number(environment.PORT);
12
+ try {
13
+ if (argv.unsafeRpcMethods) {
14
+ await loadRpcMethodsByScripts(argv.unsafeRpcMethods);
15
+ }
16
+ if (argv.config) {
17
+ Object.assign(argv, _.defaults(argv, await fetchConfig(argv.config)));
18
+ }
19
+ if (environment.PORT) {
20
+ argv.port = Number(environment.PORT);
21
+ }
22
+ } catch (error) {
23
+ if (error instanceof z.ZodError) {
24
+ throw new Error('Bad argv', {
25
+ cause: error.flatten().fieldErrors
26
+ });
27
+ } else {
28
+ throw error;
29
+ }
19
30
  }
20
31
  };
21
32
  const commands = yargs(hideBin(process.argv)).scriptName('chopsticks').middleware(processArgv, false).command('*', 'Dev mode, fork off a chain', (yargs)=>yargs.config('config', 'Path to config file with default options', ()=>({})).options(getYargsOptions(configSchema.shape)), async (argv)=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acala-network/chopsticks",
3
- "version": "0.13.0-1",
3
+ "version": "0.13.1",
4
4
  "author": "Acala Developers <hello@acala.network>",
5
5
  "license": "Apache-2.0",
6
6
  "bin": "./chopsticks.cjs",
@@ -12,8 +12,8 @@
12
12
  "depcheck": "npx depcheck --ignore-patterns='*.test.ts'"
13
13
  },
14
14
  "dependencies": {
15
- "@acala-network/chopsticks-core": "0.13.0-1",
16
- "@acala-network/chopsticks-db": "0.13.0-1",
15
+ "@acala-network/chopsticks-core": "0.13.1",
16
+ "@acala-network/chopsticks-db": "0.13.1",
17
17
  "@pnpm/npm-conf": "^2.2.2",
18
18
  "@polkadot/api": "^12.1.1",
19
19
  "@polkadot/api-augment": "^12.1.1",