@equinor/fusion-framework-cli 11.0.0-next.5 → 11.0.0-next.6
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 +23 -0
- package/bin/build/bin.js +7 -7
- package/bin/build/cli.js +422 -188
- package/bin/build/{portal-pack-qpEBTWNW.js → portal-config-publish-CqqdoblS.js} +209 -7
- package/dist/esm/bin/helpers/resolve-portal-config.js +46 -0
- package/dist/esm/bin/helpers/resolve-portal-config.js.map +1 -0
- package/dist/esm/bin/index.js +2 -0
- package/dist/esm/bin/index.js.map +1 -1
- package/dist/esm/bin/portal-config-publish.js +74 -0
- package/dist/esm/bin/portal-config-publish.js.map +1 -0
- package/dist/esm/bin/portal-config.js +48 -0
- package/dist/esm/bin/portal-config.js.map +1 -0
- package/dist/esm/bin/portal-dev.js +3 -4
- package/dist/esm/bin/portal-dev.js.map +1 -1
- package/dist/esm/cli/commands/app/alias.js +4 -4
- package/dist/esm/cli/commands/app/alias.js.map +1 -1
- package/dist/esm/cli/commands/app/build.js +10 -3
- package/dist/esm/cli/commands/app/build.js.map +1 -1
- package/dist/esm/cli/commands/app/check.js +15 -5
- package/dist/esm/cli/commands/app/check.js.map +1 -1
- package/dist/esm/cli/commands/app/config.js +20 -8
- package/dist/esm/cli/commands/app/config.js.map +1 -1
- package/dist/esm/cli/commands/app/dev.js +10 -4
- package/dist/esm/cli/commands/app/dev.js.map +1 -1
- package/dist/esm/cli/commands/app/index.js +18 -1
- package/dist/esm/cli/commands/app/index.js.map +1 -1
- package/dist/esm/cli/commands/app/manifest.js +12 -3
- package/dist/esm/cli/commands/app/manifest.js.map +1 -1
- package/dist/esm/cli/commands/app/pack.js +16 -9
- package/dist/esm/cli/commands/app/pack.js.map +1 -1
- package/dist/esm/cli/commands/app/publish.js +15 -4
- package/dist/esm/cli/commands/app/publish.js.map +1 -1
- package/dist/esm/cli/commands/app/tag.js +16 -4
- package/dist/esm/cli/commands/app/tag.js.map +1 -1
- package/dist/esm/cli/commands/app/upload.js +13 -8
- package/dist/esm/cli/commands/app/upload.js.map +1 -1
- package/dist/esm/cli/commands/auth/index.js +13 -1
- package/dist/esm/cli/commands/auth/index.js.map +1 -1
- package/dist/esm/cli/commands/auth/login.js +11 -7
- package/dist/esm/cli/commands/auth/login.js.map +1 -1
- package/dist/esm/cli/commands/auth/logout.js +10 -7
- package/dist/esm/cli/commands/auth/logout.js.map +1 -1
- package/dist/esm/cli/commands/auth/token.js +13 -9
- package/dist/esm/cli/commands/auth/token.js.map +1 -1
- package/dist/esm/cli/commands/disco/resolve.js +13 -16
- package/dist/esm/cli/commands/disco/resolve.js.map +1 -1
- package/dist/esm/cli/commands/portal/build.js +12 -7
- package/dist/esm/cli/commands/portal/build.js.map +1 -1
- package/dist/esm/cli/commands/portal/config.js +101 -0
- package/dist/esm/cli/commands/portal/config.js.map +1 -0
- package/dist/esm/cli/commands/portal/dev.js +9 -6
- package/dist/esm/cli/commands/portal/dev.js.map +1 -1
- package/dist/esm/cli/commands/portal/index.js +3 -1
- package/dist/esm/cli/commands/portal/index.js.map +1 -1
- package/dist/esm/cli/commands/portal/manifest.js +11 -8
- package/dist/esm/cli/commands/portal/manifest.js.map +1 -1
- package/dist/esm/cli/commands/portal/pack.js +13 -8
- package/dist/esm/cli/commands/portal/pack.js.map +1 -1
- package/dist/esm/cli/commands/portal/publish.js +11 -8
- package/dist/esm/cli/commands/portal/publish.js.map +1 -1
- package/dist/esm/cli/commands/portal/schema.js +10 -8
- package/dist/esm/cli/commands/portal/schema.js.map +1 -1
- package/dist/esm/cli/commands/portal/tag.js +12 -8
- package/dist/esm/cli/commands/portal/tag.js.map +1 -1
- package/dist/esm/cli/commands/portal/upload.js +8 -7
- package/dist/esm/cli/commands/portal/upload.js.map +1 -1
- package/dist/esm/lib/portal/index.js +2 -0
- package/dist/esm/lib/portal/index.js.map +1 -1
- package/dist/esm/lib/portal/load-portal-config.js +49 -0
- package/dist/esm/lib/portal/load-portal-config.js.map +1 -0
- package/dist/esm/lib/portal/portal-config.js +23 -0
- package/dist/esm/lib/portal/portal-config.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/bin/helpers/resolve-portal-config.d.ts +18 -0
- package/dist/types/bin/index.d.ts +2 -0
- package/dist/types/bin/portal-config-publish.d.ts +26 -0
- package/dist/types/bin/portal-config.d.ts +46 -0
- package/dist/types/cli/commands/app/config.d.ts +3 -3
- package/dist/types/cli/commands/app/pack.d.ts +1 -1
- package/dist/types/cli/commands/auth/logout.d.ts +0 -4
- package/dist/types/cli/commands/auth/token.d.ts +0 -5
- package/dist/types/cli/commands/disco/resolve.d.ts +0 -7
- package/dist/types/cli/commands/portal/config.d.ts +32 -0
- package/dist/types/lib/portal/index.d.ts +2 -0
- package/dist/types/lib/portal/load-portal-config.d.ts +83 -0
- package/dist/types/lib/portal/portal-config.d.ts +69 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +5 -4
|
@@ -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
|
/**
|
|
@@ -11904,6 +11904,53 @@ const loadPortalSchema = async (env, options) => {
|
|
|
11904
11904
|
};
|
|
11905
11905
|
};
|
|
11906
11906
|
|
|
11907
|
+
/**
|
|
11908
|
+
* Loads and resolves the portal configuration from a file or function export.
|
|
11909
|
+
*
|
|
11910
|
+
* This function uses a script resolver to handle dynamic imports. If the imported module's default export
|
|
11911
|
+
* is a function, it will be invoked with the base configuration and runtime environment. The result
|
|
11912
|
+
* is validated against the provided schema (or a permissive passthrough schema by default).
|
|
11913
|
+
*
|
|
11914
|
+
* @param env - The runtime environment containing the root directory and other environment-specific settings.
|
|
11915
|
+
* @param options - Optional parameters for configuring the import process.
|
|
11916
|
+
* @returns A promise that resolves to the imported and validated portal configuration.
|
|
11917
|
+
*
|
|
11918
|
+
* @remarks
|
|
11919
|
+
* - Supports both static and dynamic config authoring patterns for portals.
|
|
11920
|
+
* - Ensures all configs are validated against the schema for type safety.
|
|
11921
|
+
* - Designed for maintainability and RAG-based documentation extraction.
|
|
11922
|
+
*
|
|
11923
|
+
* @example
|
|
11924
|
+
* ```ts
|
|
11925
|
+
* const config = await loadPortalConfig(env, { file: 'custom-portal.config.ts' });
|
|
11926
|
+
* ```
|
|
11927
|
+
*/
|
|
11928
|
+
const loadPortalConfig = (env, options) => {
|
|
11929
|
+
// Suggest config filenames based on environment, fallback to default
|
|
11930
|
+
const suggestions = options?.file ?? [`portal.config.${env.environment}`, 'portal.config'];
|
|
11931
|
+
return importConfig(suggestions, {
|
|
11932
|
+
baseDir: env.root, // Set the base directory for config resolution
|
|
11933
|
+
extensions: options?.extensions, // Allow custom file extensions
|
|
11934
|
+
script: {
|
|
11935
|
+
// Custom resolver for the imported config module
|
|
11936
|
+
resolve: async (module) => {
|
|
11937
|
+
// Use provided schema or a permissive passthrough schema by default
|
|
11938
|
+
const schema = options?.schema ?? z$2.object({}).passthrough();
|
|
11939
|
+
const base = options?.base ?? {}; // Use provided base or default
|
|
11940
|
+
// If the module's default export is a function, invoke it with the base config and environment
|
|
11941
|
+
// and validate the result against the schema
|
|
11942
|
+
if (typeof module.default === 'function') {
|
|
11943
|
+
const result = (await module.default(base, env)) ?? base;
|
|
11944
|
+
return schema.parse(result ?? base); // Validate and return
|
|
11945
|
+
}
|
|
11946
|
+
// If the module's default export is not a function, treat it as a configuration object
|
|
11947
|
+
// and validate it against the schema
|
|
11948
|
+
return schema.parse(module.default ?? base); // Validate and return
|
|
11949
|
+
},
|
|
11950
|
+
},
|
|
11951
|
+
});
|
|
11952
|
+
};
|
|
11953
|
+
|
|
11907
11954
|
/**
|
|
11908
11955
|
* Resolves the portal manifest for a given runtime environment and package.
|
|
11909
11956
|
*
|
|
@@ -12081,4 +12128,159 @@ const bundlePortal = async (options) => {
|
|
|
12081
12128
|
};
|
|
12082
12129
|
};
|
|
12083
12130
|
|
|
12084
|
-
|
|
12131
|
+
/**
|
|
12132
|
+
* Resolves the portal configuration based on the provided runtime environment and options.
|
|
12133
|
+
* Handles logging, error reporting, and fallback to built-in config if no local config is found.
|
|
12134
|
+
*
|
|
12135
|
+
* @param env - The runtime environment containing the command and mode information.
|
|
12136
|
+
* @param options - Optional parameters:
|
|
12137
|
+
* - config: Path to a specific configuration file.
|
|
12138
|
+
* - log: Logger utility for progress and status messages.
|
|
12139
|
+
* @returns A promise resolving to the loaded portal configuration.
|
|
12140
|
+
* @throws If the portal configuration cannot be resolved.
|
|
12141
|
+
*/
|
|
12142
|
+
const resolvePortalConfig = async (env, options) => {
|
|
12143
|
+
const { log } = options;
|
|
12144
|
+
try {
|
|
12145
|
+
// Start logging the config creation process
|
|
12146
|
+
log?.start('create portal configuration');
|
|
12147
|
+
log?.info(`generating config with ${chalk.red.dim(env.command)} command in ${chalk.green.dim(env.mode)} mode`);
|
|
12148
|
+
// Attempt to load the portal config (from file if specified)
|
|
12149
|
+
const result = await loadPortalConfig(env, { file: options?.config });
|
|
12150
|
+
// Log success and show the config file path
|
|
12151
|
+
log?.succeed('⚙️ generated config from ', formatPath(result.path, { relative: true }));
|
|
12152
|
+
return result.config;
|
|
12153
|
+
}
|
|
12154
|
+
catch (err) {
|
|
12155
|
+
// Handle missing config file error
|
|
12156
|
+
if (err instanceof FileNotFoundError) {
|
|
12157
|
+
if (options.config) {
|
|
12158
|
+
// Warn if a specific config file was requested but not found
|
|
12159
|
+
log?.warn(`failed to load config file ${formatPath(options.config)}, please check the path.`);
|
|
12160
|
+
}
|
|
12161
|
+
else {
|
|
12162
|
+
// Fallback to built-in config if no local config is present
|
|
12163
|
+
log?.succeed(chalk.dim('⚙️ no local portal config applied, using built-in'));
|
|
12164
|
+
return {};
|
|
12165
|
+
}
|
|
12166
|
+
}
|
|
12167
|
+
// Log failure and debug information for other errors
|
|
12168
|
+
log?.fail('failed to resolve portal config');
|
|
12169
|
+
log?.debug(err);
|
|
12170
|
+
throw err;
|
|
12171
|
+
}
|
|
12172
|
+
};
|
|
12173
|
+
|
|
12174
|
+
/**
|
|
12175
|
+
* Generates the portal configuration object for the current project.
|
|
12176
|
+
*
|
|
12177
|
+
* This function resolves the portal package, sets up the runtime environment, resolves the portal config,
|
|
12178
|
+
* and optionally writes the config to a file if an output path is provided. Logging is supported for
|
|
12179
|
+
* debugging and progress tracking.
|
|
12180
|
+
*
|
|
12181
|
+
* @param options - Optional settings for logger, environment overrides, config path, and output file.
|
|
12182
|
+
* @returns An object containing the generated config and the resolved package info.
|
|
12183
|
+
* @throws If writing the config to file fails.
|
|
12184
|
+
* @public
|
|
12185
|
+
*/
|
|
12186
|
+
const generatePortalConfig = async (options) => {
|
|
12187
|
+
const { log } = options ?? {};
|
|
12188
|
+
// Resolve the portal's package.json for root and metadata
|
|
12189
|
+
const pkg = await resolveProjectPackage(log);
|
|
12190
|
+
// Setup the runtime environment for config resolution
|
|
12191
|
+
const env = {
|
|
12192
|
+
command: 'build',
|
|
12193
|
+
mode: process.env.NODE_ENV ?? 'production',
|
|
12194
|
+
root: pkg.root,
|
|
12195
|
+
...options?.env, // Allow overrides from options
|
|
12196
|
+
};
|
|
12197
|
+
// Resolve the portal config using the environment and config path
|
|
12198
|
+
const config = await resolvePortalConfig(env, { log, config: options?.config });
|
|
12199
|
+
log?.debug('config:', config);
|
|
12200
|
+
// If an output path is provided, write the config to file
|
|
12201
|
+
if (options?.output) {
|
|
12202
|
+
log?.start('writing config to file');
|
|
12203
|
+
try {
|
|
12204
|
+
// Write the config as pretty-printed JSON
|
|
12205
|
+
await writeFile(options.output, JSON.stringify(config, null, 2));
|
|
12206
|
+
log?.succeed('config written successfully', formatPath(options.output, { relative: true }));
|
|
12207
|
+
}
|
|
12208
|
+
catch (error) {
|
|
12209
|
+
// Log and rethrow errors encountered during file write
|
|
12210
|
+
log?.fail('failed to write config');
|
|
12211
|
+
throw error;
|
|
12212
|
+
}
|
|
12213
|
+
}
|
|
12214
|
+
// Return the generated config and resolved package info for further use
|
|
12215
|
+
return { config, pkg };
|
|
12216
|
+
};
|
|
12217
|
+
|
|
12218
|
+
/**
|
|
12219
|
+
* Publishes the portal configuration to the portal store for a specific build version.
|
|
12220
|
+
*
|
|
12221
|
+
* This function generates the portal config, loads the manifest, initializes the Fusion Framework,
|
|
12222
|
+
* and sends the config to the portal service. Handles and logs errors for common failure scenarios.
|
|
12223
|
+
*
|
|
12224
|
+
* @param options - Options for config, manifest, environment, authentication, and logging.
|
|
12225
|
+
* @returns A promise that resolves when publishing is complete.
|
|
12226
|
+
* @throws If the build version is missing or publishing fails.
|
|
12227
|
+
* @public
|
|
12228
|
+
*/
|
|
12229
|
+
const publishPortalConfig = async (options) => {
|
|
12230
|
+
const { log, portal } = options;
|
|
12231
|
+
// Generate the portal config using provided options and environment
|
|
12232
|
+
const { config: portalConfig } = await generatePortalConfig({
|
|
12233
|
+
log,
|
|
12234
|
+
config: options.config,
|
|
12235
|
+
env: { environment: options.environment },
|
|
12236
|
+
});
|
|
12237
|
+
log?.start('Initializing Fusion Framework...');
|
|
12238
|
+
// Initialize the Fusion Framework with the provided environment and authentication
|
|
12239
|
+
const framework = await initializeFramework({
|
|
12240
|
+
env: options.environment,
|
|
12241
|
+
auth: options.auth,
|
|
12242
|
+
});
|
|
12243
|
+
log?.succeed('Initialized Fusion Framework');
|
|
12244
|
+
// Create a client for the 'portals' service
|
|
12245
|
+
const portalClient = await framework.serviceDiscovery.createClient('portals');
|
|
12246
|
+
// Subscribe to outgoing requests for logging and debugging
|
|
12247
|
+
portalClient.request$.subscribe((request) => {
|
|
12248
|
+
log?.debug('Request:', request);
|
|
12249
|
+
log?.info('🌎', 'Executing request to:', formatPath(request.uri));
|
|
12250
|
+
});
|
|
12251
|
+
log?.start('Publishing portal config');
|
|
12252
|
+
log?.info('Using environment:', chalk.redBright(options.environment));
|
|
12253
|
+
try {
|
|
12254
|
+
// Send a PUT request to publish the portal config for the specific build version
|
|
12255
|
+
const response = await portalClient.json(`/portals/${portal.name}@${portal.version}/config`, {
|
|
12256
|
+
method: 'PUT',
|
|
12257
|
+
body: portalConfig,
|
|
12258
|
+
});
|
|
12259
|
+
log?.debug('Response:', response);
|
|
12260
|
+
log?.succeed('Published portal config');
|
|
12261
|
+
}
|
|
12262
|
+
catch (error) {
|
|
12263
|
+
// Handle known HTTP errors with specific log messages
|
|
12264
|
+
if (error instanceof HttpJsonResponseError) {
|
|
12265
|
+
switch (error.response.status) {
|
|
12266
|
+
case 410:
|
|
12267
|
+
log?.fail('🤬', `Portal ${portal.name} is deleted from portals-service. Please check the portal key and try again.`);
|
|
12268
|
+
break;
|
|
12269
|
+
case 404:
|
|
12270
|
+
log?.fail('🤬', `Portal ${portal.name} not found. Please check the portal key and try again.`);
|
|
12271
|
+
break;
|
|
12272
|
+
case 403:
|
|
12273
|
+
case 401:
|
|
12274
|
+
log?.fail('🤬', 'You are not authorized to publish portal config. Please check your permissions.');
|
|
12275
|
+
break;
|
|
12276
|
+
default:
|
|
12277
|
+
log?.fail('🤬', 'Failed to publish portal config.', `Status code: ${error.response.status}`, `Message: ${error.response.statusText}`);
|
|
12278
|
+
break;
|
|
12279
|
+
}
|
|
12280
|
+
}
|
|
12281
|
+
// Rethrow error for upstream handling
|
|
12282
|
+
throw error;
|
|
12283
|
+
}
|
|
12284
|
+
};
|
|
12285
|
+
|
|
12286
|
+
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, getDefaultExportFromCjs as v, loadPortalSchema as w, writeFile as x };
|
|
@@ -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,MAAM,yBAAyB,CAAC;AAK5D,OAAO,EAAE,KAAK,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;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"}
|
package/dist/esm/bin/index.js
CHANGED
|
@@ -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;
|
|
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,KAAK,EAAE,OAAmC,EAAE,EAAE;IAC/E,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEhC,oEAAoE;IACpE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,oBAAoB,CAAC;QAC1D,GAAG;QACH,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE;KAC1C,CAAC,CAAC;IAEH,GAAG,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC/C,mFAAmF;IACnF,MAAM,SAAS,GAAG,MAAM,mBAAmB,CAAC;QAC1C,GAAG,EAAE,OAAO,CAAC,WAAW;QACxB,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC,CAAC;IACH,GAAG,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAE7C,4CAA4C;IAC5C,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,gBAAgB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC9E,2DAA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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,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAC9B,0DAA0D;IAC1D,MAAM,GAAG,GAAG,MAAM,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAE7C,sDAAsD;IACtD,MAAM,GAAG,GAAe;QACtB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,YAAY;QAC1C,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,GAAG,OAAO,EAAE,GAAG,EAAE,+BAA+B;KACjD,CAAC;IAEF,kEAAkE;IAClE,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAChF,GAAG,EAAE,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAE9B,0DAA0D;IAC1D,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;QACpB,GAAG,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QACrC,IAAI,CAAC;YACH,0CAA0C;YAC1C,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YACjE,GAAG,EAAE,OAAO,CAAC,6BAA6B,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,uDAAuD;YACvD,GAAG,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC;YACpC,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,wEAAwE;IACxE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createDevServer } from './utils';
|
|
2
2
|
import { resolveProjectPackage } from './helpers/resolve-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
|
|
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,
|
|
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,sCAAsC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,OAuB1C,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE9B,2DAA2D;IAC3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D;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, {
|
|
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',
|
|
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') ??
|
|
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', (
|
|
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,O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AAG,MAAM,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,OAAO,eAAe,MAAM,eAAe,CAAC;AAC5C,eAAe,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE;IAC7D,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,gBAAgB,EAAE,CAAC;QACzC,OAAO,CAAC,IAAI,CACV,KAAK,CAAC,WAAW,CAAC,IAAI,CACpB,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
|
-
|
|
32
|
-
'
|
|
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,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;KAC1C,WAAW,CACV;IACE,
|
|
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,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;KAC1C,WAAW,CACV,qFAAqF,CACtF;KACA,WAAW,CACV,OAAO,EACP;IACE,sFAAsF;IACtF,wGAAwG;IACxG,mEAAmE;IACnE,EAAE;IACF,YAAY;IACZ,0EAA0E;IAC1E,EAAE;IACF,UAAU;IACV,uEAAuE;IACvE,EAAE;IACF,WAAW;IACX,kBAAkB;IAClB,8CAA8C;CAC/C,CAAC,IAAI,CAAC,IAAI,CAAC,CACb;KACA,MAAM,CAAC,aAAa,EAAE,uCAAuC,EAAE,KAAK,CAAC;KACrE,QAAQ,CAAC,YAAY,EAAE,2DAA2D,CAAC;KACnF,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE;IAC9B,MAAM,GAAG,GAAG,IAAI,aAAa,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;IACjE,MAAM,gBAAgB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC5C,CAAC,CAAC,CAAC;AAEL,eAAe,OAAO,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createCommand } from 'commander';
|
|
2
2
|
import { createEnvOption } from '../../options/env.js';
|
|
3
3
|
import { withAuthOptions } from '../../options/auth.js';
|
|
4
|
-
import checkApp from '../../../bin/app-check.js';
|
|
4
|
+
import { checkApp } from '../../../bin/app-check.js';
|
|
5
5
|
import { ConsoleLogger } from '../../../bin/utils';
|
|
6
6
|
/**
|
|
7
7
|
* CLI command: `check`
|
|
@@ -28,10 +28,20 @@ import { ConsoleLogger } from '../../../bin/utils';
|
|
|
28
28
|
* @see checkApp for implementation details
|
|
29
29
|
*/
|
|
30
30
|
export const command = withAuthOptions(createCommand('check')
|
|
31
|
-
.description(
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
|
|
31
|
+
.description('Check if application is registered in Fusion app store.')
|
|
32
|
+
.addHelpText('after', [
|
|
33
|
+
'Checks if the application is registered in the Fusion app store.',
|
|
34
|
+
'Verifies the registration status of your application in the Fusion app store.',
|
|
35
|
+
'Helps identify issues with app registration or configuration.',
|
|
36
|
+
'Supports authentication and environment options. Provides a debug mode for verbose logging.',
|
|
37
|
+
'',
|
|
38
|
+
'Options:',
|
|
39
|
+
' -d, --debug Enable debug mode for verbose logging (default: false)',
|
|
40
|
+
' --environment <env> Specify the environment (see available environments)',
|
|
41
|
+
' --token <token> Provide an authentication token (if required)',
|
|
42
|
+
'',
|
|
43
|
+
'Examples:',
|
|
44
|
+
' $ fusion check --environment prod --debug',
|
|
35
45
|
].join('\n'))
|
|
36
46
|
.option('-d, --debug', 'debug mode', false)
|
|
37
47
|
.addOption(createEnvOption({ allowDev: false }))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../../../src/cli/commands/app/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,QAAQ,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../../../src/cli/commands/app/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CACpC,aAAa,CAAC,OAAO,CAAC;KACnB,WAAW,CAAC,yDAAyD,CAAC;KACtE,WAAW,CACV,OAAO,EACP;IACE,kEAAkE;IAClE,+EAA+E;IAC/E,+DAA+D;IAC/D,6FAA6F;IAC7F,EAAE;IACF,UAAU;IACV,8EAA8E;IAC9E,4EAA4E;IAC5E,qEAAqE;IACrE,EAAE;IACF,WAAW;IACX,6CAA6C;CAC9C,CAAC,IAAI,CAAC,IAAI,CAAC,CACb;KACA,MAAM,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,CAAC;KAC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