@equinor/echo-cli 1.0.0-beta-2 → 1.0.0-beta-4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/echo-dev-host/.vscode/settings.json +5 -0
  2. package/{lib/echo-client → echo-dev-host}/README.md +7 -5
  3. package/{lib/echo-client → echo-dev-host}/package-lock.json +2 -2
  4. package/{lib/echo-client → echo-dev-host}/src/app.tsx +1 -1
  5. package/{lib/echo-client → echo-dev-host}/webpack.config.js +4 -4
  6. package/lib/config/common/initOptions.js +1 -1
  7. package/lib/config/common/initOptions.js.map +1 -1
  8. package/lib/{echo-build-client.d.ts → echo-build-dev-host.d.ts} +1 -1
  9. package/lib/echo-build-dev-host.js +35 -0
  10. package/lib/echo-build-dev-host.js.map +1 -0
  11. package/lib/echo-dev-host/.env +29 -0
  12. package/lib/echo-dev-host/README.md +46 -0
  13. package/lib/echo-dev-host/babel.config.js +11 -0
  14. package/lib/echo-dev-host/env.sh +51 -0
  15. package/lib/echo-dev-host/jest.config.js +21 -0
  16. package/lib/echo-dev-host/package-lock.json +12457 -0
  17. package/lib/echo-dev-host/package.json +80 -0
  18. package/lib/echo-dev-host/public/env-config.js +17 -0
  19. package/{client → lib/echo-dev-host/public}/index.html +1 -1
  20. package/lib/echo-dev-host/src/api/api-plants.ts +22 -0
  21. package/lib/echo-dev-host/src/app.css +12 -0
  22. package/lib/echo-dev-host/src/app.tsx +43 -0
  23. package/lib/echo-dev-host/src/components/Home/Home.tsx +23 -0
  24. package/lib/echo-dev-host/src/components/Home/home.module.css +38 -0
  25. package/lib/echo-dev-host/src/components/legend.tsx +3 -0
  26. package/lib/echo-dev-host/src/index.tsx +90 -0
  27. package/lib/echo-dev-host/src/setupTests.ts +25 -0
  28. package/lib/echo-dev-host/src/utils/plants.test.ts +33 -0
  29. package/lib/echo-dev-host/src/utils/plants.ts +12 -0
  30. package/lib/echo-dev-host/src/utils/setupSkipAuth.ts +43 -0
  31. package/lib/echo-dev-host/tsconfig.json +21 -0
  32. package/lib/echo-dev-host/webpack.config.js +138 -0
  33. package/package.json +4 -4
  34. package/client/env-config.js +0 -1
  35. package/client/main.echo.bundle.js +0 -3
  36. package/client/main.echo.bundle.js.LICENSE.txt +0 -133
  37. package/client/main.echo.bundle.js.map +0 -1
  38. package/client/vendors-node_modules_babel_polyfill_lib_index_js-node_modules_react-dom_client_js-node_module-5b8715.echo.bundle.js +0 -3
  39. package/client/vendors-node_modules_babel_polyfill_lib_index_js-node_modules_react-dom_client_js-node_module-5b8715.echo.bundle.js.LICENSE.txt +0 -8453
  40. package/client/vendors-node_modules_babel_polyfill_lib_index_js-node_modules_react-dom_client_js-node_module-5b8715.echo.bundle.js.map +0 -1
  41. package/lib/echo-build-client.js +0 -37
  42. package/lib/echo-build-client.js.map +0 -1
  43. package/lib/echo-client/.links.json +0 -3
  44. package/lib/echo-client/build/env-config.js +0 -1
  45. package/lib/echo-client/public/echoModuleManifest.json +0 -30
  46. package/lib/echo-client/public/index.css +0 -60
  47. package/lib/echo-client/public/module-bundle-demo1.js +0 -250
  48. package/lib/echo-client/public/module-bundle-demo2.js +0 -251
  49. package/lib/echo-client/public/module-bundle-demo3.js +0 -251
  50. /package/{lib/echo-client → echo-dev-host}/.env +0 -0
  51. /package/{lib/echo-client → echo-dev-host}/babel.config.js +0 -0
  52. /package/{lib/echo-client → echo-dev-host}/env.sh +0 -0
  53. /package/{lib/echo-client → echo-dev-host}/jest.config.js +0 -0
  54. /package/{lib/echo-client → echo-dev-host}/package.json +0 -0
  55. /package/{lib/echo-client → echo-dev-host}/public/env-config.js +0 -0
  56. /package/{client → echo-dev-host/public}/index.css +0 -0
  57. /package/{lib/echo-client → echo-dev-host}/public/index.html +0 -0
  58. /package/{lib/echo-client → echo-dev-host}/src/api/api-plants.ts +0 -0
  59. /package/{lib/echo-client → echo-dev-host}/src/app.css +0 -0
  60. /package/{lib/echo-client → echo-dev-host}/src/components/Home/Home.tsx +0 -0
  61. /package/{lib/echo-client → echo-dev-host}/src/components/Home/home.module.css +0 -0
  62. /package/{lib/echo-client → echo-dev-host}/src/components/legend.tsx +0 -0
  63. /package/{lib/echo-client → echo-dev-host}/src/images/frontpage-brand-placeholder.jpg +0 -0
  64. /package/{lib/echo-client → echo-dev-host}/src/index.tsx +0 -0
  65. /package/{lib/echo-client → echo-dev-host}/src/setupTests.ts +0 -0
  66. /package/{lib/echo-client → echo-dev-host}/src/utils/plants.test.ts +0 -0
  67. /package/{lib/echo-client → echo-dev-host}/src/utils/plants.ts +0 -0
  68. /package/{lib/echo-client → echo-dev-host}/src/utils/setupSkipAuth.ts +0 -0
  69. /package/{lib/echo-client → echo-dev-host}/tsconfig.json +0 -0
  70. /package/lib/{echo-client/build → echo-dev-host/public}/index.css +0 -0
  71. /package/{client/d2d97a9feca22f12a8c8c7413d7867ac.jpg → lib/echo-dev-host/src/images/frontpage-brand-placeholder.jpg} +0 -0
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@equinor/echo-client",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "start": "webpack serve --mode development --env development --open --hot",
8
+ "build-client": "webpack --env development --env=cli=true",
9
+ "build": "webpack --mode development",
10
+ "echo-update": "echo-update",
11
+ "echo-update-version": "echo-update -v",
12
+ "echo-update-next": "echo-update -c",
13
+ "echo-update-all": "echo-update -a",
14
+ "echo-test": "jest",
15
+ "lint": "eslint --ext .js,.jsx,.ts,.tsx src --color",
16
+ "test-wo-install": "jest --watchAll",
17
+ "test": "npm ci & jest --watchAll",
18
+ "test-coverage": "npm ci & jest --coverage --watchAll",
19
+ "unlink-echo-search": "node unlink-echo-search.js"
20
+ },
21
+ "author": "",
22
+ "license": "MIT",
23
+ "dependencies": {
24
+ "@equinor/echo-base": "0.7.6",
25
+ "@equinor/echo-components": "0.12.7",
26
+ "@equinor/echo-core": "0.9.20",
27
+ "@equinor/echo-framework": "0.25.5",
28
+ "@equinor/echo-scripts": "0.1.5",
29
+ "@equinor/echo-search": "0.15.17",
30
+ "@equinor/echo-utils": "0.4.16",
31
+ "@equinor/eds-core-react": "0.43.0",
32
+ "@equinor/eds-icons": "0.22.0",
33
+ "@equinor/eds-utils": "0.8.6",
34
+ "@microsoft/signalr": "8.0.7",
35
+ "@svgr/webpack": "8.1.0",
36
+ "@tanstack/react-query": "5.80.10",
37
+ "classnames": "2.5.1",
38
+ "fs-extra": "11.3.0",
39
+ "history": "5.3.0",
40
+ "immer": "10.1.1",
41
+ "lodash": "4.17.21",
42
+ "react": "18.3.1",
43
+ "react-dom": "18.3.1",
44
+ "react-router-dom": "5.3.4",
45
+ "react-sortablejs": "6.1.4",
46
+ "sortablejs": "1.15.6",
47
+ "styled-components": "6.1.19",
48
+ "zustand": "4.5.5"
49
+ },
50
+ "devDependencies": {
51
+ "@babel/core": "7.27.1",
52
+ "@babel/plugin-transform-runtime": "7.27.1",
53
+ "@babel/polyfill": "7.12.1",
54
+ "@babel/preset-env": "7.27.2",
55
+ "@babel/preset-react": "7.27.1",
56
+ "@babel/preset-typescript": "7.27.1",
57
+ "@equinor/echo-update": "1.3.3",
58
+ "@types/jest": "29.5.14",
59
+ "@types/node": "22.15.19",
60
+ "@types/react": "18.3.18",
61
+ "@types/react-dom": "18.3.5",
62
+ "@types/react-router-dom": "5.3.3",
63
+ "@types/webpack-env": "1.18.8",
64
+ "babel-loader": "10.0.0",
65
+ "copy-webpack-plugin": "13.0.0",
66
+ "css-loader": "7.1.2",
67
+ "dotenv-webpack": "8.1.0",
68
+ "file-loader": "6.2.0",
69
+ "html-webpack-plugin": "5.6.3",
70
+ "jest": "29.7.0",
71
+ "style-loader": "4.0.0",
72
+ "ts-jest": "29.3.4",
73
+ "ts-loader": "9.5.2",
74
+ "typescript": "5.8.3",
75
+ "webpack": "5.99.8",
76
+ "webpack-cli": "6.0.1",
77
+ "webpack-dev-server": "5.2.1",
78
+ "webpackbar": "7.0.0"
79
+ }
80
+ }
@@ -0,0 +1,17 @@
1
+ window._env_ = {
2
+ HTTPS: "true",
3
+ GENERATE_SOURCEMAP: "true",
4
+ INLINE_RUNTIME_CHUNK: "false",
5
+ WEBSITE_HOSTNAME: "localhost:3000;",
6
+ REACT_APP_DEFAULT_CACHE_LOCATION: "localstorage",
7
+ REACT_APP_API_URL: "https://dt-echopedia-api-dev.azurewebsites.net",
8
+ REACT_APP_WEB_URL: "https://dt-echopedia-web-dev.azurewebsites.net",
9
+ REACT_APP_WEB_PROD_URL: "https://echo.equinor.com",
10
+ REACT_APP_AZURE_AD_TENNANT: "StatoilSRM.onmicrosoft.com",
11
+ REACT_APP_AZURE_AD_TENNANT_ID: "3aa4a235-b6e2-48d5-9195-7fcf05b459b0",
12
+ REACT_APP_AZURE_AD_CLIENT_ID: "751d2504-0b66-4b78-9807-4b60525a14c6",
13
+ REACT_APP_API_CLIENT_ID: "aef35d97-53d4-4fd0-adaf-c5a514b38436",
14
+ REACT_APP_APPINSIGHTS_CONNECTION_STRING: "InstrumentationKey=e5299075-a00d-4012-96f9-42861e8d8a9e;IngestionEndpoint=https://northeurope-3.in.applicationinsights.azure.com/;LiveEndpoint=https://northeurope.livediagnostics.monitor.azure.com/;ApplicationId=a9b64222-d4a9-42e6-a615-7428fe1a26af",
15
+ REACT_APP_AZURE_BUILD_NUMBER: "0.8.dev.9",
16
+ REACT_APP_LOGGER_ACTIVE: "false",
17
+ }
@@ -14,7 +14,7 @@
14
14
  <link rel="preconnect" href="https://dc.services.visualstudio.com" />
