@manuelp1345/graph-generator 1.1.5 → 1.2.7
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/dist/cli.js +27 -0
- package/package.json +5 -2
- package/src/cli.ts +20 -0
package/dist/cli.js
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
9
|
+
};
|
10
|
+
import { exec } from "child_process";
|
11
|
+
import { promisify } from "util";
|
12
|
+
const execPromise = promisify(exec);
|
13
|
+
function runCodegen() {
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
15
|
+
try {
|
16
|
+
const { stdout, stderr } = yield execPromise("graphql-codegen --config src/codegen.ts");
|
17
|
+
console.log(stdout);
|
18
|
+
if (stderr) {
|
19
|
+
console.error(stderr);
|
20
|
+
}
|
21
|
+
}
|
22
|
+
catch (error) {
|
23
|
+
console.error("Error executing graphql-codegen:", error);
|
24
|
+
}
|
25
|
+
});
|
26
|
+
}
|
27
|
+
runCodegen();
|
package/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@manuelp1345/graph-generator",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.2.7",
|
4
4
|
"description": "generador de schema y types de graphql",
|
5
|
-
"main": "src/index.ts",
|
6
5
|
"scripts": {
|
7
6
|
"codegen": "graphql-codegen --config src/codegen.ts",
|
7
|
+
"start": "echo \"Error: no start specified\" && exit 1",
|
8
8
|
"build": "tsc",
|
9
9
|
"prepublishOnly": "npm run codegen && npm run build"
|
10
10
|
},
|
@@ -23,5 +23,8 @@
|
|
23
23
|
},
|
24
24
|
"devDependencies": {
|
25
25
|
"typescript": "^5.7.3"
|
26
|
+
},
|
27
|
+
"bin": {
|
28
|
+
"graph-generator": "dist/cli.js"
|
26
29
|
}
|
27
30
|
}
|
package/src/cli.ts
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
import { exec } from "child_process";
|
2
|
+
import { promisify } from "util";
|
3
|
+
|
4
|
+
const execPromise = promisify(exec);
|
5
|
+
|
6
|
+
async function runCodegen() {
|
7
|
+
try {
|
8
|
+
const { stdout, stderr } = await execPromise(
|
9
|
+
"graphql-codegen --config src/codegen.ts"
|
10
|
+
);
|
11
|
+
console.log(stdout);
|
12
|
+
if (stderr) {
|
13
|
+
console.error(stderr);
|
14
|
+
}
|
15
|
+
} catch (error) {
|
16
|
+
console.error("Error executing graphql-codegen:", error);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
runCodegen();
|