@trackunit/react-graphql-tools 0.0.64 → 0.0.65
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/CHANGELOG.md +2 -0
- package/generators.json +9 -0
- package/package.json +2 -1
- package/src/generators/add-grapqhl/files/root/graphql.config.json.template +3 -0
- package/src/generators/add-grapqhl/files/subDirectory/codegen.ts.template +7 -0
- package/src/generators/add-grapqhl/generator.js +39 -0
- package/src/generators/add-grapqhl/generator.js.map +1 -0
- package/src/generators/add-grapqhl/schema.d.ts +3 -0
- package/src/generators/add-grapqhl/schema.json +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.0.65](https://github.com/Trackunit/manager/compare/react-graphql-tools/0.0.64...react-graphql-tools/0.0.65) (2024-01-19)
|
|
6
|
+
|
|
5
7
|
## [0.0.64](https://github.com/Trackunit/manager/compare/react-graphql-tools/0.0.63...react-graphql-tools/0.0.64) (2024-01-17)
|
|
6
8
|
|
|
7
9
|
### Dependency Updates
|
package/generators.json
ADDED
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-graphql-tools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.65",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"executors": "./executors.json",
|
|
6
|
+
"generators": "./generators.json",
|
|
6
7
|
"repository": "https://github.com/Trackunit/manager",
|
|
7
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
8
9
|
"engines": {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addGrapqhlGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/* eslint-disable no-console */
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const path = tslib_1.__importStar(require("path"));
|
|
8
|
+
/**
|
|
9
|
+
* Setting up Graphql tools for Iris App development
|
|
10
|
+
*/
|
|
11
|
+
function addGrapqhlGenerator(tree, options) {
|
|
12
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
const workspaceRoot = "";
|
|
14
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
15
|
+
const libraryRoot = projectConfig.root;
|
|
16
|
+
if (!tree.exists("graphql.config.json")) {
|
|
17
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, "files", "root"), workspaceRoot, options);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
console.log(`"graphql.config.json" already exist in your workspace root. \nPlease ensure that your "graphql.config.json" contains "schema": "https://iris.trackunit.com/api/graphql/".`);
|
|
21
|
+
}
|
|
22
|
+
if (!tree.exists(`${libraryRoot}/codegen.ts`)) {
|
|
23
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, "files", "subDirectory"), libraryRoot, options);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
console.log(`codegen.ts already exists in ${libraryRoot}`);
|
|
27
|
+
}
|
|
28
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(libraryRoot, "project.json"), projectJSON => {
|
|
29
|
+
projectJSON.targets = Object.assign(Object.assign({}, projectJSON.targets), { "graphql-hooks": {
|
|
30
|
+
executor: "@trackunit/react-graphql-tools:createHooks",
|
|
31
|
+
} });
|
|
32
|
+
return projectJSON;
|
|
33
|
+
});
|
|
34
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.addGrapqhlGenerator = addGrapqhlGenerator;
|
|
38
|
+
exports.default = addGrapqhlGenerator;
|
|
39
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../libs/react/graphql-tools/src/generators/add-grapqhl/generator.ts"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,uCAAuH;AACvH,mDAA6B;AAG7B;;GAEG;AACH,SAAsB,mBAAmB,CAAC,IAAU,EAAE,OAAkC;;QACtF,MAAM,aAAa,GAAG,EAAE,CAAC;QACzB,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACtE,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE;YACvC,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;SACpF;aAAM;YACL,OAAO,CAAC,GAAG,CACT,2KAA2K,CAC5K,CAAC;SACH;QAED,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,WAAW,aAAa,CAAC,EAAE;YAC7C,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;SAC1F;aAAM;YACL,OAAO,CAAC,GAAG,CAAC,gCAAgC,WAAW,EAAE,CAAC,CAAC;SAC5D;QAED,IAAA,mBAAU,EAAC,IAAI,EAAE,IAAA,0BAAiB,EAAC,WAAW,EAAE,cAAc,CAAC,EAAE,WAAW,CAAC,EAAE;YAC7E,WAAW,CAAC,OAAO,mCACd,WAAW,CAAC,OAAO,KACtB,eAAe,EAAE;oBACf,QAAQ,EAAE,4CAA4C;iBACvD,GACF,CAAC;YACF,OAAO,WAAW,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AA5BD,kDA4BC;AAED,kBAAe,mBAAmB,CAAC","sourcesContent":["/* eslint-disable no-console */\nimport { formatFiles, generateFiles, joinPathFragments, readProjectConfiguration, Tree, updateJson } from \"@nx/devkit\";\nimport * as path from \"path\";\nimport { AddGrapqhlGeneratorSchema } from \"./schema\";\n\n/**\n * Setting up Graphql tools for Iris App development\n */\nexport async function addGrapqhlGenerator(tree: Tree, options: AddGrapqhlGeneratorSchema) {\n const workspaceRoot = \"\";\n const projectConfig = readProjectConfiguration(tree, options.project);\n const libraryRoot = projectConfig.root;\n if (!tree.exists(\"graphql.config.json\")) {\n generateFiles(tree, path.join(__dirname, \"files\", \"root\"), workspaceRoot, options);\n } else {\n console.log(\n `\"graphql.config.json\" already exist in your workspace root. \\nPlease ensure that your \"graphql.config.json\" contains \"schema\": \"https://iris.trackunit.com/api/graphql/\".`\n );\n }\n\n if (!tree.exists(`${libraryRoot}/codegen.ts`)) {\n generateFiles(tree, path.join(__dirname, \"files\", \"subDirectory\"), libraryRoot, options);\n } else {\n console.log(`codegen.ts already exists in ${libraryRoot}`);\n }\n\n updateJson(tree, joinPathFragments(libraryRoot, \"project.json\"), projectJSON => {\n projectJSON.targets = {\n ...projectJSON.targets,\n \"graphql-hooks\": {\n executor: \"@trackunit/react-graphql-tools:createHooks\",\n },\n };\n return projectJSON;\n });\n await formatFiles(tree);\n}\n\nexport default addGrapqhlGenerator;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "AddGrapqhl",
|
|
4
|
+
"title": "",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "What library should we add graphql to?",
|
|
15
|
+
"x-dropdown": "projects"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"required": [
|
|
19
|
+
"project"
|
|
20
|
+
]
|
|
21
|
+
}
|