Comparing version 0.0.4 to 0.0.5
@@ -14,11 +14,12 @@ "use strict"; | ||
const useConfig = require(configPath); | ||
const { gqlConstantModule, query, useQuery, useMutate, refetch, customGql } = useConfig; | ||
lib_1.generateGql(); | ||
const { gqlConstantModule, httpModule = 'stook-graphql', isGenerateGql, query, useQuery, useMutate, refetch, customGql, } = useConfig; | ||
if (isGenerateGql) | ||
lib_1.generateGql(); | ||
lib_1.generateCustomGql(customGql); | ||
lib_1.generateApi(gqlConstantModule, query); | ||
lib_1.generateHooks(gqlConstantModule, [...useQuery, ...useMutate]); | ||
lib_1.generateRefetcher(gqlConstantModule, refetch); | ||
lib_1.generateApi(httpModule, gqlConstantModule, query); | ||
lib_1.generateHooks(httpModule, gqlConstantModule, [...useQuery, ...useMutate]); | ||
lib_1.generateRefetcher(httpModule, gqlConstantModule, refetch); | ||
} | ||
catch (error) { | ||
this.log('config path invalid'); | ||
console.log('error:', error); | ||
} | ||
@@ -25,0 +26,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export declare function generateApi(gqlConstantModule: string, apiConfig: string[]): void; | ||
export declare function generateApi(httpModule: string, gqlConstantModule: string, apiConfig: string[]): void; |
@@ -11,3 +11,3 @@ "use strict"; | ||
const saveSourceFile_1 = tslib_1.__importDefault(require("../utils/saveSourceFile")); | ||
function generateApi(gqlConstantModule, apiConfig) { | ||
function generateApi(httpModule, gqlConstantModule, apiConfig) { | ||
const project = new ts_morph_1.Project(); | ||
@@ -98,3 +98,3 @@ const baseDirPath = process.cwd(); | ||
sourceFile.addImportDeclaration({ | ||
moduleSpecifier: '@common/taro-stook-graphql', | ||
moduleSpecifier: httpModule, | ||
namedImports: ['Options', 'query'], | ||
@@ -101,0 +101,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
export declare function generateHooks(gqlConstantModule: string, hooksConfig: string[]): void; | ||
export declare function generateHooks(httpModule: string, gqlConstantModule: string, hooksConfig: string[]): void; |
@@ -11,3 +11,3 @@ "use strict"; | ||
const saveSourceFile_1 = tslib_1.__importDefault(require("../utils/saveSourceFile")); | ||
function generateHooks(gqlConstantModule, hooksConfig) { | ||
function generateHooks(httpModule, gqlConstantModule, hooksConfig) { | ||
const project = new ts_morph_1.Project(); | ||
@@ -100,3 +100,3 @@ const baseDirPath = process.cwd(); | ||
sourceFile.addImportDeclaration({ | ||
moduleSpecifier: '@common/taro-stook-graphql', | ||
moduleSpecifier: httpModule, | ||
namedImports: ['Options', 'useQuery', 'useMutate'], | ||
@@ -103,0 +103,0 @@ }); |
@@ -8,2 +8,2 @@ /** | ||
*/ | ||
export declare function generateRefetcher(gqlConstantModule: string, refetchConfig: string[]): void; | ||
export declare function generateRefetcher(httpModule: string, gqlConstantModule: string, refetchConfig: string[]): void; |
@@ -18,3 +18,3 @@ "use strict"; | ||
*/ | ||
function generateRefetcher(gqlConstantModule, refetchConfig) { | ||
function generateRefetcher(httpModule, gqlConstantModule, refetchConfig) { | ||
const project = new ts_morph_1.Project(); | ||
@@ -127,3 +127,3 @@ const baseDirPath = process.cwd(); | ||
sourceFile.addImportDeclaration({ | ||
moduleSpecifier: '@common/taro-stook-graphql', | ||
moduleSpecifier: httpModule, | ||
namedImports: ['RefetchOptions', 'fetcher'], | ||
@@ -130,0 +130,0 @@ }); |
{ | ||
"name": "gqlgen", | ||
"description": "gqlgen", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"author": "forsigner", | ||
@@ -6,0 +6,0 @@ "bin": { |
@@ -22,3 +22,3 @@ gqlgen | ||
$ gqlgen (-v|--version|version) | ||
gqlgen/0.0.4 darwin-x64 node-v12.8.1 | ||
gqlgen/0.0.5 darwin-x64 node-v12.8.1 | ||
$ gqlgen --help [COMMAND] | ||
@@ -25,0 +25,0 @@ USAGE |
33554
771