@trackunit/iris-app-build-utilities 2.4.12 → 2.4.13
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 +7 -0
- package/package.json +3 -3
- package/src/checkContentInsetAdoption.d.ts +16 -0
- package/src/checkContentInsetAdoption.js +36 -0
- package/src/checkContentSpaceAdoption.d.ts +9 -0
- package/src/checkContentSpaceAdoption.js +67 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/iris-app-build-utilities",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.13",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"repository": "https://github.com/Trackunit/manager",
|
|
6
6
|
"engines": {
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"@nx/react": "23.1.0",
|
|
14
14
|
"tslib": "^2.6.2",
|
|
15
15
|
"csp-header": "^6.3.1",
|
|
16
|
-
"@trackunit/iris-app-api": "2.4.
|
|
16
|
+
"@trackunit/iris-app-api": "2.4.9",
|
|
17
17
|
"@nx/devkit": "23.1.0",
|
|
18
|
-
"@trackunit/shared-utils": "1.16.
|
|
18
|
+
"@trackunit/shared-utils": "1.16.20",
|
|
19
19
|
"http-proxy-middleware": "3.0.5",
|
|
20
20
|
"marked": "14.1.2",
|
|
21
21
|
"pacote": "^21.0.4",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Duplicate of `CUTOFF_VERSION` from
|
|
3
|
+
* `libs/iris-app-runtime/core-host/src/contentInsetCutoff.ts`.
|
|
4
|
+
* Build utilities must not depend on core-host (wrong dependency direction);
|
|
5
|
+
* keep this string in sync with the host constant (GLU-1660).
|
|
6
|
+
*/
|
|
7
|
+
export declare const CUTOFF_VERSION = "2.5.12";
|
|
8
|
+
/**
|
|
9
|
+
* Advisory warning when an app's resolved SDK version is at/above the content-inset
|
|
10
|
+
* cutoff but the app source has not adopted `p-content-space`. Matches the
|
|
11
|
+
* `versionCheck`/`console.warn` tone in `checkPackageVersion` — never throws.
|
|
12
|
+
*
|
|
13
|
+
* @param sdkVersion - Installed `@trackunit/iris-app` version (from `resolveSdkVersion`), if any
|
|
14
|
+
* @param appDir - Absolute path to the Iris app project root
|
|
15
|
+
*/
|
|
16
|
+
export declare const checkContentInsetAdoption: (sdkVersion: string | undefined, appDir: string) => void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkContentInsetAdoption = exports.CUTOFF_VERSION = void 0;
|
|
4
|
+
const semver_1 = require("semver");
|
|
5
|
+
const checkContentSpaceAdoption_1 = require("./checkContentSpaceAdoption");
|
|
6
|
+
/**
|
|
7
|
+
* Duplicate of `CUTOFF_VERSION` from
|
|
8
|
+
* `libs/iris-app-runtime/core-host/src/contentInsetCutoff.ts`.
|
|
9
|
+
* Build utilities must not depend on core-host (wrong dependency direction);
|
|
10
|
+
* keep this string in sync with the host constant (GLU-1660).
|
|
11
|
+
*/
|
|
12
|
+
exports.CUTOFF_VERSION = "2.5.12";
|
|
13
|
+
/**
|
|
14
|
+
* Advisory warning when an app's resolved SDK version is at/above the content-inset
|
|
15
|
+
* cutoff but the app source has not adopted `p-content-space`. Matches the
|
|
16
|
+
* `versionCheck`/`console.warn` tone in `checkPackageVersion` — never throws.
|
|
17
|
+
*
|
|
18
|
+
* @param sdkVersion - Installed `@trackunit/iris-app` version (from `resolveSdkVersion`), if any
|
|
19
|
+
* @param appDir - Absolute path to the Iris app project root
|
|
20
|
+
*/
|
|
21
|
+
const checkContentInsetAdoption = (sdkVersion, appDir) => {
|
|
22
|
+
if (sdkVersion === undefined || (0, semver_1.valid)(sdkVersion) === null) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!(0, semver_1.gte)(sdkVersion, exports.CUTOFF_VERSION)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if ((0, checkContentSpaceAdoption_1.checkContentSpaceAdoption)(appDir)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// eslint-disable-next-line no-console
|
|
32
|
+
console.warn(`⚠️ Iris App SDK ${sdkVersion} is at/above the content-inset cutoff (${exports.CUTOFF_VERSION}) but this app's source does not reference \`p-content-space\`. 👈\n` +
|
|
33
|
+
` Add \`p-content-space\` to own your content inset (or the host will apply none). See the Iris App migration guide for details.\n`);
|
|
34
|
+
};
|
|
35
|
+
exports.checkContentInsetAdoption = checkContentInsetAdoption;
|
|
36
|
+
//# sourceMappingURL=checkContentInsetAdoption.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Best-effort scan of an Iris app's source tree for `p-content-space` adoption.
|
|
3
|
+
* Mirrors the advisory, never-throws philosophy of `checkCustomFields`: an empty
|
|
4
|
+
* or unreadable directory is treated as "not adopted" so builds keep running.
|
|
5
|
+
*
|
|
6
|
+
* @param appDir - Absolute path to the Iris app project root
|
|
7
|
+
* @returns {boolean} true when any readable source file references `p-content-space`
|
|
8
|
+
*/
|
|
9
|
+
export declare const checkContentSpaceAdoption: (appDir: string) => boolean;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkContentSpaceAdoption = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const CONTENT_SPACE_TOKEN = "p-content-space";
|
|
7
|
+
const SOURCE_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx", ".css", ".html"]);
|
|
8
|
+
const SKIP_DIR_NAMES = new Set(["node_modules", "dist", "coverage", ".git"]);
|
|
9
|
+
/**
|
|
10
|
+
* Best-effort scan of an Iris app's source tree for `p-content-space` adoption.
|
|
11
|
+
* Mirrors the advisory, never-throws philosophy of `checkCustomFields`: an empty
|
|
12
|
+
* or unreadable directory is treated as "not adopted" so builds keep running.
|
|
13
|
+
*
|
|
14
|
+
* @param appDir - Absolute path to the Iris app project root
|
|
15
|
+
* @returns {boolean} true when any readable source file references `p-content-space`
|
|
16
|
+
*/
|
|
17
|
+
const checkContentSpaceAdoption = (appDir) => {
|
|
18
|
+
try {
|
|
19
|
+
return directoryContainsContentSpace(appDir);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.checkContentSpaceAdoption = checkContentSpaceAdoption;
|
|
26
|
+
const directoryContainsContentSpace = (dir) => {
|
|
27
|
+
let entries;
|
|
28
|
+
try {
|
|
29
|
+
entries = (0, fs_1.readdirSync)(dir);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
for (const entry of entries) {
|
|
35
|
+
if (SKIP_DIR_NAMES.has(entry)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const fullPath = (0, path_1.join)(dir, entry);
|
|
39
|
+
let stats;
|
|
40
|
+
try {
|
|
41
|
+
stats = (0, fs_1.statSync)(fullPath);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (stats.isDirectory()) {
|
|
47
|
+
if (directoryContainsContentSpace(fullPath)) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (!stats.isFile() || !SOURCE_EXTENSIONS.has((0, path_1.extname)(entry))) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const contents = (0, fs_1.readFileSync)(fullPath, "utf-8");
|
|
57
|
+
if (contents.includes(CONTENT_SPACE_TOKEN)) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// Unreadable file — skip and keep scanning.
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=checkContentSpaceAdoption.js.map
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./checkContentInsetAdoption"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./checkContentSpaceAdoption"), exports);
|
|
4
6
|
tslib_1.__exportStar(require("./checkPackageVersion"), exports);
|
|
5
7
|
tslib_1.__exportStar(require("./createInvokeProxyMiddleware"), exports);
|
|
6
8
|
tslib_1.__exportStar(require("./enableTsConfigPath"), exports);
|