@toptal/davinci-graphql-codegen 2.0.3-alpha-fx-4080-generated-c2c3732a.10 → 2.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @toptal/davinci-graphql-codegen
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2063](https://github.com/toptal/davinci/pull/2063) [`d25b726e`](https://github.com/toptal/davinci/commit/d25b726e7f5f5e11c516fc5d0191694ed6065a3e) Thanks [@augustobmoura](https://github.com/augustobmoura)!
8
+
9
+ ### Documents
10
+
11
+ - add support for multiple documents
12
+
3
13
  ## 2.0.2
4
14
 
5
15
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-graphql-codegen",
3
- "version": "2.0.3-alpha-fx-4080-generated-c2c3732a.10+c2c3732a",
3
+ "version": "2.1.0",
4
4
  "description": "Codegen",
5
5
  "author": "Toptal",
6
6
  "license": "SEE LICENSE IN LICENSE.MD",
@@ -38,14 +38,14 @@
38
38
  "@graphql-codegen/typescript-resolvers": "^2.2.1",
39
39
  "@graphql-tools/url-loader": "^7.17.14",
40
40
  "@graphql-typed-document-node/core": "^3.2.0",
41
- "@toptal/davinci-cli-shared": "2.3.3-alpha-fx-4080-generated-c2c3732a.16+c2c3732a",
42
- "@toptal/davinci-monorepo": "8.2.3-alpha-fx-4080-generated-c2c3732a.16+c2c3732a",
41
+ "@toptal/davinci-cli-shared": "^2.3.2",
42
+ "@toptal/davinci-monorepo": "8.2.2",
43
43
  "babel-plugin-extract-export": "^0.1.0",
44
44
  "chalk": "^4.1.2",
45
45
  "deepmerge": "^4.2.2",
46
46
  "fs-extra": "^11.1.1",
47
47
  "glob": "^8.0.3",
48
- "lodash.castarray": "^4.4.0"
48
+ "lodash": "^4.17.21"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "graphql": "^16",
@@ -55,6 +55,5 @@
55
55
  "@jest/globals": "^29.4.2",
56
56
  "graphql": "^16",
57
57
  "prettier": "^2.6.2"
58
- },
59
- "gitHead": "c2c3732af7dc5371f5181e26903935349342a0d4"
58
+ }
60
59
  }
@@ -15,11 +15,7 @@ const codegenGenerateOperations = async ({
15
15
 
16
16
  const codegen = await readConfig(config)
17
17
 
18
- for await (const {
19
- schema,
20
- documents,
21
- config: customConfig = {},
22
- } of codegen) {
18
+ for (const { schema, documents, config: customConfig = {} } of codegen) {
23
19
  await generateOperations({
24
20
  schema,
25
21
  documents,
@@ -42,7 +38,7 @@ export const createGenerateOperationsCommand = program =>
42
38
  .option(
43
39
  '-e, --extension <extension>',
44
40
  'Custom extension that generated files will have',
45
- '.generated.ts'
41
+ '.ts'
46
42
  )
47
43
  .option(
48
44
  '-s, --schema-name <name>',
@@ -6,7 +6,7 @@ import readConfig from '../read-config/index.js'
6
6
  const codegenGenerateSchema = async ({ projectId, config }) => {
7
7
  const codegen = await readConfig(config)
8
8
 
9
- for await (const { schema, documents, target } of codegen) {
9
+ for (const { schema, documents, target } of codegen) {
10
10
  await generateSchema({
11
11
  schema,
12
12
  documents,
@@ -3,6 +3,7 @@ import { generate } from '@graphql-codegen/cli'
3
3
  import fsExtra from 'fs-extra'
4
4
  import prettier from 'prettier'
5
5
  import { dirname } from 'path'
6
+ import castArray from 'lodash/castArray.js'
6
7
 
7
8
  import {
8
9
  commonOperationTypesConfig,
@@ -10,7 +11,7 @@ import {
10
11
  } from '../config/config.js'
11
12
  import getSchemaPath from '../services/get-schema-path.js'
12
13
  import getRelativeFilePath from '../utils/get-relative-file-path.js'
13
- import { plugin as fragmetImportResolverGraphQL } from '../extensions/fragment-import-resolver/graphql/index.js'
14
+ import { plugin as fragmentImportResolverGraphQL } from '../extensions/fragment-import-resolver/graphql/index.js'
14
15
 
15
16
  const { readFileSync, writeFileSync } = fsExtra
16
17
 
@@ -34,7 +35,7 @@ const generateOperations = async ({
34
35
  const isFragmentResolverExperimentEnabled =
35
36
  enabledExperiments.includes('fragment-resolver')
36
37
 
37
- const docsPath = getRelativeFilePath(documents)
38
+ const docsPath = castArray(documents).map(getRelativeFilePath)
38
39
 
39
40
  const { target, schemaPath, schemaPathResolution } = getSchemaPath(schema)
40
41
 
@@ -44,7 +45,7 @@ const generateOperations = async ({
44
45
  await generate(
45
46
  {
46
47
  documents: isFragmentResolverExperimentEnabled
47
- ? fragmetImportResolverGraphQL(docsPath)
48
+ ? docsPath.flatMap(fragmentImportResolverGraphQL)
48
49
  : docsPath,
49
50
  config: {
50
51
  ...commonOperationTypesConfig,
@@ -1,6 +1,6 @@
1
1
  import chalk from 'chalk'
2
2
  import { createRequire } from 'module'
3
- import toArray from 'lodash.castarray'
3
+ import toArray from 'lodash/castArray.js'
4
4
 
5
5
  import getRelativeFilePath from '../utils/get-relative-file-path.js'
6
6