@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.
- package/bin/davinci-graphql-codegen.js +0 -23
- package/package.json +3 -3
- package/src/commands/generate-operations.js +2 -3
- package/src/commands/generate-schema.js +2 -3
- package/src/{shared-config/shared-config.js → config/config.js} +0 -0
- package/src/config/index.js +3 -0
- package/src/generate/operations.js +6 -3
- package/src/generate/schema.js +1 -1
- package/src/read-config/read-config.js +2 -2
- package/src/services/gs-schema-loader.js +2 -2
- package/src/services/schema-loader.js +2 -2
- package/src/{services → utils}/detect-schema-source.js +0 -0
- package/src/{services → utils}/get-relative-file-path.js +0 -0
- package/src/{services → utils}/parse-gs-uri.js +0 -0
- package/src/{services → utils}/process-args.js +1 -1
- package/src/{services → utils}/to-array.js +0 -0
- package/src/shared-config/index.js +0 -3
|
@@ -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.
|
|
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.
|
|
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": "
|
|
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('../
|
|
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
|
-
|
|
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('../
|
|
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
|
-
|
|
10
|
-
async function codegenGenerateSchema() {
|
|
9
|
+
const codegenGenerateSchema = async () => {
|
|
11
10
|
const codegen = await readConfig()
|
|
12
11
|
|
|
13
12
|
switch (operation) {
|
|
File without changes
|
|
@@ -3,8 +3,8 @@ const { generate } = require('@graphql-codegen/cli')
|
|
|
3
3
|
const {
|
|
4
4
|
commonOperationTypesConfig,
|
|
5
5
|
autoGenerationComments
|
|
6
|
-
} = require('../
|
|
7
|
-
const getRelativeFilePath = require('../
|
|
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
|
|
15
|
+
const schemaPath = schema
|
|
16
|
+
.split('/')
|
|
17
|
+
.slice(0, 2)
|
|
18
|
+
.join('/')
|
|
16
19
|
|
|
17
20
|
await generate(
|
|
18
21
|
{
|
package/src/generate/schema.js
CHANGED
|
@@ -4,7 +4,7 @@ const chalk = require('chalk')
|
|
|
4
4
|
const {
|
|
5
5
|
commonSchemaTypesConfig,
|
|
6
6
|
autoGenerationComments
|
|
7
|
-
} = require('../
|
|
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('../
|
|
4
|
-
const toArray = require('../
|
|
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('../
|
|
4
|
-
const parseGSURI = require('
|
|
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('
|
|
4
|
+
const getRelativeFilePath = require('../utils/get-relative-file-path')
|
|
5
5
|
const {
|
|
6
6
|
isSchemaFromBucket,
|
|
7
7
|
isLocalSchema,
|
|
8
8
|
isSchemaFromHttp
|
|
9
|
-
} = require('
|
|
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
|
|
File without changes
|
|
File without changes
|