@toptal/davinci-graphql-codegen 0.4.3-alpha-fix-bundle-analyze-e1cf8407.5 → 0.4.3-alpha-feature-esm-migration-e551c09d.30

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,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
+ import cliEngine from '@toptal/davinci-cli-shared'
2
3
 
3
- const cliEngine = require('@toptal/davinci-cli-shared')
4
-
5
- const codegenGenerateSchemaCreator = require('../src/commands/generate-schema')
6
- const codegenGenerateOperationsCreator = require('../src/commands/generate-operations')
4
+ import codegenGenerateSchemaCreator from '../src/commands/generate-schema.js'
5
+ import codegenGenerateOperationsCreator from '../src/commands/generate-operations.js'
7
6
 
8
7
  cliEngine.loadCommands(
9
8
  [codegenGenerateSchemaCreator, codegenGenerateOperationsCreator],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-graphql-codegen",
3
- "version": "0.4.3-alpha-fix-bundle-analyze-e1cf8407.5+e1cf8407",
3
+ "version": "0.4.3-alpha-feature-esm-migration-e551c09d.30+e551c09d",
4
4
  "description": "Codegen",
5
5
  "author": "Toptal",
6
6
  "license": "ISC",
@@ -11,14 +11,15 @@
11
11
  "bin": {
12
12
  "davinci-graphql-codegen": "./bin/davinci-graphql-codegen.js"
13
13
  },
14
- "main": "src/index.js",
14
+ "type": "module",
15
+ "exports": "./index.js",
15
16
  "files": [
16
17
  "src",
17
18
  "bin",
18
19
  "CHANGELOG.md"
19
20
  ],
20
21
  "scripts": {
21
- "test": "echo \"Error: no test specified\" && exit 1"
22
+ "test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' yarn jest"
22
23
  },
23
24
  "sideEffects": false,
24
25
  "dependencies": {
@@ -32,16 +33,19 @@
32
33
  "@graphql-codegen/typescript-operations": "^2.3.5",
33
34
  "@graphql-codegen/typescript-resolvers": "^2.2.1",
34
35
  "@graphql-typed-document-node/core": "^3.1.0",
35
- "@toptal/davinci-cli-shared": "1.10.3-alpha-fix-bundle-analyze-e1cf8407.5+e1cf8407",
36
- "@toptal/davinci-monorepo": "6.8.9-alpha-fix-bundle-analyze-e1cf8407.5+e1cf8407",
36
+ "@toptal/davinci-cli-shared": "1.10.3-alpha-feature-esm-migration-e551c09d.30+e551c09d",
37
+ "@toptal/davinci-monorepo": "6.8.9-alpha-feature-esm-migration-e551c09d.30+e551c09d",
37
38
  "chalk": "^4.1.2",
38
39
  "deepmerge": "^4.2.2",
39
40
  "fs-extra": "^10.1.0",
40
- "graphql": "^15.7.1",
41
- "prettier": "^2.6.2"
41
+ "graphql": "^15.7.1"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "prettier": "^2.6.2"
45
45
  },
46
- "gitHead": "e1cf84072ed2102a43bc67c5c725e5c45ff6a36e"
46
+ "devDependencies": {
47
+ "@jest/globals": "^29.3.1",
48
+ "prettier": "^2.6.2"
49
+ },
50
+ "gitHead": "e551c09d98a4e340ab16afb27a42fe52a8548d00"
47
51
  }
@@ -1,7 +1,7 @@
1
- const chalk = require('chalk')
1
+ import chalk from 'chalk'
2
2
 
3
- const { generateOperations } = require('../generate')
4
- const readConfig = require('../read-config')
3
+ import { generateOperations } from '../generate/index.js'
4
+ import readConfig from '../read-config/index.js'
5
5
 
6
6
  const codegenGenerateOperations = async ({ config, extension = '.ts' }) => {
7
7
  const codegen = await readConfig(config)
@@ -40,4 +40,4 @@ const codegenGenerateOperationsCreator = {
40
40
  },
41
41
  }
42
42
 
43
- module.exports = codegenGenerateOperationsCreator
43
+ export default codegenGenerateOperationsCreator
@@ -1,7 +1,7 @@
1
- const chalk = require('chalk')
1
+ import chalk from 'chalk'
2
2
 
3
- const { generateSchema } = require('../generate')
4
- const readConfig = require('../read-config')
3
+ import { generateSchema } from '../generate/index.js'
4
+ import readConfig from '../read-config/index.js'
5
5
 