15
15
  <link rel="preconnect" href="https://cdn.eds.equinor.com" />
16
16
  <title>Echo | Development</title>
17
- <script defer src="/vendors-node_modules_babel_polyfill_lib_index_js-node_modules_react-dom_client_js-node_module-5b8715.echo.bundle.js"></script><script defer src="/main.echo.bundle.js"></script></head>
17
+ </head>
18
18
  <body>
19
19
  <div id="root"></div>
20
20
  </body>
@@ -0,0 +1,22 @@
1
+ import { EchoEnv, Plant, request, setPlantsData } from '@equinor/echo-core';
2
+
3
+ async function getPlantsFromApi(): Promise<Plant[] | undefined> {
4
+ const url = `${EchoEnv.env().REACT_APP_API_URL}/plants`;
5
+ return request<Plant[]>({
6
+ url, cache: {
7
+ timeInSeconds: 4 * 60 * 60 // 4 hours
8
+ }
9
+ });
10
+ }
11
+
12
+ export async function getCorePlants(): Promise<void> {
13
+ try {
14
+ const apiPlants = (await getPlantsFromApi() ?? []);
15
+
16
+ if (apiPlants && apiPlants.length > 0) {
17
+ setPlantsData({ plants: apiPlants });
18
+ }
19
+ } catch (ex) {
20
+ console.error(ex);
21
+ }
22
+ }
@@ -0,0 +1,12 @@
1
+ /* Applied in echo application by bootstrap so it should exist here to */
2
+ *,
3
+ :after,
4
+ :before {
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ #root {
9
+ height: 100%;
10
+ overflow: hidden;
11
+ width: 100%;
12
+ }
@@ -0,0 +1,43 @@
1
+ import { EchoEnv, useInitial } from '@equinor/echo-core';
2
+ import { displayToast, EchoContent, EchoEventHandler, EchoRoutes, Toasters } from '@equinor/echo-framework';
3
+ import { Syncer } from '@equinor/echo-search';
4
+ import React from 'react';
5
+ import { Redirect as TypedRedirect, Route as TypedRoute, Switch as TypedSwitch } from 'react-router-dom';
6
+ import { getCorePlants } from './api/api-plants';
7
+ import './app.css';
8
+ import { Home } from './components/Home/Home';
9
+ import { Legend } from './components/legend';
10
+
11
+ export const EchoApp: React.FC = () => {
12
+ useInitial(async () => {
13
+ await Syncer.configuration.setApiBaseUrl(EchoEnv.env().REACT_APP_API_URL);
14
+ fireAndForget(getCorePlants, {
15
+ userFriendlyErrorMessage: '[echo-dev-host][app.tsx] Failed to load plants data',
16
+ displayToast: true
17
+ });
18
+ });
19
+
20
+ return (
21
+ <EchoEventHandler>
22
+ <EchoContent Legend={Legend} isOnboardingCompleted={true}>
23
+ <TypedSwitch>
24
+ <EchoRoutes homeComponent={Home} />
25
+ <TypedRoute render={(): JSX.Element => <TypedRedirect to="/" />} />
26
+ </TypedSwitch>
27
+ <Toasters />
28
+ </EchoContent>
29
+ </EchoEventHandler>
30
+ );
31
+ };
32
+
33
+ function fireAndForget(
34
+ asyncFunc: () => Promise<void>,
35
+ options: { userFriendlyErrorMessage: string; displayToast?: boolean }
36
+ ): void {
37
+ asyncFunc().catch((error) => {
38
+ console.error(error, options.userFriendlyErrorMessage);
39
+ if (options.displayToast) {
40
+ displayToast({ message: options.userFriendlyErrorMessage });
41
+ }
42
+ });
43
+ }
@@ -0,0 +1,23 @@
1
+ import { AppLinks, EchoLogo, Footer, PlantSelector } from '@equinor/echo-framework';
2
+ import React from 'react';
3
+ import placeholderHomeImage from '../../images/frontpage-brand-placeholder.jpg';
4
+ import style from './home.module.css';
5
+
6
+ export const Home: React.FC = () => {
7
+ return (
8
+ <main className={style.home}>
9
+ <div className={style.plantSelector}>
10
+ <div>
11
+ <EchoLogo />
12
+ </div>
13
+
14
+ <PlantSelector />
15
+ </div>
16
+ <AppLinks />
17
+ <div className={style.brandSliderContainer}>
18
+ <img src={placeholderHomeImage} alt="Application Echo on tablet" />
19
+ </div>
20
+ <Footer />
21
+ </main>
22
+ );
23
+ };
@@ -0,0 +1,38 @@
1
+ .home {
2
+ display: grid;
3
+ grid-template-rows: 30% 100px auto 56px;
4
+ gap: 1rem;
5
+ height: 100%;
6
+ width: 100%;
7
+ }
8
+
9
+ .plantSelector {
10
+ display: flex;
11
+ justify-content: center;
12
+ align-items: baseline;
13
+ align-self: center;
14
+ flex-flow: wrap;
15
+ }
16
+
17
+ .heading {
18
+ padding-left: 18px;
19
+ }
20
+
21
+ .brandSliderContainer {
22
+ display: flex;
23
+ flex: 1 1;
24
+ flex-flow: column-reverse;
25
+ margin: 0;
26
+ width: 100%;
27
+ overflow: hidden;
28
+ object-fit: cover;
29
+ }
30
+
31
+ .appBar {
32
+ margin: 0 auto 48px;
33
+ display: flex;
34
+ flex-wrap: wrap;
35
+ justify-content: center;
36
+ align-items: flex-start;
37
+ }
38
+
@@ -0,0 +1,3 @@
1
+ export const Legend: React.FC = () => {
2
+ return null;
3
+ };
@@ -0,0 +1,90 @@
1
+ import { LoadingModuleOptions } from '@equinor/echo-base';
2
+ import '@equinor/echo-components/style-reset.css';
3
+ import EchoCore, { createEchoAppModuleApi, EventHubProvider, queryClient } from '@equinor/echo-core';
4
+ import { mainMenu, Mediator, searchPanel } from '@equinor/echo-framework';
5
+ import { Icon } from '@equinor/eds-core-react';
6
+ import * as Icons from '@equinor/eds-icons';
7
+ import React from 'react';
8
+ import { initForE2ETests } from './utils/setupSkipAuth';
9
+
10
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
11
+ import { createRoot } from 'react-dom/client';
12
+ import { BrowserRouter } from 'react-router-dom';
13
+ import { EchoApp } from './app';
14
+
15
+ const useEdsIcon = (): void => {
16
+ Icon.add({
17
+ ...Icons
18
+ });
19
+ };
20
+
21
+ const Echo: React.FC = (): JSX.Element => {
22
+ /* Needed to skip authentication when running e2e tests*/
23
+ initForE2ETests();
24
+
25
+ const isAuthenticated = EchoCore.useEchoSetup({
26
+ leftPanels: [searchPanel],
27
+ rightPanel: mainMenu
28
+ });
29
+ useEdsIcon();
30
+ const moduleOptions: LoadingModuleOptions = {
31
+ createApi: createEchoAppModuleApi(),
32
+ dependencies: {
33
+ react: require('react'),
34
+ 'react-dom': require('react-dom'),
35
+ 'react-router-dom': require('react-router-dom'),
36
+ '@equinor/echo-core': require('@equinor/echo-core'),
37
+ '@equinor/echo-framework': require('@equinor/echo-framework'),
38
+ '@equinor/echo-utils': require('@equinor/echo-utils'),
39
+ '@equinor/echo-components': require('@equinor/echo-components'),
40
+ '@equinor/echo-base': require('@equinor/echo-base'),
41
+ '@equinor/echo-search': require('@equinor/echo-search'),
42
+ '@equinor/eds-core-react': require('@equinor/eds-core-react'),
43
+ '@equinor/eds-icons': require('@equinor/eds-icons'),
44
+ 'styled-components': require('styled-components'),
45
+ classnames: require('classnames'),
46
+ lodash: require('lodash'),
47
+ zustand: require('zustand')
48
+ },
49
+ fetchModules: () => {
50
+ return new Promise((resolve) => {
51
+ fetch('/echoModuleManifest.json').then((response) => {
52
+ response.json().then((manifests) => {
53
+ manifests.forEach((manifest) => {
54
+ manifest.fileUri = `/index.js`;
55
+ });
56
+ resolve(manifests);
57
+ });
58
+ });
59
+ });
60
+ }
61
+ };
62
+ return (
63
+ <>
64
+ {isAuthenticated && (
65
+ <EchoCore.AuthProviderComponent>
66
+ {/*
67
+ Need to cast queryClient to QueryClient because of the following error:
68
+ TS2352: Conversion of type 'import("Equinor\\EchopediaWeb\\node_modules\\@tanstack\\query-core\\build\\modern\\hydration-CwYEwyQI").b' to type 'import("Equinor\\EchopediaWeb\\node_modules\\@tanstack\\query-core\\build\\modern\\hydration-BlEK5ylC").b' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
69
+ Property '#private' in type 'QueryClient' refers to a different member that cannot be accessed from within type 'QueryClient'.
70
+ Based on my research we used the same version of react-query in echopediaWeb and echo-client.
71
+ */}
72
+ <QueryClientProvider client={queryClient as unknown as QueryClient}>
73
+ <EventHubProvider>
74
+ <Mediator options={moduleOptions} />
75
+ <BrowserRouter>
76
+ <EchoApp />
77
+ </BrowserRouter>
78
+ </EventHubProvider>
79
+ </QueryClientProvider>
80
+ </EchoCore.AuthProviderComponent>
81
+ )}
82
+ </>
83
+ );
84
+ };
85
+
86
+ if (!(window !== window.parent && !window.opener)) {
87
+ const container = document.getElementById('root') as HTMLElement;
88
+ const root = createRoot(container);
89
+ root.render(<Echo />);
90
+ }
@@ -0,0 +1,25 @@
1
+ export {};
2
+ // Should remove this error: BrowserAuthError: crypto_nonexistent: The crypto object or function is not available. Detail:Browser crypto or msCrypto object not available.
3
+ const mGetRandomValues = jest.fn().mockReturnValueOnce(new Uint32Array(10));
4
+ Object.defineProperty(window, 'crypto', {
5
+ value: { getRandomValues: mGetRandomValues }
6
+ });
7
+
8
+ jest.mock('@equinor/echo-core', () => {
9
+ return {
10
+ __esModule: true,
11
+ ...jest.requireActual('@equinor/echo-core'),
12
+ storage: {
13
+ getItem: jest.fn(),
14
+ setItem: jest.fn()
15
+ },
16
+ EchoEnv: {
17
+ env: jest.fn().mockImplementation(() => {
18
+ return {
19
+ REACT_APP_AZURE_AD_CLIENT_ID: '',
20
+ REACT_APP_API_URL: 'non-mono-base-api-url'
21
+ };
22
+ })
23
+ }
24
+ };
25
+ });
@@ -0,0 +1,33 @@
1
+ import { Plant } from '@equinor/echo-core';
2
+ import { checkIsPlantsListUpdated } from './plants';
3
+
4
+ describe('checkIsPlantsListUpdated', () => {
5
+ const originalPlant: Plant = {
6
+ instCode: 'JSV',
7
+ hasTr2000: true,
8
+ description: 'A description',
9
+ sapPlantId: '',
10
+ proCoSysPlantId: ''
11
+ };
12
+ const updatedPlant: Plant = { ...originalPlant, description: 'A changed description' };
13
+ it('should return false if lists are identical', () => {
14
+ // given
15
+ const apiPlants = [originalPlant];
16
+ const localStoragePlants = [originalPlant];
17
+
18
+ // when
19
+ const result = checkIsPlantsListUpdated(apiPlants, localStoragePlants);
20
+
21
+ expect(result).toBe(false);
22
+ });
23
+ it('should return true if lists are not identical', () => {
24
+ // given
25
+ const apiPlants = [updatedPlant];
26
+ const localStoragePlants = [originalPlant];
27
+
28
+ // when
29
+ const result = checkIsPlantsListUpdated(apiPlants, localStoragePlants);
30
+
31
+ expect(result).toBe(true);
32
+ });
33
+ });
@@ -0,0 +1,12 @@
1
+ import { Plant } from '@equinor/echo-core';
2
+ import EchoUtils from '@equinor/echo-utils';
3
+
4
+ const { arraysIsEqual } = EchoUtils.Utils;
5
+
6
+ export const checkIsPlantsListUpdated = (apiPlants: Plant[], localStoragePlants: Plant[]): boolean => {
7
+ if (!localStoragePlants || localStoragePlants.length === 0 || !arraysIsEqual([...localStoragePlants], apiPlants)) {
8
+ return true;
9
+ } else {
10
+ return false;
11
+ }
12
+ };
@@ -0,0 +1,43 @@
1
+ import EchoCore, { AuthenticationResult } from '@equinor/echo-core';
2
+ import { getDeepLinkParams } from '@equinor/echo-utils';
3
+
4
+ export function initForE2ETests() {
5
+ const { skipAuth } = getDeepLinkParams(['skipAuth']);
6
+ if (skipAuth?.toLowerCase() === 'true') {
7
+ setupSkipAuth();
8
+ }
9
+ }
10
+
11
+ const setAuthentication = () => {
12
+ EchoCore.EchoAuthProvider.isAuthenticated = true;
13
+ EchoCore.EchoAuthProvider.userProperties = {
14
+ account: {
15
+ homeAccountId: 'homeAccountId',
16
+ environment: 'testingEnvironment',
17
+ tenantId: 'tenantId',
18
+ username: 'tester',
19
+ localAccountId: 'tester123'
20
+ }
21
+ };
22
+ };
23
+
24
+ export function setupSkipAuth() {
25
+ EchoCore.EchoAuthProvider.isAuthenticated = true;
26
+ EchoCore.EchoAuthProvider.handleLogin = async (logRequest?: (...args: unknown[]) => void): Promise<void> => {
27
+ setAuthentication();
28
+ return Promise.resolve(undefined);
29
+ };
30
+ EchoCore.EchoAuthProvider.ssoSilentOrRedirectToAuthenticate = async () => {
31
+ setAuthentication();
32
+ return Promise.resolve(undefined);
33
+ };
34
+ EchoCore.EchoAuthProvider.aquireTokenSilentOrRedirectToAuthenticate =
35
+ async (): Promise<AuthenticationResult | null> => {
36
+ setAuthentication();
37
+ return null;
38
+ };
39
+ EchoCore.EchoAuthProvider.login = async () => {
40
+ setAuthentication();
41
+ return Promise.resolve();
42
+ };
43
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "jsx": "react-jsx",
5
+ "lib": ["dom", "dom.iterable", "esnext"],
6
+ "allowSyntheticDefaultImports": true,
7
+ "esModuleInterop": true,
8
+ "module": "commonjs",
9
+ "outDir": "./build/",
10
+ "preserveConstEnums": true,
11
+ "removeComments": true,
12
+ "sourceMap": true,
13
+ "noImplicitAny": false,
14
+ "allowJs": true,
15
+ "skipLibCheck": true,
16
+ "target": "es5",
17
+ "resolveJsonModule": true,
18
+ "types": ["@equinor/echo-scripts", "@types/node", "@types/webpack-env", "@types/jest"]
19
+ },
20
+ "include": ["src"]
21
+ }
@@ -0,0 +1,138 @@
1
+ import CopyPlugin from 'copy-webpack-plugin';
2
+ import Dotenv from 'dotenv-webpack';
3
+ import HtmlWebpackPlugin from 'html-webpack-plugin';
4
+ import path from 'path';
5
+ import WebpackBar from 'webpackbar';
6
+
7
+ const webpackConfig = (env) => {
8
+ console.log('Building the dev host application for EchoCli.');
9
+ return {
10
+ entry: ['@babel/polyfill', './src/index.tsx'],
11
+ mode: 'production',
12
+ devtool: 'source-map',
13
+ output: {
14
+ clean: true,
15
+ path: path.resolve(process.cwd(), 'echo-dev-host'),
16
+ filename: '[name].echo.bundle.js',
17
+ chunkFilename: 'assets/[name].[contenthash].chunk.js',
18
+ publicPath: '/'
19
+ },
20
+ resolve: {
21
+ extensions: ['.ts', '.tsx', '.js', '.jsx'],
22
+ fallback: {
23
+ crypto: false,
24
+ stream: false,
25
+ buffer: false
26
+ }
27
+ },
28
+ module: {
29
+ rules: [
30
+ {
31
+ test: /\.(ts|tsx)$/,
32
+ loader: 'ts-loader',
33
+ exclude: /node_modules/
34
+ },
35
+ {
36
+ test: /\.(js|jsx)$/,
37
+ exclude: /node_modules/,
38
+ loader: 'babel-loader'
39
+ },
40
+ {
41
+ test: /\.css$/,
42
+ use: [
43
+ 'style-loader',
44
+ {
45
+ loader: 'css-loader',
46
+ options: {
47
+ importLoaders: 1,
48
+ modules: {
49
+ mode: 'local',
50
+ localIdentName: 'echo-[folder]__[local]-[hash:base64:5]',
51
+ namedExport: false,
52
+ exportLocalsConvention: 'as-is'
53
+ }
54
+ }
55
+ }
56
+ ],
57
+ include: /\.module\.css$/
58
+ },
59
+ {
60
+ test: /\.css$/,
61
+ use: ['style-loader', 'css-loader'],
62
+ exclude: /\.module\.css$/
63
+ },
64
+ {
65
+ test: /\.svg$/,
66
+ use: ['@svgr/webpack']
67
+ },
68
+ {
69
+ test: /\.(png|jpe?g|gif)$/i,
70
+ use: [
71
+ {
72
+ loader: 'file-loader'
73
+ }
74
+ ]
75
+ }
76
+ ]
77
+ },
78
+ devServer: {
79
+ static: [
80
+ {
81
+ directory: path.join(import.meta.dirname, 'public')
82
+ },
83
+ {
84
+ directory: path.join(import.meta.dirname, 'build')
85
+ }
86
+ ],
87
+ compress: true,
88
+ port: 3000,
89
+ hot: true,
90
+ historyApiFallback: true,
91
+ server: 'https',
92
+ headers: {
93
+ 'Access-Control-Allow-Origin': '*',
94
+ 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
95
+ 'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'
96
+ }
97
+ // overlay: {
98
+ // warnings: true,
99
+ // errors: true,
100
+ // },
101
+ },
102
+ plugins: [
103
+ new Dotenv({
104
+ ignoreStub: false,
105
+ expand: true,
106
+ systemvars: false
107
+ }),
108
+ new HtmlWebpackPlugin({
109
+ template: path.resolve(import.meta.dirname, './public/index.html')
110
+ }),
111
+ new WebpackBar({
112
+ name: 'Echo module',
113
+ color: '#007079',
114
+ profile: true
115
+ }),
116
+ new CopyPlugin({
117
+ patterns: [
118
+ {
119
+ from: path.resolve(import.meta.dirname, './public/index.css'),
120
+ to: path.resolve(process.cwd(), 'echo-dev-host', 'index.css')
121
+ },
122
+ {
123
+ from: path.resolve(import.meta.dirname, './public/env-config.js'),
124
+ to: path.resolve(process.cwd(), 'echo-dev-host', 'env-config.js')
125
+ }
126
+ ]
127
+ })
128
+ ],
129
+ optimization: {
130
+ splitChunks: {
131
+ chunks: 'all'
132
+ },
133
+ minimize: true
134
+ }
135
+ };
136
+ };
137
+
138
+ export default webpackConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-cli",
3
- "version": "1.0.0-beta-2",
3
+ "version": "1.0.0-beta-4",
4
4
  "description": "Command line interface for Echo Apps",
