@trackunit/iris-app 2.8.4 → 2.8.6

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,24 @@
1
+ ## 2.8.6 (2026-09-30)
2
+
3
+ ### 🧱 Updated Dependencies
4
+
5
+ - Updated iris-app-build-utilities to 2.5.4
6
+ - Updated iris-app-api to 2.7.4
7
+ - Updated react-vite-test-setup to 0.0.152
8
+ - Updated css-classname-utils to 0.0.60
9
+ - Updated react-graphql-tools to 1.18.4
10
+ - Updated shared-utils to 1.17.4
11
+
12
+ ## 2.8.5 (2026-09-30)
13
+
14
+ ### 🩹 Fixes
15
+
16
+ - Add when submitting iris app for returning 404 on approval ([f60e0f7c192](https://github.com/Trackunit/manager/commit/f60e0f7c192))
17
+
18
+ ### ❤️ Thank You
19
+
20
+ - Søren Bendlin Gammelmark
21
+
1
22
  ## 2.8.4 (2026-09-30)
2
23
 
3
24
  ### 🧱 Updated Dependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app",
3
- "version": "2.8.4",
3
+ "version": "2.8.6",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "main": "src/index.js",
6
6
  "generators": "./generators.json",
@@ -10,7 +10,7 @@
10
10
  "node": ">=24.x"
11
11
  },
12
12
  "dependencies": {
13
- "@trackunit/css-classname-utils": "0.0.59",
13
+ "@trackunit/css-classname-utils": "0.0.60",
14
14
  "@typescript-eslint/types": "8.58.1",
15
15
  "@typescript-eslint/typescript-estree": "8.58.1",
16
16
  "pacote": "^21.0.4",
@@ -26,10 +26,10 @@
26
26
  "@nx/react": "23.1.0",
27
27
  "@npmcli/arborist": "^9.1.9",
28
28
  "win-ca": "^3.5.1",
29
- "@trackunit/iris-app-build-utilities": "2.5.3",
30
- "@trackunit/react-graphql-tools": "1.18.3",
31
- "@trackunit/shared-utils": "1.17.3",
32
- "@trackunit/iris-app-api": "2.7.3",
29
+ "@trackunit/iris-app-build-utilities": "2.5.4",
30
+ "@trackunit/react-graphql-tools": "1.18.4",
31
+ "@trackunit/shared-utils": "1.17.4",
32
+ "@trackunit/iris-app-api": "2.7.4",
33
33
  "tslib": "^2.6.2",
34
34
  "@clack/prompts": "^1.0.0",
35
35
  "@npm/types": "^1.0.2",
@@ -90,6 +90,11 @@ function isRetryableError(statusCode, code, type) {
90
90
  }
91
91
  return RETRYABLE_TRANSPORT_CODES.has(code) || (code === "FETCH_ERROR" && type === "request-timeout");
92
92
  }
93
+ function isRetryableApproveError(statusCode, code, type) {
94
+ // Same as isRetryableError but also accept 404 for approvals.
95
+ // 404 can happen spuriously on approval
96
+ return (statusCode !== undefined && statusCode === 404) || isRetryableError(statusCode, code, type);
97
+ }
93
98
  /**
94
99
  * Submit the package to the npm registry.
95
100
  *
@@ -230,7 +235,7 @@ async function doApproveAppWithRetry(token, manifest, settings, retryCount) {
230
235
  console.error("❌ Unable to approve app package. Got error from Iris App SDK repository.", e);
231
236
  return { success: false };
232
237
  }
233
- if (!isRetryableError(e.statusCode, e.code)) {
238
+ if (!isRetryableApproveError(e.statusCode, e.code)) {
234
239
  console.error("❌ Unable to approve app package.", e.message);
235
240
  return { success: false };
236
241
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "extends": "./tsconfig.json",
3
- "compilerOptions": { "module": "commonjs", "types": ["jest", "node", "@testing-library/jest-dom"] },
3
+ "compilerOptions": { "module": "commonjs", "types": ["vitest/globals", "node", "@testing-library/jest-dom"] },
4
4
  "include": [
5
5
  "vite.config.ts"
6
6
  ]
@@ -65,11 +65,11 @@ const IrisAppGenerator = async function (tree, options) {
65
65
  };
66
66
  const irisAppSdkVitePackageJsonFromNpm = (0, get_package_manifest_1.getPackageManifest)("@trackunit/iris-app-sdk-vite");
67
67
  const reactCoreContextsTestPackageJsonFromNpm = (0, get_package_manifest_1.getPackageManifest)("@trackunit/react-core-contexts-test");
68
- const reactTestSetupPackageJsonFromNpm = (0, get_package_manifest_1.getPackageManifest)("@trackunit/react-test-setup");
68
+ const reactViteTestSetupPackageJsonFromNpm = (0, get_package_manifest_1.getPackageManifest)("@trackunit/react-vite-test-setup");
69
69
  const tuDevDependencies = {
70
70
  "@trackunit/iris-app-sdk-vite": (await irisAppSdkVitePackageJsonFromNpm).version,
71
71
  "@trackunit/react-core-contexts-test": (await reactCoreContextsTestPackageJsonFromNpm).version,
72
- "@trackunit/react-test-setup": (await reactTestSetupPackageJsonFromNpm).version,
72
+ "@trackunit/react-vite-test-setup": (await reactViteTestSetupPackageJsonFromNpm).version,
73
73
  };
74
74
  (0, devkit_1.addDependenciesToPackageJson)(tree, {
75
75
  ...tuDependencies,
@@ -4,12 +4,15 @@ export declare const spaDependencies: {
4
4
  "single-spa-react": string;
5
5
  };
6
6
  export declare const testDependencies: {
7
- "@nx/jest": string;
8
- "@testing-library/react": string;
7
+ "@nx/vite": string;
8
+ "@nx/vitest": string;
9
9
  "@testing-library/dom": string;
10
- jest: string;
11
- "jest-environment-jsdom": string;
12
- "jest-transform-stub": string;
13
- "jest-fetch-mock": string;
14
- "ts-jest": string;
10
+ "@testing-library/jest-dom": string;
11
+ "@testing-library/react": string;
12
+ "@vitejs/plugin-react": string;
13
+ "@vitest/coverage-istanbul": string;
14
+ jsdom: string;
15
+ vite: string;
16
+ "vite-tsconfig-paths": string;
17
+ vitest: string;
15
18
  };
@@ -12,13 +12,16 @@ exports.spaDependencies = {
12
12
  "single-spa-react": "5.1.4",
13
13
  };
14
14
  exports.testDependencies = {
15
- "@nx/jest": "23.1.0",
16
- "@testing-library/react": "16.2.0",
15
+ "@nx/vite": "23.1.0",
16
+ "@nx/vitest": "23.1.0",
17
17
  "@testing-library/dom": "^10.4.0",
18
- jest: "30.3.0",
19
- "jest-environment-jsdom": "30.0.5",
20
- "jest-transform-stub": "^2.0.0",
21
- "jest-fetch-mock": "^3.0.3",
22
- "ts-jest": "29.4.9",
18
+ "@testing-library/jest-dom": "^6.9.1",
19
+ "@testing-library/react": "16.2.0",
20
+ "@vitejs/plugin-react": "6.1.0",
21
+ "@vitest/coverage-istanbul": "^4.1.6",
22
+ jsdom: "^26.1.0",
23
+ vite: "8.2.2",
24
+ "vite-tsconfig-paths": "^6.1.1",
25
+ vitest: "^4.1.6",
23
26
  };
24
27
  //# sourceMappingURL=dependencies.js.map
@@ -0,0 +1,11 @@
1
+ import extensionManifest from "./extension-manifest";
2
+
3
+ describe("extension manifest", () => {
4
+ it("declares the generated extension", () => {
5
+ expect(extensionManifest).toMatchObject({
6
+ id: "<%= projectName %>",
7
+ type: "<%= type %>",
8
+ sourceRoot: "<% if (type === 'SERVERSIDE_API_EXTENSION') { %>dist/<%= projectRoot %>/<% } else { %><%= sourceRoot %><% } %>",
9
+ });
10
+ });
11
+ });
@@ -0,0 +1,34 @@
1
+ import { vitestPreset } from "@trackunit/react-vite-test-setup/preset";
2
+ import { resolve } from "node:path";
3
+ import tsconfigPaths from "vite-tsconfig-paths";
4
+ import { defineConfig, mergeConfig } from "vitest/config";
5
+
6
+ const workspaceRoot = resolve(__dirname, "<%= offsetFromRoot %>");
7
+
8
+ export default mergeConfig(
9
+ vitestPreset,
10
+ defineConfig({
11
+ root: __dirname,
12
+ cacheDir: "<%= offsetFromRoot %>node_modules/.vite/<%= projectName %>",
13
+ plugins: [
14
+ tsconfigPaths({
15
+ root: workspaceRoot,
16
+ projects: ["tsconfig.base.json"],
17
+ }),
18
+ ],
19
+ test: {
20
+ name: "<%= projectName %>",
21
+ watch: false,
22
+ globals: true,
23
+ environment: "node",
24
+ include: ["**/*.spec.ts"],
25
+ exclude: ["**/node_modules/**", "**/dist/**"],
26
+ reporters: ["default"],
27
+ coverage: {
28
+ provider: "istanbul",
29
+ reporter: ["lcov"],
30
+ reportsDirectory: "<%= offsetFromRoot %>coverage/<%= projectRoot %>",
31
+ },
32
+ },
33
+ })
34
+ );
@@ -3,8 +3,9 @@ import { trackunitProviders } from "@trackunit/react-core-contexts-test";
3
3
  import { App } from "./app";
