@trackunit/iris-app-build-utilities 0.0.359 → 0.0.361

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,13 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.0.361](https://github.com/Trackunit/manager/compare/iris-app-build-utilities/0.0.360...iris-app-build-utilities/0.0.361) (2024-02-06)
6
+
7
+ ## [0.0.360](https://github.com/Trackunit/manager/compare/iris-app-build-utilities/0.0.359...iris-app-build-utilities/0.0.360) (2024-02-06)
8
+
9
+ ### Dependency Updates
10
+
11
+ * `iris-app-api` updated to version `0.0.359`
5
12
  ## [0.0.359](https://github.com/Trackunit/manager/compare/iris-app-build-utilities/0.0.358...iris-app-build-utilities/0.0.359) (2024-02-05)
6
13
 
7
14
  ### Dependency Updates
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-build-utilities",
3
- "version": "0.0.359",
3
+ "version": "0.0.361",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "engines": {
@@ -3,8 +3,7 @@ import { CodegenConfig } from "@graphql-codegen/cli";
3
3
  * This function returns the codegen config for trackunit public graphql-codegen.
4
4
  *
5
5
  * @param nxLibPath The library path.
6
- * @param gqlFilesRegex (optional) The regex to find the files that declares queries to the public GQL. Default value: '**\/*.graphql'.
7
- * Use it when the library needs to call both public and not public GQL to limit set of files to public.
6
+ * @param gqlFilePaths (optional) An array of library relative paths to the graphql-files to generate hooks for.
8
7
  * @returns GraphQL code generation config.
9
8
  */
10
- export declare const getGraphqlCodegenConfig: (nxLibPath: string, gqlFilesRegex?: string) => CodegenConfig;
9
+ export declare const getGraphqlCodegenConfig: (nxLibPath: string, gqlFilePaths?: string[]) => CodegenConfig;
@@ -7,27 +7,24 @@ const path_1 = require("path");
7
7
  * This function returns the codegen config for trackunit public graphql-codegen.
8
8
  *
9
9
  * @param nxLibPath The library path.
10
- * @param gqlFilesRegex (optional) The regex to find the files that declares queries to the public GQL. Default value: '**\/*.graphql'.
11
- * Use it when the library needs to call both public and not public GQL to limit set of files to public.
10
+ * @param gqlFilePaths (optional) An array of library relative paths to the graphql-files to generate hooks for.
12
11
  * @returns GraphQL code generation config.
13
12
  */
14
- const getGraphqlCodegenConfig = (nxLibPath, gqlFilesRegex) => {
13
+ const getGraphqlCodegenConfig = (nxLibPath, gqlFilePaths) => {
15
14
  const internalSchemaFilePath = (0, path_1.join)(__dirname, "..", "..", "..", "..", "libs", "api", "internal-gql-schema", "src", "internal-schema.gql");
16
15
  const publicSchemaUrlOrInternalSchemaPath = (0, fs_1.existsSync)(internalSchemaFilePath)
17
16
  ? internalSchemaFilePath
18
17
  : "https://iris.trackunit.com/api/graphql/";
19
18
  // eslint-disable-next-line no-console
20
19
  console.log(`Using schema: ${publicSchemaUrlOrInternalSchemaPath}`);
21
- const generatedGqlOutputFolder = (0, path_1.join)(nxLibPath, "src", "generated", "graphql-api") + path_1.sep;
20
+ // Adds a / to the end of the path to make gql client-preset happy - also on Windows
21
+ const generatedGqlOutputFolder = (0, path_1.join)(nxLibPath, "src", "generated", "graphql-api") + "/";
22
22
  if ((0, fs_1.existsSync)(generatedGqlOutputFolder)) {
23
23
  (0, fs_1.rmSync)(generatedGqlOutputFolder, { recursive: true });
24
24
  console.log(`Cleanup path: ${generatedGqlOutputFolder}`);
25
25
  }
26
- const documents = [
27
- (0, path_1.join)(nxLibPath, "src", "**", "*.tsx"),
28
- (0, path_1.join)(nxLibPath, "src", gqlFilesRegex || (0, path_1.join)("**", "*.graphql")),
29
- ];
30
- if (!gqlFilesRegex) {
26
+ const documents = gqlFilePaths && gqlFilePaths.length > 0 ? gqlFilePaths : [(0, path_1.join)(nxLibPath, "src", "**", "*.graphql")];
27
+ if (!gqlFilePaths) {
31
28
  documents.push((0, path_1.join)(`!${nxLibPath}`, "src", "**", "*-manager.graphql"));
32
29
  }
33
30
  const generates = {};
@@ -1 +1 @@
1
- {"version":3,"file":"getGraphqlCodeGenConfig.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-build-utilities/src/getGraphqlCodeGenConfig.ts"],"names":[],"mappings":";;;AACA,2BAAwC;AACxC,+BAAiC;AAEjC;;;;;;;GAOG;AACI,MAAM,uBAAuB,GAAiE,CACnG,SAAiB,EACjB,aAAsB,EACtB,EAAE;IACF,MAAM,sBAAsB,GAAG,IAAA,WAAI,EACjC,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,KAAK,EACL,qBAAqB,EACrB,KAAK,EACL,qBAAqB,CACtB,CAAC;IACF,MAAM,mCAAmC,GAAG,IAAA,eAAU,EAAC,sBAAsB,CAAC;QAC5E,CAAC,CAAC,sBAAsB;QACxB,CAAC,CAAC,yCAAyC,CAAC;IAE9C,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,iBAAiB,mCAAmC,EAAE,CAAC,CAAC;IAEpE,MAAM,wBAAwB,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,CAAC,GAAG,UAAG,CAAC;IAC1F,IAAI,IAAA,eAAU,EAAC,wBAAwB,CAAC,EAAE;QACxC,IAAA,WAAM,EAAC,wBAAwB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,iBAAiB,wBAAwB,EAAE,CAAC,CAAC;KAC1D;IACD,MAAM,SAAS,GAAG;QAChB,IAAA,WAAI,EAAC,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC;QACrC,IAAA,WAAI,EAAC,SAAS,EAAE,KAAK,EAAE,aAAa,IAAI,IAAA,WAAI,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;KACjE,CAAC;IACF,IAAI,CAAC,aAAa,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4FlC","sourcesContent":["import { CodegenConfig } from \"@graphql-codegen/cli\";\nimport { existsSync, rmSync } from \"fs\";\nimport { join, sep } from \"path\";\n\n/**\n * This function returns the codegen config for trackunit public graphql-codegen.\n *\n * @param nxLibPath The library path.\n * @param gqlFilesRegex (optional) The regex to find the files that declares queries to the public GQL. Default value: '**\\/*.graphql'.\n * Use it when the library needs to call both public and not public GQL to limit set of files to public.\n * @returns GraphQL code generation config.\n */\nexport const getGraphqlCodegenConfig: (nxLibPath: string, gqlFilesRegex?: string) => CodegenConfig = (\n nxLibPath: string,\n gqlFilesRegex?: string\n) => {\n const internalSchemaFilePath = join(\n __dirname,\n \"..\",\n \"..\",\n \"..\",\n \"..\",\n \"libs\",\n \"api\",\n \"internal-gql-schema\",\n \"src\",\n \"internal-schema.gql\"\n );\n const publicSchemaUrlOrInternalSchemaPath = existsSync(internalSchemaFilePath)\n ? internalSchemaFilePath\n : \"https://iris.trackunit.com/api/graphql/\";\n\n // eslint-disable-next-line no-console\n console.log(`Using schema: ${publicSchemaUrlOrInternalSchemaPath}`);\n\n const generatedGqlOutputFolder = join(nxLibPath, \"src\", \"generated\", \"graphql-api\") + sep;\n if (existsSync(generatedGqlOutputFolder)) {\n rmSync(generatedGqlOutputFolder, { recursive: true });\n console.log(`Cleanup path: ${generatedGqlOutputFolder}`);\n }\n const documents = [\n join(nxLibPath, \"src\", \"**\", \"*.tsx\"),\n join(nxLibPath, \"src\", gqlFilesRegex || join(\"**\", \"*.graphql\")),\n ];\n if (!gqlFilesRegex) {\n documents.push(join(`!${nxLibPath}`, \"src\", \"**\", \"*-manager.graphql\"));\n }\n\n const generates: CodegenConfig[\"generates\"] = {};\n generates[generatedGqlOutputFolder] = {\n schema: publicSchemaUrlOrInternalSchemaPath,\n documents,\n preset: \"client\",\n plugins: [\n {\n add: {\n content: [\n \"export type DateTimeISOString = string;\",\n \"import type { PublicIrisAppManifest } from '@trackunit/iris-app-api';\",\n ],\n },\n },\n ],\n config: {\n scalars: {\n Cursor: \"string\",\n Date: \"DateTimeISOString\",\n DateTime: \"DateTimeISOString\",\n GeoJSONCoordinates: \"number[] | number[][]\",\n PublicIrisAppManifest: \"PublicIrisAppManifest\",\n },\n namingConvention: {\n typeNames: \"keep\",\n enumValues: \"keep\",\n },\n avoidOptionals: {\n field: true,\n inputValue: false,\n object: true,\n defaultValue: true,\n },\n },\n presetConfig: {\n fragmentMasking: { unmaskFunctionName: \"getFragmentData\" },\n noExport: true,\n avoidOptionals: {\n field: true,\n inputValue: false,\n object: true,\n defaultValue: true,\n },\n noNamespaces: true,\n namingConvention: {\n typeNames: \"keep\",\n enumValues: \"keep\",\n },\n },\n };\n\n return {\n schema: \"\",\n ignoreNoDocuments: true, // for better experience with the watcher\n generates,\n };\n};"]}
1
+ {"version":3,"file":"getGraphqlCodeGenConfig.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-build-utilities/src/getGraphqlCodeGenConfig.ts"],"names":[],"mappings":";;;AACA,2BAAwC;AACxC,+BAA4B;AAE5B;;;;;;GAMG;AACI,MAAM,uBAAuB,GAAkE,CACpG,SAAiB,EACjB,YAAuB,EACvB,EAAE;IACF,MAAM,sBAAsB,GAAG,IAAA,WAAI,EACjC,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,KAAK,EACL,qBAAqB,EACrB,KAAK,EACL,qBAAqB,CACtB,CAAC;IACF,MAAM,mCAAmC,GAAG,IAAA,eAAU,EAAC,sBAAsB,CAAC;QAC5E,CAAC,CAAC,sBAAsB;QACxB,CAAC,CAAC,yCAAyC,CAAC;IAE9C,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,iBAAiB,mCAAmC,EAAE,CAAC,CAAC;IAEpE,oFAAoF;IACpF,MAAM,wBAAwB,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,CAAC,GAAG,GAAG,CAAC;IAC1F,IAAI,IAAA,eAAU,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AE;YAC1D,QAAQ,EAAE,IAAI;YACd,cAAc,EAAE;gBACd,KAAK,EAAE,IAAI;gBACX,UAAU,EAAE,KAAK;gBACjB,MAAM,EAAE,IAAI;gBACZ,YAAY,EAAE,IAAI;aACnB;YACD,YAAY,EAAE,IAAI;YAClB,gBAAgB,EAAE;gBAChB,SAAS,EAAE,MAAM;gBACjB,UAAU,EAAE,MAAM;aACnB;SACF;KACF,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,EAAE;QACV,iBAAiB,EAAE,IAAI;QACvB,SAAS;KACV,CAAC;AACJ,CAAC,CAAC;AA3FW,QAAA,uBAAuB,2BA2FlC","sourcesContent":["import { CodegenConfig } from \"@graphql-codegen/cli\";\nimport { existsSync, rmSync } from \"fs\";\nimport { join } from \"path\";\n\n/**\n * This function returns the codegen config for trackunit public graphql-codegen.\n *\n * @param nxLibPath The library path.\n * @param gqlFilePaths (optional) An array of library relative paths to the graphql-files to generate hooks for.\n * @returns GraphQL code generation config.\n */\nexport const getGraphqlCodegenConfig: (nxLibPath: string, gqlFilePaths?: string[]) => CodegenConfig = (\n nxLibPath: string,\n gqlFilePaths?: string[]\n) => {\n const internalSchemaFilePath = join(\n __dirname,\n \"..\",\n \"..\",\n \"..\",\n \"..\",\n \"libs\",\n \"api\",\n \"internal-gql-schema\",\n \"src\",\n \"internal-schema.gql\"\n );\n const publicSchemaUrlOrInternalSchemaPath = existsSync(internalSchemaFilePath)\n ? internalSchemaFilePath\n : \"https://iris.trackunit.com/api/graphql/\";\n\n // eslint-disable-next-line no-console\n console.log(`Using schema: ${publicSchemaUrlOrInternalSchemaPath}`);\n\n // Adds a / to the end of the path to make gql client-preset happy - also on Windows\n const generatedGqlOutputFolder = join(nxLibPath, \"src\", \"generated\", \"graphql-api\") + \"/\";\n if (existsSync(generatedGqlOutputFolder)) {\n rmSync(generatedGqlOutputFolder, { recursive: true });\n console.log(`Cleanup path: ${generatedGqlOutputFolder}`);\n }\n const documents =\n gqlFilePaths && gqlFilePaths.length > 0 ? gqlFilePaths : [join(nxLibPath, \"src\", \"**\", \"*.graphql\")];\n if (!gqlFilePaths) {\n documents.push(join(`!${nxLibPath}`, \"src\", \"**\", \"*-manager.graphql\"));\n }\n\n const generates: CodegenConfig[\"generates\"] = {};\n generates[generatedGqlOutputFolder] = {\n schema: publicSchemaUrlOrInternalSchemaPath,\n documents,\n preset: \"client\",\n plugins: [\n {\n add: {\n content: [\n \"export type DateTimeISOString = string;\",\n \"import type { PublicIrisAppManifest } from '@trackunit/iris-app-api';\",\n ],\n },\n },\n ],\n config: {\n scalars: {\n Cursor: \"string\",\n Date: \"DateTimeISOString\",\n DateTime: \"DateTimeISOString\",\n GeoJSONCoordinates: \"number[] | number[][]\",\n PublicIrisAppManifest: \"PublicIrisAppManifest\",\n },\n namingConvention: {\n typeNames: \"keep\",\n enumValues: \"keep\",\n },\n avoidOptionals: {\n field: true,\n inputValue: false,\n object: true,\n defaultValue: true,\n },\n },\n presetConfig: {\n fragmentMasking: { unmaskFunctionName: \"getFragmentData\" },\n noExport: true,\n avoidOptionals: {\n field: true,\n inputValue: false,\n object: true,\n defaultValue: true,\n },\n noNamespaces: true,\n namingConvention: {\n typeNames: \"keep\",\n enumValues: \"keep\",\n },\n },\n };\n\n return {\n schema: \"\",\n ignoreNoDocuments: true, // for better experience with the watcher\n generates,\n };\n};\n"]}