@equinor/echo-cli 1.0.0-beta-9 → 1.0.0-beta-11
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/echo-dev-host/package.json +1 -1
- package/echo-dev-host/public/index.css +60 -60
- package/echo-dev-host/src/api/api-plants.ts +22 -22
- package/echo-dev-host/src/app.css +12 -12
- package/echo-dev-host/src/app.tsx +43 -43
- package/echo-dev-host/src/components/Home/Home.tsx +23 -23
- package/echo-dev-host/src/components/Home/home.module.css +38 -38
- package/echo-dev-host/src/components/legend.tsx +3 -3
- package/echo-dev-host/src/index.tsx +90 -90
- package/echo-dev-host/src/setupTests.ts +25 -25
- package/echo-dev-host/src/utils/plants.test.ts +33 -33
- package/echo-dev-host/src/utils/plants.ts +12 -12
- package/echo-dev-host/src/utils/setupSkipAuth.ts +43 -43
- package/lib/echo-build-dev-host.d.ts +1 -1
- package/lib/echo-build-dev-host.js +1 -1
- package/lib/echo-build-dev-host.js.map +1 -1
- package/lib/echo-build.d.ts +5 -5
- package/lib/echo-build.js +10 -6
- package/lib/echo-build.js.map +1 -1
- package/lib/echo-create.d.ts +9 -9
- package/lib/echo-create.js +10 -10
- package/lib/echo-create.js.map +1 -1
- package/lib/echo-dev-host/package.json +1 -1
- package/lib/echo-dev-host/public/index.css +60 -60
- package/lib/echo-dev-host/src/api/api-plants.ts +22 -22
- package/lib/echo-dev-host/src/app.css +12 -12
- package/lib/echo-dev-host/src/app.tsx +43 -43
- package/lib/echo-dev-host/src/components/Home/Home.tsx +23 -23
- package/lib/echo-dev-host/src/components/Home/home.module.css +38 -38
- package/lib/echo-dev-host/src/components/legend.tsx +3 -3
- package/lib/echo-dev-host/src/index.tsx +90 -90
- package/lib/echo-dev-host/src/setupTests.ts +25 -25
- package/lib/echo-dev-host/src/utils/plants.test.ts +33 -33
- package/lib/echo-dev-host/src/utils/plants.ts +12 -12
- package/lib/echo-dev-host/src/utils/setupSkipAuth.ts +43 -43
- package/lib/echo-manifest.d.ts +1 -1
- package/lib/echo-manifest.js +1 -1
- package/lib/echo-manifest.js.map +1 -1
- package/lib/echo-update-dev-host-deps.d.ts +2 -2
- package/lib/echo-update-dev-host-deps.js +3 -3
- package/lib/echo-update-dev-host-deps.js.map +1 -1
- package/lib/tools/buildScripts/buildAndCopyDevHost.js +1 -1
- package/lib/tools/buildScripts/buildAndCopyDevHost.js.map +1 -1
- package/lib/utils/printDevHostVersions.js +5 -6
- package/lib/utils/printDevHostVersions.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,33 +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
|
-
});
|
|
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
|
+
});
|
|
@@ -1,12 +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
|
-
};
|
|
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
|
+
};
|
|
@@ -1,43 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command } from '@oclif/
|
|
2
|
+
import { Command } from '@oclif/core';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { buildAndCopyDevHost } from './tools/buildScripts/buildAndCopyDevHost.js';
|
|
5
5
|
export default class BuildDevHost extends Command {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo-build-dev-host.js","sourceRoot":"","sources":["../src/echo-build-dev-host.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"echo-build-dev-host.js","sourceRoot":"","sources":["../src/echo-build-dev-host.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAElF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAC7C,MAAM,CAAC,WAAW,GAAG,4DAA4D,CAAC;IAElF,KAAK,CAAC,GAAG;QACL,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAC3F,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;QAE/D,MAAM,mBAAmB,CAAC;YACtB,YAAY,EAAE,OAAO,CAAC,GAAG,EAAE;YAC3B,cAAc,EAAE,WAAW;SAC9B,CAAC,CAAC;IACP,CAAC;;AAGL,YAAY,CAAC,GAAG,EAAE,CAAC"}
|
package/lib/echo-build.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command } from '@oclif/
|
|
2
|
+
import { Command } from '@oclif/core';
|
|
3
3
|
export default class CreateBundle extends Command {
|
|
4
4
|
static description: string;
|
|
5
5
|
static flags: {
|
|
6
|
-
serve: import("@oclif/
|
|
7
|
-
isDevelopment: import("@oclif/
|
|
8
|
-
copy: import("@oclif/
|
|
9
|
-
analyze: import("@oclif/
|
|
6
|
+
serve: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
7
|
+
isDevelopment: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
8
|
+
copy: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
9
|
+
analyze: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
10
10
|
};
|
|
11
11
|
run(): Promise<void>;
|
|
12
12
|
}
|
package/lib/echo-build.js
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command,
|
|
2
|
+
import { Command, Flags } from '@oclif/core';
|
|
3
|
+
import chalk from 'chalk';
|
|
3
4
|
import { echoWebpackBuild } from './tools/buildScripts/webpackBuilds.js';
|
|
4
5
|
import { echoCliLogo } from './utils/logo.js';
|
|
5
6
|
import { printDevHostVersions } from './utils/printDevHostVersions.js';
|
|
6
7
|
export default class CreateBundle extends Command {
|
|
7
8
|
static description = 'Creates Echo Bundle';
|
|
8
9
|
static flags = {
|
|
9
|
-
serve:
|
|
10
|
+
serve: Flags.boolean({
|
|
10
11
|
char: 's',
|
|
11
12
|
description: 'Add the serve Echo Client with app'
|
|
12
13
|
}),
|
|
13
|
-
isDevelopment:
|
|
14
|
+
isDevelopment: Flags.boolean({
|
|
14
15
|
char: 'd',
|
|
15
16
|
description: 'Production is default, add -d flag for development'
|
|
16
17
|
}),
|
|
17
|
-
copy:
|
|
18
|
+
copy: Flags.boolean({
|
|
18
19
|
char: 'c',
|
|
19
20
|
description: 'Will copy the client to the build folder'
|
|
20
21
|
}),
|
|
21
|
-
analyze:
|
|
22
|
+
analyze: Flags.boolean({
|
|
22
23
|
char: 'b',
|
|
23
24
|
description: 'Provides an interactive treemap to inspect the bundle'
|
|
24
25
|
})
|
|
25
26
|
};
|
|
26
27
|
async run() {
|
|
27
|
-
const options = this.parse(CreateBundle);
|
|
28
|
+
const options = await this.parse(CreateBundle);
|
|
28
29
|
echoCliLogo();
|
|
30
|
+
console.log(chalk.cyan('echo-cli runs your echo application with echo-dev-host, which is using the following echo lib versions:'));
|
|
31
|
+
// TODO: actually this should get the version numbers from node_modules/@equinor/echo-cli/echo-dev-host/package.json
|
|
32
|
+
// probably this function needs to recieve a path to the package.json file
|
|
29
33
|
printDevHostVersions();
|
|
30
34
|
await echoWebpackBuild(options.flags, options.flags.isDevelopment);
|
|
31
35
|
}
|
package/lib/echo-build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo-build.js","sourceRoot":"","sources":["../src/echo-build.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"echo-build.js","sourceRoot":"","sources":["../src/echo-build.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IACtC,MAAM,CAAC,WAAW,GAAG,qBAAqB,CAAC;IAE3C,MAAM,CAAC,KAAK,GAAG;QAClB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;YACjB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,oCAAoC;SACpD,CAAC;QACF,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC;YACzB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,oDAAoD;SACpE,CAAC;QACF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC;YAChB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,0CAA0C;SAC1D,CAAC;QACF,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;YACnB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,uDAAuD;SACvE,CAAC;KACL,CAAC;IAEK,KAAK,CAAC,GAAG;QACZ,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAE/C,WAAW,EAAE,CAAC;QAEd,OAAO,CAAC,GAAG,CACP,KAAK,CAAC,IAAI,CACN,yGAAyG,CAC5G,CACJ,CAAC;QACF,oHAAoH;QACpH,0EAA0E;QAC1E,oBAAoB,EAAE,CAAC;QAEvB,MAAM,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACvE,CAAC;;AAGL,YAAY,CAAC,GAAG,EAAE,CAAC"}
|
package/lib/echo-create.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command
|
|
2
|
+
import { Command } from '@oclif/core';
|
|
3
3
|
export default class CreateApp extends Command {
|
|
4
4
|
static description: string;
|
|
5
5
|
static flags: {
|
|
6
|
-
description:
|
|
7
|
-
git: import("@oclif/
|
|
8
|
-
help: import("@oclif/
|
|
9
|
-
install: import("@oclif/
|
|
10
|
-
key:
|
|
11
|
-
name:
|
|
12
|
-
shortName:
|
|
13
|
-
templateName:
|
|
6
|
+
description: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
|
+
git: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
8
|
+
help: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<void>;
|
|
9
|
+
install: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
10
|
+
key: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
+
name: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
12
|
+
shortName: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
13
|
+
templateName: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
14
14
|
};
|
|
15
15
|
run(): Promise<void>;
|
|
16
16
|
}
|
package/lib/echo-create.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command,
|
|
2
|
+
import { Command, Flags } from '@oclif/core';
|
|
3
3
|
import { createProject } from './tools/create/createProject.js';
|
|
4
4
|
import { promptForMissingOptions } from './tools/create/promptOptions.js';
|
|
5
5
|
import { echoCliLogo } from './utils/logo.js';
|
|
6
6
|
export default class CreateApp extends Command {
|
|
7
7
|
static description = 'Creates a new Echo app';
|
|
8
8
|
static flags = {
|
|
9
|
-
description:
|
|
10
|
-
git:
|
|
11
|
-
help:
|
|
12
|
-
install:
|
|
9
|
+
description: Flags.string({ char: 'd', description: 'App description' }),
|
|
10
|
+
git: Flags.boolean({ char: 'g', description: 'Initialize git repository' }),
|
|
11
|
+
help: Flags.help({ char: 'h' }),
|
|
12
|
+
install: Flags.boolean({
|
|
13
13
|
char: 'i',
|
|
14
14
|
description: 'Install dev dependencies'
|
|
15
15
|
}),
|
|
16
|
-
key:
|
|
17
|
-
name:
|
|
16
|
+
key: Flags.string({ char: 'k', description: 'Key for app/tile' }),
|
|
17
|
+
name: Flags.string({
|
|
18
18
|
char: 'n',
|
|
19
19
|
description: 'Name for app/tile(use quotes for spaces)'
|
|
20
20
|
}),
|
|
21
|
-
shortName:
|
|
22
|
-
templateName:
|
|
21
|
+
shortName: Flags.string({ char: 'N', description: 'App short name' }),
|
|
22
|
+
templateName: Flags.string({
|
|
23
23
|
char: 't',
|
|
24
24
|
description: 'App template to use'
|
|
25
25
|
})
|
|
26
26
|
};
|
|
27
27
|
async run() {
|
|
28
|
-
const parsed = this.parse(CreateApp);
|
|
28
|
+
const parsed = await this.parse(CreateApp);
|
|
29
29
|
echoCliLogo();
|
|
30
30
|
const options = await promptForMissingOptions(parsed.flags);
|
|
31
31
|
await createProject(options);
|
package/lib/echo-create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo-create.js","sourceRoot":"","sources":["../src/echo-create.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"echo-create.js","sourceRoot":"","sources":["../src/echo-create.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,OAAO;IACnC,MAAM,CAAC,WAAW,GAAG,wBAAwB,CAAC;IAE9C,MAAM,CAAC,KAAK,GAAG;QAClB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;QACxE,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;QAC3E,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAC/B,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;YACnB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,0BAA0B;SAC1C,CAAC;QACF,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;QACjE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACf,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,0CAA0C;SAC1D,CAAC;QACF,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;QACrE,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC;YACvB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,qBAAqB;SACrC,CAAC;KACL,CAAC;IAEK,KAAK,CAAC,GAAG;QACZ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC3C,WAAW,EAAE,CAAC;QACd,MAAM,OAAO,GAAG,MAAM,uBAAuB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5D,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;;AAGL,SAAS,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
body {
|
|
2
|
-
overflow: hidden;
|
|
3
|
-
margin: 0;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.highlightedText {
|
|
7
|
-
background: yellow;
|
|
8
|
-
color: black;
|
|
9
|
-
padding: 0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
#rootloading {
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
color: #ff1243;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
align-items: center;
|
|
18
|
-
text-align: center;
|
|
19
|
-
position: absolute;
|
|
20
|
-
width: 100%;
|
|
21
|
-
height: 100%;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.loaderContainer {
|
|
25
|
-
margin: 8px auto;
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-direction: column;
|
|
28
|
-
padding-top: 0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.productLogo {
|
|
32
|
-
flex: 1;
|
|
33
|
-
margin-bottom: 4rem;
|
|
34
|
-
text-align: left;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.productLogoImg {
|
|
38
|
-
display: inline-block;
|
|
39
|
-
vertical-align: baseline;
|
|
40
|
-
width: 122px;
|
|
41
|
-
animation: fadeIn 0.5s;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.equinorLogo {
|
|
45
|
-
margin: 0 auto;
|
|
46
|
-
display: inline-block;
|
|
47
|
-
vertical-align: baseline;
|
|
48
|
-
width: 64px;
|
|
49
|
-
height: 64px;
|
|
50
|
-
animation: fadeIn 0.5s;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@keyframes fadeIn {
|
|
54
|
-
0% {
|
|
55
|
-
opacity: 0;
|
|
56
|
-
}
|
|
57
|
-
100% {
|
|
58
|
-
opacity: 1;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
1
|
+
body {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
margin: 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.highlightedText {
|
|
7
|
+
background: yellow;
|
|
8
|
+
color: black;
|
|
9
|
+
padding: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
#rootloading {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
color: #ff1243;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
text-align: center;
|
|
19
|
+
position: absolute;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.loaderContainer {
|
|
25
|
+
margin: 8px auto;
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
padding-top: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.productLogo {
|
|
32
|
+
flex: 1;
|
|
33
|
+
margin-bottom: 4rem;
|
|
34
|
+
text-align: left;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.productLogoImg {
|
|
38
|
+
display: inline-block;
|
|
39
|
+
vertical-align: baseline;
|
|
40
|
+
width: 122px;
|
|
41
|
+
animation: fadeIn 0.5s;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.equinorLogo {
|
|
45
|
+
margin: 0 auto;
|
|
46
|
+
display: inline-block;
|
|
47
|
+
vertical-align: baseline;
|
|
48
|
+
width: 64px;
|
|
49
|
+
height: 64px;
|
|
50
|
+
animation: fadeIn 0.5s;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes fadeIn {
|
|
54
|
+
0% {
|
|
55
|
+
opacity: 0;
|
|
56
|
+
}
|
|
57
|
+
100% {
|
|
58
|
+
opacity: 1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,22 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,12 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,43 +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
|
-
}
|
|
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
|
+
}
|