4
4
 
5
5
  describe("App", () => {
6
- it("Should render", async () => {
6
+ it("renders the extension", async () => {
7
7
  await trackunitProviders().render(<App />);
8
- expect(screen.getByTestId("app")).toBeDefined();
8
+
9
+ expect(screen.getByTestId("app")).toBeInTheDocument();
9
10
  });
10
11
  });
@@ -0,0 +1,20 @@
1
+ import "@testing-library/jest-dom/vitest";
2
+ import {
3
+ setupCanvasMock,
4
+ setupFailOnConsole,
5
+ setupReactTestingLibrary,
6
+ setupResizeObserver,
7
+ setupTranslations,
8
+ } from "@trackunit/react-vite-test-setup";
9
+ import { vi } from "vitest";
10
+
11
+ setupFailOnConsole();
12
+ setupReactTestingLibrary();
13
+ setupTranslations();
14
+ setupResizeObserver();
15
+ setupCanvasMock();
16
+
17
+ Object.defineProperty(window.URL, "createObjectURL", {
18
+ configurable: true,
19
+ value: vi.fn(),
20
+ });
@@ -0,0 +1,37 @@
1
+ import { vitestPreset } from "@trackunit/react-vite-test-setup/preset";
2
+ import react from "@vitejs/plugin-react";
3
+ import { resolve } from "node:path";
4
+ import tsconfigPaths from "vite-tsconfig-paths";
5
+ import { defineConfig, mergeConfig } from "vitest/config";
6
+
7
+ const workspaceRoot = resolve(__dirname, "<%= offsetFromRoot %>");
8
+
9
+ export default mergeConfig(
10
+ vitestPreset,
11
+ defineConfig({
12
+ root: __dirname,
13
+ cacheDir: "<%= offsetFromRoot %>node_modules/.vite/<%= projectName %>",
14
+ plugins: [
15
+ tsconfigPaths({
16
+ root: workspaceRoot,
17
+ projects: ["tsconfig.base.json"],
18
+ }),
19
+ react(),
20
+ ],
21
+ test: {
22
+ name: "<%= projectName %>",
23
+ watch: false,
24
+ globals: true,
25
+ environment: "jsdom",
26
+ setupFiles: ["test/config/vitest.setup.tsx"],
27
+ include: ["**/*.spec.ts", "**/*.spec.tsx"],
28
+ exclude: ["**/node_modules/**", "**/dist/**"],
29
+ reporters: ["default"],
30
+ coverage: {
31
+ provider: "istanbul",
32
+ reporter: ["lcov"],
33
+ reportsDirectory: "<%= offsetFromRoot %>coverage/<%= projectRoot %>",
34
+ },
35
+ },
36
+ })
37
+ );
@@ -10,11 +10,6 @@ type ServersideGraphqlOptions = {
10
10
  * Adds public-schema codegen and a typed Hono example to a generated serverside extension.
11
11
  */
12
12
  export declare const addServersideGraphql: (tree: Tree, options: ServersideGraphqlOptions) => Promise<void>;
13
- /**
14
- * Ensures that jest.preset.js exists and includes the required @trackunit/react-test-setup preset.
15
- * If the file doesn't exist, creates it. If it exists but doesn't include the preset, updates it.
16
- */
17
- export declare function ensureJestPresetConfiguration(tree: Tree, templateOptions?: object): void;
18
13
  /**
19
14
  * Iris App Extension Generator.
20
15
  *
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IrisAppExtensionGenerator = exports.addServersideGraphql = void 0;
4
- exports.ensureJestPresetConfiguration = ensureJestPresetConfiguration;
5
4
  const tslib_1 = require("tslib");
6
5
  const devkit_1 = require("@nx/devkit");
7
6
  const eslint_1 = require("@nx/eslint");
@@ -14,7 +13,6 @@ const fs = tslib_1.__importStar(require("fs"));
14
13
  const path = tslib_1.__importStar(require("path"));
15
14
  const string_ts_1 = require("string-ts");
16
15
  const ts_morph_1 = require("ts-morph");
17
- const astUtils_1 = require("../../utils/ast/astUtils");
18
16
  const get_package_manifest_1 = require("../utils/get-package-manifest");
19
17
  const dependencies_1 = require("./dependencies");
20
18
  const addGraphqlDependency = (target) => {
@@ -81,35 +79,6 @@ function normalizeOptions(tree, options) {
81
79
  dependencyDefinitionFile,
82
80
  };
83
81
  }
84
- /**
85
- * Ensures that jest.preset.js exists and includes the required @trackunit/react-test-setup preset.
86
- * If the file doesn't exist, creates it. If it exists but doesn't include the preset, updates it.
87
- */
88
- function ensureJestPresetConfiguration(tree, templateOptions) {
89
- const jestPresetPath = "jest.preset.js";
90
- if (!tree.exists(jestPresetPath)) {
91
- // File doesn't exist, generate it using the template
92
- (0, devkit_1.generateFiles)(tree, path.join(__dirname, "files", "preset"), "/", templateOptions || {});
93
- return;
94
- }
95
- // File exists, use AST utilities for reliable manipulation
96
- let currentContent = tree.read(jestPresetPath, "utf-8");
97
- if (!currentContent) {
98
- throw new Error(`Could not read ${jestPresetPath}`);
99
- }
100
- // Extract variable name from existing import if it exists
101
- let presetVariableName = "irisPreset"; // default name
102
- const existingImportMatch = currentContent.match(/const\s+(\w+)\s*=\s*require\(["']@trackunit\/react-test-setup\/preset["']\)/);
103
- if (existingImportMatch && existingImportMatch[1]) {
104
- presetVariableName = existingImportMatch[1];
105
- }
106
- // Add the require statement if it doesn't exist
107
- currentContent = (0, astUtils_1.addRequireStatement)(currentContent, presetVariableName, "@trackunit/react-test-setup/preset");
108
- // Add the spread assignment to the module.exports object
109
- currentContent = (0, astUtils_1.addSpreadAssignment)(currentContent, presetVariableName);
110
- // Write the updated content back to the tree
111
- tree.write(jestPresetPath, currentContent);
112
- }
113
82
  /**
114
83
  * Iris App Extension Generator.
115
84
  *
@@ -141,6 +110,7 @@ const IrisAppExtensionGenerator = async function (tree, options) {
141
110
  (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
142
111
  ...dependencies_1.spaDependencies,
143
112
  ...dependencies_1.testDependencies,
113
+ "@trackunit/react-vite-test-setup": await getPackageVersion("@trackunit/react-vite-test-setup"),
144
114
  });
145
115
  }
146
116
  const schema = {
@@ -148,11 +118,7 @@ const IrisAppExtensionGenerator = async function (tree, options) {
148
118
  style: "none",
149
119
  skipFormat: false,
150
120
  strict: true,
151
- // Nx 23 warns that "jest" emits the deprecated @nx/jest:jest target, but unlike
152
- // createSubgraph this generator has no jest.config/tsconfig.spec templates of its
153
- // own and updates the generated tsconfig.spec.json below. Switching to "none"
154
- // requires shipping those templates first.
155
- unitTestRunner: "jest",
121
+ unitTestRunner: "vitest",
156
122
  linter: eslint_1.Linter.EsLint,
157
123
  routing: false,
158
124
  directory: normalizedOptions.projectRoot,
@@ -160,13 +126,30 @@ const IrisAppExtensionGenerator = async function (tree, options) {
160
126
  skipPackageJson: true,
161
127
  };
162
128
  await (0, react_1.libraryGenerator)(tree, schema);
129
+ tree.delete((0, devkit_1.joinPathFragments)(normalizedOptions.projectRoot, "vite.config.mts"));
163
130
  (0, devkit_1.generateFiles)(tree, path.join(__dirname, "files", irisAppExtensionType), normalizedOptions.projectRoot, templateOptions);
164
- if (!iris_app_api_1.nonUiExtensionTypes.includes(irisAppExtensionType)) {
131
+ if (iris_app_api_1.nonUiExtensionTypes.includes(irisAppExtensionType)) {
132
+ (0, devkit_1.generateFiles)(tree, path.join(__dirname, "files", "non-ui-test"), normalizedOptions.projectRoot, templateOptions);
133
+ }
134
+ else {
165
135
  (0, devkit_1.generateFiles)(tree, path.join(__dirname, "files", "react-app"), normalizedOptions.projectRoot, templateOptions);
166
- if (normalizedOptions.extendJestPreset) {
167
- ensureJestPresetConfiguration(tree, templateOptions);
136
+ if (!tree.exists("vitest.empty-stub.ts")) {
137
+ tree.write("vitest.empty-stub.ts", "export default {};\n");
168
138
  }
169
139
  }
140
+ tree.delete((0, devkit_1.joinPathFragments)(normalizedOptions.projectRoot, "jest.config.ts"));
141
+ tree.delete((0, devkit_1.joinPathFragments)(normalizedOptions.projectRoot, "jest.config.cts"));
142
+ tree.delete((0, devkit_1.joinPathFragments)(normalizedOptions.projectRoot, "test", "config", "jest.setup.tsx"));
143
+ (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(normalizedOptions.projectRoot, "project.json"), projectJson => {
144
+ const testTarget = projectJson.targets.test;
145
+ if (testTarget) {
146
+ testTarget.options = {
147
+ ...testTarget.options,
148
+ configFile: (0, devkit_1.joinPathFragments)(normalizedOptions.projectRoot, "vitest.config.ts"),
149
+ };
150
+ }
151
+ return projectJson;
152
+ });
170
153
  const rootTsConfigPath = (0, js_1.getRootTsConfigPathInTree)(tree);
171
154
  if (!rootTsConfigPath) {
172
155
  throw new Error("Could not find root tsconfig.json");
@@ -278,13 +261,23 @@ const IrisAppExtensionGenerator = async function (tree, options) {
278
261
  tree.delete((0, devkit_1.joinPathFragments)(normalizedOptions.projectRoot, "src", "index.ts"));
279
262
  }
280
263
  (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(normalizedOptions.projectRoot, "tsconfig.spec.json"), tsConfigSpec => {
281
- // extension-manifest.ts is a build time file, so we only need to include it in the spec file for type/lint checking
282
- tsConfigSpec.include = [...tsConfigSpec.include, "**/jest.setup.ts*", "extension-manifest.ts"];
264
+ const isUiExtension = !iris_app_api_1.nonUiExtensionTypes.includes(irisAppExtensionType);
265
+ tsConfigSpec.compilerOptions.types = isUiExtension
266
+ ? ["vitest/globals", "node", "@testing-library/jest-dom"]
267
+ : ["vitest/globals", "node"];
268
+ tsConfigSpec.include = [
269
+ "vitest.config.ts",
270
+ ...(isUiExtension ? ["test/config/vitest.setup.tsx"] : []),
271
+ "**/*.spec.ts",
272
+ ...(isUiExtension ? ["**/*.spec.tsx"] : []),
273
+ "**/*.d.ts",
274
+ "extension-manifest.ts",
275
+ ];
283
276
  return tsConfigSpec;
284
277
  });
285
278
  await (0, devkit_1.formatFiles)(tree);
286
- (0, devkit_1.installPackagesTask)(tree, true);
287
279
  return () => {
280
+ (0, devkit_1.installPackagesTask)(tree, true);
288
281
  // eslint-disable-next-line no-console
289
282
  console.log("🥳 Successfully created an app extensions and it is already added to the Iris App!");
290
283
  };
@@ -15,6 +15,5 @@ export interface IrisAppExtensionGeneratorSchema {
15
15
  | "ASSET_EVENTS_ACTIONS_EXTENSION"
16
16
  | "LIFECYCLE_EXTENSION"
17
17
  | "SERVERSIDE_API_EXTENSION";
18
- extendJestPreset?: boolean;
19
18
  graphql?: boolean;
20
19
  }
@@ -60,11 +60,6 @@
60
60
  ]
61
61
  }
62
62
  },
63
- "extendJestPreset": {
64
- "type": "boolean",
65
- "description": "If the root jest.preset.js should be extended with the Iris app preset",
66
- "default": true
67
- },
68
63
  "graphql": {
69
64
  "type": "boolean",
70
65
  "description": "Add typed Trackunit public GraphQL support (SERVERSIDE_API_EXTENSION only)",
@@ -23,11 +23,15 @@ async function presetGenerator(tree, options) {
23
23
  tree.write(extensionsPath, "{}");
24
24
  }
25
25
  (0, devkit_1.generateFiles)(tree, path_1.default.join(__dirname, "files"), ".", {});
26
+ if (!tree.exists("vitest.empty-stub.ts")) {
27
+ tree.write("vitest.empty-stub.ts", "export default {};\n");
28
+ }
26
29
  (0, devkit_1.updateJson)(tree, extensionsPath, value => {
27
30
  if (!value.recommendations) {
28
31
  value.recommendations = [];
29
32
  }
30
- value.recommendations.push("graphql.vscode-graphql", "graphql.vscode-graphql-syntax", "bradlc.vscode-tailwindcss", "firsttris.vscode-jest-runner");
33
+ value.recommendations = value.recommendations.filter((recommendation) => recommendation !== "firsttris.vscode-jest-runner");
34
+ value.recommendations.push("graphql.vscode-graphql", "graphql.vscode-graphql-syntax", "bradlc.vscode-tailwindcss", "vitest.explorer");
31
35
  return value;
32
36
  });
33
37
  const jsInitTask = await (0, js_1.initGenerator)(tree, {
@@ -1,7 +0,0 @@
1
- const irisPreset = require("@trackunit/react-test-setup/preset").default;
2
- const nxPreset = require("@nx/jest/preset").default;
3
-
4
- module.exports = {
5
- ...nxPreset,
6
- ...irisPreset,
7
- };
@@ -1,14 +0,0 @@
1
- import {
2
- setupFailOnConsole,
3
- setupReactTestingLibrary,
4
- setupResizeObserver,
5
- setupTranslations,
6
- } from "@trackunit/react-test-setup";
7
-
8
- setupFailOnConsole();
9
- setupReactTestingLibrary();
10
- setupTranslations();
11
- setupResizeObserver();
12
-
13
- (global as unknown as { fetch: unknown }).fetch = require("jest-fetch-mock");
14
- (window as unknown as { URL: { createObjectURL: () => void } }).URL.createObjectURL = jest.fn();