@equinor/fusion-framework-cli 10.0.0-next-663bed8344cc2ca0111705b05045173328b3104d → 10.0.0-next-65f4bbf022d22b529abd095acd74ab218499fb8b
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 +10 -15
- package/bin/cli.mjs +1 -1
- package/dist/bin/build-application.js +65 -0
- package/dist/bin/build-application.js.map +1 -0
- package/dist/bin/bundle-application.js +56 -0
- package/dist/bin/bundle-application.js.map +1 -0
- package/dist/bin/create-dev-serve.js +123 -0
- package/dist/bin/create-dev-serve.js.map +1 -0
- package/dist/bin/create-export-config.js +50 -0
- package/dist/bin/create-export-config.js.map +1 -0
- package/dist/bin/create-export-manifest.js +77 -0
- package/dist/bin/create-export-manifest.js.map +1 -0
- package/dist/bin/dev-portal/AppLoader.js +77 -0
- package/dist/bin/dev-portal/AppLoader.js.map +1 -0
- package/dist/bin/dev-portal/BookMarkSideSheet.js +15 -0
- package/dist/bin/dev-portal/BookMarkSideSheet.js.map +1 -0
- package/dist/bin/dev-portal/ContextSelector/ContextSelector.js +41 -0
- package/dist/bin/dev-portal/ContextSelector/ContextSelector.js.map +1 -0
- package/dist/bin/dev-portal/ContextSelector/index.js +2 -0
- package/dist/bin/dev-portal/ContextSelector/index.js.map +1 -0
- package/dist/bin/dev-portal/ContextSelector/useContextResolver.js +171 -0
- package/dist/bin/dev-portal/ContextSelector/useContextResolver.js.map +1 -0
- package/dist/bin/dev-portal/EquinorLoader.js +14 -0
- package/dist/bin/dev-portal/EquinorLoader.js.map +1 -0
- package/dist/bin/dev-portal/ErrorViewer.js +7 -0
- package/dist/bin/dev-portal/ErrorViewer.js.map +1 -0
- package/dist/bin/dev-portal/FusionLogo.js +4 -0
- package/dist/bin/dev-portal/FusionLogo.js.map +1 -0
- package/dist/bin/dev-portal/Header.js +37 -0
- package/dist/bin/dev-portal/Header.js.map +1 -0
- package/dist/bin/dev-portal/PersonSideSheet/index.js +32 -0
- package/dist/bin/dev-portal/PersonSideSheet/index.js.map +1 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureSheetContent.js +16 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureSheetContent.js.map +1 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerApp.js +16 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerApp.js.map +1 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerPortal.js +16 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerPortal.js.map +1 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/LandingSheetContent.js +19 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/LandingSheetContent.js.map +1 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/Styled.js +30 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/Styled.js.map +1 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/index.js +3 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/index.js.map +1 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/types.js +2 -0
- package/dist/bin/dev-portal/PersonSideSheet/sheets/types.js.map +1 -0
- package/dist/bin/dev-portal/Router.js +59 -0
- package/dist/bin/dev-portal/Router.js.map +1 -0
- package/dist/bin/dev-portal/config.js +69 -0
- package/dist/bin/dev-portal/config.js.map +1 -0
- package/dist/bin/dev-portal/main.js +13 -0
- package/dist/bin/dev-portal/main.js.map +1 -0
- package/dist/bin/dev-portal/resources/fallback-photo.svg.js +3 -0
- package/dist/bin/dev-portal/resources/fallback-photo.svg.js.map +1 -0
- package/dist/bin/dev-portal/useAppContextNavigation.js +68 -0
- package/dist/bin/dev-portal/useAppContextNavigation.js.map +1 -0
- package/dist/bin/main.app.js +171 -0
- package/dist/bin/main.app.js.map +1 -0
- package/dist/bin/main.js +20 -0
- package/dist/bin/main.js.map +1 -0
- package/dist/bin/public/assets/{index-Cb85_fOB.js → index-D0eBBcR8.js} +483 -483
- package/dist/bin/public/index.html +1 -1
- package/dist/bin/publish-application.js +104 -0
- package/dist/bin/publish-application.js.map +1 -0
- package/dist/bin/tag-application.js +82 -0
- package/dist/bin/tag-application.js.map +1 -0
- package/dist/bin/upload-application.js +72 -0
- package/dist/bin/upload-application.js.map +1 -0
- package/dist/bin/upload-export-config.js +87 -0
- package/dist/bin/upload-export-config.js.map +1 -0
- package/dist/bin/utils/execute-command.js +23 -0
- package/dist/bin/utils/execute-command.js.map +1 -0
- package/dist/bin/utils/format.js +17 -0
- package/dist/bin/utils/format.js.map +1 -0
- package/dist/bin/utils/getEndpointUrl.js +49 -0
- package/dist/bin/utils/getEndpointUrl.js.map +1 -0
- package/dist/bin/utils/index.js +14 -0
- package/dist/bin/utils/index.js.map +1 -0
- package/dist/bin/utils/isAppRegistered.js +35 -0
- package/dist/bin/utils/isAppRegistered.js.map +1 -0
- package/dist/bin/utils/load-app-config.js +35 -0
- package/dist/bin/utils/load-app-config.js.map +1 -0
- package/dist/bin/utils/load-manifest.js +40 -0
- package/dist/bin/utils/load-manifest.js.map +1 -0
- package/dist/bin/utils/load-package.js +24 -0
- package/dist/bin/utils/load-package.js.map +1 -0
- package/dist/bin/utils/load-vite-config.js +54 -0
- package/dist/bin/utils/load-vite-config.js.map +1 -0
- package/dist/bin/utils/proxy-request-logger.js +34 -0
- package/dist/bin/utils/proxy-request-logger.js.map +1 -0
- package/dist/bin/utils/publishAppConfig.js +36 -0
- package/dist/bin/utils/publishAppConfig.js.map +1 -0
- package/dist/bin/utils/requireToken.js +10 -0
- package/dist/bin/utils/requireToken.js.map +1 -0
- package/dist/bin/utils/spinner.js +77 -0
- package/dist/bin/utils/spinner.js.map +1 -0
- package/dist/bin/utils/tagAppBundle.js +35 -0
- package/dist/bin/utils/tagAppBundle.js.map +1 -0
- package/dist/bin/utils/uploadAppBundle.js +54 -0
- package/dist/bin/utils/uploadAppBundle.js.map +1 -0
- package/dist/lib/app-config.js +1 -1
- package/dist/lib/app-config.js.map +1 -1
- package/dist/schemas.js +14 -0
- package/dist/schemas.js.map +1 -0
- package/dist/types/bin/build-application.d.ts +13 -0
- package/dist/types/bin/bundle-application.d.ts +4 -0
- package/dist/types/bin/create-dev-serve.d.ts +11 -0
- package/dist/types/bin/create-export-config.d.ts +13 -0
- package/dist/types/bin/create-export-manifest.d.ts +16 -0
- package/dist/types/bin/dev-portal/AppLoader.d.ts +11 -0
- package/dist/types/bin/dev-portal/BookMarkSideSheet.d.ts +6 -0
- package/dist/types/bin/dev-portal/ContextSelector/ContextSelector.d.ts +8 -0
- package/dist/types/bin/dev-portal/ContextSelector/index.d.ts +1 -0
- package/dist/types/bin/dev-portal/ContextSelector/useContextResolver.d.ts +15 -0
- package/dist/types/bin/dev-portal/EquinorLoader.d.ts +5 -0
- package/dist/types/bin/dev-portal/ErrorViewer.d.ts +4 -0
- package/dist/types/bin/dev-portal/FusionLogo.d.ts +5 -0
- package/dist/types/bin/dev-portal/Header.d.ts +3 -0
- package/dist/types/bin/dev-portal/PersonSideSheet/index.d.ts +11 -0
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/FeatureSheetContent.d.ts +6 -0
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerApp.d.ts +5 -0
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerPortal.d.ts +5 -0
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/LandingSheetContent.d.ts +5 -0
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/Styled.d.ts +6 -0
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/index.d.ts +2 -0
- package/dist/types/bin/dev-portal/PersonSideSheet/sheets/types.d.ts +5 -0
- package/dist/types/bin/dev-portal/Router.d.ts +1 -0
- package/dist/types/bin/dev-portal/config.d.ts +3 -0
- package/dist/types/bin/dev-portal/main.d.ts +1 -0
- package/dist/types/bin/dev-portal/resources/fallback-photo.svg.d.ts +2 -0
- package/dist/types/bin/dev-portal/useAppContextNavigation.d.ts +5 -0
- package/dist/types/bin/main.app.d.ts +3 -0
- package/dist/types/bin/main.d.ts +1 -0
- package/dist/types/bin/publish-application.d.ts +6 -0
- package/dist/types/bin/tag-application.d.ts +12 -0
- package/dist/types/bin/upload-application.d.ts +6 -0
- package/dist/types/bin/upload-export-config.d.ts +10 -0
- package/dist/types/bin/utils/execute-command.d.ts +8 -0
- package/dist/types/bin/utils/format.d.ts +8 -0
- package/dist/types/bin/utils/getEndpointUrl.d.ts +10 -0
- package/dist/types/bin/utils/index.d.ts +14 -0
- package/dist/types/bin/utils/isAppRegistered.d.ts +5 -0
- package/dist/types/bin/utils/load-app-config.d.ts +10 -0
- package/dist/types/bin/utils/load-manifest.d.ts +10 -0
- package/dist/types/bin/utils/load-package.d.ts +5 -0
- package/dist/types/bin/utils/load-vite-config.d.ts +10 -0
- package/dist/types/bin/utils/proxy-request-logger.d.ts +15 -0
- package/dist/types/bin/utils/publishAppConfig.d.ts +9 -0
- package/dist/types/bin/utils/requireToken.d.ts +4 -0
- package/dist/types/bin/utils/spinner.d.ts +20 -0
- package/dist/types/bin/utils/tagAppBundle.d.ts +7 -0
- package/dist/types/bin/utils/uploadAppBundle.d.ts +7 -0
- package/dist/types/{app-config.d.ts → lib/app-config.d.ts} +1 -1
- package/dist/types/{plugins → lib/plugins}/app-proxy/app-proxy-plugin.d.ts +1 -1
- package/dist/types/schemas.d.ts +30 -0
- package/dist/types/version.d.ts +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +20 -23
- package/dist/bin/main.mjs +0 -2003
- /package/dist/types/{app-manifest.d.ts → lib/app-manifest.d.ts} +0 -0
- /package/dist/types/{app-package.d.ts → lib/app-package.d.ts} +0 -0
- /package/dist/types/{index.d.ts → lib/index.d.ts} +0 -0
- /package/dist/types/{plugins → lib/plugins}/app-assets/app-asset-plugin.d.ts +0 -0
- /package/dist/types/{plugins → lib/plugins}/app-assets/emit-asset.d.ts +0 -0
- /package/dist/types/{plugins → lib/plugins}/app-assets/extension-filter-pattern.d.ts +0 -0
- /package/dist/types/{plugins → lib/plugins}/app-assets/index.d.ts +0 -0
- /package/dist/types/{plugins → lib/plugins}/app-assets/read-asset-content.d.ts +0 -0
- /package/dist/types/{plugins → lib/plugins}/app-assets/resolve-asset-id.d.ts +0 -0
- /package/dist/types/{plugins → lib/plugins}/app-assets/static.d.ts +0 -0
- /package/dist/types/{plugins → lib/plugins}/app-proxy/index.d.ts +0 -0
- /package/dist/types/{plugins → lib/plugins}/external-public/external-public-plugin.d.ts +0 -0
- /package/dist/types/{plugins → lib/plugins}/external-public/index.d.ts +0 -0
- /package/dist/types/{utils → lib/utils}/assert.d.ts +0 -0
- /package/dist/types/{utils → lib/utils}/config.d.ts +0 -0
- /package/dist/types/{utils → lib/utils}/expect.d.ts +0 -0
- /package/dist/types/{utils → lib/utils}/file-exists.d.ts +0 -0
- /package/dist/types/{utils → lib/utils}/ts-transpile.d.ts +0 -0
- /package/dist/types/{utils → lib/utils}/types.d.ts +0 -0
- /package/dist/types/{vite-config.d.ts → lib/vite-config.d.ts} +0 -0
- /package/dist/types/{vite-logger.d.ts → lib/vite-logger.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## 10.0.0-next-
|
|
3
|
+
## 10.0.0-next-65f4bbf022d22b529abd095acd74ab218499fb8b
|
|
4
4
|
|
|
5
5
|
### Major Changes
|
|
6
6
|
|
|
7
|
-
- [#
|
|
8
|
-
|
|
9
|
-
> [!WARNING]
|
|
10
|
-
> This will introduce breaking changes to the consumption of fusion-framework moduels.
|
|
11
|
-
|
|
12
|
-
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`9f6eec8`](https://github.com/equinor/fusion-framework/commit/9f6eec8c5a4cb3dd430fc6bee227442a3dc28bb8) Thanks [@odinr](https://github.com/odinr)! - Adding new commands for app management, `build-publish`, `build-pack`, `build-upload`, `build-config`, `build-manifest` and `build-tag`.
|
|
7
|
+
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`c468117`](https://github.com/equinor/fusion-framework/commit/c4681176a587ad4a0948b3f20427c396d231dd8b) Thanks [@odinr](https://github.com/odinr)! - Adding new commands for app management, `build-publish`, `build-pack`, `build-upload`, `build-config`, `build-manifest` and `build-tag`.
|
|
13
8
|
|
|
14
9
|
Introduces new parameters to the `build-config` command for publishing the app config to a build version.
|
|
15
10
|
|
|
@@ -95,12 +90,12 @@
|
|
|
95
90
|
|
|
96
91
|
### Minor Changes
|
|
97
92
|
|
|
98
|
-
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`
|
|
93
|
+
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`c468117`](https://github.com/equinor/fusion-framework/commit/c4681176a587ad4a0948b3f20427c396d231dd8b) Thanks [@odinr](https://github.com/odinr)! - Introduced `proxyRequestLogger` to log proxy requests in the CLI.
|
|
99
94
|
|
|
100
95
|
- Show the request URL and method in the console when a proxy request is made.
|
|
101
96
|
- Show proxy response status code
|
|
102
97
|
|
|
103
|
-
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`
|
|
98
|
+
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`c468117`](https://github.com/equinor/fusion-framework/commit/c4681176a587ad4a0948b3f20427c396d231dd8b) Thanks [@odinr](https://github.com/odinr)! - Create a plugin `externalPublicPlugin` to fix the issue with serving the `index.html` file from the specified external public directory. Vite mode `spa` will not serve the `index.html` file from the specified external public directory.
|
|
104
99
|
|
|
105
100
|
- Enhanced the middleware to intercept requests and serve the `index.html` file from the specified external public directory.
|
|
106
101
|
- Transformed the HTML using Vite's `transformIndexHtml` method.
|
|
@@ -117,7 +112,7 @@
|
|
|
117
112
|
});
|
|
118
113
|
```
|
|
119
114
|
|
|
120
|
-
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`
|
|
115
|
+
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`c468117`](https://github.com/equinor/fusion-framework/commit/c4681176a587ad4a0948b3f20427c396d231dd8b) Thanks [@odinr](https://github.com/odinr)! - Updated commands in CLI to reflect purpose of the command:
|
|
121
116
|
|
|
122
117
|
- renamed `config` to `build-config` to generate build config of an application.
|
|
123
118
|
- renamed `pack`to `build-pack` to bundle an application.
|
|
@@ -130,7 +125,7 @@
|
|
|
130
125
|
> [!NOTE]
|
|
131
126
|
> This mean that `mergeAppConfig` and `mergeManifestConfig` functions are no longer needed and can be removed from the application.
|
|
132
127
|
|
|
133
|
-
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`
|
|
128
|
+
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`c468117`](https://github.com/equinor/fusion-framework/commit/c4681176a587ad4a0948b3f20427c396d231dd8b) Thanks [@odinr](https://github.com/odinr)! - The `appProxyPlugin` is a Vite plugin designed to proxy requests to a Fusion app backend.
|
|
134
129
|
It sets up proxy rules for API and bundle requests and serves the app configuration and manifest based on the app key and version.
|
|
135
130
|
|
|
136
131
|
Key Features:
|
|
@@ -194,9 +189,9 @@
|
|
|
194
189
|
fetch('/app-proxy/bundles/my-app/builds/0.0.9/index.js'); // proxy
|
|
195
190
|
```
|
|
196
191
|
|
|
197
|
-
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`
|
|
192
|
+
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`c468117`](https://github.com/equinor/fusion-framework/commit/c4681176a587ad4a0948b3f20427c396d231dd8b) Thanks [@odinr](https://github.com/odinr)! - when building an application the `AppAssetExportPlugin` is now added to the `ViteConfig` and configure to include `manifest.build.allowedExtensions`
|
|
198
193
|
|
|
199
|
-
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`
|
|
194
|
+
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`c468117`](https://github.com/equinor/fusion-framework/commit/c4681176a587ad4a0948b3f20427c396d231dd8b) Thanks [@odinr](https://github.com/odinr)! - **App Assets Export Plugin**
|
|
200
195
|
|
|
201
196
|
Create a plugin that exports assets from the app's source code.
|
|
202
197
|
This plugin resolves the issue where assets are not extracted from the app's source code since the app is in `lib` mode.
|
|
@@ -217,13 +212,13 @@
|
|
|
217
212
|
|
|
218
213
|
### Patch Changes
|
|
219
214
|
|
|
220
|
-
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`
|
|
215
|
+
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`c468117`](https://github.com/equinor/fusion-framework/commit/c4681176a587ad4a0948b3f20427c396d231dd8b) Thanks [@odinr](https://github.com/odinr)! - Updating fusion-wc-person to fix issues when using selectedPerson = null in PersonSelect component.
|
|
221
216
|
|
|
222
217
|
Updated the following dependencies
|
|
223
218
|
|
|
224
219
|
- `@equinor/fusion-wc-person` from `^3.0.1` to `^3.0.3` in `packages/cli/package.json` and `packages/react/components/people-resolver/package.json`.
|
|
225
220
|
|
|
226
|
-
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`
|
|
221
|
+
- [#2494](https://github.com/equinor/fusion-framework/pull/2494) [`c468117`](https://github.com/equinor/fusion-framework/commit/c4681176a587ad4a0948b3f20427c396d231dd8b) Thanks [@odinr](https://github.com/odinr)! - Generated base manifest from package will now include `StandardIncludeAssetExtensions` as `allowedExtensions`
|
|
227
222
|
|
|
228
223
|
## 9.13.1
|
|
229
224
|
|
package/bin/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import('../dist/bin/main.
|
|
2
|
+
import('../dist/bin/main.js');
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { dirname } from 'node:path';
|
|
11
|
+
import { build } from 'vite';
|
|
12
|
+
import { chalk } from './utils/format.js';
|
|
13
|
+
import { Spinner } from './utils/spinner.js';
|
|
14
|
+
import { loadViteConfig } from './utils/load-vite-config.js';
|
|
15
|
+
import { loadAppManifest } from './utils/load-manifest.js';
|
|
16
|
+
import { resolveAppPackage } from '../lib/app-package.js';
|
|
17
|
+
import { AppAssetExportPlugin, createExtensionFilterPattern, } from '../lib/plugins/app-assets/index.js';
|
|
18
|
+
export const buildApplication = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
const { configSourceFiles, library, outDir } = options;
|
|
21
|
+
const env = {
|
|
22
|
+
command: 'build',
|
|
23
|
+
mode: (_a = process.env.NODE_ENV) !== null && _a !== void 0 ? _a : 'production',
|
|
24
|
+
};
|
|
25
|
+
const spinner = Spinner.Global({ prefixText: chalk.dim('build') });
|
|
26
|
+
spinner.start('resolve application package');
|
|
27
|
+
const pkg = yield resolveAppPackage();
|
|
28
|
+
spinner.succeed();
|
|
29
|
+
spinner.info('📦', chalk.yellowBright([pkg.packageJson.name, pkg.packageJson.version].join('@')));
|
|
30
|
+
const packageDirname = dirname(pkg.path);
|
|
31
|
+
spinner.info(`🏠 ${chalk.blueBright(packageDirname)}`);
|
|
32
|
+
spinner.start('resolve application manifest');
|
|
33
|
+
const { manifest } = yield loadAppManifest(env, pkg, {
|
|
34
|
+
file: configSourceFiles === null || configSourceFiles === void 0 ? void 0 : configSourceFiles.manifest,
|
|
35
|
+
});
|
|
36
|
+
spinner.succeed();
|
|
37
|
+
const { viteConfig } = yield loadViteConfig(env, {
|
|
38
|
+
file: configSourceFiles === null || configSourceFiles === void 0 ? void 0 : configSourceFiles.vite,
|
|
39
|
+
});
|
|
40
|
+
const includeAssetsPattern = ((_b = manifest.build) === null || _b === void 0 ? void 0 : _b.allowedExtensions)
|
|
41
|
+
? createExtensionFilterPattern(manifest.build.allowedExtensions)
|
|
42
|
+
: undefined;
|
|
43
|
+
spinner.info('📂', 'Using asset include filter:', chalk.red(includeAssetsPattern));
|
|
44
|
+
viteConfig.plugins = [
|
|
45
|
+
...viteConfig.plugins,
|
|
46
|
+
AppAssetExportPlugin({
|
|
47
|
+
include: includeAssetsPattern,
|
|
48
|
+
}),
|
|
49
|
+
];
|
|
50
|
+
if (library === 'react') {
|
|
51
|
+
const reactPlugin = yield import('@vitejs/plugin-react');
|
|
52
|
+
viteConfig.plugins.push(reactPlugin.default());
|
|
53
|
+
}
|
|
54
|
+
viteConfig.build.outDir = outDir.trim();
|
|
55
|
+
spinner.attachConsole = true;
|
|
56
|
+
console.log('Building application...');
|
|
57
|
+
const viteBuild = yield build(viteConfig);
|
|
58
|
+
spinner.attachConsole = false;
|
|
59
|
+
return {
|
|
60
|
+
viteConfig,
|
|
61
|
+
viteBuild,
|
|
62
|
+
pkg,
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=build-application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-application.js","sourceRoot":"","sources":["../../src/bin/build-application.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,C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ator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import AdmZip from 'adm-zip';
|
|
11
|
+
import { dirname, resolve } from 'node:path';
|
|
12
|
+
import { mkdir } from 'node:fs/promises';
|
|
13
|
+
import { chalk, formatByteSize, formatPath } from './utils/format.js';
|
|
14
|
+
import { Spinner } from './utils/spinner.js';
|
|
15
|
+
import { buildApplication } from './build-application.js';
|
|
16
|
+
import { createBuildManifest } from './create-export-manifest.js';
|
|
17
|
+
import { fileExistsSync } from '../lib/utils/file-exists.js';
|
|
18
|
+
export const bundleApplication = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
const { outDir, archive } = options;
|
|
20
|
+
const spinner = Spinner.Global({ prefixText: chalk.dim('pack') });
|
|
21
|
+
spinner.start('build application');
|
|
22
|
+
const { pkg } = yield buildApplication({ outDir });
|
|
23
|
+
spinner.succeed();
|
|
24
|
+
spinner.start('generate manifest');
|
|
25
|
+
const buildManifest = yield createBuildManifest({ outputFile: `${outDir}/app-manifest.json` });
|
|
26
|
+
spinner.succeed('generated manifest:', '\n' + JSON.stringify(buildManifest, undefined, 2));
|
|
27
|
+
const bundle = new AdmZip();
|
|
28
|
+
bundle.addLocalFile(pkg.path);
|
|
29
|
+
spinner.info(`added ./package.json`);
|
|
30
|
+
bundle.addLocalFolder(outDir);
|
|
31
|
+
spinner.info(`added ./${outDir}`);
|
|
32
|
+
const appDir = dirname(pkg.path);
|
|
33
|
+
const licenseFile = resolve(appDir, 'LICENSE.md');
|
|
34
|
+
if (fileExistsSync(licenseFile)) {
|
|
35
|
+
bundle.addLocalFile(licenseFile);
|
|
36
|
+
spinner.info(`added ${licenseFile}`);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
spinner.warn(`missing ${licenseFile}`);
|
|
40
|
+
}
|
|
41
|
+
const readmeFile = resolve(appDir, 'README.md');
|
|
42
|
+
if (fileExistsSync(readmeFile)) {
|
|
43
|
+
bundle.addLocalFile(readmeFile);
|
|
44
|
+
spinner.info(`added ${readmeFile}`);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
spinner.warn(`missing ${readmeFile}`);
|
|
48
|
+
}
|
|
49
|
+
spinner.start('compressing content');
|
|
50
|
+
if (!fileExistsSync(dirname(archive))) {
|
|
51
|
+
yield mkdir(dirname(archive), { recursive: true });
|
|
52
|
+
}
|
|
53
|
+
bundle.writeZip(archive);
|
|
54
|
+
spinner.succeed('Bundle complete', formatPath(archive, { relative: true }), formatByteSize(archive));
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=bundle-application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-application.js","sourceRoot":"","sources":["../../src/bin/bundle-application.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,C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,CAAC,SAAS,WAAW,EAAE,CAAC,CAAC;IACzC,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,IAAI,CAAC,WAAW,WAAW,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAChD,IAAI,cAAc,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7B,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC,SAAS,UAAU,EAAE,CAAC,CAAC;IACxC,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,IAAI,CAAC,WAAW,UAAU,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACrC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QACpC,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzB,OAAO,CAAC,OAAO,CACX,iBAAiB,EACjB,UAAU,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EACvC,cAAc,CAAC,OAAO,CAAC,CAC1B,CAAC;AACN,CAAC,CAAA,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { createServer, defineConfig, mergeConfig, } from 'vite';
|
|
11
|
+
import { assert } from 'node:console';
|
|
12
|
+
import { join, relative } from 'node:path';
|
|
13
|
+
import portFinder from 'portfinder';
|
|
14
|
+
import deepmerge from 'deepmerge/index.js';
|
|
15
|
+
import ViteRestart from 'vite-plugin-restart';
|
|
16
|
+
import { appProxyPlugin } from '../lib/plugins/app-proxy/app-proxy-plugin.js';
|
|
17
|
+
import { externalPublicPlugin } from '../lib/plugins/external-public/external-public-plugin.js';
|
|
18
|
+
import { supportedExt } from '../lib/utils/config.js';
|
|
19
|
+
import { manifestConfigFilename } from '../lib/app-manifest.js';
|
|
20
|
+
import { appConfigFilename } from '../lib/app-config.js';
|
|
21
|
+
import { loadAppConfig } from './utils/load-app-config.js';
|
|
22
|
+
import { loadViteConfig } from './utils/load-vite-config.js';
|
|
23
|
+
import { loadPackage } from './utils/load-package.js';
|
|
24
|
+
import { Spinner } from './utils/spinner.js';
|
|
25
|
+
import { chalk, formatPath } from './utils/format.js';
|
|
26
|
+
import { loadAppManifest } from './utils/load-manifest.js';
|
|
27
|
+
import { proxyRequestLogger } from './utils/proxy-request-logger.js';
|
|
28
|
+
export const createDevServer = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
var _a, _b, _c, _d;
|
|
30
|
+
const { configSourceFiles, library, port, devPortalPath } = options;
|
|
31
|
+
const spinner = Spinner.Global({ prefixText: chalk.dim('dev-server') });
|
|
32
|
+
const pkg = yield loadPackage();
|
|
33
|
+
const env = {
|
|
34
|
+
command: 'serve',
|
|
35
|
+
mode: (_a = process.env.NODE_ENV) !== null && _a !== void 0 ? _a : 'development',
|
|
36
|
+
root: pkg.root,
|
|
37
|
+
};
|
|
38
|
+
const generateManifest = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
const { manifest } = yield loadAppManifest(env, pkg, {
|
|
40
|
+
file: configSourceFiles.manifest,
|
|
41
|
+
});
|
|
42
|
+
const assetPath = `bundles/apps/${manifest.appKey}/${pkg.packageJson.version}`;
|
|
43
|
+
return deepmerge(manifest, {
|
|
44
|
+
build: {
|
|
45
|
+
assetPath,
|
|
46
|
+
configUrl: `${assetPath}/config`,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
const generateConfig = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
const { config } = yield loadAppConfig(env, pkg, {
|
|
52
|
+
file: configSourceFiles.app,
|
|
53
|
+
});
|
|
54
|
+
return config;
|
|
55
|
+
});
|
|
56
|
+
const { appKey } = yield generateManifest();
|
|
57
|
+
/**
|
|
58
|
+
* Load application manifest
|
|
59
|
+
* Application might have overridden the `appKey`
|
|
60
|
+
*/
|
|
61
|
+
spinner.info(`resolved application key ${chalk.magenta(appKey)}`);
|
|
62
|
+
const { viteConfig: baseViteConfig, path: viteConfigPath } = yield loadViteConfig(env, {
|
|
63
|
+
file: configSourceFiles.vite,
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* Defines the configuration for the development server.
|
|
67
|
+
*/
|
|
68
|
+
const devServerConfig = defineConfig({
|
|
69
|
+
publicDir: devPortalPath,
|
|
70
|
+
appType: 'custom',
|
|
71
|
+
server: {
|
|
72
|
+
open: `/apps/${appKey}`,
|
|
73
|
+
port: port !== null && port !== void 0 ? port : (yield portFinder.getPortPromise({ port: 3000 })),
|
|
74
|
+
},
|
|
75
|
+
plugins: [
|
|
76
|
+
// Serve the dev portal as static files
|
|
77
|
+
externalPublicPlugin(devPortalPath),
|
|
78
|
+
// Proxy requests to the app server
|
|
79
|
+
appProxyPlugin({
|
|
80
|
+
proxy: {
|
|
81
|
+
path: '/apps-proxy',
|
|
82
|
+
target: 'https://fusion-s-apps-ci.azurewebsites.net/',
|
|
83
|
+
onProxyReq: proxyRequestLogger,
|
|
84
|
+
},
|
|
85
|
+
app: {
|
|
86
|
+
key: appKey,
|
|
87
|
+
version: String(pkg.packageJson.version),
|
|
88
|
+
generateConfig,
|
|
89
|
+
generateManifest,
|
|
90
|
+
},
|
|
91
|
+
}),
|
|
92
|
+
// Restart the server when config changes or the dev portal source is updated
|
|
93
|
+
ViteRestart({
|
|
94
|
+
restart: [
|
|
95
|
+
'package.json',
|
|
96
|
+
viteConfigPath,
|
|
97
|
+
join(relative(process.cwd(), devPortalPath), '/**/*'),
|
|
98
|
+
].filter((x) => !!x),
|
|
99
|
+
/** reload the CLI when config changes, note change to APP-KEY need restart */
|
|
100
|
+
reload: [
|
|
101
|
+
...supportedExt.map((ext) => [appConfigFilename, ext].join('')),
|
|
102
|
+
...supportedExt.map((ext) => [manifestConfigFilename, ext].join('')),
|
|
103
|
+
],
|
|
104
|
+
}),
|
|
105
|
+
],
|
|
106
|
+
});
|
|
107
|
+
// Merge the base Vite config with the dev server config
|
|
108
|
+
const viteConfig = mergeConfig(devServerConfig, baseViteConfig);
|
|
109
|
+
/** Add library/framework plugins */
|
|
110
|
+
if (library === 'react') {
|
|
111
|
+
const reactPlugin = yield import('@vitejs/plugin-react');
|
|
112
|
+
viteConfig.plugins.push(reactPlugin.default());
|
|
113
|
+
}
|
|
114
|
+
assert((_b = viteConfig.build) === null || _b === void 0 ? void 0 : _b.lib, 'expected vite build to have library defined');
|
|
115
|
+
const { entry } = viteConfig.build.lib;
|
|
116
|
+
spinner.info('💾 application entrypoint', formatPath(String(entry), { relative: true }));
|
|
117
|
+
spinner.info('resolving cli internal assets from', formatPath(String(viteConfig.publicDir), { relative: true }));
|
|
118
|
+
const vite = yield createServer(Object.assign(Object.assign({}, env), viteConfig));
|
|
119
|
+
spinner.start('🚀 start server');
|
|
120
|
+
yield vite.listen();
|
|
121
|
+
spinner.succeed('🔗', chalk.underline.green(new URL(`/apps/${appKey}`, (_d = (_c = vite.resolvedUrls) === null || _c === void 0 ? void 0 : _c.local[0]) !== null && _d !== void 0 ? _d : `https://localhost:/${vite.config.server.port}`).href));
|
|
122
|
+
});
|
|
123
|
+
//# sourceMappingURL=create-dev-serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-dev-serve.js","sourceRoot":"","sources":["../../src/bin/create-dev-serve.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,YAAY,EACZ,YAAY,EACZ,WAAW,GAGd,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAE3C,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAC;AAEhG,OAAO,EAAE,YAAY,EAA0B,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAIrE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAO,OAUrC,EAAE,EAAE;;IACD,MAAM,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AK,CAAC,CAAC,CAAC,mCAAI,sBAAsB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CACjF,CAAC,IAAI,CACT,CACJ,CAAC;AACN,CAAC,CAAA,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import nodeFs from 'node:fs';
|
|
11
|
+
import { writeFile } from 'node:fs/promises';
|
|
12
|
+
import { dirname } from 'node:path';
|
|
13
|
+
import { chalk, formatPath } from './utils/format.js';
|
|
14
|
+
import { Spinner } from './utils/spinner.js';
|
|
15
|
+
import { loadAppConfig, loadPackage } from './utils/index.js';
|
|
16
|
+
export const createExportConfig = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
var _a;
|
|
18
|
+
const { command = 'build', outputFile, configFile } = options;
|
|
19
|
+
const spinner = Spinner.Global({ prefixText: chalk.dim('config') });
|
|
20
|
+
const pkg = yield loadPackage();
|
|
21
|
+
const appEnv = {
|
|
22
|
+
command,
|
|
23
|
+
mode: (_a = process.env.NODE_ENV) !== null && _a !== void 0 ? _a : 'development',
|
|
24
|
+
root: pkg.root,
|
|
25
|
+
};
|
|
26
|
+
const { config } = yield loadAppConfig(appEnv, pkg, {
|
|
27
|
+
file: configFile,
|
|
28
|
+
});
|
|
29
|
+
if (outputFile) {
|
|
30
|
+
spinner.start(`outputting config to ${formatPath(outputFile)}`);
|
|
31
|
+
try {
|
|
32
|
+
const dir = dirname(outputFile).trim();
|
|
33
|
+
if (!nodeFs.existsSync(dirname(outputFile))) {
|
|
34
|
+
nodeFs.mkdirSync(dir, { recursive: true });
|
|
35
|
+
}
|
|
36
|
+
writeFile(outputFile, JSON.stringify(config));
|
|
37
|
+
spinner.succeed();
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
spinner.fail();
|
|
41
|
+
throw err;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
console.log(config);
|
|
46
|
+
}
|
|
47
|
+
return config;
|
|
48
|
+
});
|
|
49
|
+
export default createExportConfig;
|
|
50
|
+
//# sourceMappingURL=create-export-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-export-config.js","sourceRoot":"","sources":["../../src/bin/create-export-config.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAO,OAIxC,EAAE,EAAE;;IACD,MAAM,EAAE,OAAO,GAAG,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE9D,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEpE,MAAM,GAAG,GAAG,MAAM,WAAW,EAAE,CAAC;IAEhC,MAAM,MAAM,GAAsB;QAC9B,OAAO;QACP,IAAI,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,mCAAI,aAAa;QAC3C,IAAI,EAAE,GAAG,CAAC,IAAI;KACjB,CAAC;IAEF,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE;QAChD,IAAI,EAAE,UAAU;KACnB,CAAC,CAAC;IAEH,IAAI,UAAU,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,wBAAwB,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC;YACD,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;YACvC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;gBAC1C,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC/C,CAAC;YACD,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;YAC9C,OAAO,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,GAAG,CAAC;QACd,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import nodeFs from 'node:fs';
|
|
11
|
+
import { writeFile } from 'node:fs/promises';
|
|
12
|
+
import assert from 'node:assert';
|
|
13
|
+
import { SemVer, parse as parseSemver } from 'semver';
|
|
14
|
+
import { chalk, formatPath } from './utils/format.js';
|
|
15
|
+
import { Spinner } from './utils/spinner.js';
|
|
16
|
+
import { loadAppManifest } from './utils/load-manifest.js';
|
|
17
|
+
import { loadPackage } from './utils/load-package.js';
|
|
18
|
+
import { dirname } from 'node:path';
|
|
19
|
+
// TODO why do we do this??? can`t backend parse semver?
|
|
20
|
+
export const normalizeVersion = (version) => {
|
|
21
|
+
const semverVersion = parseSemver(version);
|
|
22
|
+
assert(semverVersion instanceof SemVer, 'expected version in AppManifest to be SemVer');
|
|
23
|
+
const { major, minor, patch } = semverVersion;
|
|
24
|
+
return { major, minor, patch };
|
|
25
|
+
};
|
|
26
|
+
export const createAppManifest = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
Spinner.Global({ prefixText: chalk.dim('app manifest') });
|
|
28
|
+
const manifest = yield createManifest(options);
|
|
29
|
+
if (options === null || options === void 0 ? void 0 : options.outputFile) {
|
|
30
|
+
yield writeManifestToDisk(manifest, options.outputFile);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
console.log(JSON.stringify(manifest, undefined, 2));
|
|
34
|
+
}
|
|
35
|
+
return manifest;
|
|
36
|
+
});
|
|
37
|
+
export const createBuildManifest = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
Spinner.Global({ prefixText: chalk.dim('build manifest') });
|
|
39
|
+
const { build } = yield createManifest(options);
|
|
40
|
+
if (options === null || options === void 0 ? void 0 : options.outputFile) {
|
|
41
|
+
yield writeManifestToDisk(build, options.outputFile);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
console.log(JSON.stringify(build, undefined, 2));
|
|
45
|
+
}
|
|
46
|
+
return build;
|
|
47
|
+
});
|
|
48
|
+
const writeManifestToDisk = (content, outputFile) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
const spinner = Spinner.Clone();
|
|
50
|
+
spinner.start(`Exporting manifest to ${formatPath(outputFile)}`);
|
|
51
|
+
try {
|
|
52
|
+
const dir = dirname(outputFile).trim();
|
|
53
|
+
if (!nodeFs.existsSync(dirname(outputFile))) {
|
|
54
|
+
nodeFs.mkdirSync(dir, { recursive: true });
|
|
55
|
+
}
|
|
56
|
+
yield writeFile(outputFile, JSON.stringify(content));
|
|
57
|
+
spinner.succeed();
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
spinner.fail();
|
|
61
|
+
throw err;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const createManifest = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
const pkg = yield loadPackage();
|
|
67
|
+
const env = {
|
|
68
|
+
command: (_a = options === null || options === void 0 ? void 0 : options.command) !== null && _a !== void 0 ? _a : 'build',
|
|
69
|
+
mode: (_b = process.env.NODE_ENV) !== null && _b !== void 0 ? _b : 'development',
|
|
70
|
+
root: pkg.root,
|
|
71
|
+
};
|
|
72
|
+
const { manifest } = yield loadAppManifest(env, pkg, {
|
|
73
|
+
file: options === null || options === void 0 ? void 0 : options.configFile,
|
|
74
|
+
});
|
|
75
|
+
return manifest;
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=create-export-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-export-manifest.js","sourceRoot":"","sources":["../../src/bin/create-export-manifest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,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QACrD,OAAO,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,GAAG,CAAC;IACd,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,cAAc,GAAG,CAAO,OAA+B,EAAwB,EAAE;;IACnF,MAAM,GAAG,GAAG,MAAM,WAAW,EAAE,CAAC;IAEhC,MAAM,GAAG,GAAsB;QAC3B,OAAO,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,OAAO;QACpC,IAAI,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,mCAAI,aAAa;QAC3C,IAAI,EAAE,GAAG,CAAC,IAAI;KACjB,CAAC;IAEF,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE;QACjD,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU;KAC5B,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAA,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { Subscription } from 'rxjs';
|
|
4
|
+
import { useFramework } from '@equinor/fusion-framework-react';
|
|
5
|
+
import { useObservableState } from '@equinor/fusion-observable/react';
|
|
6
|
+
import { AppManifestError } from '@equinor/fusion-framework-module-app/errors.js';
|
|
7
|
+
import { ErrorViewer } from './ErrorViewer';
|
|
8
|
+
import EquinorLoader from './EquinorLoader';
|
|
9
|
+
/**
|
|
10
|
+
* React Functional Component for handling current application
|
|
11
|
+
*
|
|
12
|
+
* this component will set the current app by provided appKey.
|
|
13
|
+
* when the appKey changes, this component will try to initialize the referred application
|
|
14
|
+
* and render it.
|
|
15
|
+
*/
|
|
16
|
+
export const AppLoader = (props) => {
|
|
17
|
+
const { appKey } = props;
|
|
18
|
+
const fusion = useFramework();
|
|
19
|
+
/** reference of application section/container */
|
|
20
|
+
const ref = useRef(null);
|
|
21
|
+
const [loading, setLoading] = useState(false);
|
|
22
|
+
const [error, setError] = useState();
|
|
23
|
+
// TODO change to `useCurrentApp`
|
|
24
|
+
/** observe and use the current selected application from framework */
|
|
25
|
+
const { value: currentApp } = useObservableState(useMemo(() => fusion.modules.app.current$, [fusion.modules.app]));
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
/** when appKey property change, assign it to current */
|
|
28
|
+
fusion.modules.app.setCurrentApp(appKey);
|
|
29
|
+
}, [appKey, fusion]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
/** flag that application is loading */
|
|
32
|
+
setLoading(true);
|
|
33
|
+
/** clear previous errors */
|
|
34
|
+
setError(undefined);
|
|
35
|
+
/** create a teardown of load */
|
|
36
|
+
const subscription = new Subscription();
|
|
37
|
+
/** make sure that initialize is canceled and disposed if current app changes */
|
|
38
|
+
subscription.add(currentApp === null || currentApp === void 0 ? void 0 : currentApp.initialize().subscribe({
|
|
39
|
+
next: ({ manifest, script, config }) => {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
/** generate basename for application */
|
|
42
|
+
const [basename] = (_a = window.location.pathname.match(/\/?apps\/[a-z|-]+(\/)?/g)) !== null && _a !== void 0 ? _a : [''];
|
|
43
|
+
/** create a 'private' element for the application */
|
|
44
|
+
const el = document.createElement('div');
|
|
45
|
+
if (!ref.current) {
|
|
46
|
+
throw Error('Missing application mounting point');
|
|
47
|
+
}
|
|
48
|
+
ref.current.appendChild(el);
|
|
49
|
+
/** extract render callback function from javascript module */
|
|
50
|
+
const render = (_b = script.renderApp) !== null && _b !== void 0 ? _b : script.default;
|
|
51
|
+
/** add application teardown to current render effect teardown */
|
|
52
|
+
subscription.add(render(el, { fusion, env: { basename, config, manifest } }));
|
|
53
|
+
/** remove app element when application unmounts */
|
|
54
|
+
subscription.add(() => el.remove());
|
|
55
|
+
},
|
|
56
|
+
complete: () => {
|
|
57
|
+
/** flag that application is no longer loading */
|
|
58
|
+
setLoading(false);
|
|
59
|
+
},
|
|
60
|
+
error: (err) => {
|
|
61
|
+
/** set error if initialization of application fails */
|
|
62
|
+
setError(err);
|
|
63
|
+
},
|
|
64
|
+
}));
|
|
65
|
+
/** teardown application when hook unmounts */
|
|
66
|
+
return () => subscription.unsubscribe();
|
|
67
|
+
}, [fusion, currentApp, ref]);
|
|
68
|
+
if (error) {
|
|
69
|
+
if (error.cause instanceof AppManifestError) {
|
|
70
|
+
return (_jsxs("div", { children: [_jsx("h2", { children: "\uD83D\uDD25 Failed to load application manifest \uD83E\uDD2C" }), _jsx("h3", { children: error.cause.type }), _jsx(ErrorViewer, { error: error })] }));
|
|
71
|
+
}
|
|
72
|
+
return (_jsxs("div", { children: [_jsx("h2", { children: "\uD83D\uDD25 Failed to load application \uD83E\uDD2C" }), _jsx(ErrorViewer, { error: error })] }));
|
|
73
|
+
}
|
|
74
|
+
return (_jsx("section", { id: "application-content", ref: ref, style: { display: 'contents' }, children: loading && _jsx(EquinorLoader, { text: "Loading Application" }) }));
|
|
75
|
+
};
|
|
76
|
+
export default AppLoader;
|
|
77
|
+
//# sourceMappingURL=AppLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppLoader.js","sourceRoot":"","sources":["../../../src/bin/dev-portal/AppLoader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAA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AAC,CAAC;IAE9B,IAAI,KAAK,EAAE,CAAC;QACR,IAAI,KAAK,CAAC,KAAK,YAAY,gBAAgB,EAAE,CAAC;YAC1C,OAAO,CACH,0BACI,yFAAkD,EAClD,uBAAK,KAAK,CAAC,KAAK,CAAC,IAAI,GAAM,EAC3B,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,GAAI,IAC3B,CACT,CAAC;QACN,CAAC;QACD,OAAO,CACH,0BACI,gFAAyC,EACzC,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,GAAI,IAC3B,CACT,CAAC;IACN,CAAC;IAED,OAAO,CACH,kBAAS,EAAE,EAAC,qBAAqB,EAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,YACrE,OAAO,IAAI,KAAC,aAAa,IAAC,IAAI,EAAC,qBAAqB,GAAG,GAClD,CACb,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Icon } from '@equinor/eds-core-react';
|
|
3
|
+
import { useFramework } from '@equinor/fusion-framework-react';
|
|
4
|
+
import { Bookmark } from '@equinor/fusion-framework-react-components-bookmark';
|
|
5
|
+
import { useHasBookmark } from '@equinor/fusion-framework-react-module-bookmark/portal';
|
|
6
|
+
import { SideSheet } from '@equinor/fusion-react-side-sheet';
|
|
7
|
+
export const BookmarkSideSheet = ({ isOpen, onClose }) => {
|
|
8
|
+
const hasBookmark = useHasBookmark();
|
|
9
|
+
const { event } = useFramework().modules;
|
|
10
|
+
return (_jsxs(SideSheet, { isOpen: isOpen, onClose: onClose, isDismissable: true, enableFullscreen: true, children: [_jsx(SideSheet.Indicator, { color: '#258800' }), _jsx(SideSheet.Title, { title: "Bookmarks" }), _jsx(SideSheet.SubTitle, { subTitle: 'Application bookmarks' }), _jsx(SideSheet.Actions, { children: _jsxs(Button, { disabled: !hasBookmark, variant: "ghost", onClick: () => {
|
|
11
|
+
onClose();
|
|
12
|
+
event.dispatchEvent('onBookmarkOpen', { detail: true });
|
|
13
|
+
}, children: [_jsx(Icon, { name: "add" }), " Add Bookmark"] }) }), _jsx(SideSheet.Content, { children: _jsx(Bookmark, {}) })] }));
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=BookMarkSideSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BookMarkSideSheet.js","sourceRoot":"","sources":["../../../src/bin/dev-portal/BookMarkSideSheet.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,qDAAqD,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAO7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAA0B,EAAE,EAAE;IAC7E,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC,OAAO,CAAC;IAEzC,OAAO,CACH,MAAC,SAAS,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,aACpF,KAAC,SAAS,CAAC,SAAS,IAAC,KAAK,EAAE,SAAS,GAAI,EACzC,KAAC,SAAS,CAAC,KAAK,IAAC,KAAK,EAAC,WAAW,GAAG,EACrC,KAAC,SAAS,CAAC,QAAQ,IAAC,QAAQ,EAAE,uBAAuB,GAAI,EACzD,KAAC,SAAS,CAAC,OAAO,cACd,MAAC,MAAM,IACH,QAAQ,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