6
6
  const codegenGenerateSchema = async ({ projectId = 'toptal-hub', config }) => {
7
7
  const codegen = await readConfig(config)
@@ -36,4 +36,4 @@ const codegenGenerateSchemaCreator = {
36
36
  },
37
37
  }
38
38
 
39
- module.exports = codegenGenerateSchemaCreator
39
+ export default codegenGenerateSchemaCreator
@@ -23,7 +23,7 @@ const commonTypesConfig = {
23
23
  },
24
24
  }
25
25
 
26
- const commonSchemaTypesConfig = {
26
+ export const commonSchemaTypesConfig = {
27
27
  ...commonTypesConfig,
28
28
  resolverTypeWrapperSignature:
29
29
  '(parent: unknown, args: any) => ({ [K in keyof Partial<T>]: TypeOrMockList<T[K]> }) | null',
@@ -33,17 +33,17 @@ const commonSchemaTypesConfig = {
33
33
  optionalResolveType: true,
34
34
  }
35
35
 
36
- const commonOperationTypesConfig = {
36
+ export const commonOperationTypesConfig = {
37
37
  ...commonTypesConfig,
38
38
  dedupeFragments: true,
39
39
  }
40
40
 
41
- const autoGenerationComments = [
41
+ export const autoGenerationComments = [
42
42
  '/* eslint-disable */',
43
43
  '/* ⚠️ THIS IS AN AUTOGENERATED FILE, DO NOT EDIT ⚠️ */',
44
44
  ]
45
45
 
46
- module.exports = {
46
+ export default {
47
47
  commonOperationTypesConfig,
48
48
  commonSchemaTypesConfig,
49
49
  autoGenerationComments,
@@ -1,3 +1,3 @@
1
- const config = require('./config')
1
+ import config from './config.js'
2
2
 
3
- module.exports = config
3
+ export default config
@@ -1,4 +1,5 @@
1
- const generateOperations = require('./operations')
2
- const generateSchema = require('./schema')
1
+ import generateOperations from './operations.js'
2
+ import generateSchema from './schema.js'
3
3
 
4
- module.exports = { generateOperations, generateSchema }
4
+ export { generateOperations, generateSchema }
5
+ export default { generateOperations, generateSchema }
@@ -1,16 +1,18 @@
1
- const chalk = require('chalk')
2
- const { generate } = require('@graphql-codegen/cli')
3
- const { readFileSync, writeFileSync } = require('fs-extra')
4
- const prettier = require('prettier')
5
- const { dirname } = require('path')
6
- const merge = require('deepmerge')
1
+ import chalk from 'chalk'
2
+ import { generate } from '@graphql-codegen/cli'
3
+ import fs from 'fs-extra'
4
+ import prettier from 'prettier'
5
+ import { dirname } from 'path'
6
+ import merge from 'deepmerge'
7
7
 
8
- const {
8
+ import {
9
9
  commonOperationTypesConfig,
10
10
  autoGenerationComments,
11
- } = require('../config/config')
12
- const getSchemaPath = require('../services/get-schema-path')
13
- const getRelativeFilePath = require('../utils/get-relative-file-path')
11
+ } from '../config/config.js'
12
+ import getSchemaPath from '../services/get-schema-path.js'
13
+ import getRelativeFilePath from '../utils/get-relative-file-path.js'
14
+
15
+ const { readFileSync, writeFileSync } = fs
14
16
 
15
17
  const generateOperations = async ({ schema, documents, extension, config }) => {
16
18
  const docsPath = getRelativeFilePath(documents)
@@ -65,4 +67,4 @@ const generateOperations = async ({ schema, documents, extension, config }) => {
65
67
  )
66
68
  }
67
69
 
68
- module.exports = generateOperations
70
+ export default generateOperations
@@ -1,15 +1,18 @@
1
- const { generate } = require('@graphql-codegen/cli')
2
- const chalk = require('chalk')
3
- const { readFileSync, writeFileSync } = require('fs')
4
- const prettier = require('prettier')
5
- const { dirname } = require('path')
1
+ import { generate } from '@graphql-codegen/cli'
2
+ import chalk from 'chalk'
3
+ import { createRequire } from 'module'
4
+ import { readFileSync, writeFileSync } from 'fs'
5
+ import prettier from 'prettier'
6
+ import { dirname } from 'path'
6
7
 
7
- const {
8
+ import {
8
9
  commonSchemaTypesConfig,
9
10
  autoGenerationComments,
10
- } = require('../config/config')
11
- const schemaLoader = require('../services/schema-loader')
12
- const { isSchemaFromHttp } = require('../utils/detect-schema-source')
11
+ } from '../config/config.js'
12
+ import schemaLoader from '../services/schema-loader.js'
13
+ import { isSchemaFromHttp } from '../utils/detect-schema-source.js'
14
+
15
+ const localRequire = createRequire(import.meta.url)
13
16
 
14
17
  const generateSchema = async ({ schema, target, projectId }) => {
15
18
  const { schema: schemaPath, destination: destinationPathTs } =
@@ -27,7 +30,7 @@ const generateSchema = async ({ schema, target, projectId }) => {
27
30
  [destinationPathTs]: {
28
31
  schema: isSchemaFromHttp(schema)
29
32
  ? schema
30
- : require.resolve(schemaPath),
33
+ : localRequire.resolve(schemaPath),
31
34
  plugins: [
32
35
  'typescript',
33
36
  'typescript-resolvers',
@@ -64,4 +67,4 @@ const generateSchema = async ({ schema, target, projectId }) => {
64
67
  )
65
68
  }
66
69
 
67
- module.exports = generateSchema
70
+ export default generateSchema
package/src/index.js CHANGED
@@ -1,8 +1,8 @@
1
- const codegenGenerateSchemaCreator = require('./commands/generate-schema')
2
- const codegenGenerateOperationsCreator = require('./commands/generate-operations')
3
- const config = require('./config')
1
+ import codegenGenerateSchemaCreator from './commands/generate-schema.js'
2
+ import codegenGenerateOperationsCreator from './commands/generate-operations.js'
3
+ import config from './config'
4
4
 
5
- module.exports = {
5
+ export default {
6
6
  commands: [codegenGenerateSchemaCreator, codegenGenerateOperationsCreator],
7
7
  config,
8
8
  }
@@ -1,3 +1,3 @@
1
- const readConfig = require('./read-config')
1
+ import readConfig from './read-config.js'
2
2
 
3
- module.exports = readConfig
3
+ export default readConfig
@@ -1,13 +1,32 @@
1
- const chalk = require('chalk')
1
+ import chalk from 'chalk'
2
+ import { createRequire } from 'module'
2
3
 
3
- const getRelativeFilePath = require('../utils/get-relative-file-path')
4
- const toArray = require('../utils/to-array')
4
+ import getRelativeFilePath from '../utils/get-relative-file-path.js'
5
+ import toArray from '../utils/to-array.js'
5
6
 
6
- const readConfig = async config => {
7
- let codegenPath
7
+ const importCodgenConfig = async path => {
8
+ try {
9
+ const localRequire = createRequire(import.meta.url)
10
+
11
+ return localRequire(path)
12
+ } catch (err) {
13
+ if (err.code === 'ERR_REQUIRE_ESM') {
14
+ const result = await import(path)
15
+
16
+ if (!result.default) {
17
+ throw Error('codegen has no default export')
18
+ }
19
+
20
+ return result.default
21
+ }
22
+ }
23
+ }
8
24
 
25
+ const readConfig = async config => {
9
26
  const configFileName = config ? config.split('/').pop() : 'codegen.json'
10
27
 
28
+ let codegenPath
29
+
11
30
  if (config) {
12
31
  console.log(
13
32
  `🔍 Searching for ${chalk.bold(
@@ -19,15 +38,13 @@ const readConfig = async config => {
19
38
  console.log(`🔍 Searching for ${chalk.bold(configFileName)} file`)
20
39
  codegenPath = getRelativeFilePath(configFileName)
21
40
  }
22
- let codegenConfig
23
41
 
24
42
  try {
25
- codegenConfig = require(codegenPath)
43
+ return toArray(await importCodgenConfig(codegenPath))
26
44
  } catch (error) {
45
+ console.log(error)
27
46
  throw new Error(`❌ There is no ${chalk.bold(configFileName)} file`)
28
47
  }
29
-
30
- return toArray(codegenConfig)
31
48
  }
32
49
 
33
- module.exports = readConfig
50
+ export default readConfig
@@ -1,11 +1,15 @@
1
- const getRelativeFilePath = require('../utils/get-relative-file-path')
1
+ import getRelativeFilePath from '../utils/get-relative-file-path.js'
2
2
 
3
- const getMonolithSchemaPath = schemaPath => {
4
- const schemaPathResolution = getRelativeFilePath(
5
- `${schemaPath}/schema.graphql`
6
- )
3
+ export const createGetMonolithSchemaPathResolver =
4
+ relativeFilePathResolver => schemaPath => {
5
+ const schemaPathResolution = relativeFilePathResolver(
6
+ `${schemaPath}/schema.graphql`
7
+ )
7
8
 
8
- return { target: schemaPath, schemaPath, schemaPathResolution }
9
- }
9
+ return { target: schemaPath, schemaPath, schemaPathResolution }
10
+ }
10
11
 
11
- module.exports = getMonolithSchemaPath
12
+ const getMonolithSchemaPath =
13
+ createGetMonolithSchemaPathResolver(getRelativeFilePath)
14
+
15
+ export default getMonolithSchemaPath
@@ -0,0 +1,22 @@
1
+ import { jest } from '@jest/globals'
2
+
3
+ import { createGetMonolithSchemaPathResolver } from './get-monolith-schema-path'
4
+
5
+ const schemaPathResolution =
6
+ 'home/users/alexvcasillas/toptal/screening-wizard/src/modules/graphql/schema.graphql'
7
+ const getRelativeFilePathMock = jest.fn(() => schemaPathResolution)
8
+ const getMonolithSchemaPath = createGetMonolithSchemaPathResolver(
9
+ getRelativeFilePathMock
10
+ )
11
+
12
+ describe('getMonolithSchemaPath', () => {
13
+ it('returns target, schemaPath and schemaPathResolution', () => {
14
+ const schemaPath = 'src/modules/graphql'
15
+
16
+ expect(getMonolithSchemaPath(schemaPath)).toEqual({
17
+ target: schemaPath,
18
+ schemaPath,
19
+ schemaPathResolution,
20
+ })
21
+ })
22
+ })
@@ -1,14 +1,22 @@
1
- const getMonorepoSchemaPath = schema => {
1
+ import { createRequire } from 'module'
2
+
3
+ const localRequire = createRequire(import.meta.url)
4
+
5
+ export const createGetMonorepoSchemaPathResolver = pathResolver => schema => {
2
6
  // @toptal/modularity-template-graphql/talent -> talent
3
7
  const target = schema.split('/').pop()
4
8
  // @toptal/modularity-template-graphql/talent -> @toptal/modularity-template-graphql
5
9
  const schemaPath = schema.split('/').slice(0, 2).join('/')
6
10
 
7
- const schemaPathResolution = require.resolve(
11
+ const schemaPathResolution = pathResolver(
8
12
  `${schemaPath}/${target}/schema.graphql`
9
13
  )
10
14
 
11
15
  return { target, schemaPath, schemaPathResolution }
12
16
  }
13
17
 
14
- module.exports = getMonorepoSchemaPath
18
+ const getMonorepoSchemaPath = createGetMonorepoSchemaPathResolver(
19
+ localRequire.resolve
20
+ )
21
+
22
+ export default getMonorepoSchemaPath
@@ -0,0 +1,22 @@
1
+ import { jest } from '@jest/globals'
2
+
3
+ import { createGetMonorepoSchemaPathResolver } from './get-monorepo-schema-path'
4
+
5
+ const pathResolverMock = jest.fn(
6
+ () => 'home/users/johndoe/toptal/libs/graphql/schema.graphql'
7
+ )
8
+ const getMonorepoSchemaPath =
9
+ createGetMonorepoSchemaPathResolver(pathResolverMock)
10
+
11
+ describe('getMonorepoSchemaPath', () => {
12
+ it('returns target, schemaPath and schemaPathResolution', () => {
13
+ const schemaPath = '@toptal/modularity-template-graphql/talent'
14
+
15
+ expect(getMonorepoSchemaPath(schemaPath)).toEqual({
16
+ target: 'talent',
17
+ schemaPath: '@toptal/modularity-template-graphql',
18
+ schemaPathResolution:
19
+ 'home/users/johndoe/toptal/libs/graphql/schema.graphql',
20
+ })
21
+ })
22
+ })
@@ -1,14 +1,16 @@
1
- const {
2
- utils: { checkIfMonorepo },
3
- } = require('@toptal/davinci-monorepo')
1
+ import monorepo from '@toptal/davinci-monorepo'
4
2
 
5
- const getMonorepoSchemaPath = require('./get-monorepo-schema-path')
6
- const getMonolithSchemaPath = require('./get-monolith-schema-path')
3
+ import getMonorepoSchemaPath from './get-monorepo-schema-path.js'
4
+ import getMonolithSchemaPath from './get-monolith-schema-path.js'
5
+
6
+ const { checkIfMonorepo } = monorepo.utils
7
7
 
8
8
  const getSchemaPath = schema => {
9
- return checkIfMonorepo({ considerYarnWorkspaces: true })
10
- ? getMonorepoSchemaPath(schema)
11
- : getMonolithSchemaPath(schema)
9
+ if (checkIfMonorepo({ considerYarnWorkspaces: true })) {
10
+ return getMonorepoSchemaPath(schema)
11
+ }
12
+
13
+ return getMonolithSchemaPath(schema)
12
14
  }
13
15
 
14
- module.exports = getSchemaPath
16
+ export default getSchemaPath
@@ -1,7 +1,7 @@
1
- const { Storage } = require('@google-cloud/storage')
1
+ import { Storage } from '@google-cloud/storage'
2
2
 
3
- const getRelativeFilePath = require('../utils/get-relative-file-path')
4
- const parseGSURI = require('../utils/parse-gs-uri')
3
+ import getRelativeFilePath from '../utils/get-relative-file-path.js'
4
+ import parseGSURI from '../utils/parse-gs-uri.js'
5
5
 
6
6
  const gsSchemaLoader = async (projectId, source, destination) => {
7
7
  // Creates a Google Storage Client
@@ -17,4 +17,4 @@ const gsSchemaLoader = async (projectId, source, destination) => {
17
17
  })
18
18
  }
19
19
 
20
- module.exports = gsSchemaLoader
20
+ export default gsSchemaLoader
@@ -1,15 +1,15 @@
1
- const chalk = require('chalk')
2
- const { existsSync, copyFileSync, mkdirSync } = require('fs')
1
+ import chalk from 'chalk'
2
+ import { existsSync, copyFileSync, mkdirSync } from 'fs'
3
3
 
4
- const gsSchemaLoader = require('./gs-schema-loader')
5
- const getRelativeFilePath = require('../utils/get-relative-file-path')
6
- const {
4
+ import gsSchemaLoader from './gs-schema-loader.js'
5
+ import getRelativeFilePath from '../utils/get-relative-file-path.js'
6
+ import {
7
7
  isSchemaFromBucket,
8
8
  isLocalSchema,
9
9
  isSchemaFromHttp,
10
- } = require('../utils/detect-schema-source')
10
+ } from '../utils/detect-schema-source.js'
11
11
 
12
- module.exports = async (schema, target, projectId) => {
12
+ export default async (schema, target, projectId) => {
13
13
  if (!existsSync(target)) {
14
14
  console.log("📁 Destination target doesn't exist, creating one for you...")
15
15
  mkdirSync(target)
@@ -1,16 +1,16 @@
1
- const isSchemaFromBucket = schema => {
1
+ export const isSchemaFromBucket = schema => {
2
2
  return schema.startsWith('gs://')
3
3
  }
4
4
 
5
- const isSchemaFromHttp = schema => {
5
+ export const isSchemaFromHttp = schema => {
6
6
  return schema.startsWith('https://')
7
7
  }
8
8
 
9
- const isLocalSchema = schema => {
9
+ export const isLocalSchema = schema => {
10
10
  return !isSchemaFromBucket(schema) && !isSchemaFromHttp(schema)
11
11
  }
12
12
 
13
- module.exports = {
13
+ export default {
14
14
  isSchemaFromBucket,
15
15
  isSchemaFromHttp,
16
16
  isLocalSchema,
@@ -1,8 +1,8 @@
1
- const {
1
+ import {
2
2
  isSchemaFromBucket,
3
3
  isSchemaFromHttp,
4
4
  isLocalSchema,
5
- } = require('./detect-schema-source')
5
+ } from './detect-schema-source.js'
6
6
 
7
7
  const gsBucketSchema = 'gs://toptal.net/gateway/graphql/talent'
8
8
  const httpSchema = 'https://toptal.net/gateway/graphql/talent'
@@ -2,4 +2,4 @@ const getRelativeFilePath = file => {
2
2
  return `${process.cwd()}/${file}`
3
3
  }
4
4
 
5
- module.exports = getRelativeFilePath
5
+ export default getRelativeFilePath
@@ -13,4 +13,4 @@ const parseGSURI = source => {
13
13
  }
14
14
  }
15
15
 
16
- module.exports = parseGSURI
16
+ export default parseGSURI
@@ -1,4 +1,4 @@
1
- const parseGSURI = require('./parse-gs-uri')
1
+ import parseGSURI from './parse-gs-uri.js'
2
2
 
3
3
  const bucketURI = 'gs://gqlgw-introspection/staging_talent_schema.graphql'
4
4
 
@@ -19,4 +19,4 @@ const processArgs = args => {
19
19
  return obj
20
20
  }
21
21
 
22
- module.exports = processArgs
22
+ export default processArgs
@@ -1,4 +1,4 @@
1
- const processArgs = require('./process-args')
1
+ import processArgs from './process-args.js'
2
2
 
3
3
  describe('Argument processor', () => {
4
4
  it('process arguments correctly', () => {
@@ -6,4 +6,4 @@ const toArray = value => {
6
6
  return [value]
7
7
  }
8
8
 
9
- module.exports = toArray
9
+ export default toArray
@@ -1,4 +1,4 @@
1
- const toArray = require('./to-array')
1
+ import toArray from './to-array.js'
2
2
 
3
3
  describe('toArray', () => {
4
4
  it("converts a value into an array if it's not one", () => {
@@ -1,71 +0,0 @@
1
- jest.mock('@toptal/davinci-monorepo', () => ({
2
- commands: [],
3
- utils: { checkIfMonorepo: jest.fn() },
4
- }))
5
-
6
- jest.mock('./get-monorepo-schema-path', () =>
7
- jest.fn(() => ({
8
- target: 'talent',
9
- schemaPath: '@toptal/modularity-template-graphql',
10
- schemaPathResolution:
11
- 'home/users/alexvcasillas/toptal/libs/graphql/schema.graphql',
12
- }))
13
- )
14
-
15
- jest.mock('./get-monolith-schema-path', () =>
16
- jest.fn(() => ({
17
- target: 'src/modules/graphql',
18
- schemaPath: 'src/modules/graphql',
19
- schemaPathResolution:
20
- 'home/users/alexvcasillas/toptal/screening-wizard/src/modules/graphql/schema.graphql',
21
- }))
22
- )
23
-
24
- const {
25
- utils: { checkIfMonorepo },
26
- } = require('@toptal/davinci-monorepo')
27
-
28
- const getSchemaPath = require('./get-schema-path')
29
-
30
- const monorepoSchema = '@toptal/modularity-template-graphql/talent'
31
- const monolithSchema = 'src/modules/graphql'
32
-
33
- describe('getSchemaPath', () => {
34
- beforeEach(() => {
35
- checkIfMonorepo.mockReset()
36
- })
37
-
38
- it('returns target, schemaPath and schemaPathResolution for monorepo', () => {
39
- checkIfMonorepo.mockReturnValue(() => true)
40
-
41
- const { target, schemaPath, schemaPathResolution } =
42
- getSchemaPath(monorepoSchema)
43
-
44
- expect(checkIfMonorepo).toHaveBeenCalledTimes(1)
45
- expect(checkIfMonorepo).toHaveBeenCalledWith({
46
- considerYarnWorkspaces: true,
47
- })
48
- expect(target).toBe('talent')
49
- expect(schemaPath).toBe('@toptal/modularity-template-graphql')
50
- expect(schemaPathResolution).toBe(
51
- 'home/users/alexvcasillas/toptal/libs/graphql/schema.graphql'
52
- )
53
- })
54
-
55
- it('returns target, schemaPath and schemaPathResolution for monolith', () => {
56
- checkIfMonorepo.mockReturnValue(false)
57
-
58
- const { target, schemaPath, schemaPathResolution } =
59
- getSchemaPath(monolithSchema)
60
-
61
- expect(checkIfMonorepo).toHaveBeenCalledTimes(1)
62
- expect(checkIfMonorepo).toHaveBeenCalledWith({
63
- considerYarnWorkspaces: true,
64
- })
65
- expect(target).toBe('src/modules/graphql')
66
- expect(schemaPath).toBe('src/modules/graphql')
67
- expect(schemaPathResolution).toBe(
68
- 'home/users/alexvcasillas/toptal/screening-wizard/src/modules/graphql/schema.graphql'
69
- )
70
- })
71
- })