@equinor/fusion-framework-cli 11.0.0-next.5 → 11.0.0-next.7

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/bin/build/bin.js +7 -7
  3. package/bin/build/cli.js +426 -188
  4. package/bin/build/{portal-pack-qpEBTWNW.js → portal-config-publish-OZ7Ocme4.js} +219 -22
  5. package/dist/esm/bin/helpers/resolve-portal-config.js +46 -0
  6. package/dist/esm/bin/helpers/resolve-portal-config.js.map +1 -0
  7. package/dist/esm/bin/index.js +2 -0
  8. package/dist/esm/bin/index.js.map +1 -1
  9. package/dist/esm/bin/portal-config-publish.js +74 -0
  10. package/dist/esm/bin/portal-config-publish.js.map +1 -0
  11. package/dist/esm/bin/portal-config.js +48 -0
  12. package/dist/esm/bin/portal-config.js.map +1 -0
  13. package/dist/esm/bin/portal-dev.js +3 -4
  14. package/dist/esm/bin/portal-dev.js.map +1 -1
  15. package/dist/esm/cli/commands/app/alias.js +4 -4
  16. package/dist/esm/cli/commands/app/alias.js.map +1 -1
  17. package/dist/esm/cli/commands/app/build.js +10 -3
  18. package/dist/esm/cli/commands/app/build.js.map +1 -1
  19. package/dist/esm/cli/commands/app/check.js +15 -5
  20. package/dist/esm/cli/commands/app/check.js.map +1 -1
  21. package/dist/esm/cli/commands/app/config.js +20 -8
  22. package/dist/esm/cli/commands/app/config.js.map +1 -1
  23. package/dist/esm/cli/commands/app/dev.js +10 -4
  24. package/dist/esm/cli/commands/app/dev.js.map +1 -1
  25. package/dist/esm/cli/commands/app/index.js +18 -1
  26. package/dist/esm/cli/commands/app/index.js.map +1 -1
  27. package/dist/esm/cli/commands/app/manifest.js +12 -3
  28. package/dist/esm/cli/commands/app/manifest.js.map +1 -1
  29. package/dist/esm/cli/commands/app/pack.js +16 -9
  30. package/dist/esm/cli/commands/app/pack.js.map +1 -1
  31. package/dist/esm/cli/commands/app/publish.js +15 -4
  32. package/dist/esm/cli/commands/app/publish.js.map +1 -1
  33. package/dist/esm/cli/commands/app/tag.js +16 -4
  34. package/dist/esm/cli/commands/app/tag.js.map +1 -1
  35. package/dist/esm/cli/commands/app/upload.js +13 -8
  36. package/dist/esm/cli/commands/app/upload.js.map +1 -1
  37. package/dist/esm/cli/commands/auth/index.js +13 -1
  38. package/dist/esm/cli/commands/auth/index.js.map +1 -1
  39. package/dist/esm/cli/commands/auth/login.js +11 -7
  40. package/dist/esm/cli/commands/auth/login.js.map +1 -1
  41. package/dist/esm/cli/commands/auth/logout.js +10 -7
  42. package/dist/esm/cli/commands/auth/logout.js.map +1 -1
  43. package/dist/esm/cli/commands/auth/token.js +13 -9
  44. package/dist/esm/cli/commands/auth/token.js.map +1 -1
  45. package/dist/esm/cli/commands/disco/resolve.js +13 -16
  46. package/dist/esm/cli/commands/disco/resolve.js.map +1 -1
  47. package/dist/esm/cli/commands/portal/build.js +12 -7
  48. package/dist/esm/cli/commands/portal/build.js.map +1 -1
  49. package/dist/esm/cli/commands/portal/config.js +101 -0
  50. package/dist/esm/cli/commands/portal/config.js.map +1 -0
  51. package/dist/esm/cli/commands/portal/dev.js +9 -6
  52. package/dist/esm/cli/commands/portal/dev.js.map +1 -1
  53. package/dist/esm/cli/commands/portal/index.js +3 -1
  54. package/dist/esm/cli/commands/portal/index.js.map +1 -1
  55. package/dist/esm/cli/commands/portal/manifest.js +11 -8
  56. package/dist/esm/cli/commands/portal/manifest.js.map +1 -1
  57. package/dist/esm/cli/commands/portal/pack.js +13 -8
  58. package/dist/esm/cli/commands/portal/pack.js.map +1 -1
  59. package/dist/esm/cli/commands/portal/publish.js +11 -8
  60. package/dist/esm/cli/commands/portal/publish.js.map +1 -1
  61. package/dist/esm/cli/commands/portal/schema.js +10 -8
  62. package/dist/esm/cli/commands/portal/schema.js.map +1 -1
  63. package/dist/esm/cli/commands/portal/tag.js +12 -8
  64. package/dist/esm/cli/commands/portal/tag.js.map +1 -1
  65. package/dist/esm/cli/commands/portal/upload.js +8 -7
  66. package/dist/esm/cli/commands/portal/upload.js.map +1 -1
  67. package/dist/esm/lib/portal/index.js +2 -0
  68. package/dist/esm/lib/portal/index.js.map +1 -1
  69. package/dist/esm/lib/portal/load-portal-config.js +49 -0
  70. package/dist/esm/lib/portal/load-portal-config.js.map +1 -0
  71. package/dist/esm/lib/portal/portal-config.js +23 -0
  72. package/dist/esm/lib/portal/portal-config.js.map +1 -0
  73. package/dist/esm/version.js +1 -1
  74. package/dist/tsconfig.tsbuildinfo +1 -1
  75. package/dist/types/bin/helpers/resolve-portal-config.d.ts +18 -0
  76. package/dist/types/bin/index.d.ts +2 -0
  77. package/dist/types/bin/portal-config-publish.d.ts +26 -0
  78. package/dist/types/bin/portal-config.d.ts +46 -0
  79. package/dist/types/cli/commands/app/config.d.ts +3 -3
  80. package/dist/types/cli/commands/app/pack.d.ts +1 -1
  81. package/dist/types/cli/commands/auth/logout.d.ts +0 -4
  82. package/dist/types/cli/commands/auth/token.d.ts +0 -5
  83. package/dist/types/cli/commands/disco/resolve.d.ts +0 -7
  84. package/dist/types/cli/commands/portal/config.d.ts +32 -0
  85. package/dist/types/lib/portal/index.d.ts +2 -0
  86. package/dist/types/lib/portal/load-portal-config.d.ts +83 -0
  87. package/dist/types/lib/portal/portal-config.d.ts +69 -0
  88. package/dist/types/version.d.ts +1 -1
  89. package/package.json +8 -7
