@trackunit/iris-app-build-utilities 2.0.20 → 2.0.22-alpha-84ab66282fc.0

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
@@ -1,3 +1,7 @@
1
+ ## 2.0.21 (2026-06-12)
2
+
3
+ This was a version bump only for iris-app-build-utilities to align it with other projects, there were no code changes.
4
+
1
5
  ## 2.0.20 (2026-06-11)
2
6
 
3
7
  ### 🧱 Updated Dependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-build-utilities",
3
- "version": "2.0.20",
3
+ "version": "2.0.22-alpha-84ab66282fc.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "engines": {
@@ -10,14 +10,14 @@
10
10
  "tsconfig-paths": "^4.2.0",
11
11
  "typescript": "6.0.2",
12
12
  "@graphql-codegen/cli": "^5.0.3",
13
- "@nx/react": "22.6.5",
13
+ "@nx/react": "22.7.5",
14
14
  "webpack-dev-server": "5.2.1",
15
15
  "tslib": "^2.6.2",
16
16
  "csp-header": "^6.3.1",
17
17
  "@rspack/core": "1.6.7",
18
- "@trackunit/iris-app-api": "2.0.20",
19
- "@nx/devkit": "22.6.5",
20
- "@trackunit/shared-utils": "1.15.28",
18
+ "@trackunit/iris-app-api": "2.0.21-alpha-84ab66282fc.0",
19
+ "@nx/devkit": "22.7.5",
20
+ "@trackunit/shared-utils": "1.15.29-alpha-84ab66282fc.0",
21
21
  "http-proxy-middleware": "3.0.5",
22
22
  "marked": "14.1.2",
