gql-types-generator
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -43,3 +43,3 @@ #!/usr/bin/env node | ||
var fs_1 = require("./fs"); | ||
var dist_1 = require("../dist"); | ||
var fs_2 = require("./fs"); | ||
var program = new commander_1.Command('gql-types-generator'); | ||
@@ -59,22 +59,22 @@ function parsePlacement(value) { | ||
.requiredOption('--output-path <path>', 'path to file where typings will be saved') | ||
.requiredOption('--schema-artifacts <globs>', 'glob used to find schema artifacts. These artifacts will be concatenated into the only 1 file and parsed by graphql package') | ||
.parse(process.argv); | ||
(function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var source; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, fs_1.getFilePaths(program.schemaArtifacts)]; | ||
case 1: | ||
source = _a.sent(); | ||
return [4 /*yield*/, compile_1.compile({ | ||
outputPath: dist_1.withCwd(program.outputPath), | ||
source: source, | ||
sort: program.typesPlacement, | ||
})]; | ||
.arguments('<schema-globs>') | ||
.action(function (globs) { return __awaiter(void 0, void 0, void 0, function () { | ||
var _a, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
_a = compile_1.compile; | ||
_b = { | ||
outputPath: fs_2.withCwd(program.outputPath) | ||
}; | ||
return [4 /*yield*/, fs_1.withCwdAndGlob(globs)]; | ||
case 1: return [4 /*yield*/, _a.apply(void 0, [(_b.source = _c.sent(), | ||
_b.sort = program.sort, | ||
_b)])]; | ||
case 2: | ||
_a.sent(); | ||
process.exit(0); | ||
_c.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); })(); | ||
}); }) | ||
.parse(process.argv); |
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
export declare function getFilePaths(pattern: string): Promise<string[]>; | ||
export declare function withCwdAndGlob(pattern: string): Promise<string[]>; | ||
/** | ||
@@ -15,0 +15,0 @@ * Returns content of files found with passed glob |
@@ -68,3 +68,3 @@ "use strict"; | ||
*/ | ||
function getFilePaths(pattern) { | ||
function withCwdAndGlob(pattern) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -85,3 +85,3 @@ var patterns; | ||
} | ||
exports.getFilePaths = getFilePaths; | ||
exports.withCwdAndGlob = withCwdAndGlob; | ||
/** | ||
@@ -88,0 +88,0 @@ * Returns content of files found with passed glob |
{ | ||
"name": "gql-types-generator", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"main": "index.js", | ||
@@ -23,4 +23,4 @@ "types": "index.d.ts", | ||
"scripts": { | ||
"build": "rimraf dist && tsc -p tsconfig.build.json && node post-compile.js", | ||
"dev": "tsc -w --noEmit" | ||
"build": "rimraf dist && tsc -p tsconfig.json && node post-compile.js", | ||
"dev": "tsc -w" | ||
}, | ||
@@ -27,0 +27,0 @@ "dependencies": { |
@@ -15,3 +15,3 @@ gql-types-generator | ||
Package to generate types depending on GraphQL schema. | ||
Package to generate types depending on GraphQL scheme, mutations and queries. | ||
@@ -36,8 +36,8 @@ ## Install | ||
```bash | ||
Usage: gql-types-generator [options] | ||
Usage: gql-types-generator [options] <schema-globs> | ||
Options: | ||
-o --output-path <path> path to file where typings will be saved | ||
-s --schema-artifacts <globs> glob used to find schema artifacts. These artifacts will be concatenated into the only 1 file and parsed by graphql package | ||
-h, --help display help for command | ||
--sort <sort> how to display compiled types. Valid values are "as-is" and "default". By default, generator compiles scalars first, then enums, interfaces, inputs, unions and then types. "as-is" places types as they are placed in schema | ||
--output-path <path> path to file where typings will be saved | ||
-h, --help display help for command | ||
``` | ||
@@ -58,3 +58,4 @@ | ||
], | ||
outputPath: path.resolve(__dirname, 'types.d.ts'), | ||
outputPath: path.resolve(__dirname, 'types.d.ts'), | ||
sort: 'as-is', | ||
}); | ||
@@ -67,2 +68,3 @@ | ||
outputPath: path.resolve(__dirname, 'types.d.ts'), | ||
sort: 'default', | ||
}); | ||
@@ -69,0 +71,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76
33717