@trackunit/iris-app 2.16.15 → 2.16.17
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 +15 -0
- package/migrations/repair-tsconfig/repair-tsconfig.js +205 -0
- package/migrations.json +5 -0
- package/package.json +19 -6
- package/src/generators/create/files/tsconfig.app.json__template__ +1 -0
- package/src/generators/create/generator.js +13 -21
- package/src/generators/extend/generator.js +26 -34
- package/src/generators/preset/generator.js +3 -7
- package/src/generators/utils/own-package-json/own-package-json.d.ts +14 -0
- package/src/generators/utils/own-package-json/own-package-json.js +29 -0
- package/src/generators/utils/pinned-versions/pinned-versions.d.ts +30 -0
- package/src/generators/utils/pinned-versions/pinned-versions.js +45 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## 2.16.17 (2026-11-13)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated iris-app-build-utilities to 3.0.29
|
|
6
|
+
- Updated iris-app-api to 2.13.17
|
|
7
|
+
- Updated react-vite-test-setup to 0.0.217
|
|
8
|
+
- Updated css-classname-utils to 0.0.125
|
|
9
|
+
- Updated react-graphql-tools to 1.23.48
|
|
10
|
+
- Updated shared-utils to 1.22.44
|
|
11
|
+
|
|
12
|
+
## 2.16.16 (2026-11-13)
|
|
13
|
+
|
|
14
|
+
This was a version bump only for iris-app to align it with other projects, there were no code changes.
|
|
15
|
+
|
|
1
16
|
## 2.16.15 (2026-11-12)
|
|
2
17
|
|
|
3
18
|
### 🧱 Updated Dependencies
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.repairTsconfig = exports.addJsxToIrisApps = exports.repairSdkPathAliases = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const js_1 = require("@nx/js");
|
|
6
|
+
// An internal entry point: safe only because iris-app pins @nx/js exactly. Check this export on every @nx/js bump.
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
8
|
+
const typescript_1 = require("typescript");
|
|
9
|
+
/**
|
|
10
|
+
* Repairs the TypeScript configuration of workspaces the SDK itself left
|
|
11
|
+
* unbuildable under a type-checked `nx build` (SDK-649).
|
|
12
|
+
*
|
|
13
|
+
* Root cause (path aliases): the `extend` generator wrote `tsconfig.base.json` `paths` entries
|
|
14
|
+
* without a leading `./` while the workspace preset leaves `baseUrl` unset, and
|
|
15
|
+
* TypeScript 6 rejects that combination with TS5090. Generators fixed in the
|
|
16
|
+
* SDK only help new workspaces, so existing ones are repaired here.
|
|
17
|
+
*
|
|
18
|
+
* Root cause (jsx): `iris-app:create` generated a `tsconfig.app.json` with no
|
|
19
|
+
* `jsx`, so once an extension manifest imports `./src/routeTree` (`.tsx`) the
|
|
20
|
+
* app's type-check fails with TS6142.
|
|
21
|
+
*
|
|
22
|
+
* Only alias targets that are non-relative and point at an existing
|
|
23
|
+
* `extension-manifest.ts` (the shape the SDK's `extend` generator writes) are
|
|
24
|
+
* touched; other aliases that would still trip TS5090 are reported with a
|
|
25
|
+
* warning. A file is only written when something in it changes, and is then
|
|
26
|
+
* re-serialised like every other JSON edit the SDK makes, so comments and
|
|
27
|
+
* trailing commas in that file are lost. A file this migration cannot read is
|
|
28
|
+
* skipped with a warning and never aborts the migration.
|
|
29
|
+
*/
|
|
30
|
+
const EXTENSION_MANIFEST_FILE = "extension-manifest.ts";
|
|
31
|
+
const IRIS_APP_MANIFEST_FILE = "iris-app-manifest.ts";
|
|
32
|
+
const APP_TSCONFIG_FILE = "tsconfig.app.json";
|
|
33
|
+
const JSX_VALUE = "react-jsx";
|
|
34
|
+
// TODO(SDK-742): promote `isRecord` and `errorMessage` to @trackunit/shared-utils; they are copied here for now.
|
|
35
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
36
|
+
const errorMessage = (error) => (error instanceof Error ? error.message : String(error));
|
|
37
|
+
/** Reads a tsconfig (devkit's `readJson` accepts comments and trailing commas); `undefined` when it is not a JSON object. */
|
|
38
|
+
const readJsonObject = (tree, filePath) => {
|
|
39
|
+
const parsed = (0, devkit_1.readJson)(tree, filePath);
|
|
40
|
+
return isRecord(parsed) ? parsed : undefined;
|
|
41
|
+
};
|
|
42
|
+
/** TypeScript's own syntax diagnostics (TS1xxx), such as "'}' expected": the JSON of a file in the chain is broken. */
|
|
43
|
+
const isSyntaxDiagnostic = (diagnostic) => diagnostic.code < 2000;
|
|
44
|
+
/**
|
|
45
|
+
* What TypeScript itself makes of a tsconfig, `extends` chain included: the options and whether the chain could be
|
|
46
|
+
* read in full. The Tree-backed host resolves the chain exactly like `tsc`, package-form bases such as
|
|
47
|
+
* `@tsconfig/strictest` included. A chain with a missing base or broken JSON is not read in full, since an option
|
|
48
|
+
* missing from what could be read may be set in what could not.
|
|
49
|
+
*/
|
|
50
|
+
const resolveEffectiveConfig = (tree, filePath) => {
|
|
51
|
+
const parsed = (0, js_1.readTsConfig)(filePath, (0, internal_1.createTreeParseConfigHost)(tree));
|
|
52
|
+
return {
|
|
53
|
+
options: parsed.options,
|
|
54
|
+
chainReadable: !(0, js_1.extendsResolutionFailed)(parsed.errors) && !parsed.errors.some(isSyntaxDiagnostic),
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* The forward-slash form of an alias target the SDK wrote, or `undefined` when
|
|
59
|
+
* the target is not one. The `extend` generator builds targets with
|
|
60
|
+
* `path.join`, so ones created on Windows carry backslashes.
|
|
61
|
+
*/
|
|
62
|
+
const sdkExtensionManifestTarget = (tree, target) => {
|
|
63
|
+
if (typeof target !== "string") {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const normalised = (0, devkit_1.normalizePath)(target);
|
|
67
|
+
const isManifest = normalised === EXTENSION_MANIFEST_FILE || normalised.endsWith(`/${EXTENSION_MANIFEST_FILE}`);
|
|
68
|
+
return isManifest && !(0, typescript_1.isExternalModuleNameRelative)(normalised) && tree.exists(normalised) ? normalised : undefined;
|
|
69
|
+
};
|
|
70
|
+
/** Whether any target of `paths` is an SDK extension manifest target that still lacks its `./`. */
|
|
71
|
+
const hasSdkAliasToRepair = (tree, paths) => Object.values(paths).some(targets => Array.isArray(targets) && targets.some(target => sdkExtensionManifestTarget(tree, target) !== undefined));
|
|
72
|
+
/**
|
|
73
|
+
* Prefixes `./` onto every SDK extension manifest target of `paths`, in place.
|
|
74
|
+
* The prefix never changes what an alias resolves to: with `baseUrl` set,
|
|
75
|
+
* targets resolve against it and `./libs/x` is the same path as `libs/x`;
|
|
76
|
+
* without it they resolve against the tsconfig and TypeScript 6 requires the
|
|
77
|
+
* `./`.
|
|
78
|
+
*/
|
|
79
|
+
const prefixSdkAliases = (tree, paths) => {
|
|
80
|
+
for (const targets of Object.values(paths)) {
|
|
81
|
+
if (!Array.isArray(targets)) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
targets.forEach((target, index) => {
|
|
85
|
+
const manifestPath = sdkExtensionManifestTarget(tree, target);
|
|
86
|
+
if (manifestPath !== undefined) {
|
|
87
|
+
targets[index] = `./${manifestPath}`;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Aliases this migration leaves alone that still break a type-checked build:
|
|
94
|
+
* TS5090 applies to every non-relative `paths` target once no `baseUrl`
|
|
95
|
+
* applies, not only the SDK's. They are reported, never rewritten.
|
|
96
|
+
*/
|
|
97
|
+
const remainingNonRelativeAliases = (tree, paths) => Object.entries(paths)
|
|
98
|
+
.filter(([, targets]) => Array.isArray(targets) &&
|
|
99
|
+
targets.some((target) => typeof target === "string" &&
|
|
100
|
+
!(0, typescript_1.isExternalModuleNameRelative)((0, devkit_1.normalizePath)(target)) &&
|
|
101
|
+
sdkExtensionManifestTarget(tree, target) === undefined))
|
|
102
|
+
.map(([alias]) => alias);
|
|
103
|
+
const repairPathAliasesIn = (tree, rootTsConfigPath) => {
|
|
104
|
+
const tsConfig = readJsonObject(tree, rootTsConfigPath);
|
|
105
|
+
if (tsConfig === undefined || !isRecord(tsConfig.compilerOptions) || !isRecord(tsConfig.compilerOptions.paths)) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const { paths } = tsConfig.compilerOptions;
|
|
109
|
+
// The warning is only true when no baseUrl applies, whether the file sets it or inherits it through `extends`.
|
|
110
|
+
// A chain that cannot be read leaves that unknown, and an unknown is not worth a possibly false warning.
|
|
111
|
+
const { options, chainReadable } = resolveEffectiveConfig(tree, rootTsConfigPath);
|
|
112
|
+
const remaining = chainReadable && options.baseUrl === undefined ? remainingNonRelativeAliases(tree, paths) : [];
|
|
113
|
+
if (remaining.length > 0) {
|
|
114
|
+
devkit_1.logger.warn(`${rootTsConfigPath} has path aliases with non-relative targets, which TypeScript rejects when no baseUrl is set (TS5090): ${remaining.join(", ")}. They were not written by the Iris App SDK, so they were left as they are; add a leading "./" to their targets if the workspace sets no baseUrl.`);
|
|
115
|
+
}
|
|
116
|
+
if (hasSdkAliasToRepair(tree, paths)) {
|
|
117
|
+
(0, devkit_1.updateJson)(tree, rootTsConfigPath, json => {
|
|
118
|
+
if (isRecord(json.compilerOptions) && isRecord(json.compilerOptions.paths)) {
|
|
119
|
+
prefixSdkAliases(tree, json.compilerOptions.paths);
|
|
120
|
+
}
|
|
121
|
+
return json;
|
|
122
|
+
});
|
|
123
|
+
devkit_1.logger.info(`Repaired SDK path aliases in ${rootTsConfigPath}: prefixed "./" onto extension manifest paths.`);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Prefixes `./` onto the `paths` entries of the root tsconfig that point at an
|
|
128
|
+
* existing project's `extension-manifest.ts`.
|
|
129
|
+
*
|
|
130
|
+
* @param tree - Nx virtual file tree.
|
|
131
|
+
*/
|
|
132
|
+
const repairSdkPathAliases = (tree) => {
|
|
133
|
+
// Typed `string | null`, but at runtime it falls back to `tsconfig.base.json` even when neither candidate exists,
|
|
134
|
+
// so a path that is not there has to be checked for as well.
|
|
135
|
+
const rootTsConfigPath = (0, js_1.getRootTsConfigPathInTree)(tree);
|
|
136
|
+
if (rootTsConfigPath === null || !tree.exists(rootTsConfigPath)) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
repairPathAliasesIn(tree, rootTsConfigPath);
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
devkit_1.logger.warn(`Skipped path alias repair for ${rootTsConfigPath}: ${errorMessage(error)}`);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
exports.repairSdkPathAliases = repairSdkPathAliases;
|
|
147
|
+
const irisAppRoots = (tree) => Array.from((0, devkit_1.getProjects)(tree).values(), project => project.root).filter(root => tree.exists((0, devkit_1.joinPathFragments)(root, IRIS_APP_MANIFEST_FILE)));
|
|
148
|
+
const addJsxToApp = (tree, appRoot) => {
|
|
149
|
+
const appTsConfigPath = (0, devkit_1.joinPathFragments)(appRoot, APP_TSCONFIG_FILE);
|
|
150
|
+
if (!tree.isFile(appTsConfigPath)) {
|
|
151
|
+
devkit_1.logger.warn(`Skipped jsx repair for ${appRoot}: ${appTsConfigPath} not found.`);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const appTsConfig = readJsonObject(tree, appTsConfigPath);
|
|
155
|
+
if (appTsConfig === undefined) {
|
|
156
|
+
devkit_1.logger.warn(`Skipped jsx repair for ${appTsConfigPath}: it is not a JSON object.`);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (appTsConfig.compilerOptions !== undefined && !isRecord(appTsConfig.compilerOptions)) {
|
|
160
|
+
devkit_1.logger.warn(`Skipped jsx repair for ${appTsConfigPath}: its compilerOptions is not an object.`);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
// Only a chain read in full can show `jsx` is missing, so an unreadable one is left alone.
|
|
164
|
+
const { options, chainReadable } = resolveEffectiveConfig(tree, appTsConfigPath);
|
|
165
|
+
if (!chainReadable || options.jsx !== undefined) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
(0, devkit_1.updateJson)(tree, appTsConfigPath, json => ({
|
|
169
|
+
...json,
|
|
170
|
+
compilerOptions: { ...(isRecord(json.compilerOptions) ? json.compilerOptions : {}), jsx: JSX_VALUE },
|
|
171
|
+
}));
|
|
172
|
+
devkit_1.logger.info(`Added "jsx": "${JSX_VALUE}" to ${appTsConfigPath}.`);
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Adds `jsx: "react-jsx"` to the `tsconfig.app.json` of every Iris app (a
|
|
176
|
+
* project with an `iris-app-manifest.ts`) whose effective tsconfig chain
|
|
177
|
+
* (`tsconfig.app.json` -> `tsconfig.json` -> `tsconfig.base.json`, via
|
|
178
|
+
* `extends`) sets no `jsx`. An app that configures `jsx` anywhere in the chain,
|
|
179
|
+
* or whose chain cannot be read in full, is left alone.
|
|
180
|
+
*
|
|
181
|
+
* @param tree - Nx virtual file tree.
|
|
182
|
+
*/
|
|
183
|
+
const addJsxToIrisApps = (tree) => {
|
|
184
|
+
for (const appRoot of irisAppRoots(tree)) {
|
|
185
|
+
try {
|
|
186
|
+
addJsxToApp(tree, appRoot);
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
devkit_1.logger.warn(`Skipped jsx repair for ${appRoot}: ${errorMessage(error)}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
exports.addJsxToIrisApps = addJsxToIrisApps;
|
|
194
|
+
/**
|
|
195
|
+
* Repairs tsconfig defects the SDK left in existing workspaces.
|
|
196
|
+
*
|
|
197
|
+
* @param tree - Nx virtual file tree.
|
|
198
|
+
*/
|
|
199
|
+
const repairTsconfig = (tree) => {
|
|
200
|
+
(0, exports.repairSdkPathAliases)(tree);
|
|
201
|
+
(0, exports.addJsxToIrisApps)(tree);
|
|
202
|
+
};
|
|
203
|
+
exports.repairTsconfig = repairTsconfig;
|
|
204
|
+
exports.default = exports.repairTsconfig;
|
|
205
|
+
//# sourceMappingURL=repair-tsconfig.js.map
|
package/migrations.json
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
"version": "2.5.13",
|
|
5
5
|
"description": "Rewrite the legacy page-content Tailwind class to overflow-auto p-content-space, invent p-content-space on high-confidence Asset Home/Site Home/Admin content shells, and remove now-redundant bottom-inset classes.",
|
|
6
6
|
"implementation": "./migrations/p-content-space-codemod/orchestrator"
|
|
7
|
+
},
|
|
8
|
+
"v2-16-6-repair-tsconfig": {
|
|
9
|
+
"version": "2.16.6",
|
|
10
|
+
"description": "Repair the tsconfig of SDK-created workspaces so a type-checked build passes: prefix ./ on SDK-created extension path aliases in tsconfig.base.json (fixes TS5090) and add jsx react-jsx to Iris apps whose tsconfig chain sets none (fixes TS6142). Developer-written aliases and existing jsx/baseUrl settings are left untouched.",
|
|
11
|
+
"implementation": "./migrations/repair-tsconfig/repair-tsconfig"
|
|
7
12
|
}
|
|
8
13
|
}
|
|
9
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/iris-app",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.17",
|
|
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.
|
|
13
|
+
"@trackunit/css-classname-utils": "0.0.125",
|
|
14
14
|
"@typescript-eslint/types": "8.71.2",
|
|
15
15
|
"@typescript-eslint/typescript-estree": "8.71.2",
|
|
16
16
|
"pacote": "^21.5.1",
|
|
@@ -27,16 +27,29 @@
|
|
|
27
27
|
"@npmcli/arborist": "^9.1.9",
|
|
28
28
|
"win-ca": "^3.5.1",
|
|
29
29
|
"node-forge": "^1.4.3",
|
|
30
|
-
"@trackunit/iris-app-build-utilities": "3.0.
|
|
31
|
-
"@trackunit/react-graphql-tools": "1.23.
|
|
32
|
-
"@trackunit/shared-utils": "1.22.
|
|
33
|
-
"@trackunit/iris-app-api": "2.13.
|
|
30
|
+
"@trackunit/iris-app-build-utilities": "3.0.29",
|
|
31
|
+
"@trackunit/react-graphql-tools": "1.23.48",
|
|
32
|
+
"@trackunit/shared-utils": "1.22.44",
|
|
33
|
+
"@trackunit/iris-app-api": "2.13.17",
|
|
34
34
|
"tslib": "^2.6.2",
|
|
35
35
|
"@clack/prompts": "^1.8.1",
|
|
36
36
|
"@nx/devkit": "23.3.0",
|
|
37
37
|
"nx": "23.3.0"
|
|
38
38
|
},
|
|
39
39
|
"migrations": "./migrations.json",
|
|
40
|
+
"pinnedVersions": {
|
|
41
|
+
"@trackunit/iris-app-api": "2.13.17",
|
|
42
|
+
"@trackunit/react-components": "6.0.39",
|
|
43
|
+
"@trackunit/react-core-contexts": "2.20.40",
|
|
44
|
+
"@trackunit/css-core": "1.22.45",
|
|
45
|
+
"@trackunit/iris-app-sdk-vite": "1.11.51",
|
|
46
|
+
"@trackunit/react-core-contexts-test": "1.28.35",
|
|
47
|
+
"@trackunit/react-vite-test-setup": "0.0.217",
|
|
48
|
+
"@trackunit/iris-app-runtime-core": "1.28.35",
|
|
49
|
+
"@trackunit/serverside-utils": "0.5.303",
|
|
50
|
+
"@trackunit/migrations": "0.2.160",
|
|
51
|
+
"@trackunit/eslint-plugin-trackunit": "0.8.7"
|
|
52
|
+
},
|
|
40
53
|
"types": "./src/index.d.ts",
|
|
41
54
|
"type": "commonjs"
|
|
42
55
|
}
|
|
@@ -5,7 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const internal_1 = require("@nx/js/internal");
|
|
7
7
|
const path = tslib_1.__importStar(require("path"));
|
|
8
|
-
const
|
|
8
|
+
const own_package_json_1 = require("../utils/own-package-json/own-package-json");
|
|
9
|
+
const pinned_versions_1 = require("../utils/pinned-versions/pinned-versions");
|
|
9
10
|
const uses_trackunit_eslint_plugin_1 = require("../utils/uses-trackunit-eslint-plugin");
|
|
10
11
|
const write_trackunit_project_eslint_config_1 = require("../utils/write-trackunit-project-eslint-config");
|
|
11
12
|
function normalizeOptions(tree, options) {
|
|
@@ -53,30 +54,21 @@ function addFiles(tree, options, packageJson, useTrackunitLint) {
|
|
|
53
54
|
const IrisAppGenerator = async function (tree, options) {
|
|
54
55
|
const normalizedOptions = normalizeOptions(tree, options);
|
|
55
56
|
const useTrackunitLint = (0, uses_trackunit_eslint_plugin_1.usesTrackunitEslintPlugin)(tree);
|
|
56
|
-
const
|
|
57
|
-
const packageJsonLocally = (0, devkit_1.readJsonFile)(path.join(__dirname, "..", "..", "..", "package.json"));
|
|
57
|
+
const packageJsonLocally = (0, own_package_json_1.readOwnPackageJson)();
|
|
58
58
|
if (options.updatePackageJson) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
const reactComponentsPackageJsonFromNpm = (0, get_package_manifest_1.getPackageManifest)("@trackunit/react-components");
|
|
64
|
-
const reactCoreContextsPackageJsonFromNpm = (0, get_package_manifest_1.getPackageManifest)("@trackunit/react-core-contexts");
|
|
65
|
-
const cssCorePackageJsonFromNpm = (0, get_package_manifest_1.getPackageManifest)("@trackunit/css-core");
|
|
66
|
-
const irisAppApiPackageJsonFromNpm = (0, get_package_manifest_1.getPackageManifest)("@trackunit/iris-app-api");
|
|
59
|
+
// No registry lookup: it would ignore the developer's npm release-age policy.
|
|
60
|
+
// eslint-disable-next-line no-console
|
|
61
|
+
console.log("Keep the SDK current with: npx nx g @trackunit/migrations:migrate");
|
|
67
62
|
const tuDependencies = {
|
|
68
|
-
"@trackunit/react-components": (
|
|
69
|
-
"@trackunit/react-core-contexts": (
|
|
70
|
-
"@trackunit/css-core": (
|
|
71
|
-
"@trackunit/iris-app-api": (
|
|
63
|
+
"@trackunit/react-components": (0, pinned_versions_1.getPinnedVersion)("@trackunit/react-components"),
|
|
64
|
+
"@trackunit/react-core-contexts": (0, pinned_versions_1.getPinnedVersion)("@trackunit/react-core-contexts"),
|
|
65
|
+
"@trackunit/css-core": (0, pinned_versions_1.getPinnedVersion)("@trackunit/css-core"),
|
|
66
|
+
"@trackunit/iris-app-api": (0, pinned_versions_1.getPinnedVersion)("@trackunit/iris-app-api"),
|
|
72
67
|
};
|
|
73
|
-
const irisAppSdkVitePackageJsonFromNpm = (0, get_package_manifest_1.getPackageManifest)("@trackunit/iris-app-sdk-vite");
|
|
74
|
-
const reactCoreContextsTestPackageJsonFromNpm = (0, get_package_manifest_1.getPackageManifest)("@trackunit/react-core-contexts-test");
|
|
75
|
-
const reactViteTestSetupPackageJsonFromNpm = (0, get_package_manifest_1.getPackageManifest)("@trackunit/react-vite-test-setup");
|
|
76
68
|
const tuDevDependencies = {
|
|
77
|
-
"@trackunit/iris-app-sdk-vite": (
|
|
78
|
-
"@trackunit/react-core-contexts-test": (
|
|
79
|
-
"@trackunit/react-vite-test-setup": (
|
|
69
|
+
"@trackunit/iris-app-sdk-vite": (0, pinned_versions_1.getPinnedVersion)("@trackunit/iris-app-sdk-vite"),
|
|
70
|
+
"@trackunit/react-core-contexts-test": (0, pinned_versions_1.getPinnedVersion)("@trackunit/react-core-contexts-test"),
|
|
71
|
+
"@trackunit/react-vite-test-setup": (0, pinned_versions_1.getPinnedVersion)("@trackunit/react-vite-test-setup"),
|
|
80
72
|
};
|
|
81
73
|
(0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
82
74
|
...tuDependencies,
|
|
@@ -9,11 +9,10 @@ const internal_1 = require("@nx/js/internal");
|
|
|
9
9
|
const react_1 = require("@nx/react");
|
|
10
10
|
const iris_app_api_1 = require("@trackunit/iris-app-api");
|
|
11
11
|
const react_graphql_tools_1 = require("@trackunit/react-graphql-tools");
|
|
12
|
-
const fs = tslib_1.__importStar(require("fs"));
|
|
13
12
|
const path = tslib_1.__importStar(require("path"));
|
|
14
13
|
const string_ts_1 = require("string-ts");
|
|
15
14
|
const ts_morph_1 = require("ts-morph");
|
|
16
|
-
const
|
|
15
|
+
const pinned_versions_1 = require("../utils/pinned-versions/pinned-versions");
|
|
17
16
|
const uses_trackunit_eslint_plugin_1 = require("../utils/uses-trackunit-eslint-plugin");
|
|
18
17
|
const write_trackunit_project_eslint_config_1 = require("../utils/write-trackunit-project-eslint-config");
|
|
19
18
|
const dependencies_1 = require("./dependencies");
|
|
@@ -55,7 +54,6 @@ const addServersideGraphql = async (tree, options) => {
|
|
|
55
54
|
});
|
|
56
55
|
};
|
|
57
56
|
exports.addServersideGraphql = addServersideGraphql;
|
|
58
|
-
const getPackageVersion = async (packageName) => (await (0, get_package_manifest_1.getPackageManifest)(packageName)).version;
|
|
59
57
|
function normalizeOptions(tree, options) {
|
|
60
58
|
const name = (0, devkit_1.names)(options.name).fileName;
|
|
61
59
|
const projectDirectory = options.directory ? `${(0, devkit_1.names)(options.directory).fileName}/${name}` : name;
|
|
@@ -112,11 +110,11 @@ const IrisAppExtensionGenerator = async function (tree, options) {
|
|
|
112
110
|
if (normalizedOptions.updatePackageJson) {
|
|
113
111
|
const uiExtensionDependencies = iris_app_api_1.nonUiExtensionTypes.includes(irisAppExtensionType)
|
|
114
112
|
? {}
|
|
115
|
-
: { "@trackunit/iris-app-runtime-core":
|
|
113
|
+
: { "@trackunit/iris-app-runtime-core": (0, pinned_versions_1.getPinnedVersion)("@trackunit/iris-app-runtime-core") };
|
|
116
114
|
(0, devkit_1.addDependenciesToPackageJson)(tree, uiExtensionDependencies, {
|
|
117
115
|
...dependencies_1.spaDependencies,
|
|
118
116
|
...dependencies_1.testDependencies,
|
|
119
|
-
"@trackunit/react-vite-test-setup":
|
|
117
|
+
"@trackunit/react-vite-test-setup": (0, pinned_versions_1.getPinnedVersion)("@trackunit/react-vite-test-setup"),
|
|
120
118
|
});
|
|
121
119
|
}
|
|
122
120
|
const schema = {
|
|
@@ -173,8 +171,10 @@ const IrisAppExtensionGenerator = async function (tree, options) {
|
|
|
173
171
|
esModuleInterop: true,
|
|
174
172
|
};
|
|
175
173
|
}
|
|
174
|
+
// Bug fix: prefix "./" (SDK-576). Root cause: with TypeScript 6 and no `baseUrl` in the generated
|
|
175
|
+
// workspace, non-relative `paths` entries are rejected (TS5090) and break type-checked builds.
|
|
176
176
|
tsConfigBase.compilerOptions.paths[normalizedOptions.importPath] = [
|
|
177
|
-
|
|
177
|
+
`./${(0, devkit_1.joinPathFragments)(normalizedOptions.projectRoot, "extension-manifest.ts")}`,
|
|
178
178
|
];
|
|
179
179
|
return tsConfigBase;
|
|
180
180
|
});
|
|
@@ -235,7 +235,7 @@ const IrisAppExtensionGenerator = async function (tree, options) {
|
|
|
235
235
|
projectName: normalizedOptions.projectName,
|
|
236
236
|
projectRoot: normalizedOptions.projectRoot,
|
|
237
237
|
className: (0, devkit_1.names)(normalizedOptions.name).className,
|
|
238
|
-
serversideUtilsVersion:
|
|
238
|
+
serversideUtilsVersion: (0, pinned_versions_1.getPinnedVersion)("@trackunit/serverside-utils"),
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
241
|
//TODO: Change the following to update the manifest in the virtual Tree - not on the file system.
|
|
@@ -293,35 +293,27 @@ const IrisAppExtensionGenerator = async function (tree, options) {
|
|
|
293
293
|
};
|
|
294
294
|
};
|
|
295
295
|
exports.IrisAppExtensionGenerator = IrisAppExtensionGenerator;
|
|
296
|
+
const IRIS_APP_MANIFEST_FILE = "iris-app-manifest.ts";
|
|
297
|
+
/**
|
|
298
|
+
* The Iris apps in the workspace, as paths relative to the apps directory: an app either sits directly in a folder
|
|
299
|
+
* of it or one level further down, and is recognised by its `iris-app-manifest.ts`. Reads the Tree, not the disk.
|
|
300
|
+
*/
|
|
301
|
+
const findIrisApps = (tree) => {
|
|
302
|
+
const { appsDir } = (0, devkit_1.getWorkspaceLayout)(tree);
|
|
303
|
+
const directoriesIn = (dir) => tree.children(dir).filter(name => !tree.isFile((0, devkit_1.joinPathFragments)(dir, name)));
|
|
304
|
+
const hasManifest = (dir) => tree.isFile((0, devkit_1.joinPathFragments)(dir, IRIS_APP_MANIFEST_FILE));
|
|
305
|
+
return directoriesIn(appsDir).flatMap(folder => {
|
|
306
|
+
const folderPath = (0, devkit_1.joinPathFragments)(appsDir, folder);
|
|
307
|
+
return hasManifest(folderPath)
|
|
308
|
+
? [folder]
|
|
309
|
+
: directoriesIn(folderPath)
|
|
310
|
+
.filter(subFolder => hasManifest((0, devkit_1.joinPathFragments)(folderPath, subFolder)))
|
|
311
|
+
.map(subFolder => (0, devkit_1.joinPathFragments)(folder, subFolder));
|
|
312
|
+
});
|
|
313
|
+
};
|
|
296
314
|
const updateAppName = async (tree, options) => {
|
|
297
315
|
if (!options.app) {
|
|
298
|
-
const
|
|
299
|
-
.readdirSync((0, devkit_1.getWorkspaceLayout)(tree).appsDir, { withFileTypes: true })
|
|
300
|
-
.filter(item => item.isDirectory());
|
|
301
|
-
const tileApps = [];
|
|
302
|
-
folders.forEach(folder => {
|
|
303
|
-
const irisAppManifest = fs
|
|
304
|
-
.readdirSync(`${(0, devkit_1.getWorkspaceLayout)(tree).appsDir}/${folder.name}`, { withFileTypes: true })
|
|
305
|
-
.find(item => item.name === "iris-app-manifest.ts");
|
|
306
|
-
if (irisAppManifest) {
|
|
307
|
-
tileApps.push(folder.name);
|
|
308
|
-
}
|
|
309
|
-
else {
|
|
310
|
-
const subFolders = fs
|
|
311
|
-
.readdirSync(path.join((0, devkit_1.getWorkspaceLayout)(tree).appsDir, folder.name), { withFileTypes: true })
|
|
312
|
-
.filter(item => item.isDirectory());
|
|
313
|
-
subFolders.forEach(subFolder => {
|
|
314
|
-
const subDirIrisAppManifest = fs
|
|
315
|
-
.readdirSync(`${(0, devkit_1.getWorkspaceLayout)(tree).appsDir}/${folder.name}/${subFolder.name}`, {
|
|
316
|
-
withFileTypes: true,
|
|
317
|
-
})
|
|
318
|
-
.find(item => item.name === "iris-app-manifest.ts");
|
|
319
|
-
if (subDirIrisAppManifest) {
|
|
320
|
-
tileApps.push(path.join(folder.name, subFolder.name));
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
});
|
|
316
|
+
const tileApps = findIrisApps(tree);
|
|
325
317
|
if (tileApps.length === 1) {
|
|
326
318
|
options.app = tileApps[0] || "<Missing iris app name>";
|
|
327
319
|
}
|
|
@@ -6,8 +6,8 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
7
|
const react_1 = require("@nx/react");
|
|
8
8
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
|
-
const get_package_manifest_1 = require("../utils/get-package-manifest");
|
|
10
9
|
const link_claude_skills_1 = require("../utils/link-claude-skills");
|
|
10
|
+
const pinned_versions_1 = require("../utils/pinned-versions/pinned-versions");
|
|
11
11
|
const uses_trackunit_eslint_plugin_1 = require("../utils/uses-trackunit-eslint-plugin");
|
|
12
12
|
/**
|
|
13
13
|
* Preset generator for Iris apps workspace.
|
|
@@ -54,18 +54,14 @@ async function presetGenerator(tree, options) {
|
|
|
54
54
|
tsconfig.compilerOptions.strict = true;
|
|
55
55
|
return tsconfig;
|
|
56
56
|
});
|
|
57
|
-
const [migrationsManifest, eslintPluginTrackunitManifest] = await Promise.all([
|
|
58
|
-
(0, get_package_manifest_1.getPackageManifest)("@trackunit/migrations"),
|
|
59
|
-
(0, get_package_manifest_1.getPackageManifest)(uses_trackunit_eslint_plugin_1.TRACKUNIT_ESLINT_PLUGIN),
|
|
60
|
-
]);
|
|
61
57
|
(0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
62
58
|
react: "19.3.0",
|
|
63
59
|
"react-dom": "19.3.0",
|
|
64
60
|
}, {
|
|
65
61
|
// Ships the generator that upgrades every @trackunit/* dependency, so a new
|
|
66
62
|
// workspace can run the documented upgrade flow without installing it first.
|
|
67
|
-
"@trackunit/migrations":
|
|
68
|
-
[uses_trackunit_eslint_plugin_1.TRACKUNIT_ESLINT_PLUGIN]:
|
|
63
|
+
"@trackunit/migrations": (0, pinned_versions_1.getPinnedVersion)("@trackunit/migrations"),
|
|
64
|
+
[uses_trackunit_eslint_plugin_1.TRACKUNIT_ESLINT_PLUGIN]: (0, pinned_versions_1.getPinnedVersion)(uses_trackunit_eslint_plugin_1.TRACKUNIT_ESLINT_PLUGIN),
|
|
69
65
|
"@typescript-eslint/parser": "8.71.2",
|
|
70
66
|
eslint: "9.33.0",
|
|
71
67
|
"@nx/eslint": "23.3.0",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PackageJson } from "nx/src/utils/package-json";
|
|
2
|
+
/** This package's own package.json, the one place in the SDK that locates it. */
|
|
3
|
+
export declare const OWN_PACKAGE_JSON_PATH: string;
|
|
4
|
+
export type OwnPackageJson = PackageJson & {
|
|
5
|
+
engines?: Record<string, string>;
|
|
6
|
+
/** Exact versions of the packages the generators write into workspaces; CI's sync-versions step sets them. */
|
|
7
|
+
pinnedVersions?: Record<string, string | undefined>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Reads this package's own package.json.
|
|
11
|
+
*
|
|
12
|
+
* @returns {OwnPackageJson} the parsed package.json of `@trackunit/iris-app`
|
|
13
|
+
*/
|
|
14
|
+
export declare const readOwnPackageJson: () => OwnPackageJson;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readOwnPackageJson = exports.OWN_PACKAGE_JSON_PATH = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
7
|
+
/**
|
|
8
|
+
* Finds this package's own package.json with TypeScript's upward search from this file, so nothing here depends on how
|
|
9
|
+
* deep the file sits. The nearest package.json upward is the package's own in all three layouts: the monorepo source
|
|
10
|
+
* (`libs/iris-app-sdk/iris-app/`), the build (`dist/libs/iris-app-sdk/iris-app/`) and an install
|
|
11
|
+
* (`node_modules/@trackunit/iris-app/`). Nothing under `src/` may get a package.json of its own.
|
|
12
|
+
*/
|
|
13
|
+
const findOwnPackageJson = () => {
|
|
14
|
+
const found = ts.findConfigFile(__dirname, ts.sys.fileExists, "package.json");
|
|
15
|
+
if (found === undefined) {
|
|
16
|
+
throw new Error(`Could not find the package.json of @trackunit/iris-app above ${__dirname}. The SDK install is incomplete; reinstall @trackunit/iris-app.`);
|
|
17
|
+
}
|
|
18
|
+
return found;
|
|
19
|
+
};
|
|
20
|
+
/** This package's own package.json, the one place in the SDK that locates it. */
|
|
21
|
+
exports.OWN_PACKAGE_JSON_PATH = findOwnPackageJson();
|
|
22
|
+
/**
|
|
23
|
+
* Reads this package's own package.json.
|
|
24
|
+
*
|
|
25
|
+
* @returns {OwnPackageJson} the parsed package.json of `@trackunit/iris-app`
|
|
26
|
+
*/
|
|
27
|
+
const readOwnPackageJson = () => (0, devkit_1.readJsonFile)(exports.OWN_PACKAGE_JSON_PATH);
|
|
28
|
+
exports.readOwnPackageJson = readOwnPackageJson;
|
|
29
|
+
//# sourceMappingURL=own-package-json.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type PinnedVersionsOptions = {
|
|
2
|
+
/** Absolute path of the package.json to read the pins from. Defaults to this package's own, used by tests. */
|
|
3
|
+
packageJsonPath?: string;
|
|
4
|
+
};
|
|
5
|
+
type PinnedVersions = Readonly<Record<string, string | undefined>>;
|
|
6
|
+
/**
|
|
7
|
+
* Reads the `pinnedVersions` field of a package.json: the exact `@trackunit/*` versions this release of the SDK was
|
|
8
|
+
* built against. The one way to read the pins, so specs read them the way the generators do.
|
|
9
|
+
*
|
|
10
|
+
* @param packageJsonPath absolute path of the package.json to read; defaults to this package's own
|
|
11
|
+
* @returns {PinnedVersions} the pins by package name, empty when the field is missing
|
|
12
|
+
* @throws {Error} naming the file when it is missing (ENOENT) or not valid JSON; devkit's `readJsonFile` puts the path
|
|
13
|
+
* in both messages
|
|
14
|
+
*/
|
|
15
|
+
export declare const readPinnedVersions: (packageJsonPath?: string) => PinnedVersions;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the exact version of a `@trackunit/*` package this release of the SDK was built against.
|
|
18
|
+
*
|
|
19
|
+
* The pins live in the `pinnedVersions` field of this package's own package.json, which CI's sync-versions step
|
|
20
|
+
* sets to the to-be-published versions before the package is built and published.
|
|
21
|
+
*
|
|
22
|
+
* Never consults the npm registry and never returns "latest": a missing pin is a broken install and fails loudly,
|
|
23
|
+
* so workspace creation cannot pick a version the developer's npm release-age policy forbids.
|
|
24
|
+
*
|
|
25
|
+
* @param packageName full package name, e.g. `@trackunit/react-components`
|
|
26
|
+
* @param options override location of the package.json, used by tests
|
|
27
|
+
* @returns {string} the exact pinned version, e.g. `6.0.17`
|
|
28
|
+
*/
|
|
29
|
+
export declare const getPinnedVersion: (packageName: string, options?: PinnedVersionsOptions) => string;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPinnedVersion = exports.readPinnedVersions = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const semver_1 = require("semver");
|
|
6
|
+
const own_package_json_1 = require("../own-package-json/own-package-json");
|
|
7
|
+
/**
|
|
8
|
+
* A pin must be an exact version: "", "latest" and ranges would reopen the registry-"latest" problem.
|
|
9
|
+
* `valid` normalises (trims, strips a leading "v"), so only a string it returns unchanged is exact.
|
|
10
|
+
*/
|
|
11
|
+
const isExactVersion = (version) => (0, semver_1.valid)(version) === version;
|
|
12
|
+
/**
|
|
13
|
+
* Reads the `pinnedVersions` field of a package.json: the exact `@trackunit/*` versions this release of the SDK was
|
|
14
|
+
* built against. The one way to read the pins, so specs read them the way the generators do.
|
|
15
|
+
*
|
|
16
|
+
* @param packageJsonPath absolute path of the package.json to read; defaults to this package's own
|
|
17
|
+
* @returns {PinnedVersions} the pins by package name, empty when the field is missing
|
|
18
|
+
* @throws {Error} naming the file when it is missing (ENOENT) or not valid JSON; devkit's `readJsonFile` puts the path
|
|
19
|
+
* in both messages
|
|
20
|
+
*/
|
|
21
|
+
const readPinnedVersions = (packageJsonPath = own_package_json_1.OWN_PACKAGE_JSON_PATH) => (0, devkit_1.readJsonFile)(packageJsonPath).pinnedVersions ?? {};
|
|
22
|
+
exports.readPinnedVersions = readPinnedVersions;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the exact version of a `@trackunit/*` package this release of the SDK was built against.
|
|
25
|
+
*
|
|
26
|
+
* The pins live in the `pinnedVersions` field of this package's own package.json, which CI's sync-versions step
|
|
27
|
+
* sets to the to-be-published versions before the package is built and published.
|
|
28
|
+
*
|
|
29
|
+
* Never consults the npm registry and never returns "latest": a missing pin is a broken install and fails loudly,
|
|
30
|
+
* so workspace creation cannot pick a version the developer's npm release-age policy forbids.
|
|
31
|
+
*
|
|
32
|
+
* @param packageName full package name, e.g. `@trackunit/react-components`
|
|
33
|
+
* @param options override location of the package.json, used by tests
|
|
34
|
+
* @returns {string} the exact pinned version, e.g. `6.0.17`
|
|
35
|
+
*/
|
|
36
|
+
const getPinnedVersion = (packageName, options = {}) => {
|
|
37
|
+
const packageJsonPath = options.packageJsonPath ?? own_package_json_1.OWN_PACKAGE_JSON_PATH;
|
|
38
|
+
const version = (0, exports.readPinnedVersions)(packageJsonPath)[packageName];
|
|
39
|
+
if (!isExactVersion(version)) {
|
|
40
|
+
throw new Error(`No valid pinned version for ${packageName} in the "pinnedVersions" field of ${packageJsonPath}. The SDK install is incomplete; reinstall @trackunit/iris-app.`);
|
|
41
|
+
}
|
|
42
|
+
return version;
|
|
43
|
+
};
|
|
44
|
+
exports.getPinnedVersion = getPinnedVersion;
|
|
45
|
+
//# sourceMappingURL=pinned-versions.js.map
|