b-gsdk 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/dist/bin.js +10 -1
  2. package/package.json +1 -4
  3. package/src/bin.ts +11 -2
package/dist/bin.js CHANGED
@@ -32,7 +32,16 @@ const cmds = {
32
32
  // Run CLI
33
33
  try {
34
34
  // Run command or show usage for unknown command
35
- cmds[cmd] ? cmds[cmd](args) : help(0);
35
+ cmds[cmd]
36
+ ? cmds[cmd](args)
37
+ .then(() => {
38
+ process.exit(0);
39
+ })
40
+ .catch((error) => {
41
+ console.error((0, format_error_1.formatError)(error));
42
+ process.exit(1);
43
+ })
44
+ : help(0);
36
45
  }
37
46
  catch (e) {
38
47
  console.error((0, format_error_1.formatError)(e).message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "b-gsdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A GraphQL Codegen that outputs a TypeScript SDK.",
5
5
  "author": "Julian Benegas",
6
6
  "license": "MIT",
@@ -32,8 +32,5 @@
32
32
  "graphql": "^16.3.0",
33
33
  "ts-node": "^10.7.0",
34
34
  "typescript": "^4.6.3"
35
- },
36
- "engines": {
37
- "node": ">=16.0.0"
38
35
  }
39
36
  }
package/src/bin.ts CHANGED
@@ -29,14 +29,23 @@ const args = arg(
29
29
  );
30
30
 
31
31
  // CLI commands
32
- const cmds: { [key: string]: (args: Args) => void } = {
32
+ const cmds: { [key: string]: (args: Args) => Promise<void> } = {
33
33
  generate: main,
34
34
  };
35
35
 
36
36
  // Run CLI
37
37
  try {
38
38
  // Run command or show usage for unknown command
39
- cmds[cmd] ? cmds[cmd](args) : help(0);
39
+ cmds[cmd]
40
+ ? cmds[cmd](args)
41
+ .then(() => {
42
+ process.exit(0);
43
+ })
44
+ .catch((error) => {
45
+ console.error(formatError(error));
46
+ process.exit(1);
47
+ })
48
+ : help(0);
40
49
  } catch (e) {
41
50
  console.error(formatError(e).message);
42
51
  process.exit(1);