@manuelp1345/graph-generator 1.2.10 → 1.2.12
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 +6 -10
- package/package.json +2 -2
- package/src/cli.ts +8 -11
package/dist/cli.js
CHANGED
@@ -10,21 +10,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
import { exec } from "child_process";
|
12
12
|
import { promisify } from "util";
|
13
|
-
|
14
|
-
|
15
|
-
runCodegen(); // Ejecuta la función de generación del esquema
|
16
|
-
}
|
17
|
-
else {
|
18
|
-
console.log("Comando desconocido");
|
19
|
-
}
|
13
|
+
import path from "path";
|
14
|
+
// Promisify exec to use async/await
|
20
15
|
const execPromise = promisify(exec);
|
16
|
+
// Función para ejecutar el comando de generación de código
|
21
17
|
function runCodegen() {
|
22
18
|
return __awaiter(this, void 0, void 0, function* () {
|
23
19
|
try {
|
24
|
-
const { stdout, stderr } = yield execPromise(
|
25
|
-
console.log(stdout);
|
20
|
+
const { stdout, stderr } = yield execPromise(`graphql-codegen --config ${path.join(__dirname, "../dist/codegen.js")} `);
|
21
|
+
console.log("stdout:", stdout);
|
26
22
|
if (stderr) {
|
27
|
-
console.error(stderr);
|
23
|
+
console.error("stderr:", stderr);
|
28
24
|
}
|
29
25
|
}
|
30
26
|
catch (error) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@manuelp1345/graph-generator",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.12",
|
4
4
|
"description": "generador de schema y types de graphql",
|
5
5
|
"scripts": {
|
6
6
|
"codegen": "graphql-codegen --config src/codegen.ts",
|
@@ -8,7 +8,7 @@
|
|
8
8
|
"build": "tsc",
|
9
9
|
"prepublishOnly": "npm run codegen && npm run build"
|
10
10
|
},
|
11
|
-
"main": "
|
11
|
+
"main": "src/index.ts",
|
12
12
|
"type": "module",
|
13
13
|
"keywords": [],
|
14
14
|
"author": "manuelDev",
|
package/src/cli.ts
CHANGED
@@ -1,25 +1,22 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
+
|
2
3
|
import { exec } from "child_process";
|
3
4
|
import { promisify } from "util";
|
5
|
+
import path from "path";
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
if (command === "codegen") {
|
8
|
-
runCodegen(); // Ejecuta la función de generación del esquema
|
9
|
-
} else {
|
10
|
-
console.log("Comando desconocido");
|
11
|
-
}
|
12
|
-
|
7
|
+
// Promisify exec to use async/await
|
13
8
|
const execPromise = promisify(exec);
|
14
9
|
|
10
|
+
// Función para ejecutar el comando de generación de código
|
15
11
|
async function runCodegen() {
|
16
12
|
try {
|
17
13
|
const { stdout, stderr } = await execPromise(
|
18
|
-
|
14
|
+
`graphql-codegen --config ${path.join(__dirname, "../dist/codegen.js")} `
|
19
15
|
);
|
20
|
-
|
16
|
+
|
17
|
+
console.log("stdout:", stdout);
|
21
18
|
if (stderr) {
|
22
|
-
console.error(stderr);
|
19
|
+
console.error("stderr:", stderr);
|
23
20
|
}
|
24
21
|
} catch (error) {
|
25
22
|
console.error("Error executing graphql-codegen:", error);
|