@equinor/fusion-framework-cli 11.0.0-next.11 → 11.0.0-next.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/bin/build/bin.js +1 -1
- package/bin/build/cli.js +1 -1
- package/bin/build/{create-auth-client-B_j4Y_Dr.js → create-auth-client-BEG7gK6o.js} +1 -1
- package/bin/build/{portal-config-publish-ezU_DFki.js → portal-config-publish-DfiJReWS.js} +75 -37
- package/dist/esm/lib/load-dev-server-config.js +7 -3
- package/dist/esm/lib/load-dev-server-config.js.map +1 -1
- package/dist/esm/lib/merge-dev-server-config.js +9 -8
- package/dist/esm/lib/merge-dev-server-config.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/lib/load-dev-server-config.d.ts +2 -2
- package/dist/types/lib/types.d.ts +29 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 11.0.0-next.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3075](https://github.com/equinor/fusion-framework/pull/3075) [`32273e1`](https://github.com/equinor/fusion-framework/commit/32273e19dd89ed7b51fac175e1e5a0b82c7ba8ec) Thanks [@odinr](https://github.com/odinr)! - Refactor dev server config loading and merging:
|
|
8
|
+
|
|
9
|
+
- Add `RecursivePartial` type for improved type safety and flexibility in dev server config overrides.
|
|
10
|
+
- Update `mergeDevServerConfig` to use a custom array merge strategy (source arrays replace and prepend base arrays).
|
|
11
|
+
- Refactor `loadDevServerConfig` to support async config functions and deep merging with the new strategy.
|
|
12
|
+
- Improve inline documentation and maintainability for config utilities.
|
|
13
|
+
|
|
14
|
+
This change improves the developer experience and reliability of dev server configuration in the CLI package.
|
|
15
|
+
|
|
16
|
+
## 11.0.0-next.12
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies []:
|
|
21
|
+
- @equinor/fusion-framework-dev-server@1.0.0-next.8
|
|
22
|
+
- @equinor/fusion-framework-dev-portal@1.0.0-next.2
|
|
23
|
+
|
|
3
24
|
## 11.0.0-next.11
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/bin/build/bin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as buildApplication, c as buildPortal, a as bundleApp, d as bundlePortal, g as generateApplicationConfig, e as generatePortalConfig, l as loadPortalManifest, h as pack, p as publishAppConfig, f as publishPortalConfig, s as startAppDevServer } from './portal-config-publish-
|
|
1
|
+
export { b as buildApplication, c as buildPortal, a as bundleApp, d as bundlePortal, g as generateApplicationConfig, e as generatePortalConfig, l as loadPortalManifest, h as pack, p as publishAppConfig, f as publishPortalConfig, s as startAppDevServer } from './portal-config-publish-DfiJReWS.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import 'chalk';
|
|
4
4
|
import '@equinor/fusion-imports';
|
package/bin/build/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readPackageUpSync } from 'read-package-up';
|
|
|
4
4
|
import { createCommand, createOption, InvalidOptionArgumentError, Command } from 'commander';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import chalk from 'chalk';
|
|
7
|
-
import { S as Spinner, b as buildApplication, a as bundleApp, F as FusionEnv, r as resolveDefaultEnv, i as resolveProjectPackage, j as resolveAppManifest, k as initializeFramework, p as publishAppConfig, g as generateApplicationConfig, m as formatPath, H as HttpJsonResponseError, n as loadAppManifest, s as startAppDevServer, o as fileExistsSync, N as NoAccountsError, q as resolvePortalManifest, t as resolvePortalConfig, u as createDevServer, l as loadPortalManifest, v as getDefaultExportFromCjs, w as loadPortalSchema, x as writeFile$1, c as buildPortal, d as bundlePortal, f as publishPortalConfig, e as generatePortalConfig } from './portal-config-publish-
|
|
7
|
+
import { S as Spinner, b as buildApplication, a as bundleApp, F as FusionEnv, r as resolveDefaultEnv, i as resolveProjectPackage, j as resolveAppManifest, k as initializeFramework, p as publishAppConfig, g as generateApplicationConfig, m as formatPath, H as HttpJsonResponseError, n as loadAppManifest, s as startAppDevServer, o as fileExistsSync, N as NoAccountsError, q as resolvePortalManifest, t as resolvePortalConfig, u as createDevServer, l as loadPortalManifest, v as getDefaultExportFromCjs, w as loadPortalSchema, x as writeFile$1, c as buildPortal, d as bundlePortal, f as publishPortalConfig, e as generatePortalConfig } from './portal-config-publish-DfiJReWS.js';
|
|
8
8
|
import { importJSON } from '@equinor/fusion-imports';
|
|
9
9
|
import '@equinor/fusion-framework-dev-server';
|
|
10
10
|
import 'vite';
|
|
@@ -359,42 +359,6 @@ let _spinner = new Spinner();
|
|
|
359
359
|
const parseArgs = (args) => args.length ? args.join(' ') : undefined;
|
|
360
360
|
const originalConsole = console;
|
|
361
361
|
|
|
362
|
-
/**
|
|
363
|
-
* Loads the dev server configuration from a file or function.
|
|
364
|
-
*
|
|
365
|
-
* @param env - The runtime environment configuration.
|
|
366
|
-
* @param base - The base DevServerOptions to use as defaults.
|
|
367
|
-
* @param options - Optional settings for file name and extensions.
|
|
368
|
-
* @returns A promise resolving to the imported config result.
|
|
369
|
-
*
|
|
370
|
-
* This function uses importConfig to dynamically load the configuration file.
|
|
371
|
-
* If the config export is a function, it is invoked with the environment and a cloned base config.
|
|
372
|
-
* If the config export is an object, it is merged with the base config.
|
|
373
|
-
*
|
|
374
|
-
* Inline comments are provided for maintainability and clarity.
|
|
375
|
-
*/
|
|
376
|
-
const loadDevServerConfig = async (env, base, options) => {
|
|
377
|
-
// Use importConfig to load the config file, defaulting to 'dev-server.config' if not specified
|
|
378
|
-
return importConfig('dev-server.config', {
|
|
379
|
-
baseDir: env.root, // Set the base directory for config resolution
|
|
380
|
-
extensions: options?.extensions, // Allow custom file extensions
|
|
381
|
-
script: {
|
|
382
|
-
// Custom resolver for the config module
|
|
383
|
-
resolve: async (module) => {
|
|
384
|
-
// If the default export is a function, call it with env and a cloned base config
|
|
385
|
-
if (typeof module.default === 'function') {
|
|
386
|
-
const baseClone = { ...base }; // Clone base to avoid mutation
|
|
387
|
-
const result = (await module.default(env, { base: baseClone })) ?? base;
|
|
388
|
-
// TODO: Add zod validation of the config for type safety
|
|
389
|
-
return result ?? baseClone;
|
|
390
|
-
}
|
|
391
|
-
// If the default export is an object, return it or fallback to base
|
|
392
|
-
return module.default ?? base;
|
|
393
|
-
},
|
|
394
|
-
},
|
|
395
|
-
});
|
|
396
|
-
};
|
|
397
|
-
|
|
398
362
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
399
363
|
|
|
400
364
|
function getDefaultExportFromCjs (x) {
|
|
@@ -2386,6 +2350,80 @@ function requireLodash_mergewith () {
|
|
|
2386
2350
|
var lodash_mergewithExports = requireLodash_mergewith();
|
|
2387
2351
|
var mergeWith = /*@__PURE__*/getDefaultExportFromCjs(lodash_mergewithExports);
|
|
2388
2352
|
|
|
2353
|
+
/**
|
|
2354
|
+
* Customizer function for merging objects, intended for use with utilities like `_.mergeWith`.
|
|
2355
|
+
*
|
|
2356
|
+
* - If either `objValue` or `srcValue` is an array, replaces the target array with the source array,
|
|
2357
|
+
* concatenating the source array with the target array (source first).
|
|
2358
|
+
* - For non-array values, allows the default merge behavior.
|
|
2359
|
+
*
|
|
2360
|
+
* @param objValue - The destination value being merged.
|
|
2361
|
+
* @param srcValue - The source value being merged.
|
|
2362
|
+
* @returns The merged value if custom logic applies, otherwise `undefined` to use default merging.
|
|
2363
|
+
*/
|
|
2364
|
+
const customizer = (objValue, srcValue) => {
|
|
2365
|
+
if (Array.isArray(objValue) || Array.isArray(srcValue)) {
|
|
2366
|
+
// Replace arrays instead of merging/concatenating them
|
|
2367
|
+
return (srcValue ?? []).concat(objValue ?? []);
|
|
2368
|
+
}
|
|
2369
|
+
// For non-arrays, use default merge behavior
|
|
2370
|
+
};
|
|
2371
|
+
/**
|
|
2372
|
+
* Merges a base development server configuration with an overrides object.
|
|
2373
|
+
*
|
|
2374
|
+
* Uses lodash.mergeWith to deeply merge properties, with custom logic for arrays.
|
|
2375
|
+
* Arrays in the overrides object will replace arrays in the base config.
|
|
2376
|
+
*
|
|
2377
|
+
* @param base - The base development server configuration.
|
|
2378
|
+
* @param overrides - A partial configuration object containing properties to override in the base configuration.
|
|
2379
|
+
* @returns The merged development server configuration.
|
|
2380
|
+
*
|
|
2381
|
+
* Inline comments are provided for maintainability and clarity.
|
|
2382
|
+
*/
|
|
2383
|
+
const mergeDevServerConfig = (base, overrides) => {
|
|
2384
|
+
// Use lodash.mergeWith to merge base and overrides, applying the customizer for arrays
|
|
2385
|
+
return mergeWith(base, overrides, customizer);
|
|
2386
|
+
};
|
|
2387
|
+
|
|
2388
|
+
/**
|
|
2389
|
+
* Loads the dev server configuration from a file or function.
|
|
2390
|
+
*
|
|
2391
|
+
* @param env - The runtime environment configuration.
|
|
2392
|
+
* @param base - The base DevServerOptions to use as defaults.
|
|
2393
|
+
* @param options - Optional settings for file name and extensions.
|
|
2394
|
+
* @returns A promise resolving to the imported config result.
|
|
2395
|
+
*
|
|
2396
|
+
* This function uses importConfig to dynamically load the configuration file.
|
|
2397
|
+
* If the config export is a function, it is invoked with the environment and a cloned base config.
|
|
2398
|
+
* If the config export is an object, it is merged with the base config.
|
|
2399
|
+
*
|
|
2400
|
+
* Inline comments are provided for maintainability and clarity.
|
|
2401
|
+
*/
|
|
2402
|
+
const loadDevServerConfig = async (env, base, options) => {
|
|
2403
|
+
// Use importConfig to load the config file, defaulting to 'dev-server.config' if not specified
|
|
2404
|
+
return importConfig('dev-server.config', {
|
|
2405
|
+
baseDir: env.root, // Set the base directory for config resolution
|
|
2406
|
+
extensions: options?.extensions, // Allow custom file extensions
|
|
2407
|
+
script: {
|
|
2408
|
+
// Custom resolver for the config module
|
|
2409
|
+
resolve: async (module) => {
|
|
2410
|
+
// If the default export is a function, call it with env and a cloned base config
|
|
2411
|
+
let overrides;
|
|
2412
|
+
if (typeof module.default === 'function') {
|
|
2413
|
+
const baseClone = { ...base }; // Clone base to avoid mutation
|
|
2414
|
+
overrides = await module.default(env, { base: baseClone });
|
|
2415
|
+
// TODO: Add zod validation of the config for type safety
|
|
2416
|
+
}
|
|
2417
|
+
else {
|
|
2418
|
+
overrides = module.default;
|
|
2419
|
+
}
|
|
2420
|
+
// If the default export is an object, return it or fallback to base
|
|
2421
|
+
return mergeDevServerConfig(base, overrides ?? {});
|
|
2422
|
+
},
|
|
2423
|
+
},
|
|
2424
|
+
});
|
|
2425
|
+
};
|
|
2426
|
+
|
|
2389
2427
|
/**
|
|
2390
2428
|
* Creates a Fusion dev server template environment, merging with user overrides.
|
|
2391
2429
|
*
|
|
@@ -23386,7 +23424,7 @@ class AuthConfigurator extends BaseConfigBuilder {
|
|
|
23386
23424
|
// Dynamically import the createAuthClient function since the client uses `libsecret``
|
|
23387
23425
|
// which is not default installed in all environments.
|
|
23388
23426
|
// This avoids installing `libsecret` in environments where it is not needed, like CI/CD pipelines.
|
|
23389
|
-
const { createAuthClient } = await import('./create-auth-client-
|
|
23427
|
+
const { createAuthClient } = await import('./create-auth-client-BEG7gK6o.js');
|
|
23390
23428
|
return createAuthClient(tenantId, clientId);
|
|
23391
23429
|
});
|
|
23392
23430
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { importConfig } from '@equinor/fusion-imports';
|
|
2
|
+
import { mergeDevServerConfig } from './merge-dev-server-config.js';
|
|
2
3
|
/**
|
|
3
4
|
* Helper to define a dev server config function with proper typing.
|
|
4
5
|
* @param fn - The configuration function to be used as the dev server config.
|
|
@@ -28,14 +29,17 @@ export const loadDevServerConfig = async (env, base, options) => {
|
|
|
28
29
|
// Custom resolver for the config module
|
|
29
30
|
resolve: async (module) => {
|
|
30
31
|
// If the default export is a function, call it with env and a cloned base config
|
|
32
|
+
let overrides;
|
|
31
33
|
if (typeof module.default === 'function') {
|
|
32
34
|
const baseClone = { ...base }; // Clone base to avoid mutation
|
|
33
|
-
|
|
35
|
+
overrides = await module.default(env, { base: baseClone });
|
|
34
36
|
// TODO: Add zod validation of the config for type safety
|
|
35
|
-
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
overrides = module.default;
|
|
36
40
|
}
|
|
37
41
|
// If the default export is an object, return it or fallback to base
|
|
38
|
-
return
|
|
42
|
+
return mergeDevServerConfig(base, overrides ?? {});
|
|
39
43
|
},
|
|
40
44
|
},
|
|
41
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-dev-server-config.js","sourceRoot":"","sources":["../../../src/lib/load-dev-server-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA2B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"load-dev-server-config.js","sourceRoot":"","sources":["../../../src/lib/load-dev-server-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA2B,MAAM,yBAAyB,CAAC;AAGhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAqBpE;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAqB,EAAE,EAAE,CAAC,EAAE,CAAC;AAEnE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACtC,GAAe,EACf,IAAsB,EACtB,OAGC,EAC8C,EAAE;IACjD,+FAA+F;IAC/F,OAAO,YAAY,CAAC,OAAO,EAAE,IAAI,IAAI,mBAAmB,EAAE;QACxD,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,+CAA+C;QAClE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,+BAA+B;QAChE,MAAM,EAAE;YACN,wCAAwC;YACxC,OAAO,EAAE,KAAK,EAAE,MAA0C,EAA6B,EAAE;gBACvF,iFAAiF;gBACjF,IAAI,SAAyD,CAAC;gBAC9D,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;oBACzC,MAAM,SAAS,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,+BAA+B;oBAC9D,SAAS,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;oBAC3D,yDAAyD;gBAC3D,CAAC;qBAAM,CAAC;oBACN,SAAS,GAAG,MAAM,CAAC,OAA6C,CAAC;gBACnE,CAAC;gBACD,oEAAoE;gBACpE,OAAO,oBAAoB,CAAC,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;YACrD,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import mergeWith from 'lodash.mergewith';
|
|
2
2
|
/**
|
|
3
|
-
* Customizer function for
|
|
3
|
+
* Customizer function for merging objects, intended for use with utilities like `_.mergeWith`.
|
|
4
4
|
*
|
|
5
|
-
* If
|
|
6
|
-
*
|
|
5
|
+
* - If either `objValue` or `srcValue` is an array, replaces the target array with the source array,
|
|
6
|
+
* concatenating the source array with the target array (source first).
|
|
7
|
+
* - For non-array values, allows the default merge behavior.
|
|
7
8
|
*
|
|
8
|
-
* @param objValue - The value
|
|
9
|
-
* @param srcValue - The value
|
|
10
|
-
* @returns The value
|
|
9
|
+
* @param objValue - The destination value being merged.
|
|
10
|
+
* @param srcValue - The source value being merged.
|
|
11
|
+
* @returns The merged value if custom logic applies, otherwise `undefined` to use default merging.
|
|
11
12
|
*/
|
|
12
13
|
const customizer = (objValue, srcValue) => {
|
|
13
|
-
if (Array.isArray(objValue)) {
|
|
14
|
+
if (Array.isArray(objValue) || Array.isArray(srcValue)) {
|
|
14
15
|
// Replace arrays instead of merging/concatenating them
|
|
15
|
-
return srcValue;
|
|
16
|
+
return (srcValue ?? []).concat(objValue ?? []);
|
|
16
17
|
}
|
|
17
18
|
// For non-arrays, use default merge behavior
|
|
18
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-dev-server-config.js","sourceRoot":"","sources":["../../../src/lib/merge-dev-server-config.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAKzC
|
|
1
|
+
{"version":3,"file":"merge-dev-server-config.js","sourceRoot":"","sources":["../../../src/lib/merge-dev-server-config.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAKzC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,GAAG,CAAC,QAAiB,EAAE,QAAiB,EAAE,EAAE;IAC1D,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvD,uDAAuD;QACvD,OAAO,CAAE,QAA2B,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,6CAA6C;AAC/C,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,IAAsB,EACtB,SAA6C,EAC3B,EAAE;IACpB,uFAAuF;IACvF,OAAO,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAqB,CAAC;AACpE,CAAC,CAAC;AAEF,+CAA+C;AAC/C,eAAe,oBAAoB,CAAC"}
|
package/dist/esm/version.js
CHANGED