@equinor/roma-nx-plugin 6.0.0-beta.8 → 6.0.1
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 +54 -0
- package/generators.json +5 -0
- package/migrations.json +6 -6
- package/package.json +2 -3
- package/src/executors/create-vite-config.js +1 -3
- package/src/executors/create-vite-config.js.map +1 -1
- package/src/executors/publish/manifest-model.d.ts +11 -0
- package/src/executors/publish/publish-script.js +78 -1
- package/src/executors/publish/publish-script.js.map +1 -1
- package/src/executors/publish/readme.md +83 -27
- package/src/executors/serve/server.js +35 -24
- package/src/executors/serve/server.js.map +1 -1
- package/src/executors/utils/logger.js +7 -3
- package/src/executors/utils/logger.js.map +1 -1
- package/src/executors/utils/read-manifest.js +4 -1
- package/src/executors/utils/read-manifest.js.map +1 -1
- package/src/executors/utils/verify-manifest.d.ts +2 -0
- package/src/executors/utils/verify-manifest.js +18 -0
- package/src/executors/utils/verify-manifest.js.map +1 -0
- package/src/generators/app/data/generated-dependencies.json +23 -0
- package/src/generators/app/generator.js +7 -17
- package/src/generators/app/generator.js.map +1 -1
- package/src/generators/component-test/generator.js +1 -1
- package/src/generators/preset/generator.js.map +1 -1
- package/src/generators/preset/schema.d.ts +1 -0
- package/src/generators/skill/files/roma-app-development/SKILL.md +38 -0
- package/src/generators/skill/files/roma-app-development/fusion-modules.md +577 -0
- package/src/generators/skill/files/roma-app-development/generators.md +357 -0
- package/src/generators/skill/files/roma-app-development/roma-modules.md +409 -0
- package/src/generators/skill/files/roma-app-development/services.md +450 -0
- package/src/generators/skill/generator.d.ts +4 -0
- package/src/generators/skill/generator.js +14 -0
- package/src/generators/skill/generator.js.map +1 -0
- package/src/generators/skill/schema.d.ts +3 -0
- package/src/generators/skill/schema.json +14 -0
- package/src/generators/app/data/modules.d.ts +0 -19
- package/src/generators/app/data/modules.js +0 -23
- package/src/generators/app/data/modules.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,60 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [6.0.1](https://github.com/equinor/tops-roma/compare/roma-6.0.0...roma-6.0.1) (2026-05-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **ROMA-277:** Update migrations.json ([f6f4d3b](https://github.com/equinor/tops-roma/commit/f6f4d3b085b0e8c0e297d10bc4ce5adb5a186f7d))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [6.0.0](https://github.com/equinor/tops-roma/compare/roma-6.0.0-beta.13...roma-6.0.0) (2026-05-18)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [6.0.0-beta.13](https://github.com/equinor/tops-roma/compare/roma-6.0.0-beta.12...roma-6.0.0-beta.13) (2026-05-13)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **ROMA-277:** Handle additionalProjects correct ([0f1d113](https://github.com/equinor/tops-roma/commit/0f1d113c798c12a206b3645c151418d3d2ba0c19))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# [6.0.0-beta.12](https://github.com/equinor/tops-roma/compare/roma-6.0.0-beta.11...roma-6.0.0-beta.12) (2026-05-08)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* **ROMA-277:** Remove chalk dependency ([3a9d446](https://github.com/equinor/tops-roma/commit/3a9d4468b47fef20ba6a5e4a2cb91dad7d5cb1e5))
|
|
33
|
+
* **ROMA-277:** Update generated skill. Handle cancelled+cleared ([1f3c1b5](https://github.com/equinor/tops-roma/commit/1f3c1b570b7a5d49e1529c2ff1f01cd7f3025085))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# [6.0.0-beta.11](https://github.com/equinor/tops-roma/compare/roma-6.0.0-beta.10...roma-6.0.0-beta.11) (2026-04-13)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Reverts
|
|
41
|
+
|
|
42
|
+
* Revert "chore(ROMA-277): Temp fix for types" ([29cb169](https://github.com/equinor/tops-roma/commit/29cb169a1ea5bd949ddd5924570b0a00050a3c84))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# [6.0.0-beta.10](https://github.com/equinor/tops-roma/compare/roma-6.0.0-beta.9...roma-6.0.0-beta.10) (2026-04-09)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# [6.0.0-beta.9](https://github.com/equinor/tops-roma/compare/roma-6.0.0-beta.8...roma-6.0.0-beta.9) (2026-04-09)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Bug Fixes
|
|
54
|
+
|
|
55
|
+
* **ROMA-277:** Misc minor fixes/tweaks ([fdef0f8](https://github.com/equinor/tops-roma/commit/fdef0f8e04b179199af4c789b91b131f201dd67f))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
5
59
|
# [6.0.0-beta.8](https://github.com/equinor/tops-roma/compare/roma-6.0.0-beta.7...roma-6.0.0-beta.8) (2026-04-09)
|
|
6
60
|
|
|
7
61
|
|
package/generators.json
CHANGED
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"factory": "./src/generators/component-test/generator",
|
|
16
16
|
"schema": "./src/generators/component-test/schema.json",
|
|
17
17
|
"description": "Generate component-test setup for project"
|
|
18
|
+
},
|
|
19
|
+
"skill": {
|
|
20
|
+
"factory": "./src/generators/skill/generator",
|
|
21
|
+
"schema": "./src/generators/skill/schema.json",
|
|
22
|
+
"description": "Add the Roma development skill for AI assistants"
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
25
|
}
|
package/migrations.json
CHANGED
|
@@ -455,12 +455,12 @@
|
|
|
455
455
|
"@types/react-dom": { "version": "^19.0.0" },
|
|
456
456
|
"react-intl": { "version": "^10.1.0" },
|
|
457
457
|
"react-router-dom": { "version": "^7.13.2" },
|
|
458
|
-
"@equinor/roma-framework": { "version": "^6.0.
|
|
459
|
-
"@equinor/roma-ui": { "version": "^1.0.1
|
|
460
|
-
"@equinor/roma-sse-module": { "version": "^1.0.0
|
|
461
|
-
"@equinor/roma-sse-module-react": { "version": "^1.0.0
|
|
462
|
-
"@equinor/roma-page-title-module": { "version": "^1.0.1
|
|
463
|
-
"@equinor/roma-page-title-module-react": { "version": "^1.0.1
|
|
458
|
+
"@equinor/roma-framework": { "version": "^6.0.0" },
|
|
459
|
+
"@equinor/roma-ui": { "version": "^1.0.1" },
|
|
460
|
+
"@equinor/roma-sse-module": { "version": "^1.0.0" },
|
|
461
|
+
"@equinor/roma-sse-module-react": { "version": "^1.0.0" },
|
|
462
|
+
"@equinor/roma-page-title-module": { "version": "^1.0.1" },
|
|
463
|
+
"@equinor/roma-page-title-module-react": { "version": "^1.0.1" },
|
|
464
464
|
"@equinor/eds-core-react": { "version": "^2.4.0" },
|
|
465
465
|
"@equinor/eds-data-grid-react": { "version": "^1.3.0" },
|
|
466
466
|
"@equinor/eds-icons": { "version": "^1.3.0" },
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/roma-nx-plugin",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "6.0.
|
|
4
|
+
"version": "6.0.1",
|
|
5
5
|
"repository": "https://github.com/equinor/tops-roma",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@nx/devkit": "^22.0.3",
|
|
8
8
|
"@nx/react": "^22.0.3",
|
|
9
9
|
"open": "^10.2.0",
|
|
10
|
-
"chalk": "^4.0.0",
|
|
11
10
|
"vite-plugin-checker": "^0.12.0",
|
|
12
11
|
"tslib": "^2.3.0",
|
|
13
12
|
"@azure/identity": "^4.4.1",
|
|
@@ -21,7 +20,7 @@
|
|
|
21
20
|
"esbuild": "0.27.3",
|
|
22
21
|
"cypress": "^15.13.0",
|
|
23
22
|
"@equinor/fusion-framework-module-app": "8.0.0",
|
|
24
|
-
"@equinor/roma-framework": "6.0.
|
|
23
|
+
"@equinor/roma-framework": "6.0.0",
|
|
25
24
|
"get-port": "^7.2.0"
|
|
26
25
|
},
|
|
27
26
|
"peerDependencies": {
|
|
@@ -23,7 +23,6 @@ const createRomaViteConfig = async (config, context, watch = false, hmrPort = 42
|
|
|
23
23
|
const options = serveConfig.options;
|
|
24
24
|
let base;
|
|
25
25
|
let entry;
|
|
26
|
-
let viteConfigPath;
|
|
27
26
|
let projectRoot = project.root;
|
|
28
27
|
let appDir = '';
|
|
29
28
|
if (isServe) {
|
|
@@ -34,12 +33,10 @@ const createRomaViteConfig = async (config, context, watch = false, hmrPort = 42
|
|
|
34
33
|
entry = {
|
|
35
34
|
self: (0, path_1.join)(projectRoot, 'src/index.ts'),
|
|
36
35
|
};
|
|
37
|
-
viteConfigPath = (0, path_1.resolve)(base, projectRoot, 'vite.config.ts');
|
|
38
36
|
}
|
|
39
37
|
else {
|
|
40
38
|
base = (0, path_1.resolve)(context.root, projectRoot);
|
|
41
39
|
entry = 'src/index.ts';
|
|
42
|
-
viteConfigPath = (0, path_1.resolve)(base, 'vite.config.ts');
|
|
43
40
|
}
|
|
44
41
|
let version;
|
|
45
42
|
try {
|
|
@@ -78,6 +75,7 @@ const createRomaViteConfig = async (config, context, watch = false, hmrPort = 42
|
|
|
78
75
|
};
|
|
79
76
|
}
|
|
80
77
|
config.build.lib.entry = entry;
|
|
78
|
+
config.build.emptyOutDir = true;
|
|
81
79
|
const plugins = [];
|
|
82
80
|
if (config.build.minify) {
|
|
83
81
|
plugins.push((0, minify_1.minifyEs)());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-vite-config.js","sourceRoot":"","sources":["../../../../../plugins/roma/src/executors/create-vite-config.ts"],"names":[],"mappings":";;;;AAAA,sDAAsD;AACtD,+BAMc;AACd,8FAA8C;AAC9C,+BAAqC;AACrC,2DAA2D;AAC3D,gFAAyC;AACzC,2CAAwC;AAGxC,wFAA0E;AAC1E,2CAA0C;AAE1C,sFAA0C;AAC1C,qDAAiD;AAM1C,MAAM,oBAAoB,GAAG,KAAK,EACvC,MAAkB,EAClB,OAAwB,EACxB,KAAK,GAAG,KAAK,EACb,OAAO,GAAG,KAAK,EACf,EAAE;;IACF,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,KAAK,OAAO,CAAC;IAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACxC,MAAM,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACrE,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IACnC,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;IAC1C,MAAM,OAAO,GAAG,WAAW,CAAC,OAA8B,CAAC;IAC3D,IAAI,IAAY,CAAC;IACjB,IAAI,KAAsC,CAAC;IAC3C,IAAI,
|
|
1
|
+
{"version":3,"file":"create-vite-config.js","sourceRoot":"","sources":["../../../../../plugins/roma/src/executors/create-vite-config.ts"],"names":[],"mappings":";;;;AAAA,sDAAsD;AACtD,+BAMc;AACd,8FAA8C;AAC9C,+BAAqC;AACrC,2DAA2D;AAC3D,gFAAyC;AACzC,2CAAwC;AAGxC,wFAA0E;AAC1E,2CAA0C;AAE1C,sFAA0C;AAC1C,qDAAiD;AAM1C,MAAM,oBAAoB,GAAG,KAAK,EACvC,MAAkB,EAClB,OAAwB,EACxB,KAAK,GAAG,KAAK,EACb,OAAO,GAAG,KAAK,EACf,EAAE;;IACF,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,KAAK,OAAO,CAAC;IAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACxC,MAAM,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACrE,MAAM,aAAa,GAA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,IAAA,mBAAY,EAAC,IAAA,kBAAW,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AACvD,CAAC,CAAC;AAvIW,QAAA,oBAAoB,wBAuI/B"}
|
|
@@ -12,6 +12,17 @@ export type Manifest = AppManifest & {
|
|
|
12
12
|
* @deprecated Use `keywords` instead.
|
|
13
13
|
*/
|
|
14
14
|
tags?: Array<string>;
|
|
15
|
+
config: {
|
|
16
|
+
groups: Array<string>;
|
|
17
|
+
admins: Array<{
|
|
18
|
+
id: string;
|
|
19
|
+
adminType: 'User' | 'ServicePrincipal';
|
|
20
|
+
displayName: string;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
metadata?: {
|
|
24
|
+
assets?: string[];
|
|
25
|
+
};
|
|
15
26
|
};
|
|
16
27
|
export type ManifestFile = Omit<Manifest, 'version'> & {
|
|
17
28
|
version: string;
|
|
@@ -52,7 +52,7 @@ let token;
|
|
|
52
52
|
* @param options - The options for the publish operation.
|
|
53
53
|
*/
|
|
54
54
|
const publishApplication = async (pathToOutput, options) => {
|
|
55
|
-
var _a, _b;
|
|
55
|
+
var _a, _b, _c;
|
|
56
56
|
let env = options.environment;
|
|
57
57
|
// @ts-expect-error Need to rewrite this as nx expects production, not prod.
|
|
58
58
|
if (env === 'prod')
|
|
@@ -89,6 +89,20 @@ const publishApplication = async (pathToOutput, options) => {
|
|
|
89
89
|
if (bundleResult === Status.ERROR) {
|
|
90
90
|
throw new Error('Failed to upload application');
|
|
91
91
|
}
|
|
92
|
+
console.log(`Checking for additional assets in ${pathToOutput}`);
|
|
93
|
+
const assetResult = await uploadAssets(appName, pathToOutput, config);
|
|
94
|
+
if (assetResult === Status.ERROR) {
|
|
95
|
+
throw new Error(`Failed to upload assets for ${appName}`);
|
|
96
|
+
}
|
|
97
|
+
// Enrich manifest with asset CDN URIs
|
|
98
|
+
const assetFilenames = await getAssetFilenames(pathToOutput);
|
|
99
|
+
if (assetFilenames.length > 0) {
|
|
100
|
+
const version = config.randomVersion
|
|
101
|
+
? Date.now()
|
|
102
|
+
: parsedManifest.build.version;
|
|
103
|
+
parsedManifest.metadata = Object.assign(Object.assign({}, ((_c = parsedManifest.metadata) !== null && _c !== void 0 ? _c : {})), { assets: assetFilenames.map((f) => `${config.romaUri}/cdn/applications/bundle/${appName}/assets/${f}?version=${version}`) });
|
|
104
|
+
console.log(`Added ${assetFilenames.length} asset URI(s) to manifest metadata`);
|
|
105
|
+
}
|
|
92
106
|
console.log(`Reading & uploading application manifest to ${config.romaUri}`);
|
|
93
107
|
const status = await publishManifest(parsedManifest, config);
|
|
94
108
|
if (status === Status.ERROR) {
|
|
@@ -195,4 +209,67 @@ async function uploadBundle(appName, bundle, config) {
|
|
|
195
209
|
return Status.ERROR;
|
|
196
210
|
}
|
|
197
211
|
}
|
|
212
|
+
const EXCLUDED_ASSETS = new Set([
|
|
213
|
+
'app-bundle.js',
|
|
214
|
+
'manifest.json',
|
|
215
|
+
'package.json',
|
|
216
|
+
]);
|
|
217
|
+
/**
|
|
218
|
+
* Scans the output folder and returns relative paths of all asset files,
|
|
219
|
+
* excluding files handled by the existing bundle/manifest flows.
|
|
220
|
+
*/
|
|
221
|
+
async function getAssetFilenames(pathToOutput) {
|
|
222
|
+
const entries = await (0, promises_1.readdir)(pathToOutput, {
|
|
223
|
+
recursive: true,
|
|
224
|
+
withFileTypes: true,
|
|
225
|
+
});
|
|
226
|
+
return entries
|
|
227
|
+
.filter((entry) => entry.isFile())
|
|
228
|
+
.map((entry) => { var _a; return (0, node_path_1.relative)(pathToOutput, (0, node_path_1.join)((_a = entry.parentPath) !== null && _a !== void 0 ? _a : entry.path, entry.name)); })
|
|
229
|
+
.filter((relativePath) => !EXCLUDED_ASSETS.has(relativePath));
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Uploads additional asset files from the output folder to the Roma API.
|
|
233
|
+
* Files like app-bundle.js and manifest.json are excluded since they are
|
|
234
|
+
* handled by the existing upload/publish flow.
|
|
235
|
+
*
|
|
236
|
+
* @param appName - The application key.
|
|
237
|
+
* @param pathToOutput - The build output directory to scan for assets.
|
|
238
|
+
* @param config - The active environment config.
|
|
239
|
+
*/
|
|
240
|
+
async function uploadAssets(appName, pathToOutput, config) {
|
|
241
|
+
const assetFilenames = await getAssetFilenames(pathToOutput);
|
|
242
|
+
if (assetFilenames.length === 0) {
|
|
243
|
+
console.log('No additional assets to upload');
|
|
244
|
+
return Status.SUCCESS;
|
|
245
|
+
}
|
|
246
|
+
const fd = new FormData();
|
|
247
|
+
for (const relativePath of assetFilenames) {
|
|
248
|
+
const fileBytes = await (0, promises_1.readFile)((0, node_path_1.join)(pathToOutput, relativePath));
|
|
249
|
+
fd.append('files', new Blob([fileBytes.buffer]), relativePath);
|
|
250
|
+
}
|
|
251
|
+
console.log(`Uploading ${assetFilenames.length} asset(s) for ${appName}: ${assetFilenames.join(', ')}`);
|
|
252
|
+
const token = await authenticate(config);
|
|
253
|
+
const req = await fetch(`${config.romaUri}/api/apps/key/${appName}/assets`, {
|
|
254
|
+
method: 'POST',
|
|
255
|
+
headers: {
|
|
256
|
+
Authorization: `Bearer ${token}`,
|
|
257
|
+
},
|
|
258
|
+
body: fd,
|
|
259
|
+
});
|
|
260
|
+
if (req.status === 404) {
|
|
261
|
+
console.warn('Asset upload endpoint not available (404). The backend may not support asset uploads yet — skipping.');
|
|
262
|
+
return Status.SUCCESS;
|
|
263
|
+
}
|
|
264
|
+
if (req.status < 400) {
|
|
265
|
+
console.log(`Successfully uploaded assets for ${appName}`);
|
|
266
|
+
return Status.SUCCESS;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
console.error(`Failed to upload assets: Received statuscode ${req.status}`);
|
|
270
|
+
const err = await req.json();
|
|
271
|
+
console.error(err);
|
|
272
|
+
return Status.ERROR;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
198
275
|
//# sourceMappingURL=publish-script.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-script.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/publish/publish-script.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"publish-script.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/publish/publish-script.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AACrD,yCAA2C;AAC3C,8CAAyD;AAGzD,yCAA2C;AAC3C,yCAAsC;AAEtC,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,0BAAc,CAAC,CAAC;AAEzC;;;GAGG;AACH,IAAK,MAGJ;AAHD,WAAK,MAAM;IACT,yCAAO,CAAA;IACP,qCAAK,CAAA;AACP,CAAC,EAHI,MAAM,KAAN,MAAM,QAGV;AAeD;;GAEG;AACH,MAAM,SAAS,GAA2B;IACxC,GAAG,EAAE;QACH,OAAO,EAAE,6BAA6B;QACtC,aAAa,EAAE,IAAI;QACnB,SAAS,EAAE,CAAC,wCAAwC,CAAC;KACtD;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,8BAA8B;QACvC,aAAa,EAAE,IAAI;QACnB,SAAS,EAAE,CAAC,wCAAwC,CAAC;KACtD;IACD,EAAE,EAAE;QACF,OAAO,EAAE,4BAA4B;QACrC,aAAa,EAAE,IAAI;QACnB,SAAS,EAAE,CAAC,wCAAwC,CAAC;KACtD;IACD,UAAU,EAAE;QACV,OAAO,EAAE,0BAA0B;QACnC,aAAa,EAAE,KAAK;QACpB,SAAS,EAAE,CAAC,iCAAiC,CAAC;KAC/C;CACF,CAAC;AAEF;;GAEG;AACH,IAAI,KAAa,CAAC;AAElB;;;;;GAKG;AACI,MAAM,kBAAkB,GAAG,KAAK,EACrC,YAAoB,EACpB,OAA8B,EAC9B,EAAE;;IACF,IAAI,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC;IAC9B,4EAA4E;IAC5E,IAAI,GAAG,KAAK,MAAM;QAAE,GAAG,GAAG,YAAY,CAAC;IACvC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,C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,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,CAAC,GAAG,CACT,aAAa,cAAc,CAAC,MAAM,iBAAiB,OAAO,KAAK,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC3F,CAAC;IAEF,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,iBAAiB,OAAO,SAAS,EAAE;QAC1E,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,KAAK,EAAE;SACjC;QACD,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,CACV,sGAAsG,CACvG,CAAC;QACF,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,oCAAoC,OAAO,EAAE,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,gDAAgD,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAC5E,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC;AACH,CAAC"}
|
|
@@ -4,6 +4,84 @@ This is a NX executor script for publishing Roma applications to Azure Blob Stor
|
|
|
4
4
|
|
|
5
5
|
Usage of this executor is documented further in [confluence](https://oiltradeent.atlassian.net/wiki/spaces/LS/pages/3781885953/Developer+tooling+for+Roma+applications)
|
|
6
6
|
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
The publish executor is configured in each app's `project.json`:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"publish": {
|
|
14
|
+
"executor": "@equinor/roma-nx-plugin:publish",
|
|
15
|
+
"dependsOn": ["build"],
|
|
16
|
+
"configurations": {
|
|
17
|
+
"production": { "environment": "production" },
|
|
18
|
+
"qa": { "environment": "qa" },
|
|
19
|
+
"dev": { "environment": "dev" }
|
|
20
|
+
},
|
|
21
|
+
"defaultConfiguration": "dev"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Run with: `nx publish <app-name> --configuration=dev`
|
|
27
|
+
|
|
28
|
+
## Asset Upload
|
|
29
|
+
|
|
30
|
+
In addition to the application bundle (`app-bundle.js`) and manifest, the publish executor automatically uploads any additional files found in the build output folder. This allows applications to ship static assets (icons, stylesheets, config files, etc.) alongside their bundle.
|
|
31
|
+
|
|
32
|
+
### How it works
|
|
33
|
+
|
|
34
|
+
1. The executor scans the build output directory (e.g. `dist/apps/my-app/`).
|
|
35
|
+
2. Files named `app-bundle.js` and `manifest.json` are excluded (they are handled by the existing bundle upload and manifest publish flows).
|
|
36
|
+
3. All remaining files are uploaded via `POST /api/apps/key/{appKey}/assets` as multipart form data.
|
|
37
|
+
4. If no additional files are found, the asset upload step is skipped.
|
|
38
|
+
|
|
39
|
+
### Adding assets to your app
|
|
40
|
+
|
|
41
|
+
Place static files in your app's `public/` directory. Vite automatically copies these to the build output during `nx build`. See [Vite's Static Asset Handling](https://vite.dev/guide/assets.html#the-public-directory) for details.
|
|
42
|
+
|
|
43
|
+
Example:
|
|
44
|
+
```
|
|
45
|
+
apps/applications/my-app/
|
|
46
|
+
├── public/
|
|
47
|
+
│ ├── logo.png
|
|
48
|
+
│ └── config/settings.json
|
|
49
|
+
├── src/
|
|
50
|
+
│ └── ...
|
|
51
|
+
└── project.json
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
After build, the output folder will contain:
|
|
55
|
+
```
|
|
56
|
+
dist/apps/my-app/
|
|
57
|
+
├── app-bundle.js (uploaded as bundle)
|
|
58
|
+
├── manifest.json (published as manifest)
|
|
59
|
+
├── logo.png (uploaded as asset)
|
|
60
|
+
└── config/
|
|
61
|
+
└── settings.json (uploaded as asset)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> **Note:** If the backend asset upload endpoint is not yet deployed, the executor logs a warning and continues without failing.
|
|
65
|
+
|
|
66
|
+
### Asset metadata in manifest
|
|
67
|
+
|
|
68
|
+
When assets are present, the publish executor adds a `metadata.assets` field to the manifest before publishing. This field contains an array of CDN URIs for each asset, allowing the Roma framework to discover and load them at runtime.
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"metadata": {
|
|
73
|
+
"assets": [
|
|
74
|
+
"https://roma.equinor.com/cdn/applications/bundle/my-app/assets/logo.png?version=1716300000000",
|
|
75
|
+
"https://roma.equinor.com/cdn/applications/bundle/my-app/assets/app-bundle.css?version=1716300000000"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The URL pattern is: `{romaUri}/cdn/applications/bundle/{appKey}/assets/{filename}?version={version}`
|
|
82
|
+
|
|
83
|
+
This is particularly important for CSS files — Vite library mode extracts CSS into a separate `app-bundle.css` file. The framework can use `metadata.assets` to load the CSS at runtime.
|
|
84
|
+
|
|
7
85
|
## Code Explanation
|
|
8
86
|
|
|
9
87
|
This script exports a default asynchronous function `runExecutor` which is what NX calls on executors.
|
|
@@ -11,39 +89,17 @@ This script exports a default asynchronous function `runExecutor` which is what
|
|
|
11
89
|
The function reads the configuration of the project and builds the project to the specified output directory. It then reads the built application bundle and manifest and publishes the application to the specified environment using the Roma API.
|
|
12
90
|
|
|
13
91
|
The `publishApplication` function is responsible for publishing the application to the specified environment. It takes the following parameters:
|
|
14
|
-
- `appName`: The name of the application to publish.
|
|
15
92
|
- `pathToOutput`: The path to the output directory.
|
|
16
93
|
- `options`: The options for the publish operation.
|
|
17
94
|
|
|
18
|
-
The
|
|
95
|
+
The publish flow is: **bundle upload → asset upload → manifest publish**.
|
|
19
96
|
|
|
20
97
|
The `authenticate` function is responsible for authenticating the user and returning the authentication token. It uses the `DefaultAzureCredential` class from the `@azure/identity` package to authenticate the user.
|
|
21
98
|
|
|
22
|
-
The `getCategories` function
|
|
23
|
-
- `config`: The configuration for the environment.
|
|
24
|
-
|
|
25
|
-
The function uses the `fetch` function to make a request to the Roma API to get the list of categories.
|
|
26
|
-
|
|
27
|
-
The `publishManifest` function is responsible for publishing the manifest for the application. It takes the following parameters:
|
|
28
|
-
- `manifest`: The manifest for the application.
|
|
29
|
-
- `config`: The configuration for the application.
|
|
30
|
-
|
|
31
|
-
The function uses the `fetch` function to make a request to the Roma API to publish the manifest.
|
|
32
|
-
|
|
33
|
-
The `uploadBundle` function is responsible for uploading the bundle for the application to Azure Blob Storage. It takes the following parameters:
|
|
34
|
-
- `appName`: The name of the application.
|
|
35
|
-
- `bundle`: The bundle for the application.
|
|
36
|
-
|
|
37
|
-
The function uses the `@azure/storage-blob` package to upload the bundle to Azure Blob Storage.
|
|
38
|
-
## Code Explanation (continued)
|
|
99
|
+
The `getCategories` function gets a list of valid Roma categories and validates the manifest's `categoryId`.
|
|
39
100
|
|
|
40
|
-
The
|
|
41
|
-
- `BuildConfiguration`: An interface that extends `ProjectConfiguration` and adds an optional `outputPath` property.
|
|
42
|
-
- `Config`: An interface that represents the configuration for the publish script.
|
|
43
|
-
- `Status`: An enum that represents the status of the publish operation.
|
|
44
|
-
- `Manifest`: An interface that represents the manifest for the application.
|
|
45
|
-
- `PublishExecutorSchema`: An interface that represents the options for the publish operation.
|
|
101
|
+
The `uploadBundle` function uploads the brotli-compressed bundle to Azure Blob Storage.
|
|
46
102
|
|
|
47
|
-
The
|
|
103
|
+
The `uploadAssets` function scans the output directory for additional files and uploads them (uncompressed) to the assets endpoint.
|
|
48
104
|
|
|
49
|
-
|
|
105
|
+
The `publishManifest` function publishes the application manifest to the Roma API.
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createServer = createServer;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
const read_manifest_1 = require("../utils/read-manifest");
|
|
8
|
+
const express = require('express');
|
|
5
9
|
const open_1 = tslib_1.__importDefault(require("open"));
|
|
6
|
-
const expressImport = tslib_1.__importStar(require("express"));
|
|
7
|
-
const chalk = tslib_1.__importStar(require("chalk"));
|
|
8
10
|
const get_port_1 = tslib_1.__importStar(require("get-port"));
|
|
9
11
|
const vite_1 = require("vite");
|
|
10
12
|
const path_1 = require("path");
|
|
@@ -12,18 +14,7 @@ const node_fs_1 = require("node:fs");
|
|
|
12
14
|
const http_proxy_middleware_1 = require("http-proxy-middleware");
|
|
13
15
|
const create_vite_config_1 = require("../create-vite-config");
|
|
14
16
|
const get_vite_config_1 = require("../utils/get-vite-config");
|
|
15
|
-
const get_manifest_1 = require("./get-manifest");
|
|
16
17
|
const load_services_1 = require("../utils/load-services");
|
|
17
|
-
let express;
|
|
18
|
-
if (typeof expressImport === 'function') {
|
|
19
|
-
express = expressImport;
|
|
20
|
-
}
|
|
21
|
-
else if ('default' in expressImport) {
|
|
22
|
-
express = expressImport.default;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
throw new Error('Failed to import express');
|
|
26
|
-
}
|
|
27
18
|
const createProxyMiddleware = (options) => {
|
|
28
19
|
var _a;
|
|
29
20
|
console.log(`[ROMA] Proxying ${(_a = options.name) !== null && _a !== void 0 ? _a : options.pathFilter} to ${options.target}`);
|
|
@@ -40,7 +31,7 @@ async function createServer({ port: requestedPort = 3000, devPortal = 'node_modu
|
|
|
40
31
|
}
|
|
41
32
|
console.clear();
|
|
42
33
|
if (port !== requestedPort) {
|
|
43
|
-
console.log(
|
|
34
|
+
console.log(`\x1b[33mPort ${requestedPort} is taken, using ${port}\x1b[0m`);
|
|
44
35
|
}
|
|
45
36
|
const projectName = context.projectName;
|
|
46
37
|
const project = context.projectsConfigurations.projects[projectName];
|
|
@@ -116,27 +107,47 @@ async function createServer({ port: requestedPort = 3000, devPortal = 'node_modu
|
|
|
116
107
|
const atIndex = (_b = data === null || data === void 0 ? void 0 : data.findIndex((manifest) => { var _a; return ((_a = manifest.appKey) !== null && _a !== void 0 ? _a : manifest.key) === projectName; })) !== null && _b !== void 0 ? _b : -1;
|
|
117
108
|
// If existing app, we need to change the entry-point.
|
|
118
109
|
if (atIndex > -1) {
|
|
110
|
+
(0, read_manifest_1.readManifest)(base); // Just to verify that manifest is correct, since we are modifying the entry-point regardless. If manifest is wrong, it's better to fail here than to have a broken app in the portal.
|
|
119
111
|
data[atIndex].entry = `/${entry.self}`;
|
|
120
112
|
}
|
|
121
113
|
else {
|
|
122
114
|
// New app, so adding it to the app-list
|
|
123
115
|
try {
|
|
124
116
|
// Read and parse fusion-manifest
|
|
125
|
-
const manifest = (0,
|
|
117
|
+
const manifest = (0, read_manifest_1.readManifest)(base);
|
|
126
118
|
manifest.entry = `/${entry.self}`;
|
|
127
119
|
data.push(manifest);
|
|
128
120
|
}
|
|
129
|
-
catch (
|
|
130
|
-
throw new Error(
|
|
131
|
-
Application will now exit.`));
|
|
121
|
+
catch (_c) {
|
|
122
|
+
throw new Error(`\x1b[31mFatal error: Failed to read fusion-manifest.json in ${base}\nApplication will now exit.\x1b[0m`);
|
|
132
123
|
}
|
|
133
124
|
}
|
|
134
125
|
if (additionalProjects) {
|
|
135
|
-
additionalProjects.forEach((
|
|
126
|
+
additionalProjects.forEach((additionalProject) => {
|
|
136
127
|
var _a;
|
|
137
|
-
const atIndex = (_a = data === null || data === void 0 ? void 0 : data.findIndex((manifest) => {
|
|
128
|
+
const atIndex = (_a = data === null || data === void 0 ? void 0 : data.findIndex((manifest) => {
|
|
129
|
+
var _a;
|
|
130
|
+
return ((_a = manifest.appKey) !== null && _a !== void 0 ? _a : manifest.key) ===
|
|
131
|
+
additionalProject.name;
|
|
132
|
+
})) !== null && _a !== void 0 ? _a : -1;
|
|
138
133
|
if (atIndex >= 0) {
|
|
139
|
-
data[atIndex] = Object.assign(Object.assign({}, data[atIndex]), { entry: `/${entry[
|
|
134
|
+
data[atIndex] = Object.assign(Object.assign({}, data[atIndex]), { entry: `/${entry[additionalProject.name]}` });
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const projectConfig = context.projectsConfigurations.projects[additionalProject.name];
|
|
138
|
+
if (!projectConfig) {
|
|
139
|
+
console.warn(`\x1b[33m[ROMA] Project "${additionalProject.name}" not found in workspace\x1b[0m`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const projectBase = (0, path_1.resolve)(context.root, projectConfig.root);
|
|
143
|
+
try {
|
|
144
|
+
const manifest = (0, read_manifest_1.readManifest)(projectBase);
|
|
145
|
+
manifest.entry = `/${entry[additionalProject.name]}`;
|
|
146
|
+
data.push(manifest);
|
|
147
|
+
}
|
|
148
|
+
catch (_b) {
|
|
149
|
+
console.warn(`\x1b[33m[ROMA] Failed to read manifest for "${additionalProject.name}" in ${projectBase}\x1b[0m`);
|
|
150
|
+
}
|
|
140
151
|
}
|
|
141
152
|
});
|
|
142
153
|
}
|
|
@@ -173,13 +184,13 @@ Application will now exit.`));
|
|
|
173
184
|
return new Promise((resolve) => {
|
|
174
185
|
// listen to requested port
|
|
175
186
|
app.listen(port, () => {
|
|
176
|
-
console.log(
|
|
187
|
+
console.log(`\x1b[32mRoma dev server listening on port ${port}\x1b[0m`);
|
|
177
188
|
if (shouldOpen) {
|
|
178
|
-
console.log(
|
|
189
|
+
console.log(`\x1b[32mOpening the application at http://localhost:${port}/apps/${projectName}\x1b[0m`);
|
|
179
190
|
(0, open_1.default)(`http://localhost:${port}/apps/${projectName}`);
|
|
180
191
|
}
|
|
181
192
|
else {
|
|
182
|
-
console.log(
|
|
193
|
+
console.log(`\x1b[32mOpen the application at http://localhost:${port}/apps/${projectName}\x1b[0m`);
|
|
183
194
|
}
|
|
184
195
|
});
|
|
185
196
|
app.on('close', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/serve/server.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/serve/server.ts"],"names":[],"mappings":";;AAuCA,oCA2PC;;AAlSD,6DAA6D;AAC7D,aAAa;AACb,0DAAsD;AAEtD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAEnC,wDAAwB;AACxB,6DAAgD;AAChD,+BAIc;AACd,+BAAqC;AACrC,qCAAuC;AACvC,iEAI+B;AAC/B,8DAA6D;AAE7D,8DAAyD;AAEzD,0DAAsD;AAGtD,MAAM,qBAAqB,GAAG,CAI5B,OAAgD,EAChD,EAAE;;IACF,OAAO,CAAC,GAAG,CACT,mBAAmB,MAAA,OAAO,CAAC,IAAI,mCAAI,OAAO,CAAC,UAAU,OAAO,OAAO,CAAC,MAAM,EAAE,CAC7E,CAAC;IACF,OAAO,IAAA,6CAAsB,EAAC,OAAO,CAAC,CAAC;AACzC,CAAC,CAAC;AAEK,KAAK,UAAU,YAAY,CAChC,EACE,IAAI,EAAE,aAAa,GAAG,IAAI,EAC1B,SAAS,GAAG,iDAAiD,EAC7D,MAAM,EAAE,YAAY,GAAG,6BAA6B,EACpD,IAAI,EAAE,UAAU,GACI,EACtB,OAAwB,EACxB,kBAA+C;IAE/C,8DAA8D;IAC9D,MAAM,aAAa,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC;IAExD,gFAAgF;IAChF,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CACtB,IAAI,GAAG,CAAC,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EAAE,GAAG,EAAE;YACnB,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -13,10 +13,10 @@ const timestamp = () => {
|
|
|
13
13
|
};
|
|
14
14
|
const logModes = {
|
|
15
15
|
error: () => {
|
|
16
|
-
return
|
|
16
|
+
return `\x1b[31m${timestamp()}: [roma ERR]:\x1b[0m`;
|
|
17
17
|
},
|
|
18
18
|
warning: () => {
|
|
19
|
-
return
|
|
19
|
+
return `\x1b[33m${timestamp()}: [roma WARN]:\x1b[0m`;
|
|
20
20
|
},
|
|
21
21
|
info: () => {
|
|
22
22
|
return `${timestamp()}: [roma]:`;
|
|
@@ -50,8 +50,10 @@ class Logger {
|
|
|
50
50
|
}
|
|
51
51
|
error(msg, options) {
|
|
52
52
|
if (typeof msg === 'string' &&
|
|
53
|
-
msg.includes('resolved id:
|
|
53
|
+
msg.includes('resolved id:') &&
|
|
54
|
+
msg.includes('.mjs)'))
|
|
54
55
|
return;
|
|
56
|
+
this.errors.add(msg);
|
|
55
57
|
if (options === null || options === void 0 ? void 0 : options.clear)
|
|
56
58
|
this.clearScreen('error');
|
|
57
59
|
console.error(logModes.error(), msg);
|
|
@@ -60,6 +62,8 @@ class Logger {
|
|
|
60
62
|
console.clear();
|
|
61
63
|
if (type === 'error')
|
|
62
64
|
console.log(`Console cleared: ${type}`);
|
|
65
|
+
this.warnings.forEach((warn) => this.warn(warn));
|
|
66
|
+
this.errors.forEach((err) => this.error(typeof err === 'string' ? err : err.message));
|
|
63
67
|
}
|
|
64
68
|
hasErrorLogged(error) {
|
|
65
69
|
return this.errors.has(error);
|