@toptal/davinci-graphql-codegen 0.1.1-alpha-feature-comm-620-graphql-codegen.1441 → 0.1.1-alpha-feature-comm-620-graphql-codegen.1451

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.
@@ -9,26 +9,3 @@ cliEngine.loadCommands([
9
9
  codegenGenerateSchemaCreator,
10
10
  codegenGenerateOperationsCreator
11
11
  ])
12
-
13
- cliEngine.help(
14
- () => `
15
- Commands:
16
-
17
- help [command...] Provides help for a given command
18
- exit Exits application
19
- generate-operations generate graphql operation types based off generated schemas
20
- generate-schema generate graphql schemas
21
- `
22
- )
23
-
24
- const args = cliEngine.bootstrap({ use: 'minimist' })
25
-
26
- // eslint-disable-next-line @typescript-eslint/no-shadow
27
- cliEngine.catchErrorCommand((args, cb) => {
28
- cliEngine.execCommand(`${args.commands.join(' ')}`)
29
- cb()
30
- })
31
-
32
- if (args._ && args._.length) {
33
- cliEngine.execCommand(`${args._.join(' ')}`)
34
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-graphql-codegen",
3
- "version": "0.1.1-alpha-feature-comm-620-graphql-codegen.1441+6a5ae6bf",
3
+ "version": "0.1.1-alpha-feature-comm-620-graphql-codegen.1451+7ee636be",
4
4
  "description": "Codegen",
5
5
  "author": "Toptal",
6
6
  "license": "ISC",
@@ -28,9 +28,9 @@
28
28
  "@graphql-codegen/typescript-operations": "^2.1.4",
29
29
  "@graphql-codegen/typescript-resolvers": "^2.2.1",
30
30
  "@graphql-typed-document-node/core": "^3.1.0",
31
- "@toptal/davinci-cli-shared": "1.5.1-alpha-feature-comm-620-graphql-codegen.87+6a5ae6bf",
31
+ "@toptal/davinci-cli-shared": "1.5.1-alpha-feature-comm-620-graphql-codegen.91+7ee636be",
32
32
  "chalk": "^4.1.2",
33
33
  "graphql": "^15.7.1"
34
34
  },
35
- "gitHead": "6a5ae6bf6d03c85803bd8892e2ee922df3f4f337"
35
+ "gitHead": "7ee636beaeb668c3752550f0b808e026db7a4341"
36
36
  }
@@ -1,12 +1,11 @@
1
1
  const { generateOperations } = require('../generate')
2
2
  const readConfig = require('../read-config')
3
- const processArgs = require('../services/process-args')
3
+ const processArgs = require('../utils/process-args')
4
4
 
5
5
  const args = processArgs(process.argv.slice(2))
6
6
  const operation = args.operation
7
7
 
8
- // eslint-disable-next-line func-style
9
- async function codegenGenerateOperations() {
8
+ const codegenGenerateOperations = async () => {
10
9
  const codegen = await readConfig()
11
10
 
12
11
  switch (operation) {
@@ -1,13 +1,12 @@
1
1
  const { generateSchema } = require('../generate')
2
2
  const readConfig = require('../read-config')
3
- const processArgs = require('../services/process-args')
3
+ const processArgs = require('../utils/process-args')
4
4
 
5
5
  const args = processArgs(process.argv.slice(2))
6
6
  const operation = args.operation
7
7
  const projectId = args.projectId || 'toptal-hub'
8
8
 
9
- // eslint-disable-next-line func-style
10
- async function codegenGenerateSchema() {
9
+ const codegenGenerateSchema = async () => {
11
10
  const codegen = await readConfig()
12
11
 
13
12
  switch (operation) {
@@ -0,0 +1,3 @@
1
+ const config = require('./config')
2
+
3
+ module.exports = config
@@ -3,8 +3,8 @@ const { generate } = require('@graphql-codegen/cli')
3
3
  const {
4
4
  commonOperationTypesConfig,
5
5
  autoGenerationComments
6
- } = require('../shared-config/shared-config')
7
- const getRelativeFilePath = require('../services/get-relative-file-path')
6
+ } = require('../config/config')
7
+ const getRelativeFilePath = require('../utils/get-relative-file-path')
8
8
 
9
9
  const generateOperations = async ({ schema, documents }) => {
10
10
  const docsPath = getRelativeFilePath(documents)
@@ -12,7 +12,10 @@ const generateOperations = async ({ schema, documents }) => {
12
12
  // @toptal/modularity-template-graphql/talent -> talent
13
13
  const target = schema.split('/').pop()
14
14
  // @toptal/modularity-template-graphql/talent -> @toptal/modularity-template-graphql/talent
15
- const schemaPath = schema.split('/').slice(0, 2).join('/')
15
+ const schemaPath = schema
16
+ .split('/')
17
+ .slice(0, 2)
18
+ .join('/')
16
19
 
17
20
  await generate(
18
21
  {
@@ -4,7 +4,7 @@ const chalk = require('chalk')
4
4
  const {
5
5
  commonSchemaTypesConfig,
6
6
  autoGenerationComments
7
- } = require('../shared-config/shared-config')
7
+ } = require('../config/config')
8
8
  const schemaLoader = require('../services/schema-loader')
9
9
 
10
10
  const generateSchema = async ({ schema, target, projectId }) => {
@@ -1,7 +1,7 @@
1
1
  const chalk = require('chalk')
2
2
 
3
- const getRelativeFilePath = require('../services/get-relative-file-path')
4
- const toArray = require('../services/to-array')
3
+ const getRelativeFilePath = require('../utils/get-relative-file-path')
4
+ const toArray = require('../utils/to-array')
5
5
 
6
6
  const readConfig = async () => {
7
7
  console.log(`🔍 Searching for ${chalk.bold('codegen.json')} file`)
@@ -1,7 +1,7 @@
1
1
  const { Storage } = require('@google-cloud/storage')
2
2
 
3
- const getRelativeFilePath = require('../services/get-relative-file-path')
4
- const parseGSURI = require('./parse-gs-uri')
3
+ const getRelativeFilePath = require('../utils/get-relative-file-path')
4
+ const parseGSURI = require('../utils/parse-gs-uri')
5
5
 
6
6
  const gsSchemaLoader = async (projectId, source, destination) => {
7
7
  // Creates a Google Storage Client
@@ -1,12 +1,12 @@
1
1
  const { existsSync, copyFileSync } = require('fs')
2
2
 
3
3
  const gsSchemaLoader = require('./gs-schema-loader')
4
- const getRelativeFilePath = require('./get-relative-file-path')
4
+ const getRelativeFilePath = require('../utils/get-relative-file-path')
5
5
  const {
6
6
  isSchemaFromBucket,
7
7
  isLocalSchema,
8
8
  isSchemaFromHttp
9
- } = require('./detect-schema-source')
9
+ } = require('../utils/detect-schema-source')
10
10
 
11
11
  module.exports = async (schema, target, projectId) => {
12
12
  const schemaPath = isSchemaFromHttp(schema)
File without changes
File without changes
@@ -2,7 +2,7 @@ const processArgs = args => {
2
2
  const obj = {}
3
3
 
4
4
  args.forEach(arg => {
5
- if (arg.includes('generate:')) {
5
+ if (arg.includes('generate-')) {
6
6
  obj.operation = arg
7
7
 
8
8
  return
File without changes
@@ -1,3 +0,0 @@
1
- const sharedConfig = require('./shared-config')
2
-
3
- module.exports = sharedConfig