@trackunit/react-graphql-tools 0.0.3 → 0.0.4
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
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.0.4](https://github.com/Trackunit/manager/compare/react-graphql-tools/0.0.3...react-graphql-tools/0.0.4) (2023-03-27)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `nx-utils` updated to version `0.0.4`
|
|
5
10
|
## [0.0.3](https://github.com/Trackunit/manager/compare/react-graphql-tools/0.0.2...react-graphql-tools/0.0.3) (2023-03-23)
|
|
6
11
|
|
|
7
12
|
### Dependency Updates
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-graphql-tools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"executors": "./executors.json",
|
|
6
6
|
"repository": "https://github.com/Trackunit/manager",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@graphql-codegen/fragment-matcher": "^3.3.1",
|
|
11
11
|
"@graphql-codegen/typescript-operations": "^2.5.12",
|
|
12
12
|
"@graphql-codegen/typescript-react-apollo": "^3.3.7",
|
|
13
|
-
"@trackunit/nx-utils": "0.0.
|
|
13
|
+
"@trackunit/nx-utils": "0.0.4",
|
|
14
14
|
"@phenomnomnominal/tsquery": "4.2.0",
|
|
15
15
|
"tslib": "2.4.1"
|
|
16
16
|
},
|
|
@@ -8,7 +8,7 @@ const generateHooks_1 = require("./generateHooks");
|
|
|
8
8
|
*
|
|
9
9
|
* @param _unused unused props from nx
|
|
10
10
|
* @param context The execution context for this executor
|
|
11
|
-
* @returns success when finished
|
|
11
|
+
* @returns {Promise<{ success: number; }>} success when finished
|
|
12
12
|
*/
|
|
13
13
|
const CreateGraphqlHooks = (_unused, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
14
14
|
const nxRoot = `${context.root}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/react/graphql-tools/src/executors/createHooks/executor.ts"],"names":[],"mappings":";;;;AACA,mDAAgD;AAEhD;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,CAAO,OAAgB,EAAE,OAAwB,EAAE,EAAE;IACrF,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAEjC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAY,CAAC,CAAC,IAAI,CAAC;IACtE,MAAM,WAAW,GAAG,GAAG,MAAM,IAAI,OAAO,EAAE,CAAC;IAE3C,MAAM,IAAA,6BAAa,EAAC,mDAAmD,EAAE,WAAW,GAAG,MAAM,CAAC,CAAC;IAC/F,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACxB,CAAC,CAAA,CAAC;AARW,QAAA,kBAAkB,sBAQ7B;AAEF,kBAAe,0BAAkB,CAAC","sourcesContent":["import { ExecutorContext } from \"@nrwl/devkit\";\nimport { generateHooks } from \"./generateHooks\";\n\n/**\n * This executor generates react hooks for all graphql files.\n *\n * @param _unused unused props from nx\n * @param context The execution context for this executor\n * @returns success when finished\n */\nexport const CreateGraphqlHooks = async (_unused: unknown, context: ExecutorContext) => {\n const nxRoot = `${context.root}`;\n\n const libRoot = context.workspace.projects[context.projectName!].root;\n const fullLibRoot = `${nxRoot}/${libRoot}`;\n\n await generateHooks(\"https://dev.manager.trackunit.com/public/api/gql/\", fullLibRoot + \"/src\");\n return { success: 1 };\n};\n\nexport default CreateGraphqlHooks;\n"]}
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/react/graphql-tools/src/executors/createHooks/executor.ts"],"names":[],"mappings":";;;;AACA,mDAAgD;AAEhD;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,CAAO,OAAgB,EAAE,OAAwB,EAAE,EAAE;IACrF,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAEjC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAY,CAAC,CAAC,IAAI,CAAC;IACtE,MAAM,WAAW,GAAG,GAAG,MAAM,IAAI,OAAO,EAAE,CAAC;IAE3C,MAAM,IAAA,6BAAa,EAAC,mDAAmD,EAAE,WAAW,GAAG,MAAM,CAAC,CAAC;IAC/F,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACxB,CAAC,CAAA,CAAC;AARW,QAAA,kBAAkB,sBAQ7B;AAEF,kBAAe,0BAAkB,CAAC","sourcesContent":["import { ExecutorContext } from \"@nrwl/devkit\";\nimport { generateHooks } from \"./generateHooks\";\n\n/**\n * This executor generates react hooks for all graphql files.\n *\n * @param _unused unused props from nx\n * @param context The execution context for this executor\n * @returns {Promise<{ success: number; }>} success when finished\n */\nexport const CreateGraphqlHooks = async (_unused: unknown, context: ExecutorContext) => {\n const nxRoot = `${context.root}`;\n\n const libRoot = context.workspace.projects[context.projectName!].root;\n const fullLibRoot = `${nxRoot}/${libRoot}`;\n\n await generateHooks(\"https://dev.manager.trackunit.com/public/api/gql/\", fullLibRoot + \"/src\");\n return { success: 1 };\n};\n\nexport default CreateGraphqlHooks;\n"]}
|
|
@@ -8,9 +8,11 @@ const cli_1 = require("@graphql-codegen/cli");
|
|
|
8
8
|
*
|
|
9
9
|
* @param schemaUrl schema url to use.
|
|
10
10
|
* @param srcPath the srcPath to look for options glob.
|
|
11
|
+
* @param options the options to use.
|
|
11
12
|
* @param options.name the name of the output file.
|
|
12
13
|
* @param options.graphqlGlob the options glob allows you to override the default.
|
|
13
14
|
* @param options.plugins the options list of plugins to use.
|
|
15
|
+
* @param options.overridePluginConfig the options list of overridePluginConfig.
|
|
14
16
|
*/
|
|
15
17
|
const generateHooks = (schemaUrl, srcPath, options = {
|
|
16
18
|
name: "generated/graphql-api.tsx",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateHooks.js","sourceRoot":"","sources":["../../../../../../../libs/react/graphql-tools/src/executors/createHooks/generateHooks.ts"],"names":[],"mappings":";;;;AAAA,8CAA+D;AAE/D
|
|
1
|
+
{"version":3,"file":"generateHooks.js","sourceRoot":"","sources":["../../../../../../../libs/react/graphql-tools/src/executors/createHooks/generateHooks.ts"],"names":[],"mappings":";;;;AAAA,8CAA+D;AAE/D;;;;;;;;;;GAUG;AACI,MAAM,aAAa,GAAG,CAC3B,SAAiB,EACjB,OAAe,EACf,UAKI;IACF,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,WAAW;IACxB,OAAO,EAAE,CAAC,YAAY,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,kBAAkB,CAAC;CAChG,EACD,EAAE;IACF,MAAM,cAAc,GAAkB;QACpC,SAAS,EAAE,EAAE;KACd,CAAC;IAEF,cAAc,CAAC,SAAS,CAAC,GAAG,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,mBACpD,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,GAAG,OAAO,OAAO,OAAO,CAAC,WAAW,EAAE,EACjD,MAAM,EAAE;YACN,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,KAAK;YACpB,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,WAAW;YAC5B,gBAAgB,EAAE;gBAChB,SAAS,EAAE,MAAM;gBACjB,UAAU,EAAE,wBAAwB;aACrC;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,MAAM;aACjB;SACF,EACD,OAAO,EAAE,OAAO,CAAC,OAAO,IACrB,OAAO,CAAC,oBAAoB,CAChC,CAAC;IAEF,MAAM,IAAA,cAAQ,EAAC,cAAc,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QAC7C,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,+CAA+C,EAAE,CAAC,CAAC,CAAC;QAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AA7CW,QAAA,aAAa,iBA6CxB","sourcesContent":["import { CodegenConfig, generate } from \"@graphql-codegen/cli\";\n\n/**\n * Generates React hooks from your graphql files.\n *\n * @param schemaUrl schema url to use.\n * @param srcPath the srcPath to look for options glob.\n * @param options the options to use.\n * @param options.name the name of the output file.\n * @param options.graphqlGlob the options glob allows you to override the default.\n * @param options.plugins the options list of plugins to use.\n * @param options.overridePluginConfig the options list of overridePluginConfig.\n */\nexport const generateHooks = async (\n schemaUrl: string,\n srcPath: string,\n options: {\n name: string;\n graphqlGlob: string;\n plugins: string[];\n overridePluginConfig?: CodegenConfig;\n } = {\n name: \"generated/graphql-api.tsx\",\n graphqlGlob: \"*.graphql\",\n plugins: [\"typescript\", \"typescript-operations\", \"typescript-react-apollo\", \"fragment-matcher\"],\n }\n) => {\n const codegenOptions: CodegenConfig = {\n generates: {},\n };\n\n codegenOptions.generates[`${srcPath}/${options.name}`] = {\n schema: schemaUrl,\n documents: `${srcPath}/**/${options.graphqlGlob}`,\n config: {\n withHooks: true,\n withHOC: false,\n withComponent: false,\n noNamespaces: true,\n declarationKind: \"interface\",\n namingConvention: {\n typeNames: \"keep\",\n enumValues: \"pascal-case#pascalCase\",\n },\n scalars: {\n Date: \"Date\",\n DateTime: \"Date\",\n },\n },\n plugins: options.plugins,\n ...options.overridePluginConfig,\n };\n\n await generate(codegenOptions, true).catch(e => {\n // eslint-disable-next-line no-console\n console.error(\"❌ There was an error generating GraphQL types\", e);\n process.exit(1);\n });\n};\n"]}
|