b-gsdk 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- package/.nvmrc +1 -0
- package/README.md +1 -0
- package/package.json +8 -4
- package/dist/bin.js +0 -27
- package/dist/util/format-error.js +0 -16
- package/dist/util/get-b-gsdk-directory-path.js +0 -17
package/.nvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
16
|
package/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# b-gsdk
|
package/package.json
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"name": "b-gsdk",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.7",
|
4
4
|
"description": "A GraphQL Codegen that outputs a TypeScript SDK.",
|
5
5
|
"author": "Julian Benegas",
|
6
6
|
"license": "MIT",
|
7
7
|
"main": "dist/index.js",
|
8
8
|
"bin": "dist/bin.js",
|
9
|
+
"scripts": {
|
10
|
+
"build": "tsc",
|
11
|
+
"prepublish": "yarn build"
|
12
|
+
},
|
9
13
|
"dependencies": {
|
10
14
|
"@graphql-codegen/cli": "^2.6.2",
|
11
15
|
"@graphql-codegen/introspection": "^2.1.0",
|
@@ -25,7 +29,7 @@
|
|
25
29
|
"ts-node": "^10.7.0",
|
26
30
|
"typescript": "^4.6.3"
|
27
31
|
},
|
28
|
-
"
|
29
|
-
"
|
32
|
+
"engines": {
|
33
|
+
"node": ">=16.0.0"
|
30
34
|
}
|
31
|
-
}
|
35
|
+
}
|
package/dist/bin.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
const _1 = require(".");
|
5
|
-
const format_error_1 = require("./util/format-error");
|
6
|
-
// Show usage and exit with code
|
7
|
-
function help(code) {
|
8
|
-
console.log(`Usage:
|
9
|
-
b-gsdk generate
|
10
|
-
`);
|
11
|
-
process.exit(code);
|
12
|
-
}
|
13
|
-
// Get CLI arguments
|
14
|
-
const [, , cmd] = process.argv;
|
15
|
-
// CLI commands
|
16
|
-
const cmds = {
|
17
|
-
generate: _1.main,
|
18
|
-
};
|
19
|
-
// Run CLI
|
20
|
-
try {
|
21
|
-
// Run command or show usage for unknown command
|
22
|
-
cmds[cmd] ? cmds[cmd]() : help(0);
|
23
|
-
}
|
24
|
-
catch (e) {
|
25
|
-
console.error((0, format_error_1.formatError)(e).message);
|
26
|
-
process.exit(1);
|
27
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.formatError = void 0;
|
4
|
-
const formatError = (error) => {
|
5
|
-
if (error instanceof Error) {
|
6
|
-
return error;
|
7
|
-
}
|
8
|
-
if (typeof error === "string") {
|
9
|
-
return new Error(error);
|
10
|
-
}
|
11
|
-
if (typeof error === "object") {
|
12
|
-
return new Error(JSON.stringify(error, null, 2));
|
13
|
-
}
|
14
|
-
return new Error(`Unknown error: ${error}`);
|
15
|
-
};
|
16
|
-
exports.formatError = formatError;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.getBGsdkDirectoryPath = void 0;
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
8
|
-
const path_1 = __importDefault(require("path"));
|
9
|
-
// taken from prisma https://github.com/prisma/prisma/blob/8f6b7c7c99c1c720cf5bfed5d563423e71c1b84f/packages/sdk/src/cli/getSchema.ts#L46-L49
|
10
|
-
const getBGsdkDirectoryPath = (cwd) => {
|
11
|
-
const schemaPath = path_1.default.join(cwd, "b-gsdk");
|
12
|
-
if (fs_1.default.existsSync(schemaPath)) {
|
13
|
-
return schemaPath;
|
14
|
-
}
|
15
|
-
return null;
|
16
|
-
};
|
17
|
-
exports.getBGsdkDirectoryPath = getBGsdkDirectoryPath;
|