@@ -1,11 +1,5 @@
1
1
  import { loadConfigFromFile, mergeConfig, build } from 'vite';
2
2
  import chalk from 'chalk';
3
- import { PublicClientApplication, CryptoProvider } from '@azure/msal-node';
4
- import openBrowser from 'open';
5
- import { createServer } from 'node:http';
6
- import URL$2, { fileURLToPath } from 'node:url';
7
- import z$2, { z as z$1 } from 'zod';
8
- import isContinuousIntegration from 'is-ci';
9
3
  import { importConfig, FileNotFoundError } from '@equinor/fusion-imports';
10
4
  import mergeWith from 'lodash.mergewith';
11
5
  import { createDevServer as createDevServer$1, processServices } from '@equinor/fusion-framework-dev-server';
@@ -13,10 +7,16 @@ import { statSync, accessSync, constants as constants$1, existsSync, mkdirSync,
13
7
  import { stat, mkdir } from 'node:fs/promises';
14
8
  import { relative, resolve, dirname, basename, extname } from 'node:path';
15
9
  import { readPackageUp } from 'read-package-up';
10
+ import URL$2, { fileURLToPath } from 'node:url';
16
11
  import assert from 'node:assert';
17
12
  import { execSync } from 'node:child_process';
13
+ import z$2, { z as z$1 } from 'zod';
18
14
  import AdmZip from 'adm-zip';
19
15
  import prettyBytes from 'pretty-bytes';
16
+ import { PublicClientApplication, CryptoProvider } from '@azure/msal-node';
17
+ import openBrowser from 'open';
18
+ import { createServer } from 'node:http';
19
+ import isContinuousIntegration from 'is-ci';
20
20
  import ora from 'ora';
21
21
 
22
22
  /**
@@ -1461,10 +1461,6 @@ class ServerSentEventResponseError extends HttpResponseError {
1461
1461
  }
1462
1462
  }
1463
1463
 
1464
- function getDefaultExportFromCjs (x) {
1465
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1466
- }
1467
-
1468
1464
  var re = {exports: {}};
1469
1465
 
1470
1466
  var constants;
@@ -1821,11 +1817,11 @@ function requireIdentifiers () {
1821
1817
  return identifiers;
1822
1818
  }
1823
1819
 
1824
- var semver$2;
1820
+ var semver$1;
1825
1821
  var hasRequiredSemver$1;
1826
1822
 
1827
1823
  function requireSemver$1 () {
1828
- if (hasRequiredSemver$1) return semver$2;
1824
+ if (hasRequiredSemver$1) return semver$1;
1829
1825
  hasRequiredSemver$1 = 1;
1830
1826
 
1831
1827
  const debug = requireDebug();
@@ -2144,8 +2140,8 @@ function requireSemver$1 () {
2144
2140
  }
2145
2141
  }
2146
2142
 
2147
- semver$2 = SemVer;
2148
- return semver$2;
2143
+ semver$1 = SemVer;
2144
+ return semver$1;
2149
2145
  }
2150
2146
 
2151
2147
  var parse_1;
@@ -4065,11 +4061,11 @@ function requireSubset () {
4065
4061
  return subset_1;
4066
4062
  }
4067
4063
 
4068
- var semver$1;
4064
+ var semver;
4069
4065
  var hasRequiredSemver;
4070
4066
 
4071
4067
  function requireSemver () {
4072
- if (hasRequiredSemver) return semver$1;
4068
+ if (hasRequiredSemver) return semver;
4073
4069
  hasRequiredSemver = 1;
4074
4070
 
4075
4071
  // just pre-load all the stuff that index.js lazily exports
@@ -4114,7 +4110,7 @@ function requireSemver () {
4114
4110
  const intersects = requireIntersects();
4115
4111
  const simplifyRange = requireSimplify();
4116
4112
  const subset = requireSubset();
4117
- semver$1 = {
4113
+ semver = {
4118
4114
  parse,
4119
4115
  valid,
4120
4116
  clean,
@@ -4161,19 +4157,18 @@ function requireSemver () {
4161
4157
  compareIdentifiers: identifiers.compareIdentifiers,
4162
4158
  rcompareIdentifiers: identifiers.rcompareIdentifiers,
4163
4159
  };
4164
- return semver$1;
4160
+ return semver;
4165
4161
  }
4166
4162
 
4167
4163
  var semverExports = requireSemver();
4168
- var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
4169
4164
 
4170
4165
  /**
4171
4166
  * Extension of {@link SemVer} to expose `satisfies`
4172
4167
  * @see {@link [SemVer](https://www.npmjs.com/package/semver)}
4173
4168
  */
4174
- class SemanticVersion extends semver.SemVer {
4169
+ class SemanticVersion extends semverExports.SemVer {
4175
4170
  satisfies(arg) {
4176
- return semver.satisfies(this, arg);
4171
+ return semverExports.satisfies(this, arg);
4177
4172
  }
4178
4173
  }
4179
4174
 
@@ -11904,6 +11899,53 @@ const loadPortalSchema = async (env, options) => {
11904
11899
  };
11905
11900
  };
11906
11901
 
11902
+ /**
11903
+ * Loads and resolves the portal configuration from a file or function export.
11904
+ *
11905
+ * This function uses a script resolver to handle dynamic imports. If the imported module's default export
11906
+ * is a function, it will be invoked with the base configuration and runtime environment. The result
11907
+ * is validated against the provided schema (or a permissive passthrough schema by default).
11908
+ *
11909
+ * @param env - The runtime environment containing the root directory and other environment-specific settings.
11910
+ * @param options - Optional parameters for configuring the import process.
11911
+ * @returns A promise that resolves to the imported and validated portal configuration.
11912
+ *
11913
+ * @remarks
11914
+ * - Supports both static and dynamic config authoring patterns for portals.
11915
+ * - Ensures all configs are validated against the schema for type safety.
11916
+ * - Designed for maintainability and RAG-based documentation extraction.
11917
+ *
11918
+ * @example
11919
+ * ```ts
11920
+ * const config = await loadPortalConfig(env, { file: 'custom-portal.config.ts' });
11921
+ * ```
11922
+ */
11923
+ const loadPortalConfig = (env, options) => {
11924
+ // Suggest config filenames based on environment, fallback to default
11925
+ const suggestions = options?.file ?? [`portal.config.${env.environment}`, 'portal.config'];
11926
+ return importConfig(suggestions, {
11927
+ baseDir: env.root, // Set the base directory for config resolution
11928
+ extensions: options?.extensions, // Allow custom file extensions
11929
+ script: {
11930
+ // Custom resolver for the imported config module
11931
+ resolve: async (module) => {
11932
+ // Use provided schema or a permissive passthrough schema by default
11933
+ const schema = options?.schema ?? z$2.object({}).passthrough();
11934
+ const base = options?.base ?? {}; // Use provided base or default
11935
+ // If the module's default export is a function, invoke it with the base config and environment
11936
+ // and validate the result against the schema
11937
+ if (typeof module.default === 'function') {
11938
+ const result = (await module.default(base, env)) ?? base;
11939
+ return schema.parse(result ?? base); // Validate and return
11940
+ }
11941
+ // If the module's default export is not a function, treat it as a configuration object
11942
+ // and validate it against the schema
11943
+ return schema.parse(module.default ?? base); // Validate and return
11944
+ },
11945
+ },
11946
+ });
11947
+ };
11948
+
11907
11949
  /**
11908
11950
  * Resolves the portal manifest for a given runtime environment and package.
11909
11951
  *
@@ -12081,4 +12123,159 @@ const bundlePortal = async (options) => {
12081
12123
  };
12082
12124
  };
12083
12125
 
12084
- export { FusionEnv as F, HttpJsonResponseError as H, NoAccountsError as N, Spinner as S, bundleApp as a, buildApplication as b, buildPortal as c, bundlePortal as d, pack as e, resolveProjectPackage as f, generateApplicationConfig as g, resolveAppManifest as h, initializeFramework as i, formatPath as j, loadAppManifest as k, loadPortalManifest as l, fileExistsSync as m, resolvePortalManifest as n, createDevServer as o, publishAppConfig as p, getDefaultExportFromCjs as q, resolveDefaultEnv as r, startAppDevServer as s, loadPortalSchema as t, writeFile as w };
12126
+ /**
12127
+ * Resolves the portal configuration based on the provided runtime environment and options.
12128
+ * Handles logging, error reporting, and fallback to built-in config if no local config is found.
12129
+ *
12130
+ * @param env - The runtime environment containing the command and mode information.
12131
+ * @param options - Optional parameters:
12132
+ * - config: Path to a specific configuration file.
12133
+ * - log: Logger utility for progress and status messages.
12134
+ * @returns A promise resolving to the loaded portal configuration.
12135
+ * @throws If the portal configuration cannot be resolved.
12136
+ */
12137
+ const resolvePortalConfig = async (env, options) => {
12138
+ const { log } = options;
12139
+ try {
12140
+ // Start logging the config creation process
12141
+ log?.start('create portal configuration');
12142
+ log?.info(`generating config with ${chalk.red.dim(env.command)} command in ${chalk.green.dim(env.mode)} mode`);
12143
+ // Attempt to load the portal config (from file if specified)
12144
+ const result = await loadPortalConfig(env, { file: options?.config });
12145
+ // Log success and show the config file path
12146
+ log?.succeed('⚙️ generated config from ', formatPath(result.path, { relative: true }));
12147
+ return result.config;
12148
+ }
12149
+ catch (err) {
12150
+ // Handle missing config file error
12151
+ if (err instanceof FileNotFoundError) {
12152
+ if (options.config) {
12153
+ // Warn if a specific config file was requested but not found
12154
+ log?.warn(`failed to load config file ${formatPath(options.config)}, please check the path.`);
12155
+ }
12156
+ else {
12157
+ // Fallback to built-in config if no local config is present
12158
+ log?.succeed(chalk.dim('⚙️ no local portal config applied, using built-in'));
12159
+ return {};
12160
+ }
12161
+ }
12162
+ // Log failure and debug information for other errors
12163
+ log?.fail('failed to resolve portal config');
12164
+ log?.debug(err);
12165
+ throw err;
12166
+ }
12167
+ };
12168
+
12169
+ /**
12170
+ * Generates the portal configuration object for the current project.
12171
+ *
12172
+ * This function resolves the portal package, sets up the runtime environment, resolves the portal config,
12173
+ * and optionally writes the config to a file if an output path is provided. Logging is supported for
12174
+ * debugging and progress tracking.
12175
+ *
12176
+ * @param options - Optional settings for logger, environment overrides, config path, and output file.
12177
+ * @returns An object containing the generated config and the resolved package info.
12178
+ * @throws If writing the config to file fails.
12179
+ * @public
12180
+ */
12181
+ const generatePortalConfig = async (options) => {
12182
+ const { log } = options ?? {};
12183
+ // Resolve the portal's package.json for root and metadata
12184
+ const pkg = await resolveProjectPackage(log);
12185
+ // Setup the runtime environment for config resolution
12186
+ const env = {
12187
+ command: 'build',
12188
+ mode: process.env.NODE_ENV ?? 'production',
12189
+ root: pkg.root,
12190
+ ...options?.env, // Allow overrides from options
12191
+ };
12192
+ // Resolve the portal config using the environment and config path
12193
+ const config = await resolvePortalConfig(env, { log, config: options?.config });
12194
+ log?.debug('config:', config);
12195
+ // If an output path is provided, write the config to file
12196
+ if (options?.output) {
12197
+ log?.start('writing config to file');
12198
+ try {
12199
+ // Write the config as pretty-printed JSON
12200
+ await writeFile(options.output, JSON.stringify(config, null, 2));
12201
+ log?.succeed('config written successfully', formatPath(options.output, { relative: true }));
12202
+ }
12203
+ catch (error) {
12204
+ // Log and rethrow errors encountered during file write
12205
+ log?.fail('failed to write config');
12206
+ throw error;
12207
+ }
12208
+ }
12209
+ // Return the generated config and resolved package info for further use
12210
+ return { config, pkg };
12211
+ };
12212
+
12213
+ /**
12214
+ * Publishes the portal configuration to the portal store for a specific build version.
12215
+ *
12216
+ * This function generates the portal config, loads the manifest, initializes the Fusion Framework,
12217
+ * and sends the config to the portal service. Handles and logs errors for common failure scenarios.
12218
+ *
12219
+ * @param options - Options for config, manifest, environment, authentication, and logging.
12220
+ * @returns A promise that resolves when publishing is complete.
12221
+ * @throws If the build version is missing or publishing fails.
12222
+ * @public
12223
+ */
12224
+ const publishPortalConfig = async (options) => {
12225
+ const { log, portal } = options;
12226
+ // Generate the portal config using provided options and environment
12227
+ const { config: portalConfig } = await generatePortalConfig({
12228
+ log,
12229
+ config: options.config,
12230
+ env: { environment: options.environment },
12231
+ });
12232
+ log?.start('Initializing Fusion Framework...');
12233
+ // Initialize the Fusion Framework with the provided environment and authentication
12234
+ const framework = await initializeFramework({
12235
+ env: options.environment,
12236
+ auth: options.auth,
12237
+ });
12238
+ log?.succeed('Initialized Fusion Framework');
12239
+ // Create a client for the 'portals' service
12240
+ const portalClient = await framework.serviceDiscovery.createClient('portals');
12241
+ // Subscribe to outgoing requests for logging and debugging
12242
+ portalClient.request$.subscribe((request) => {
12243
+ log?.debug('Request:', request);
12244
+ log?.info('🌎', 'Executing request to:', formatPath(request.uri));
12245
+ });
12246
+ log?.start('Publishing portal config');
12247
+ log?.info('Using environment:', chalk.redBright(options.environment));
12248
+ try {
12249
+ // Send a PUT request to publish the portal config for the specific build version
12250
+ const response = await portalClient.json(`/portals/${portal.name}@${portal.version}/config`, {
12251
+ method: 'PUT',
12252
+ body: portalConfig,
12253
+ });
12254
+ log?.debug('Response:', response);
12255
+ log?.succeed('Published portal config');
12256
+ }
12257
+ catch (error) {
12258
+ // Handle known HTTP errors with specific log messages
12259
+ if (error instanceof HttpJsonResponseError) {
12260
+ switch (error.response.status) {
12261
+ case 410:
12262
+ log?.fail('🤬', `Portal ${portal.name} is deleted from portals-service. Please check the portal key and try again.`);
12263
+ break;
12264
+ case 404:
12265
+ log?.fail('🤬', `Portal ${portal.name} not found. Please check the portal key and try again.`);
12266
+ break;
12267
+ case 403:
12268
+ case 401:
12269
+ log?.fail('🤬', 'You are not authorized to publish portal config. Please check your permissions.');
12270
+ break;
12271
+ default:
12272
+ log?.fail('🤬', 'Failed to publish portal config.', `Status code: ${error.response.status}`, `Message: ${error.response.statusText}`);
12273
+ break;
12274
+ }
12275
+ }
12276
+ // Rethrow error for upstream handling
12277
+ throw error;
12278
+ }
12279
+ };
12280
+
12281
+ export { FusionEnv as F, HttpJsonResponseError as H, NoAccountsError as N, Spinner as S, bundleApp as a, buildApplication as b, buildPortal as c, bundlePortal as d, generatePortalConfig as e, publishPortalConfig as f, generateApplicationConfig as g, pack as h, resolveProjectPackage as i, resolveAppManifest as j, initializeFramework as k, loadPortalManifest as l, formatPath as m, loadAppManifest as n, fileExistsSync as o, publishAppConfig as p, resolvePortalManifest as q, resolveDefaultEnv as r, startAppDevServer as s, resolvePortalConfig as t, createDevServer as u, loadPortalSchema as v, writeFile as w };
@@ -0,0 +1,46 @@
1
+ import { FileNotFoundError } from '@equinor/fusion-imports';
2
+ import { chalk, formatPath } from '../utils/format.js';
3
+ import { loadPortalConfig } from '../../lib/portal';
4
+ /**
5
+ * Resolves the portal configuration based on the provided runtime environment and options.
6
+ * Handles logging, error reporting, and fallback to built-in config if no local config is found.
7
+ *
8
+ * @param env - The runtime environment containing the command and mode information.
9
+ * @param options - Optional parameters:
10
+ * - config: Path to a specific configuration file.
11
+ * - log: Logger utility for progress and status messages.
12
+ * @returns A promise resolving to the loaded portal configuration.
13
+ * @throws If the portal configuration cannot be resolved.
14
+ */
15
+ export const resolvePortalConfig = async (env, options) => {
16
+ const { log } = options;
17
+ try {
18
+ // Start logging the config creation process
19
+ log?.start('create portal configuration');
20
+ log?.info(`generating config with ${chalk.red.dim(env.command)} command in ${chalk.green.dim(env.mode)} mode`);
21
+ // Attempt to load the portal config (from file if specified)
22
+ const result = await loadPortalConfig(env, { file: options?.config });
23
+ // Log success and show the config file path
24
+ log?.succeed('⚙️ generated config from ', formatPath(result.path, { relative: true }));
25
+ return result.config;
26
+ }
27
+ catch (err) {
28
+ // Handle missing config file error
29
+ if (err instanceof FileNotFoundError) {
30
+ if (options.config) {
31
+ // Warn if a specific config file was requested but not found
32
+ log?.warn(`failed to load config file ${formatPath(options.config)}, please check the path.`);
33
+ }
34
+ else {
35
+ // Fallback to built-in config if no local config is present
36
+ log?.succeed(chalk.dim('⚙️ no local portal config applied, using built-in'));
37
+ return {};
38
+ }
39
+ }
40
+ // Log failure and debug information for other errors
41
+ log?.fail('failed to resolve portal config');
42
+ log?.debug(err);
43
+ throw err;
44
+ }
45
+ };
46
+ //# sourceMappingURL=resolve-portal-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-portal-config.js","sourceRoot":"","sources":["../../../../src/bin/helpers/resolve-portal-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,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C,CAAC;gBAC7E,OAAO,EAAO,CAAC;YACjB,CAAC;QACH,CAAC;QACD,qDAAqD;QACrD,GAAG,EAAE,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAC7C,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAChB,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC"}
@@ -6,5 +6,7 @@ export { startAppDevServer } from './app-dev.js';
6
6
  export { buildPortal } from './portal-build.js';
7
7
  export { bundlePortal } from './portal-pack.js';
8
8
  export { loadPortalManifest } from './portal-manifest.js';
9
+ export { generatePortalConfig } from './portal-config.js';
10
+ export { publishPortalConfig } from './portal-config-publish.js';
9
11
  export { pack } from './pack.js';
10
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { HttpJsonResponseError } from '@equinor/fusion-framework-module-http/errors';
2
+ import { initializeFramework, } from '../lib/framework.node.js';
3
+ import { formatPath, chalk } from './utils';
4
+ import { generatePortalConfig } from './portal-config.js';
5
+ /**
6
+ * Publishes the portal configuration to the portal store for a specific build version.
7
+ *
8
+ * This function generates the portal config, loads the manifest, initializes the Fusion Framework,
9
+ * and sends the config to the portal service. Handles and logs errors for common failure scenarios.
10
+ *
11
+ * @param options - Options for config, manifest, environment, authentication, and logging.
12
+ * @returns A promise that resolves when publishing is complete.
13
+ * @throws If the build version is missing or publishing fails.
14
+ * @public
15
+ */
16
+ export const publishPortalConfig = async (options) => {
17
+ const { log, portal } = options;
18
+ // Generate the portal config using provided options and environment
19
+ const { config: portalConfig } = await generatePortalConfig({
20
+ log,
21
+ config: options.config,
22
+ env: { environment: options.environment },
23
+ });
24
+ log?.start('Initializing Fusion Framework...');
25
+ // Initialize the Fusion Framework with the provided environment and authentication
26
+ const framework = await initializeFramework({
27
+ env: options.environment,
28
+ auth: options.auth,
29
+ });
30
+ log?.succeed('Initialized Fusion Framework');
31
+ // Create a client for the 'portals' service
32
+ const portalClient = await framework.serviceDiscovery.createClient('portals');
33
+ // Subscribe to outgoing requests for logging and debugging
34
+ portalClient.request$.subscribe((request) => {
35
+ log?.debug('Request:', request);
36
+ log?.info('🌎', 'Executing request to:', formatPath(request.uri));
37
+ });
38
+ log?.start('Publishing portal config');
39
+ log?.info('Using environment:', chalk.redBright(options.environment));
40
+ try {
41
+ // Send a PUT request to publish the portal config for the specific build version
42
+ const response = await portalClient.json(`/portals/${portal.name}@${portal.version}/config`, {
43
+ method: 'PUT',
44
+ body: portalConfig,
45
+ });
46
+ log?.debug('Response:', response);
47
+ log?.succeed('Published portal config');
48
+ }
49
+ catch (error) {
50
+ // Handle known HTTP errors with specific log messages
51
+ if (error instanceof HttpJsonResponseError) {
52
+ switch (error.response.status) {
53
+ case 410:
54
+ log?.fail('🤬', `Portal ${portal.name} is deleted from portals-service. Please check the portal key and try again.`);
55
+ break;
56
+ case 404:
57
+ log?.fail('🤬', `Portal ${portal.name} not found. Please check the portal key and try again.`);
58
+ break;
59
+ case 403:
60
+ case 401:
61
+ log?.fail('🤬', 'You are not authorized to publish portal config. Please check your permissions.');
62
+ break;
63
+ default:
64
+ log?.fail('🤬', 'Failed to publish portal config.', `Status code: ${error.response.status}`, `Message: ${error.response.statusText}`);
65
+ break;
66
+ }
67
+ }
68
+ // Rethrow error for upstream handling
69
+ throw error;
70
+ }
71
+ };
72
+ // Export as default for compatibility with import patterns
73
+ export default publishPortalConfig;
74
+ //# sourceMappingURL=portal-config-publish.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-config-publish.js","sourceRoot":"","sources":["../../../src/bin/portal-config-publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAErF,OAAO,EACL,mBAAmB,GAGpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAsB,MAAM,SAAS,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAc1D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,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AE;YAC3F,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,YAAY;SACnB,CAAC,CAAC;QACH,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAClC,GAAG,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,sDAAsD;QACtD,IAAI,KAAK,YAAY,qBAAqB,EAAE,CAAC;YAC3C,QAAQ,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAC9B,KAAK,GAAG;oBACN,GAAG,EAAE,IAAI,CACP,IAAI,EACJ,UAAU,MAAM,CAAC,IAAI,8EAA8E,CACpG,CAAC;oBACF,MAAM;gBACR,KAAK,GAAG;oBACN,GAAG,EAAE,IAAI,CACP,IAAI,EACJ,UAAU,MAAM,CAAC,IAAI,wDAAwD,CAC9E,CAAC;oBACF,MAAM;gBACR,KAAK,GAAG,CAAC;gBACT,KAAK,GAAG;oBACN,GAAG,EAAE,IAAI,CACP,IAAI,EACJ,iFAAiF,CAClF,CAAC;oBACF,MAAM;gBACR;oBACE,GAAG,EAAE,IAAI,CACP,IAAI,EACJ,kCAAkC,EAClC,gBAAgB,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,EACvC,YAAY,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,CACxC,CAAC;oBACF,MAAM;YACV,CAAC;QACH,CAAC;QACD,sCAAsC;QACtC,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,2DAA2D;AAC3D,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { writeFile } from '../lib/utils';
2
+ import { formatPath } from './utils';
3
+ import { resolveProjectPackage } from './helpers/resolve-project-package.js';
4
+ import { resolvePortalConfig } from './helpers/resolve-portal-config.js';
5
+ /**
6
+ * Generates the portal configuration object for the current project.
7
+ *
8
+ * This function resolves the portal package, sets up the runtime environment, resolves the portal config,
9
+ * and optionally writes the config to a file if an output path is provided. Logging is supported for
10
+ * debugging and progress tracking.
11
+ *
12
+ * @param options - Optional settings for logger, environment overrides, config path, and output file.
13
+ * @returns An object containing the generated config and the resolved package info.
14
+ * @throws If writing the config to file fails.
15
+ * @public
16
+ */
17
+ export const generatePortalConfig = async (options) => {
18
+ const { log } = options ?? {};
19
+ // Resolve the portal's package.json for root and metadata
20
+ const pkg = await resolveProjectPackage(log);
21
+ // Setup the runtime environment for config resolution
22
+ const env = {
23
+ command: 'build',
24
+ mode: process.env.NODE_ENV ?? 'production',
25
+ root: pkg.root,
26
+ ...options?.env, // Allow overrides from options
27
+ };
28
+ // Resolve the portal config using the environment and config path
29
+ const config = await resolvePortalConfig(env, { log, config: options?.config });
30
+ log?.debug('config:', config);
31
+ // If an output path is provided, write the config to file
32
+ if (options?.output) {
33
+ log?.start('writing config to file');
34
+ try {
35
+ // Write the config as pretty-printed JSON
36
+ await writeFile(options.output, JSON.stringify(config, null, 2));
37
+ log?.succeed('config written successfully', formatPath(options.output, { relative: true }));
38
+ }
39
+ catch (error) {
40
+ // Log and rethrow errors encountered during file write
41
+ log?.fail('failed to write config');
42
+ throw error;
43
+ }
44
+ }
45
+ // Return the generated config and resolved package info for further use
46
+ return { config, pkg };
47
+ };
48
+ //# sourceMappingURL=portal-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-config.js","sourceRoot":"","sources":["../../../src/bin/portal-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAsB,MAAM,SAAS,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AA8BzE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,OAAqC,EAAE,EAAE;IAClF,MAAM,EAAE,GAAG,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project-package.js';
3
- import { resolvePortalManifest } from './helpers/resolve-portal-manifest';
3
+ import { resolvePortalManifest } from './helpers/resolve-portal-manifest.js';
4
+ import { resolvePortalConfig } from './helpers/resolve-portal-config.js';
4
5
  /**
5
6
  * Starts the portal development server for local development and testing.
6
7
  *
@@ -14,7 +15,7 @@ import { resolvePortalManifest } from './helpers/resolve-portal-manifest';
14
15
  */
15
16
  export const startPortalDevServer = async (options) => {
16
17
  const { log } = options ?? {};
17
- // Resolve the application's package.json for root and metadata
18
+ // Resolve the portals's package.json for root and metadata
18
19
  const pkg = await resolveProjectPackage(log);
19
20
  // Setup the runtime environment for the dev server
20
21
  const env = {
@@ -29,8 +30,6 @@ export const startPortalDevServer = async (options) => {
29
30
  log,
30
31
  manifestPath: options?.manifest,
31
32
  });
32
- // Dummy implementation for resolving the portal config
33
- const resolvePortalConfig = async (...args) => ({ foo: 'bar' });
34
33
  // Resolve the portal config (replace with real logic as needed)
35
34
  const portalConfig = await resolvePortalConfig(env, { log, config: options?.config });
36
35
  log?.start('Starting app development server...');
@@ -1 +1 @@
1
- {"version":3,"file":"portal-dev.js","sourceRoot":"","sources":["../../../src/bin/portal-dev.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAsB,MAAM,SAAS,CAAC;AAE9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,OAuB1C,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE9B,+DAA+D;IAC/D,MAAM,GAAG,GAAG,MAAM,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAE7C,mDAAmD;IACnD,MAAM,GAAG,GAAe;QACtB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,WAAW,EAAE,OAAO,EAA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BACN,EAAE,EAAE,cAAc,CAAC,IAAI;aACxB;SACF;QACD,MAAM,EAAE;YACN,QAAQ,EAAE,cAAc;YACxB,MAAM,EAAE,YAAY;SACrB;KACF,EACD;QACE,MAAM,EAAE;YACN,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI;YAC3B,EAAE,EAAE;gBACF,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,qCAAqC;aACzD;SACF;KACF,CACF,CAAC;IAEF,MAAM,SAAS,CAAC,MAAM,EAAE,CAAC;IAEzB,gDAAgD;IAChD,GAAG,EAAE,OAAO,CAAC,qCAAqC,SAAS,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAExF,iDAAiD;IACjD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
@@ -4,12 +4,12 @@
4
4
  * These aliases help maintain backward compatibility and inform users about updated command usage.
5
5
  */
6
6
  import chalk from 'chalk';
7
- import packCommand, { defaultArchive } from './pack.js';
7
+ import packCommand, { DEFAULT_ARCHIVE } from './pack.js';
8
8
  packCommand.alias('build-pack').hook('preAction', (thisCommand) => {
9
9
  if (process.argv[3] === 'build-pack') {
10
10
  console.warn(chalk.bgRedBright.bold('The command "build-pack" is deprecated. Please use "pack" instead.'));
11
11
  if (!thisCommand.getOptionValue('archive')) {
12
- thisCommand.setOptionValue('archive', defaultArchive);
12
+ thisCommand.setOptionValue('archive', DEFAULT_ARCHIVE);
13
13
  }
14
14
  }
15
15
  });
@@ -20,12 +20,12 @@ uploadCommand.alias('build-upload').hook('preAction', (thisCommand) => {
20
20
  if (thisCommand.getOptionValue('service')) {
21
21
  throw new Error('The --service option is deprecated. Please use --env instead.');
22
22
  }
23
- const bundle = thisCommand.getOptionValue('bundle') ?? defaultArchive;
23
+ const bundle = thisCommand.getOptionValue('bundle') ?? DEFAULT_ARCHIVE;
24
24
  process.argv[4] = bundle;
25
25
  }
26
26
  });
27
27
  import manifestCommand from './manifest.js';
28
- manifestCommand.alias('build-manifest').hook('preAction', (thisCommand) => {
28
+ manifestCommand.alias('build-manifest').hook('preAction', () => {
29
29
  if (process.argv[3] === 'build-manifest') {
30
30
  console.warn(chalk.bgRedBright.bold('The command "build-manifest" is deprecated. Please use "manifest" instead.'));
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"alias.js","sourceRoot":"","sources":["../../../../../src/cli/commands/app/alias.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,WAAW,EAAE,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACxD,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;IAChE,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,YAAY,EAAE,CAAC;QACrC,OAAO,CAAC,IAAI,CACV,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,oEAAoE,CAAC,CAC7F,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3C,WAAW,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,OAAO,aAAa,MAAM,aAAa,CAAC;AACxC,aAAa,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;IACpE,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,cAAc,EAAE,CAAC;QACvC,OAAO,CAAC,IAAI,CACV,KAAK,CAAC,WAAW,CAAC,IAAI,CACpB,wEAAwE,CACzE,CACF,CAAC;QACF,IAAI,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,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pB,4EAA4E,CAC7E,CACF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,OAAO,cAAc,MAAM,cAAc,CAAC;AAC1C,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;IACtE,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,eAAe,EAAE,CAAC;QACxC,OAAO,CAAC,IAAI,CACV,KAAK,CAAC,WAAW,CAAC,IAAI,CACpB,0EAA0E,CAC3E,CACF,CAAC;IACJ,CAAC;IACD,IAAI,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -27,11 +27,18 @@ import { buildApplication } from '../../../bin/app-build.js';
27
27
  * @see buildApplication for build implementation details
28
28
  */
29
29
  export const command = createCommand('build')
30
- .description([
31
- 'Build the application using a manifest file and environment-specific configuration.',
32
- 'If no manifest is provided, the command will search for a default app.manifest.[ts|js|json] in the current directory.',
30
+ .description('Build the application using a manifest file and environment-specific configuration.')
31
+ .addHelpText('after', [
32
+ 'Builds the application using a manifest file and environment-specific configuration.',
33
+ 'If no manifest is provided, searches for a default app.manifest.[ts|js|json] in the current directory.',
33
34
  'You can use environment variables to customize the build process.',
34
35
  '',
36
+ 'Arguments:',
37
+ ' [manifest] Manifest file to use for building (e.g., app.manifest.ts)',
38
+ '',
39
+ 'Options:',
40
+ ' -d, --debug Enable debug mode for verbose logging (default: false)',
41
+ '',
35
42
  'Examples:',
36
43
  ' $ fusion build',
37
44
  ' $ fusion build app.manifest.dev.ts --debug',
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../../src/cli/commands/app/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAA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