@manuelp1345/graph-generator 1.2.9 → 1.2.11
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cli.js +6 -10
- package/package.json +1 -1
- package/src/cli.ts +8 -11
package/dist/cli.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
#!/usr/bin/env node
|
1
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -9,21 +10,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
10
|
};
|
10
11
|
import { exec } from "child_process";
|
11
12
|
import { promisify } from "util";
|
12
|
-
|
13
|
-
if (command === "codegen") {
|
14
|
-
runCodegen(); // Ejecuta la función de generación del esquema
|
15
|
-
}
|
16
|
-
else {
|
17
|
-
console.log("Comando desconocido");
|
18
|
-
}
|
13
|
+
// Promisify exec to use async/await
|
19
14
|
const execPromise = promisify(exec);
|
15
|
+
// Función para ejecutar el comando de generación de código
|
20
16
|
function runCodegen() {
|
21
17
|
return __awaiter(this, void 0, void 0, function* () {
|
22
18
|
try {
|
23
|
-
const { stdout, stderr } = yield execPromise("
|
24
|
-
console.log(stdout);
|
19
|
+
const { stdout, stderr } = yield execPromise("graphql-codegen --config dist/codegen.js");
|
20
|
+
console.log("stdout:", stdout);
|
25
21
|
if (stderr) {
|
26
|
-
console.error(stderr);
|
22
|
+
console.error("stderr:", stderr);
|
27
23
|
}
|
28
24
|
}
|
29
25
|
catch (error) {
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
@@ -1,24 +1,21 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
1
3
|
import { exec } from "child_process";
|
2
4
|
import { promisify } from "util";
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
if (command === "codegen") {
|
7
|
-
runCodegen(); // Ejecuta la función de generación del esquema
|
8
|
-
} else {
|
9
|
-
console.log("Comando desconocido");
|
10
|
-
}
|
11
|
-
|
6
|
+
// Promisify exec to use async/await
|
12
7
|
const execPromise = promisify(exec);
|
13
8
|
|
9
|
+
// Función para ejecutar el comando de generación de código
|
14
10
|
async function runCodegen() {
|
15
11
|
try {
|
16
12
|
const { stdout, stderr } = await execPromise(
|
17
|
-
"
|
13
|
+
"graphql-codegen --config dist/codegen.js"
|
18
14
|
);
|
19
|
-
|
15
|
+
|
16
|
+
console.log("stdout:", stdout);
|
20
17
|
if (stderr) {
|
21
|
-
console.error(stderr);
|
18
|
+
console.error("stderr:", stderr);
|
22
19
|
}
|
23
20
|
} catch (error) {
|
24
21
|
console.error("Error executing graphql-codegen:", error);
|