@equinor/roma-nx-plugin 0.0.12 → 0.0.14

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/migrations.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "implementation": "./src/migrations/add-portal-proxy-target/add-portal-proxy-target"
7
7
  },
8
8
  "add-publish-target": {
9
- "version": "0.0.6",
9
+ "version": "0.0.13",
10
10
  "description": "add-publish-target",
11
11
  "implementation": "./src/migrations/add-publish-target/add-publish-target"
12
12
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@equinor/roma-nx-plugin",
3
3
  "private": false,
4
- "version": "0.0.12",
4
+ "version": "0.0.14",
5
5
  "repository": "https://github.com/equinor/tops-roma",
6
6
  "dependencies": {
7
7
  "@nx/devkit": "16.8.1",
8
8
  "@nx/react": "16.8.1",
9
9
  "@nx/linter": "16.8.1",
10
10
  "@equinor/fusion-framework-cli": "~9.2.0",
11
- "@equinor/roma-framework": "^0.0.5",
11
+ "@equinor/roma-framework": "^0.0.6",
12
12
  "nx": "16.8.1",
13
13
  "tslib": "^2.3.0",
14
14
  "@azure/identity": "^3.3.0",
@@ -30,7 +30,7 @@ function validateManifest(manifestPath) {
30
30
  const manifest = (0, devkit_1.readJsonFile)(manifestPath);
31
31
  assertValueExists(manifest.key, 'key');
32
32
  assertValueExists(manifest.name, 'name');
33
- assertValueExists(manifest.category, 'category');
33
+ assertValueExists(manifest.categoryId, 'categoryId');
34
34
  if (manifest.type === 'standalone') {
35
35
  assertValueExists(manifest.description, 'description');
36
36
  assertValueExists(manifest.shortName, 'shortName');
@@ -38,7 +38,6 @@ function validateManifest(manifestPath) {
38
38
  }
39
39
  async function runExecutor(options, context) {
40
40
  var _a;
41
- (0, devkit_1.writeJsonFile)('ctx', context);
42
41
  const projectName = context.projectName;
43
42
  const project = context.workspace.projects[projectName];
44
43
  const projectPath = path.resolve(context.root, project.root);
@@ -46,6 +45,12 @@ async function runExecutor(options, context) {
46
45
  const outputPath = (_a = buildConfig.outputPath) !== null && _a !== void 0 ? _a : `dist/apps/${projectName}`;
47
46
  const build = () => {
48
47
  validateManifest(`${projectPath}/fusion-manifest.json`);
48
+ /**
49
+ * Build happens in two stages:
50
+ * - First we call the build-command from fusion's CLI
51
+ * - Once complete, we call the manifest command, converting the manifest to the expected format.
52
+ * This prepares the files to uploaded via the publish command.
53
+ */
49
54
  return (0, run_commands_impl_1.default)({
50
55
  commands: [
51
56
  `fusion-framework-cli app build -o ${context.root}/${outputPath}`,
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/build/executor.ts"],"names":[],"mappings":";;;AAEA,uCAAyD;AAEzD,gHAA0E;AAC1E,mDAA6B;AAG7B;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAI,KAAQ,EAAE,KAAa;IACnD,MAAM,SAAS,GAAG,OAAO,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC,CAAC;IAChE,MAAM,UAAU,GAAW,KAAK,KAAK,EAAE,CAAC;IACxC,IAAI,SAAS,KAAK,IAAI,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,eAAe,CAAC,CAAC;KAC7D;IACD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,WAAW,CAAC,CAAC;KACzD;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,gBAAgB,CAAC,YAAoB;IAC5C,kGAAkG;IAClG,MAAM,QAAQ,GAAG,IAAA,qBAAY,EAAc,YAAY,CAAC,CAAC;IACzD,iBAAiB,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACvC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzC,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU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AC,WAAW,OAAO,WAAW,EAAE,CAAC;QAC7E,OAAO,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CACvB,IAAA,2BAAW,EACT;YACE,OAAO,EAAE,KAAK;YACd,GAAG,EAAE,WAAW;YAChB,YAAY,EAAE,EAAE;SACjB,EACD,OAAO,CACR,CACF,CAAC;KACH;SAAM;QACL,OAAO,KAAK,EAAE,CAAC;KAChB;AACH,CAAC;AAxCD,8BAwCC"}
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/build/executor.ts"],"names":[],"mappings":";;;AAEA,uCAA0C;AAE1C,gHAA0E;AAC1E,mDAA6B;AAG7B;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAI,KAAQ,EAAE,KAAa;IACnD,MAAM,SAAS,GAAG,OAAO,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC,CAAC;IAChE,MAAM,UAAU,GAAW,KAAK,KAAK,EAAE,CAAC;IACxC,IAAI,SAAS,KAAK,IAAI,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,eAAe,CAAC,CAAC;KAC7D;IACD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,WAAW,CAAC,CAAC;KACzD;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,gBAAgB,CAAC,YAAoB;IAC5C,kGAAkG;IAClG,MAAM,QAAQ,GAAG,IAAA,qBAAY,EAAc,YAAY,CAAC,CAAC;IACzD,iBAAiB,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACvC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzC,iBAAiB,CAAC,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACrD,IAAI,QAAQ,CAAC,IAAI,KAAK,YAAY,EAAE;QAClC,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ACT;YACE,OAAO,EAAE,KAAK;YACd,GAAG,EAAE,WAAW;YAChB,YAAY,EAAE,EAAE;SACjB,EACD,OAAO,CACR,CACF,CAAC;KACH;SAAM;QACL,OAAO,KAAK,EAAE,CAAC;KAChB;AACH,CAAC;AA7CD,8BA6CC"}
@@ -1,6 +1,16 @@
1
1
  /// <reference types="node" />
2
2
  import { ServerOptions } from 'http-proxy';
3
3
  import { IncomingMessage, ServerResponse } from 'http';
4
+ /**
5
+ * This is a TypeScript function that creates a proxy server to forward HTTP requests to another server.
6
+ * @param port The port number on which the proxy server should listen for incoming requests.
7
+ * @param target The URL of the target server to which the HTTP requests should be forwarded.
8
+ * @param additionalTarget An optional object containing additional target servers that should be used for specific URLs. Each key in this object is a URL prefix that should be matched against the incoming request URL, and the corresponding value is an object containing the options to be passed to the http-proxy library for that URL prefix.
9
+ *
10
+ * @returns Object
11
+ * server: An instance of the Node.js http.Server class that represents the proxy server.
12
+ * proxy: An instance of the http-proxy library that is used to forward the HTTP requests to the target server.
13
+ */
4
14
  export declare const proxyServer: (port: number, target: string, additionalTarget?: Record<string, ServerOptions & {
5
15
  ignoreTargetPath?: boolean;
6
16
  }>) => {
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.proxyServer = void 0;
4
4
  const http_proxy_1 = require("http-proxy");
5
5
  const http_1 = require("http");
6
+ /**
7
+ * Function that sets up cors-handling locally, to ensure the proxy works as expected on any / all endpoints.
8
+ * @param req
9
+ * @param res
10
+ */
6
11
  const enableCors = (req, res) => {
7
12
  var _a;
8
13
  res.setHeader('access-control-allow-origin', (_a = req.headers.origin) !== null && _a !== void 0 ? _a : 'http://localhost:3001');
@@ -12,24 +17,44 @@ const enableCors = (req, res) => {
12
17
  if (req.headers['access-control-request-headers']) {
13
18
  res.setHeader('access-control-allow-headers', req.headers['access-control-request-headers']);
14
19
  }
20
+ else {
21
+ res.setHeader('access-control-allow-headers', 'Last-Event-Id');
22
+ }
15
23
  if (req.headers.origin) {
16
24
  res.setHeader('access-control-allow-credentials', 'true');
17
25
  }
18
26
  };
27
+ /**
28
+ * This is a TypeScript function that creates a proxy server to forward HTTP requests to another server.
29
+ * @param port The port number on which the proxy server should listen for incoming requests.
30
+ * @param target The URL of the target server to which the HTTP requests should be forwarded.
31
+ * @param additionalTarget An optional object containing additional target servers that should be used for specific URLs. Each key in this object is a URL prefix that should be matched against the incoming request URL, and the corresponding value is an object containing the options to be passed to the http-proxy library for that URL prefix.
32
+ *
33
+ * @returns Object
34
+ * server: An instance of the Node.js http.Server class that represents the proxy server.
35
+ * proxy: An instance of the http-proxy library that is used to forward the HTTP requests to the target server.
36
+ */
19
37
  const proxyServer = (port, target, additionalTarget) => {
20
38
  const asUri = new URL(target);
39
+ /**
40
+ * creates a new instance of createProxyServer() method from the http-proxy module, passing in an object with various configuration options.
41
+ */
21
42
  const proxy = (0, http_proxy_1.createProxyServer)({
22
43
  target,
23
- secure: true,
44
+ secure: false,
24
45
  changeOrigin: true,
25
46
  hostRewrite: asUri.origin,
26
47
  proxyTimeout: 600000,
27
48
  followRedirects: true,
28
49
  headers: {
29
50
  'Sec-Fetch-Site': 'same-origin',
30
- Accept: 'application/json',
51
+ // Accept: 'application/json',
31
52
  },
32
53
  });
54
+ /**
55
+ * This sets up an event listener for the proxyReq event, which is emitted when a request is received by the proxy server.
56
+ * It logs the request details to the console, removes the origin header from the request, removes the origin header from the response, and enables CORS.
57
+ */
33
58
  proxy.on('proxyReq', function (proxyReq, req, res) {
34
59
  console.log(
35
60
  // @ts-ignore
@@ -38,9 +63,19 @@ const proxyServer = (port, target, additionalTarget) => {
38
63
  res.removeHeader('origin');
39
64
  enableCors(req, res);
40
65
  });
66
+ /**
67
+ * This sets up an event listener for the proxyRes event, which is emitted when a response is received by the proxy server.
68
+ * It logs the response details to the console, enables CORS, and checks if the request URL matches /_discovery/environments/current.
69
+ * If it does, it reads the response body, replaces the target server URL with http://localhost:${port}, and sends the modified response to the original requester.
70
+ */
41
71
  proxy.on('proxyRes', function (proxyRes, req, res) {
42
72
  console.log(`[RES] Response from ${req.url}`);
43
73
  enableCors(req, res);
74
+ if (proxyRes.statusCode >= 400) {
75
+ console.log(req.rawHeaders);
76
+ console.error(proxyRes.rawHeaders);
77
+ console.error(proxyRes.statusMessage);
78
+ }
44
79
  if (req.url === '/_discovery/environments/current') {
45
80
  const body = [];
46
81
  proxyRes.on('data', function (chunk) {
@@ -61,20 +96,28 @@ const proxyServer = (port, target, additionalTarget) => {
61
96
  proxy.on('open', () => {
62
97
  console.log(`Proxy opened to ${target}`);
63
98
  });
99
+ /**
100
+ * creates a new HTTP server instance using createServer() method from the http module, which listens for incoming requests and forwards them to the proxy server using proxy.web() method.
101
+ * It also sets up some default headers for CORS and checks if the incoming request method is OPTIONS.
102
+ * If it is, it sends a 204 response with the CORS headers and ends the response.
103
+ */
64
104
  const server = (0, http_1.createServer)((req, res) => {
65
105
  var _a;
66
106
  const headers = {
67
107
  'Access-Control-Allow-Origin': (_a = req.headers.origin) !== null && _a !== void 0 ? _a : '*',
68
108
  'Access-Control-Allow-Methods': 'OPTIONS, POST, GET, PUT, DELETE',
69
109
  'Access-Control-Max-Age': 2592000,
70
- 'Access-Control-Allow-Headers': 'authorization,content-type',
110
+ 'Access-Control-Allow-Headers': 'authorization,content-type,last-event-id',
71
111
  };
72
112
  if (req.method === 'OPTIONS') {
73
113
  res.writeHead(204, headers);
74
114
  res.end();
75
115
  return;
76
116
  }
77
- // Specific proxy setup for service-discovery, to rewrite the urls
117
+ /**
118
+ * checks if the incoming request URL matches /_discovery/environments/current.
119
+ * If it does, it logs a message to the console, and forwards the request to the proxy server with the target and selfHandleResponse options set.
120
+ */
78
121
  if (req.url === '/_discovery/environments/current') {
79
122
  console.log(`[REWRITE] Rewriting all ROMA apis to use localhost:${port} as portal-url`);
80
123
  proxy.web(req, res, {
@@ -83,6 +126,13 @@ const proxyServer = (port, target, additionalTarget) => {
83
126
  });
84
127
  return;
85
128
  }
129
+ /**
130
+ * Check if the incoming request method is GET, POST, PUT, or DELETE.
131
+ * If it is, it checks if there are any additional configuration options for the incoming request URL.
132
+ * If there are, it reads the configuration options, replaces any environment variables in the headers, and removes the target path if necessary.
133
+ * It then forwards the request to the proxy server with the configuration options.
134
+ * If there are no additional configuration options, it forwards the request to the proxy server with the default target option.
135
+ */
86
136
  if (['GET', 'POST', 'PUT', 'DELETE'].indexOf(req.method) > -1) {
87
137
  let targetKeys = Object.keys(additionalTarget !== null && additionalTarget !== void 0 ? additionalTarget : {});
88
138
  const manualConfig = targetKeys.find((v) => req.url.startsWith(v));
@@ -108,9 +158,17 @@ const proxyServer = (port, target, additionalTarget) => {
108
158
  }
109
159
  return;
110
160
  }
161
+ /**
162
+ * If no match above, we return a 405 Method not allowed error.
163
+ */
111
164
  res.writeHead(405, headers);
112
165
  res.end(`${req.method} is not allowed for the request.`);
113
166
  });
167
+ /**
168
+ * @return an object with two properties:
169
+ * server, which is the HTTP server instance created by createServer() method.
170
+ * proxy, which is the HTTP proxy instance created by createProxyServer() method.
171
+ */
114
172
  return {
115
173
  server,
116
174
  proxy,
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/portal/proxy.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;AAE9D,+BAAqE;AAErE,MAAM,UAAU,GAAG,CACjB,GAAoB,EACpB,GAAoC,EACpC,EAAE;;IACF,GAAG,CAAC,SAAS,CACX,6BAA6B,EAC7B,MAAA,GAAG,CAAC,OAAO,CAAC,MAAM,mCAAI,uBAAuB,CAC9C,CAAC;IAEF,IAAI,GAAG,CAAC,OAAO,CAAC,+BAA+B,CAAC,EAAE;QAChD,GAAG,CAAC,SAAS,CACX,8BAA8B,EAC9B,GAAG,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAC7C,CAAC;KACH;IAED,IAAI,GAAG,CAAC,OAAO,CAAC,gCAAgC,CAAC,EAAE;QACjD,GAAG,CAAC,SAAS,CACX,8BAA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  "type": "string",
10
10
  "description": "Portal host",
11
- "default": "https://workbench-enhgbqb2h2c9ana8.z01.azurefd.net"
11
+ "default": "https://romadev.equinor.com"
12
12
  },
13
13
  "port": {
14
14
  "type": "number",
@@ -9,7 +9,7 @@ async function runExecutor(options, context) {
9
9
  const outputPath = (_a = buildConfig.outputPath) !== null && _a !== void 0 ? _a : `dist/apps/${projectName}`;
10
10
  let success = true;
11
11
  try {
12
- await (0, publish_script_1.publishApplication)(projectName, outputPath);
12
+ await (0, publish_script_1.publishApplication)(projectName, outputPath, options);
13
13
  }
14
14
  catch (ex) {
15
15
  console.error(`Error when publishing ${projectName}`);
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/publish/executor.ts"],"names":[],"mappings":";;AAEA,qDAAsD;AAOvC,KAAK,UAAU,WAAW,CACvC,OAA8B,EAC9B,OAAwB;;IAExB,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACxC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAuB,CAAC;IAC9E,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,KAA2B,CAAC;IAChE,MAAM,UAAU,GAAG,MAAA,WAAW,CAAC,UAAU,mCAAI,aAAa,WAAW,EAAE,CAAC;IACxE,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,IAAI;QACF,MAAM,IAAA,mCAAkB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;KACnD;IAAC,OAAO,EAAE,EAAE;QACX,OAAO,CAAC,KAAK,CAAC,yBAAyB,WAAW,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,GAAG,KAAK,CAAC;KACjB;IACD,OAAO;QACL,OAAO;KACR,CAAC;AACJ,CAAC;AAnBD,8BAmBC"}
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/publish/executor.ts"],"names":[],"mappings":";;AAEA,qDAAsD;AAOvC,KAAK,UAAU,WAAW,CACvC,OAA8B,EAC9B,OAAwB;;IAExB,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACxC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAuB,CAAC;IAC9E,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,KAA2B,CAAC;IAChE,MAAM,UAAU,GAAG,MAAA,WAAW,CAAC,UAAU,mCAAI,aAAa,WAAW,EAAE,CAAC;IACxE,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,IAAI;QACF,MAAM,IAAA,mCAAkB,EAAC,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;KAC5D;IAAC,OAAO,EAAE,EAAE;QACX,OAAO,CAAC,KAAK,CAAC,yBAAyB,WAAW,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,GAAG,KAAK,CAAC;KACjB;IACD,OAAO;QACL,OAAO;KACR,CAAC;AACJ,CAAC;AAnBD,8BAmBC"}
@@ -0,0 +1,27 @@
1
+ export type Manifest = {
2
+ key: string;
3
+ version: Version;
4
+ shortName: string;
5
+ name: string;
6
+ description: string;
7
+ tags: string[];
8
+ hide: boolean;
9
+ order: number;
10
+ type: string;
11
+ accentColor: string;
12
+ icon: any;
13
+ categoryId: string;
14
+ category: Category;
15
+ entry?: string;
16
+ };
17
+ export type Version = {
18
+ major: number;
19
+ minor: number;
20
+ patch: number;
21
+ };
22
+ export type Category = {
23
+ id: string;
24
+ name: string;
25
+ color: string;
26
+ defaultIcon: string;
27
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=manifest-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-model.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/publish/manifest-model.ts"],"names":[],"mappings":""}
@@ -1 +1,9 @@
1
- export declare const publishApplication: (appName: string, pathToOutput: string) => Promise<void>;
1
+ import type { PublishExecutorSchema } from './schema';
2
+ /**
3
+ * Publishes the application to the specified environment.
4
+ *
5
+ * @param appName - The name of the application to publish.
6
+ * @param pathToOutput - The path to the output directory.
7
+ * @param options - The options for the publish operation.
8
+ */
9
+ export declare const publishApplication: (appName: string, pathToOutput: string, options: PublishExecutorSchema) => Promise<void>;
@@ -1,24 +1,72 @@
1
1
  "use strict";
2
- var _a;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.publishApplication = void 0;
5
4
  const promises_1 = require("node:fs/promises");
6
5
  const node_path_1 = require("node:path");
7
6
  const identity_1 = require("@azure/identity");
8
- const storage_blob_1 = require("@azure/storage-blob");
7
+ /**
8
+ * An enum representing the status of the publish operation.
9
+ * @enum {number}
10
+ */
9
11
  var Status;
10
12
  (function (Status) {
11
13
  Status[Status["SUCCESS"] = 0] = "SUCCESS";
12
14
  Status[Status["ERROR"] = 1] = "ERROR";
13
15
  })(Status || (Status = {}));
14
- const url = (_a = process.env.API_URL) !== null && _a !== void 0 ? _a : 'https://workbench-enhgbqb2h2c9ana8.z01.azurefd.net/api/apps';
15
- const publishApplication = async (appName, pathToOutput) => {
16
- console.log(`Reading & uploading bundle for ${appName}`);
16
+ /**
17
+ * A map of environment names to their respective configurations.
18
+ */
19
+ const configMap = {
20
+ dev: {
21
+ azureFdUrl: `https://workbench-dev-d4huf3epb4fvfubz.a03.azurefd.net`,
22
+ romaUri: 'https://romadev.equinor.com',
23
+ apiScopes: ['83c0f0fa-eff6-4199-87a0-c25f28ca4bb3/.default'],
24
+ },
25
+ qa: {
26
+ azureFdUrl: ``,
27
+ romaUri: 'https://romaqa.equinor.com',
28
+ apiScopes: ['83c0f0fa-eff6-4199-87a0-c25f28ca4bb3/.default'],
29
+ },
30
+ production: {
31
+ azureFdUrl: ``,
32
+ romaUri: 'https://roma.equinor.com',
33
+ apiScopes: ['83c0f0fa-eff6-4199-87a0-c25f28ca4bb3/.default'],
34
+ },
35
+ };
36
+ /**
37
+ * Auth token to publish the application
38
+ */
39
+ let token;
40
+ /**
41
+ * Publishes the application to the specified environment.
42
+ *
43
+ * @param appName - The name of the application to publish.
44
+ * @param pathToOutput - The path to the output directory.
45
+ * @param options - The options for the publish operation.
46
+ */
47
+ const publishApplication = async (appName, pathToOutput, options) => {
48
+ const env = options.environment;
49
+ const config = configMap[env];
17
50
  const bundle = await (0, promises_1.readFile)((0, node_path_1.join)(pathToOutput, 'app-bundle.js'));
18
- await uploadBundle(appName, bundle);
19
- console.log(`Reading & uploading application manifest to ${url}`);
20
51
  const manifest = await (0, promises_1.readFile)((0, node_path_1.join)(pathToOutput, 'manifest.json'));
21
- const status = await publishManifest(manifest);
52
+ const manifestJsonString = manifest.toString('utf-8');
53
+ const parsedManifest = JSON.parse(manifestJsonString);
54
+ const categories = await getCategories(config);
55
+ const categoryIds = categories.map((c) => c.id);
56
+ if (!categoryIds.includes(parsedManifest.categoryId)) {
57
+ console.log(`Manifest validation failed: categoryId ${parsedManifest.categoryId} is not in list of categories`);
58
+ console.log(`Valid categories:`);
59
+ console.table(categories, ['id', 'name']);
60
+ console.log(`Publish will now exit.`);
61
+ throw new Error(`ManifestValidationError`);
62
+ }
63
+ console.log(`Reading & uploading bundle for ${appName}`);
64
+ const bundleResult = await uploadBundle(appName, bundle, config);
65
+ if (bundleResult === Status.ERROR) {
66
+ throw new Error('Failed to upload application');
67
+ }
68
+ console.log(`Reading & uploading application manifest to ${config.romaUri}`);
69
+ const status = await publishManifest(parsedManifest, config);
22
70
  if (status === Status.ERROR) {
23
71
  throw new Error(`Failed to publish application ${appName}`);
24
72
  }
@@ -27,37 +75,118 @@ const publishApplication = async (appName, pathToOutput) => {
27
75
  }
28
76
  };
29
77
  exports.publishApplication = publishApplication;
30
- async function publishManifest(manifest) {
31
- const manifestJsonString = manifest.toString('utf-8');
78
+ /**
79
+ * Authenticates the user and returns the authentication token.
80
+ *
81
+ * @returns The authentication token.
82
+ */
83
+ async function authenticate() {
84
+ if (token)
85
+ return token;
32
86
  const auth = new identity_1.DefaultAzureCredential();
33
- const token = await auth.getToken('83c0f0fa-eff6-4199-87a0-c25f28ca4bb3/.default');
34
- const req = await fetch(url, {
87
+ const tokenHolder = await auth.getToken('83c0f0fa-eff6-4199-87a0-c25f28ca4bb3/.default');
88
+ token = tokenHolder.token;
89
+ return token;
90
+ }
91
+ /**
92
+ * Gets a list of valid roma categories
93
+ *
94
+ * @param config - The configuration for the environment.
95
+ * @returns The categories for roma.
96
+ */
97
+ async function getCategories(config) {
98
+ const token = await authenticate();
99
+ const req = await fetch(`${config.romaUri}/api/apps/categories`, {
100
+ headers: {
101
+ Authorization: `Bearer ${token}`,
102
+ 'Content-Type': 'application/json',
103
+ },
104
+ });
105
+ if (req.status >= 400) {
106
+ console.error('Failure', req.status);
107
+ return [];
108
+ }
109
+ else {
110
+ return await req.json();
111
+ }
112
+ }
113
+ /**
114
+ * Publishes the manifest for the application.
115
+ *
116
+ * @param manifest - The manifest for the application.
117
+ * @param config - The configuration for the application.
118
+ * @returns The status of the publish operation.
119
+ */
120
+ async function publishManifest(manifest, config) {
121
+ manifest.description = manifest.description || manifest.name;
122
+ const { major, minor, patch } = manifest.version;
123
+ manifest.entry = `${config.azureFdUrl}/applications/bundle/${manifest.key}/app-bundle.js?version=${major}.${minor}.${patch}`;
124
+ const token = await authenticate();
125
+ const req = await fetch(`${config.romaUri}/api/apps`, {
35
126
  method: 'POST',
36
127
  headers: {
37
- Authorization: `Bearer ${token.token}`,
128
+ Authorization: `Bearer ${token}`,
38
129
  'Content-Type': 'application/json',
39
130
  },
40
- body: manifestJsonString,
131
+ body: JSON.stringify(manifest),
41
132
  });
42
133
  if (req.status < 400) {
43
134
  return Status.SUCCESS;
44
135
  }
45
136
  else {
46
137
  console.error(`Encountered a problem when publishing application: Received statuscode ${req.status}`);
138
+ const err = await req.json();
139
+ console.error(err);
47
140
  return Status.ERROR;
48
141
  }
49
142
  }
50
- async function uploadBundle(appName, bundle) {
51
- const blobServiceClient = new storage_blob_1.BlobServiceClient(`https://topsroma.blob.core.windows.net`, new identity_1.DefaultAzureCredential());
143
+ /**
144
+ * Uploads the bundle for the application to Azure Blob Storage.
145
+ *
146
+ * @param appName - The name of the application.
147
+ * @param bundle - The bundle for the application.
148
+ */
149
+ async function uploadBundle(appName, bundle, config) {
150
+ const fd = new FormData();
151
+ fd.set('bundleFile', new Blob([bundle.toString('utf-8')]));
152
+ const token = await authenticate();
153
+ const req = await fetch(`${config.romaUri}/api/apps/key/${appName}/bundle`, {
154
+ method: 'PUT',
155
+ headers: {
156
+ Authorization: `Bearer ${token}`,
157
+ },
158
+ body: fd,
159
+ });
160
+ if (req.status < 400) {
161
+ console.log(`Successfully uploaded bundle to ${appName}/app-bundle.js`);
162
+ return Status.SUCCESS;
163
+ }
164
+ else {
165
+ console.error(`Encountered a problem when publishing application: Received statuscode ${req.status}`);
166
+ const err = await req.json();
167
+ console.error(err);
168
+ return Status.ERROR;
169
+ }
170
+ /* const blobServiceClient = new BlobServiceClient(
171
+ `https://topsroma.blob.core.windows.net`,
172
+ new DefaultAzureCredential()
173
+ );
52
174
  const client = blobServiceClient.getContainerClient('$web');
53
175
  const blobName = `${appName}/app-bundle.js`;
54
176
  const cl = client.getBlockBlobClient(blobName);
55
- const res = await cl.upload(bundle.toString('utf-8'), bundle.toString().length);
177
+ const res = await cl.upload(
178
+ bundle.toString('utf-8'),
179
+ bundle.toString().length,
180
+ {
181
+ blobHTTPHeaders: {
182
+ blobContentType: 'application/javascript',
183
+ },
184
+ }
185
+ );
56
186
  if (res.errorCode) {
57
- console.error('Failed to upload file to storage account', res.errorCode);
58
- }
59
- else {
60
- console.log(`Successfully uploaded bundle to ${appName}/app-bundle.js`);
61
- }
187
+ console.error('Failed to upload file to storage account', res.errorCode);
188
+ } else {
189
+ console.log(`Successfully uploaded bundle to ${appName}/app-bundle.js`);
190
+ }*/
62
191
  }
63
192
  //# 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,+CAA4C;AAC5C,yCAAiC;AACjC,8CAAyD;AACzD,sDAAwD;AAExD,IAAK,MAGJ;AAHD,WAAK,MAAM;IACT,yCAAO,CAAA;IACP,qCAAK,CAAA;AACP,CAAC,EAHI,MAAM,KAAN,MAAM,QAGV;AAED,MAAM,GAAG,GACP,MAAA,OAAO,CAAC,GAAG,CAAC,OAAO,mCACnB,6DAA6D,CAAC;AAEzD,MAAM,kBAAkB,GAAG,KAAK,EACrC,OAAe,EACf,YAAoB,EACpB,EAAE;IACF,OAAO,CAAC,GAAG,CAAC,kCAAkC,OAAO,EAAE,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAA,gBAAI,EAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC;IACnE,MAAM,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,+CAA+C,GAAG,EAAE,CAAC,CAAC;IAClE,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAA,gBAAI,EAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC;IACrE,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC/C,IAAI,MAAM,KAAK,MAAM,CAAC,KAAK,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,iCAAiC,OAAO,EAAE,CAAC,CAAC;KAC7D;SAAM;QACL,OAAO,CAAC,GAAG,CAAC,sCAAsC,OAAO,EAAE,CAAC,CAAC;KAC9D;AACH,CAAC,CAAC;AAfW,QAAA,kBAAkB,sBAe7B;AAEF,KAAK,UAAU,eAAe,CAAC,QAAgB;I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KAC1E;SAAM;QACL,OAAO,CAAC,GAAG,CAAC,mCAAmC,OAAO,gBAAgB,CAAC,CAAC;KACzE;AACH,CAAC"}
1
+ {"version":3,"file":"publish-script.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/publish/publish-script.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAC5C,yCAAiC;AACjC,8CAAyD;AAKzD;;;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,UAAU,EAAE,wDAAwD;QACpE,OAAO,EAAE,6BAA6B;QACtC,SAAS,EAAE,CAAC,+CAA+C,CAAC;KAC7D;IACD,EAAE,EAAE;QACF,UAAU,EAAE,EAAE;QACd,OAAO,EAAE,4BAA4B;QACrC,SAAS,EAAE,CAAC,+CAA+C,CAAC;KAC7D;IACD,UAAU,EAAE;QACV,UAAU,EAAE,EAAE;QACd,OAAO,EAAE,0BAA0B;QACnC,SAAS,EAAE,CAAC,+CAA+C,CAAC;KAC7D;CACF,CAAC;AAEF;;GAEG;AACH,IAAI,KAAa,CAAC;AAElB;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,KAAK,EACrC,OAAe,EACf,YAAoB,EACpB,OAA8B,EAC9B,EAAE;IACF,MAAM,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC;IAChC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAA,gBAAI,EAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC;IACnE,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAA,gBAAI,EAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC;IACrE,MAAM,kBAAkB,GAAG,QAAQ,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CAAmC,OAAO,gBAAgB,CAAC,CAAC;QACxE,OAAO,MAAM,CAAC,OAAO,CAAC;KACvB;SAAM;QACL,OAAO,CAAC,KAAK,CACX,0EAA0E,GAAG,CAAC,MAAM,EAAE,CACvF,CAAC;QACF,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO,MAAM,CAAC,KAAK,CAAC;KACrB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;AACL,CAAC"}
@@ -0,0 +1,49 @@
1
+ # Roma Publish Script
2
+
3
+ This is a NX executor script for publishing Roma applications to Azure Blob Storage and the Roma API.
4
+
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
+
7
+ ## Code Explanation
8
+
9
+ This script exports a default asynchronous function `runExecutor` which is what NX calls on executors.
10
+
11
+ 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
+
13
+ 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
+ - `pathToOutput`: The path to the output directory.
16
+ - `options`: The options for the publish operation.
17
+
18
+ The function reads the built application bundle and manifest and publishes the application to the specified environment using the Roma API. It also validates the manifest to ensure that the categoryId is valid.
19
+
20
+ 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
+
22
+ The `getCategories` function is responsible for getting a list of valid Roma categories. It takes the following parameter:
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)
39
+
40
+ The script also defines a few types and interfaces:
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.
46
+
47
+ The script uses the `node:fs/promises` and `node:path` modules to read files and join paths. It also uses the `@azure/identity` and `@azure/storage-blob` packages to authenticate the user and upload the application bundle to Azure Blob Storage.
48
+
49
+ Overall, this script provides a convenient way to publish Roma applications to Azure Blob Storage and the Roma API.
@@ -1 +1,3 @@
1
- export interface PublishExecutorSchema {} // eslint-disable-line
1
+ export interface PublishExecutorSchema {
2
+ environment: 'dev' | 'production' | 'qa';
3
+ } // eslint-disable-line
@@ -4,6 +4,13 @@
4
4
  "title": "Publish executor",
5
5
  "description": "",
6
6
  "type": "object",
7
- "properties": {},
7
+ "properties": {
8
+ "environment": {
9
+ "type": "string",
10
+ "description": "Environment to publish the application to",
11
+ "enum": ["production", "qa", "dev"],
12
+ "default": "dev"
13
+ }
14
+ },
8
15
  "required": []
9
16
  }
@@ -7,19 +7,23 @@ const path = tslib_1.__importStar(require("path"));
7
7
  // const depPath = require.resolve('@equinor-roma/framework');
8
8
  async function runExecutor(options, context) {
9
9
  var _a;
10
+ // Get the name and root directory of the project.
10
11
  const projectName = context.projectName;
11
12
  const project = context.workspace.projects[projectName];
12
13
  const cwd = path.resolve(context.root, project.root);
14
+ // Set up extra arguments for the Fusion CLI command.
13
15
  const extraFusionArgs = [];
14
16
  if (options.portal) {
15
17
  extraFusionArgs.push(`--portal=${options.portal}`);
16
18
  }
17
19
  if (options.devPortal) {
20
+ // If a custom dev-portal is specified, use it.
18
21
  const portalPath = path.join(context.root, options.devPortal);
19
22
  const relativePath = path.relative(cwd, portalPath);
20
23
  extraFusionArgs.push(`--dev-portal ${relativePath}`);
21
24
  }
22
25
  else {
26
+ // If no custom dev-portal is specified, we use the default one.
23
27
  // This is a relative path to the dev-portal (see comment on l#5)
24
28
  // const relative = path.relative(projectPath, depPath);
25
29
  // Change this to the dependency dev portal location.
@@ -30,8 +34,9 @@ async function runExecutor(options, context) {
30
34
  `fusion-framework-cli app dev ${extraFusionArgs.join(' ')} -p ${(_a = options.port) !== null && _a !== void 0 ? _a : 3000}`,
31
35
  ];
32
36
  if (options.proxy) {
37
+ // If the `--proxy` flag is set, run the portal target.
33
38
  if (!project.targets.portal) {
34
- // console.log('\x1b[33m Welcome to the app! \x1b[0m');
39
+ // But not if we dont have a portal-target
35
40
  console.error(`\x1b[31m Proxy Error: Target "portal" not defined for project, portal-proxy will not run. \x1b[0m`);
36
41
  }
37
42
  else {
@@ -40,7 +45,6 @@ async function runExecutor(options, context) {
40
45
  }
41
46
  const manifestPath = path.relative(cwd, path.resolve(project.root, 'fusion-manifest.json'));
42
47
  extraFusionArgs.push(`--manifest ${manifestPath}`);
43
- const { projectsConfigurations, nxJsonConfiguration, workspace } = context, rest = tslib_1.__rest(context, ["projectsConfigurations", "nxJsonConfiguration", "workspace"]);
44
48
  return (0, run_commands_impl_1.default)({
45
49
  commands,
46
50
  parallel: true,
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/serve/executor.ts"],"names":[],"mappings":";;;AAEA,gHAA0E;AAC1E,mDAA6B;AAC7B,wEAAwE;AACxE,8DAA8D;AAE/C,KAAK,UAAU,WAAW,CACvC,OAA4B,EAC5B,OAAwB;;IAExB,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACxC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CA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IAAI,CAAC,QAAQ,CAChC,GAAG,EACH,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,sBAAsB,CAAC,CACnD,CAAC;IACF,eAAe,CAAC,IAAI,CAAC,cAAc,YAAY,EAAE,CAAC,CAAC;IACnD,MAAM,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,SAAS,KAC5D,OAAO,EAD0D,IAAI,kBACrE,OAAO,EADH,8DAAmE,CAChE,CAAC;IACV,OAAO,IAAA,2BAAW,EAChB;QACE,QAAQ;QACR,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,GAAG;QACR,YAAY,EAAE,EAAE;KACjB,EACD,OAAO,CACR,CAAC;AACJ,CAAC;AA5DD,8BA4DC"}
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/serve/executor.ts"],"names":[],"mappings":";;;AAEA,gHAA0E;AAC1E,mDAA6B;AAC7B,wEAAwE;AACxE,8DAA8D;AAE/C,KAAK,UAAU,WAAW,CACvC,OAA4B,EAC5B,OAAwB;;IAExB,kDAAkD;IAClD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACxC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAErD,qDAAqD;IACrD,MAAM,eAAe,GAAkB,EAAE,CAAC;IAC1C,IAAI,OAAO,CAAC,MAAM,EAAE;QAClB,eAAe,CAAC,IAAI,CAAC,YAAY,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;KACpD;IACD,IAAI,OAAO,CAAC,SAAS,EAAE;QACrB,+CAA+C;QAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAC9D,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QACpD,eAAe,CAAC,IAAI,CAAC,gBAAgB,YAAY,EAAE,CAAC,CAAC;KACtD;SAAM;QACL,gEAAgE;QAChE,iEAAiE;QACjE,wDAAwD;QACxD,qDAAqD;QACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAC5B,GAAG,EACH,IAAI,CAAC,OAAO,CACV,OAAO,CAAC,IAAI,EACZ,iDAAiD,CAClD,CACF,CAAC;QACF,eAAe,CAAC,IAAI,CAAC,gBAAgB,QAAQ,EAAE,CAAC,CAAC;KAClD;IACD,MAAM,QAAQ,GAAG;QACf,gCAAgC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,OACvD,MAAA,OAAO,CAAC,IAAI,mCAAI,IAClB,EAAE;KACH,CAAC;IACF,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,uDAAuD;QACvD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE;YAC3B,0CAA0C;YAC1C,OAAO,CAAC,KAAK,CACX,mGAAmG,CACpG,CAAC;SACH;aAAM;YACL,QAAQ,CAAC,IAAI,CAAC,UAAU,OAAO,CAAC,IAAI,SAAS,CAAC,CAAC;SAChD;KACF;IACD,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAChC,GAAG,EACH,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,sBAAsB,CAAC,CACnD,CAAC;IACF,eAAe,CAAC,IAAI,CAAC,cAAc,YAAY,EAAE,CAAC,CAAC;IACnD,OAAO,IAAA,2BAAW,EAChB;QACE,QAAQ;QACR,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,GAAG;QACR,YAAY,EAAE,EAAE;KACjB,EACD,OAAO,CACR,CAAC;AACJ,CAAC;AA/DD,8BA+DC"}
@@ -0,0 +1,12 @@
1
+ The `runExecutor` function is an async function that serves the application using the Fusion CLI. It takes two parameters:
2
+
3
+ - `options` - The options for serving the application. This is an object that conforms to the `ServeExecutorSchema` interface.
4
+ - `context` - The context for serving the application. This is an object that conforms to the `ExecutorContext` interface.
5
+
6
+ The function starts by getting the name and root directory of the project from the `context` object.
7
+ It then sets up extra arguments for the Fusion CLI command based on the `options` object.
8
+ If a custom dev-portal is specified, it is used instead of the default one.
9
+ If the `--proxy` flag is set, the `portal` target is run.
10
+ Finally, the function sets up the path to the manifest file and removes unnecessary properties from the `context` object.
11
+
12
+ The function then runs the command using the `runCommands` function and returns a `Promise<void>`
@@ -4,7 +4,7 @@ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
4
4
 
5
5
  export default ({ mode, command }) => {
6
6
  return defineConfig({
7
- plugins: mode === 'test' ? [react(), nxViteTsPaths()] : [],
7
+ plugins: [react(), nxViteTsPaths()],
8
8
  resolve: {
9
9
  alias: {},
10
10
  },
@@ -9,7 +9,7 @@ const modules_1 = require("./data/modules");
9
9
  const eslint_file_1 = require("@nx/linter/src/generators/utils/eslint-file");
10
10
  async function addDependencies(tree, options) {
11
11
  let dependencies = {
12
- '@equinor/roma-framework': '^0.0.5',
12
+ '@equinor/roma-framework': '^0.0.6',
13
13
  '@equinor/fusion-framework': '^7.0.19',
14
14
  '@equinor/fusion-framework-module-app': '^5.2.4',
15
15
  '@equinor/eds-core-react': '^0.32.4',
@@ -18,7 +18,7 @@ async function addDependencies(tree, options) {
18
18
  '@equinor/fusion-framework-react': '^5.2.3',
19
19
  '@equinor/fusion-framework-react-app': '^4.1.2',
20
20
  '@equinor/fusion-framework-react-module': '^3.0.5',
21
- 'styled-components': '^5.3.0',
21
+ 'styled-components': '^6.0.8',
22
22
  };
23
23
  options.fusionModules
24
24
  .flatMap((module) => module.split(','))
@@ -56,7 +56,18 @@ function updateTargets(tree, projectRoot, options) {
56
56
  };
57
57
  json.targets.publish = {
58
58
  executor: '@equinor/roma-nx-plugin:publish',
59
- options: {},
59
+ configurations: {
60
+ production: {
61
+ environment: 'production',
62
+ },
63
+ qa: {
64
+ environment: 'qa',
65
+ },
66
+ dev: {
67
+ environment: 'dev',
68
+ },
69
+ },
70
+ defaultConfiguration: 'dev',
60
71
  };
61
72
  delete json.targets.preview;
62
73
  return json;
@@ -93,6 +104,9 @@ async function appGenerator(tree, options) {
93
104
  // See: https://eslint.org/docs/latest/extend/shareable-configs
94
105
  // addExtendsToLintConfig(tree, options.appProjectRoot, '@equinor/roma');
95
106
  }
107
+ if (options.skipPackageJson) {
108
+ return () => true;
109
+ }
96
110
  return () => {
97
111
  (0, devkit_1.installPackagesTask)(tree);
98
112
  };
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/generators/app/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAWoB;AACpB,mDAA6B;AAE7B,qCAAiD;AAEjD,4CAAyC;AACzC,6EAAsF;AAEtF,KAAK,UAAU,eAAe,CAC5B,IAAU,EACV,OAA2E;IAE3E,IAAI,YAAY,GAA2B;QACzC,yBAAyB,EAAE,QAAQ;QACnC,2BAA2B,EAAE,SAAS;QACtC,sCAAsC,EAAE,QAAQ;QAChD,yBAAyB,EAAE,SAAS;QACpC,oBAAoB,EAAE,SAAS;QAC/B,qBAAqB,EAAE,QAAQ;QAC/B,iCAAiC,EAAE,QAAQ;QAC3C,qCAAqC,EAAE,QAAQ;QAC/C,wCAAwC,EAAE,QAAQ;QAClD,mBAAmB,EAAE,QAAQ;KAC9B,CAAC;IACF,OAAO,CAAC,aAAa;SAClB,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACtC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAClB,YAAY,CAAC,YAAY,MAAM,EAAE,CAAC,GAAG,iBAAO,CAAC,MAAM,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IACL,IAAI,OAAO,CAAC,OAAO,EAAE;QACnB,YAAY,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AC,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IACzE,MAAM,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACxB,IAAI,CAAC,MAAM,CAAC,GAAG,WAAW,UAAU,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,GAAG,WAAW,aAAa,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,GAAG,WAAW,eAAe,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,CAAC,GAAG,WAAW,iBAAiB,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,GAAG,WAAW,aAAa,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,GAAG,WAAW,SAAS,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,CAAC,GAAG,WAAW,iBAAiB,CAAC,CAAC;IAE7C,IAAI,OAAO,CAAC,MAAM,IAAI,IAAA,qCAAuB,EAAC,IAAI,CAAC,EAAE;QACnD,oDAAoD;QACpD,2DAA2D;QAC3D,+DAA+D;QAC/D,yEAAyE;KAC1E;IAED,IAAI,OAAO,CAAC,eAAe,EAAE;QAC3B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;KACnB;IAED,OAAO,GAAG,EAAE;QACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AAnDD,oCAmDC;AAED,kBAAe,YAAY,CAAC"}
@@ -0,0 +1,13 @@
1
+ # Readme for Roma Application Generator
2
+
3
+ ## Code Explanation
4
+
5
+ The generator is implemented in `app-generator.ts` and exports a single `appGenerator` function.
6
+
7
+ The `appGenerator` function takes two arguments: a `Tree` object representing the file system of the Nx workspace, and an `AppGeneratorSchema` object representing the options passed to the generator.
8
+
9
+ The function first calls the `applicationGenerator` function from the `@nx/react` package to generate a new React application using the options passed to the generator. It then updates the `targets` section of the `project.json` file for the new application to include the Roma-specific targets (build, serve, portal, and publish), and adds the necessary dependencies to the `package.json` file.
10
+
11
+ The function then generates several files based on the options passed to the generator, including a `fusion-manifest.json` file, a `tsconfig.json` file, and a `vite.config.ts` file. It also deletes several files and directories that are not needed for a Roma application, but that are generated by `@nx/react`'s generator.
12
+
13
+ Finally, the function returns a function that installs the necessary packages using the `installPackagesTask` function from the `@nx/devkit` package. If the `skipPackageJson` option is set to `true`, the function returns a function that does nothing instead.
@@ -11,7 +11,18 @@ function update(tree) {
11
11
  if (!((_a = project.targets) === null || _a === void 0 ? void 0 : _a.portal)) {
12
12
  project.targets.publish = {
13
13
  executor: '@equinor/roma-nx-plugin:publish',
14
- options: {},
14
+ configurations: {
15
+ production: {
16
+ environment: 'production',
17
+ },
18
+ qa: {
19
+ environment: 'qa',
20
+ },
21
+ dev: {
22
+ environment: 'dev',
23
+ },
24
+ },
25
+ defaultConfiguration: 'dev',
15
26
  };
16
27
  (0, devkit_1.updateProjectConfiguration)(tree, name, project);
17
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"add-publish-target.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/migrations/add-publish-target/add-publish-target.ts"],"names":[],"mappings":";;AAAA,sDAAsD;AACtD,uCAA2E;AAE3E,SAAwB,MAAM,CAAC,IAAU;;IACvC,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAEnC,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,QAAQ,EAAE;QACtC,IAAI,OAAO,CAAC,WAAW,KAAK,aAAa;YAAE,SAAS;QACpD,IAAI,CAAC,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,MAAM,CAAA,EAAE;YAC5B,OAAO,CAAC,OAAO,CAAC,OAAO,GAAG;gBACxB,QAAQ,EAAE,iCAAiC;gBAC3C,OAAO,EAAE,EAAE;aACZ,CAAC;YACF,IAAA,mCAA0B,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;SACjD;KACF;AACH,CAAC;AAbD,yBAaC"}
1
+ {"version":3,"file":"add-publish-target.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/migrations/add-publish-target/add-publish-target.ts"],"names":[],"mappings":";;AAAA,sDAAsD;AACtD,uCAA2E;AAE3E,SAAwB,MAAM,CAAC,IAAU;;IACvC,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAEnC,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,QAAQ,EAAE;QACtC,IAAI,OAAO,CAAC,WAAW,KAAK,aAAa;YAAE,SAAS;QACpD,IAAI,CAAC,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,MAAM,CAAA,EAAE;YAC5B,OAAO,CAAC,OAAO,CAAC,OAAO,GAAG;gBACxB,QAAQ,EAAE,iCAAiC;gBAC3C,cAAc,EAAE;oBACd,UAAU,EAAE;wBACV,WAAW,EAAE,YAAY;qBAC1B;oBACD,EAAE,EAAE;wBACF,WAAW,EAAE,IAAI;qBAClB;oBACD,GAAG,EAAE;wBACH,WAAW,EAAE,KAAK;qBACnB;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B,CAAC;YACF,IAAA,mCAA0B,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;SACjD;KACF;AACH,CAAC;AAxBD,yBAwBC"}