5
5
  "main": "dist/index.js",
6
6
  "source": "src/test.js",
@@ -19,7 +19,7 @@
19
19
  "echo-update-next": "echo-update -c",
20
20
  "echo-update-all": "echo-update -a",
21
21
  "test": "jest",
22
- "build": "tsc && node copy-client.cjs",
22
+ "build": "tsc && node copy-dev-host.cjs",
23
23
  "lint": "eslint --color",
24
24
  "cli-publish": "npm run build-cli",
25
25
  "postcli-publish": "npm run echo-publish"
@@ -32,12 +32,12 @@
32
32
  "echo-create": "./lib/echo-create.js",
33
33
  "echo-build": "./lib/echo-build.js",
34
34
  "echo-manifest": "./lib/echo-manifest.js",
35
- "build-echo-client": "./lib/echo-build-client.js"
35
+ "build-echo-dev-host": "./lib/echo-build-dev-host.js"
36
36
  },
37
37
  "files": [
38
38
  "lib",
39
39
  "templates",
40
- "client"
40
+ "echo-dev-host"
41
41
  ],
42
42
  "dependencies": {
43
43
  "@babel/core": "7.27.1",
@@ -1 +0,0 @@
1
- window._env_={HTTPS:"true",GENERATE_SOURCEMAP:"true",INLINE_RUNTIME_CHUNK:"false",WEBSITE_HOSTNAME:"localhost:3000;",REACT_APP_DEFAULT_CACHE_LOCATION:"localstorage",REACT_APP_API_URL:"https://dt-echopedia-api-dev.azurewebsites.net",REACT_APP_WEB_URL:"https://dt-echopedia-web-dev.azurewebsites.net",REACT_APP_WEB_PROD_URL:"https://echo.equinor.com",REACT_APP_AZURE_AD_TENNANT:"StatoilSRM.onmicrosoft.com",REACT_APP_AZURE_AD_TENNANT_ID:"3aa4a235-b6e2-48d5-9195-7fcf05b459b0",REACT_APP_AZURE_AD_CLIENT_ID:"751d2504-0b66-4b78-9807-4b60525a14c6",REACT_APP_API_CLIENT_ID:"aef35d97-53d4-4fd0-adaf-c5a514b38436",REACT_APP_APPINSIGHTS_CONNECTION_STRING:"InstrumentationKey=e5299075-a00d-4012-96f9-42861e8d8a9e;IngestionEndpoint=https://northeurope-3.in.applicationinsights.azure.com/;LiveEndpoint=https://northeurope.livediagnostics.monitor.azure.com/;ApplicationId=a9b64222-d4a9-42e6-a615-7428fe1a26af",REACT_APP_AZURE_BUILD_NUMBER:"0.8.dev.9",REACT_APP_LOGGER_ACTIVE:"false"};