23
23
  "pacote": "^21.0.4",
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getGraphqlCodegenConfig = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const path_1 = require("path");
6
+ const toPosixWorkspaceRelative_1 = require("./toPosixWorkspaceRelative");
6
7
  /**
7
8
  * This function returns the codegen config for trackunit public graphql-codegen.
8
9
  *
@@ -13,20 +14,27 @@ const path_1 = require("path");
13
14
  const getGraphqlCodegenConfig = (nxLibPath, gqlFilePaths) => {
14
15
  const internalSchemaFilePath = (0, path_1.join)(__dirname, "..", "..", "..", "..", "libs", "api", "internal-gql-schema", "generated", "internal-schema.gql");
15
16
  const publicSchemaUrlOrInternalSchemaPath = (0, fs_1.existsSync)(internalSchemaFilePath)
16
- ? internalSchemaFilePath
17
+ ? (0, toPosixWorkspaceRelative_1.toPosixWorkspaceRelative)(internalSchemaFilePath)
17
18
  : "https://iris.trackunit.com/api/graphql/";
18
19
  // eslint-disable-next-line no-console
19
20
  console.log(`Using schema: ${publicSchemaUrlOrInternalSchemaPath}`);
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
- if ((0, fs_1.existsSync)(generatedGqlOutputFolder)) {
23
- (0, fs_1.rmSync)(generatedGqlOutputFolder, { recursive: true });
21
+ // Pointers handed to graphql-codegen must be workspace-relative posix paths: absolute Windows
22
+ // paths contain a drive-letter colon that @graphql-tools' GitLoader misparses as a git
23
+ // ref:path pointer, and the client preset turns the generates key into a `!`-exclusion too.
24
+ const libPath = (0, toPosixWorkspaceRelative_1.toPosixWorkspaceRelative)(nxLibPath);
25
+ // Filesystem operations stay on the caller-provided native path; only codegen pointers are
26
+ // workspace-relative, so cleanup keeps working when cwd is not the workspace root.
27
+ const generatedGqlOutputDir = (0, path_1.join)(nxLibPath, "src", "generated", "graphql-api");
28
+ if ((0, fs_1.existsSync)(generatedGqlOutputDir)) {
29
+ (0, fs_1.rmSync)(generatedGqlOutputDir, { recursive: true });
24
30
  // eslint-disable-next-line no-console
25
- console.log(`Cleanup path: ${generatedGqlOutputFolder}`);
31
+ console.log(`Cleanup path: ${generatedGqlOutputDir}`);
26
32
  }
27
- const documents = gqlFilePaths && gqlFilePaths.length > 0 ? gqlFilePaths : [(0, path_1.join)(nxLibPath, "src", "**", "*.graphql")];
33
+ // The trailing / makes the gql client-preset happy - also on Windows
34
+ const generatedGqlOutputFolder = `${libPath}/src/generated/graphql-api/`;
35
+ const documents = gqlFilePaths && gqlFilePaths.length > 0 ? gqlFilePaths : [`${libPath}/src/**/*.graphql`];
28
36
  if (!gqlFilePaths) {
29
- documents.push((0, path_1.join)(`!${nxLibPath}`, "src", "**", "*-manager.graphql"));
37
+ documents.push(`!${libPath}/src/**/*-manager.graphql`);
30
38
  }
31
39
  const generates = {};
32
40
  generates[generatedGqlOutputFolder] = {
package/src/index.d.ts CHANGED
@@ -16,3 +16,4 @@ export * from "./plugin-shared/customFieldUtil";
16
16
  export * from "./plugin-shared/extensionUtil";
17
17
  export * from "./plugin-shared/indexHtmlUtil";
18
18
  export * from "./spawnServersideExtensions";
19
+ export * from "./toPosixWorkspaceRelative";
package/src/index.js CHANGED
@@ -19,4 +19,5 @@ tslib_1.__exportStar(require("./plugin-shared/customFieldUtil"), exports);
19
19
  tslib_1.__exportStar(require("./plugin-shared/extensionUtil"), exports);
20
20
  tslib_1.__exportStar(require("./plugin-shared/indexHtmlUtil"), exports);
21
21
  tslib_1.__exportStar(require("./spawnServersideExtensions"), exports);
22
+ tslib_1.__exportStar(require("./toPosixWorkspaceRelative"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Converts a path to a workspace-relative posix path for use as a graphql-tools/codegen pointer.
3
+ *
4
+ * Pointers must not contain backslashes (globs require forward slashes) and must not contain a
5
+ * drive-letter colon: `@graphql-tools` GitLoader parses any pointer with a single `:` as a
6
+ * `ref:path` git pointer, so an absolute Windows path like `C:\workspace\libs\foo` makes it run
7
+ * `git ls-tree` against a garbage ref and document loading fails.
8
+ *
9
+ * Only use this for pointers passed to graphql-codegen/graphql-tools. Filesystem operations
10
+ * should keep using native `path.join` paths.
11
+ *
12
+ * @param targetPath The absolute or relative path to convert.
13
+ * @param workspaceRoot The workspace root the result should be relative to. Defaults to
14
+ * `process.cwd()`, which is the workspace root for nx executors and codegen runs.
15
+ * @returns {string} The path relative to the workspace root with forward slashes. Paths outside
16
+ * the workspace root (e.g. on a different Windows drive) are returned as absolute posix paths.
17
+ */
18
+ export declare const toPosixWorkspaceRelative: (targetPath: string, workspaceRoot?: string) => string;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toPosixWorkspaceRelative = void 0;
4
+ const consoleUtils_1 = require("./plugin-shared/consoleUtils");
5
+ const toPosixSeparators = (value) => value.replace(/\\/g, "/");
6
+ const normalizeDriveLetter = (value) => value.replace(/^[a-z]:/, match => match.toUpperCase());
7
+ const hasDriveLetter = (value) => /^[A-Z]:/.test(value);
8
+ /**
9
+ * Converts a path to a workspace-relative posix path for use as a graphql-tools/codegen pointer.
10
+ *
11
+ * Pointers must not contain backslashes (globs require forward slashes) and must not contain a
12
+ * drive-letter colon: `@graphql-tools` GitLoader parses any pointer with a single `:` as a
13
+ * `ref:path` git pointer, so an absolute Windows path like `C:\workspace\libs\foo` makes it run
14
+ * `git ls-tree` against a garbage ref and document loading fails.
15
+ *
16
+ * Only use this for pointers passed to graphql-codegen/graphql-tools. Filesystem operations
17
+ * should keep using native `path.join` paths.
18
+ *
19
+ * @param targetPath The absolute or relative path to convert.
20
+ * @param workspaceRoot The workspace root the result should be relative to. Defaults to
21
+ * `process.cwd()`, which is the workspace root for nx executors and codegen runs.
22
+ * @returns {string} The path relative to the workspace root with forward slashes. Paths outside
23
+ * the workspace root (e.g. on a different Windows drive) are returned as absolute posix paths.
24
+ */
25
+ const toPosixWorkspaceRelative = (targetPath, workspaceRoot = process.cwd()) => {
26
+ const target = normalizeDriveLetter(toPosixSeparators(targetPath));
27
+ const root = normalizeDriveLetter(toPosixSeparators(workspaceRoot)).replace(/\/+$/, "");
28
+ // Windows paths are case-insensitive; posix paths are not
29
+ const compareCaseInsensitively = hasDriveLetter(target) && hasDriveLetter(root);
30
+ const comparableTarget = compareCaseInsensitively ? target.toLowerCase() : target;
31
+ const comparableRoot = compareCaseInsensitively ? root.toLowerCase() : root;
32
+ if (comparableTarget === comparableRoot) {
33
+ return ".";
34
+ }
35
+ if (comparableTarget.startsWith(`${comparableRoot}/`)) {
36
+ return target.slice(root.length + 1);
37
+ }
38
+ if (hasDriveLetter(target)) {
39
+ (0, consoleUtils_1.logWarning)(`Could not make ${targetPath} relative to ${workspaceRoot}; the resulting pointer keeps its drive-letter colon, which may break graphql document loading on Windows.`);
40
+ }
41
+ return target;
42
+ };
43
+ exports.toPosixWorkspaceRelative = toPosixWorkspaceRelative;
44
+ //# sourceMappingURL=toPosixWorkspaceRelative.js.map