@constructive-io/cli 5.6.21 → 5.6.22

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const child_process_1 = require("child_process");
3
+ const generate_1 = require("@constructive-io/graphql-codegen/cli/commands/generate");
4
4
  const usage = `
5
5
  Constructive GraphQL Codegen:
6
6
 
@@ -20,29 +20,23 @@ exports.default = async (argv, _prompter, _options) => {
20
20
  console.log(usage);
21
21
  process.exit(0);
22
22
  }
23
- const cwd = argv.cwd || process.cwd();
24
23
  const endpoint = argv.endpoint || '';
25
- const outDir = argv.out || 'graphql/codegen/dist';
24
+ const outDir = argv.out || 'codegen';
26
25
  const auth = argv.auth || '';
27
26
  const configPath = argv.config || '';
28
27
  const dryRun = !!(argv['dry-run'] || argv.dryRun);
29
28
  const verbose = !!(argv.verbose || argv.v);
30
- const envBin = process.env.CONSTRUCTIVE_CODEGEN_BIN;
31
- const bin = envBin || require.resolve('@constructive-io/graphql-codegen/bin/graphql-codegen.js');
32
- const args = ['generate'];
33
- if (configPath)
34
- args.push('-c', configPath);
35
- if (endpoint)
36
- args.push('-e', endpoint);
37
- if (outDir)
38
- args.push('-o', outDir);
39
- if (auth)
40
- args.push('-a', auth);
41
- if (dryRun)
42
- args.push('--dry-run');
43
- if (verbose)
44
- args.push('-v');
45
- const res = (0, child_process_1.spawnSync)(process.execPath, [bin, ...args], { cwd, stdio: 'inherit' });
46
- if ((res.status ?? 0) !== 0)
47
- process.exit(res.status ?? 1);
29
+ const result = await (0, generate_1.generateCommand)({
30
+ config: configPath,
31
+ endpoint,
32
+ output: outDir,
33
+ authorization: auth,
34
+ verbose,
35
+ dryRun,
36
+ });
37
+ if (!result.success) {
38
+ console.error('x', result.message);
39
+ process.exit(1);
40
+ }
41
+ console.log('[ok]', result.message);
48
42
  };
@@ -1,4 +1,4 @@
1
- import { spawnSync } from 'child_process';
1
+ import { generateCommand } from '@constructive-io/graphql-codegen/cli/commands/generate';
2
2
  const usage = `
3
3
  Constructive GraphQL Codegen:
4
4
 
@@ -18,29 +18,23 @@ export default async (argv, _prompter, _options) => {
18
18
  console.log(usage);
19
19
  process.exit(0);
20
20
  }
21
- const cwd = argv.cwd || process.cwd();
22
21
  const endpoint = argv.endpoint || '';
23
- const outDir = argv.out || 'graphql/codegen/dist';
22
+ const outDir = argv.out || 'codegen';
24
23
  const auth = argv.auth || '';
25
24
  const configPath = argv.config || '';
26
25
  const dryRun = !!(argv['dry-run'] || argv.dryRun);
27
26
  const verbose = !!(argv.verbose || argv.v);
28
- const envBin = process.env.CONSTRUCTIVE_CODEGEN_BIN;
29
- const bin = envBin || require.resolve('@constructive-io/graphql-codegen/bin/graphql-codegen.js');
30
- const args = ['generate'];
31
- if (configPath)
32
- args.push('-c', configPath);
33
- if (endpoint)
34
- args.push('-e', endpoint);
35
- if (outDir)
36
- args.push('-o', outDir);
37
- if (auth)
38
- args.push('-a', auth);
39
- if (dryRun)
40
- args.push('--dry-run');
41
- if (verbose)
42
- args.push('-v');
43
- const res = spawnSync(process.execPath, [bin, ...args], { cwd, stdio: 'inherit' });
44
- if ((res.status ?? 0) !== 0)
45
- process.exit(res.status ?? 1);
27
+ const result = await generateCommand({
28
+ config: configPath,
29
+ endpoint,
30
+ output: outDir,
31
+ authorization: auth,
32
+ verbose,
33
+ dryRun,
34
+ });
35
+ if (!result.success) {
36
+ console.error('x', result.message);
37
+ process.exit(1);
38
+ }
39
+ console.log('[ok]', result.message);
46
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/cli",
3
- "version": "5.6.21",
3
+ "version": "5.6.22",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "Constructive CLI",
6
6
  "main": "index.js",
@@ -48,10 +48,10 @@
48
48
  "dependencies": {
49
49
  "@constructive-io/graphql-codegen": "^2.23.3",
50
50
  "@constructive-io/graphql-env": "^2.8.19",
51
- "@constructive-io/graphql-explorer": "^2.13.15",
52
- "@constructive-io/graphql-server": "^2.16.0",
51
+ "@constructive-io/graphql-explorer": "^2.13.16",
52
+ "@constructive-io/graphql-server": "^2.16.1",
53
53
  "@inquirerer/utils": "^3.1.3",
54
- "@pgpmjs/core": "^4.14.0",
54
+ "@pgpmjs/core": "^4.15.0",
55
55
  "@pgpmjs/logger": "^1.3.7",
56
56
  "@pgpmjs/server-utils": "^2.8.15",
57
57
  "@pgpmjs/types": "^2.14.1",
@@ -61,7 +61,7 @@
61
61
  "minimist": "^1.2.8",
62
62
  "pg-cache": "^1.6.15",
63
63
  "pg-env": "^1.2.5",
64
- "pgpm": "^2.10.13",
64
+ "pgpm": "^2.10.14",
65
65
  "shelljs": "^0.10.0",
66
66
  "yanse": "^0.1.11"
67
67
  },
@@ -76,5 +76,5 @@
76
76
  "postgres",
77
77
  "graphile"
78
78
  ],
79
- "gitHead": "049ab1b8c49c5711ede9a47c8e8dbb7bbbdf5a1f"
79
+ "gitHead": "15e8f92ee6ec7bfebd6647dec743e4235b0362ac"
80
80
  }