@corva/create-app 0.0.0-73c49372-test → 0.0.0-9a3cf8e
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/README.md +7 -0
- package/bin/create-corva-app.cjs +4 -9
- package/lib/commands/build-release.js +60 -0
- package/lib/commands/release.js +6 -0
- package/lib/constants/cli.js +13 -3
- package/lib/constants/manifest.js +1 -0
- package/lib/constants/package.js +18 -6
- package/lib/flows/build-release.js +31 -0
- package/lib/flows/lib/api.js +6 -12
- package/lib/flows/lib/manifest.js +1 -1
- package/lib/flows/release.js +2 -1
- package/lib/flows/steps/build.js +25 -0
- package/lib/flows/steps/release/get-config.js +2 -2
- package/lib/flows/steps/release/prepare-data.js +14 -5
- package/lib/flows/steps/release/upload-zip-to-corva.js +80 -2
- package/lib/flows/steps/resolve-built-files-for-zip.js +35 -0
- package/lib/flows/steps/zip-file-list-resolve.js +45 -25
- package/lib/helpers/cli-version.js +39 -3
- package/lib/helpers/manifest.js +9 -1
- package/lib/helpers/resolve-app-runtime.js +3 -3
- package/lib/main.js +2 -0
- package/package.json +1 -104
- package/template_extensions/corva/.eslintrc +32 -0
- package/template_extensions/corva/.github/workflows/develop.yml +2 -0
- package/templates/scheduler_data-time/javascript/__tests__/processor.spec.js +1 -1
- package/templates/scheduler_data-time/typescript/__tests__/processor.spec.ts +1 -1
- package/templates/scheduler_depth/javascript/__tests__/processor.spec.js +1 -1
- package/templates/scheduler_depth/typescript/__tests__/processor.spec.ts +1 -1
- package/templates/scheduler_natural-time/javascript/__tests__/processor.spec.js +1 -1
- package/templates/scheduler_natural-time/typescript/__tests__/processor.spec.ts +1 -1
- package/templates/stream_depth/javascript/__tests__/processor.spec.js +1 -1
- package/templates/stream_depth/typescript/__tests__/processor.spec.ts +1 -1
- package/templates/stream_time/javascript/__tests__/processor.spec.js +1 -1
- package/templates/stream_time/typescript/__tests__/processor.spec.ts +1 -1
- package/templates/task/javascript/__tests__/processor.spec.js +1 -1
- package/templates/task/typescript/__tests__/processor.spec.ts +1 -1
- package/templates/ui/javascript/config/jest/setupTests.js +19 -0
- package/templates/ui/javascript/src/App.completion.js +30 -31
- package/templates/ui/javascript/src/App.css +0 -13
- package/templates/ui/javascript/src/App.drilling.js +31 -36
- package/templates/ui/javascript/src/__tests__/App.test.js +27 -2
- package/templates/ui/typescript/config/jest/setupTests.js +19 -0
- package/templates/ui/typescript/src/App.completion.tsx +32 -42
- package/templates/ui/typescript/src/App.css +0 -13
- package/templates/ui/typescript/src/App.drilling.tsx +32 -41
- package/templates/ui/typescript/src/AppSettings.tsx +2 -12
- package/templates/ui/typescript/src/__mocks__/mockData.ts +194 -0
- package/templates/ui/typescript/src/__tests__/App.test.tsx +80 -6
- package/templates/ui/typescript/src/__tests__/AppSettings.test.tsx +14 -3
- package/templates/ui/typescript/src/types.ts +618 -0
- package/templates/ui/typescript/tsconfig.json +0 -1
- package/templates/ui/typescript/src/__mocks__/mockAppProps.ts +0 -590
- package/templates/ui/typescript/src/__mocks__/mockAppSettingsProps.ts +0 -290
|
@@ -4,9 +4,10 @@ import semver from 'semver';
|
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
5
|
import { join } from 'path';
|
|
6
6
|
import * as url from 'url';
|
|
7
|
+
import fs from 'fs-extra';
|
|
7
8
|
|
|
8
9
|
import { logger } from './logger.js';
|
|
9
|
-
import
|
|
10
|
+
import { StepError } from '../flows/lib/step-error.js';
|
|
10
11
|
|
|
11
12
|
const npm = new NpmApi();
|
|
12
13
|
|
|
@@ -17,13 +18,41 @@ const asterisks = '*************************************************************
|
|
|
17
18
|
|
|
18
19
|
const getCurrentVersion = async () =>
|
|
19
20
|
(await fs.readJSON(join(url.fileURLToPath(new URL('.', import.meta.url)), '../../package.json'))).version;
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
const getLatestVersion = async () => {
|
|
23
|
+
try {
|
|
24
|
+
return await npm.repo('@corva/create-app').prop('version');
|
|
25
|
+
} catch (caughtError) {
|
|
26
|
+
if (caughtError.name === 'FetchError') {
|
|
27
|
+
throw new StepError(`The request to check the latest available version has failed due to the network error. Details:
|
|
28
|
+
|
|
29
|
+
${caughtError}
|
|
30
|
+
|
|
31
|
+
Please check your internet connection and that the above request is not blocked in your network
|
|
32
|
+
`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
throw caughtError;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Utility function to check if a version is a regular semver without prerelease identifiers
|
|
40
|
+
const isRegularVersion = (version) => {
|
|
41
|
+
return semver.prerelease(version) === null;
|
|
42
|
+
};
|
|
21
43
|
|
|
22
44
|
// NOTE: Stop process and show error if version is outdated
|
|
23
45
|
export async function ensureLatestVersion() {
|
|
24
46
|
const currentVersion = await getCurrentVersion();
|
|
25
47
|
const latestVersion = await getLatestVersion();
|
|
26
48
|
|
|
49
|
+
// Skip version check if current version is a prerelease (dev or next)
|
|
50
|
+
if (!isRegularVersion(currentVersion)) {
|
|
51
|
+
logger.write('Skipping version check for prerelease version.\n');
|
|
52
|
+
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
27
56
|
const isCurrentVersionOutdated = semver.gt(latestVersion, currentVersion);
|
|
28
57
|
|
|
29
58
|
if (isCurrentVersionOutdated) {
|
|
@@ -37,7 +66,7 @@ export async function ensureLatestVersion() {
|
|
|
37
66
|
|
|
38
67
|
`);
|
|
39
68
|
console.log(error(asterisks));
|
|
40
|
-
|
|
69
|
+
process.exit(0);
|
|
41
70
|
}
|
|
42
71
|
}
|
|
43
72
|
|
|
@@ -48,6 +77,13 @@ export async function warnIfOutdated() {
|
|
|
48
77
|
const currentVersion = await getCurrentVersion();
|
|
49
78
|
const latestVersion = await getLatestVersion();
|
|
50
79
|
|
|
80
|
+
// Skip version check if current version is a prerelease (dev or next)
|
|
81
|
+
if (!isRegularVersion(currentVersion)) {
|
|
82
|
+
logger.write(' ⚠️ Skipping version check for prerelease version.\n');
|
|
83
|
+
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
51
87
|
const isCurrentVersionOutdated = semver.gt(latestVersion, currentVersion);
|
|
52
88
|
|
|
53
89
|
if (isCurrentVersionOutdated) {
|
package/lib/helpers/manifest.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APP_RUNTIMES, APP_TYPES, TEMPLATE_TYPES } from '../constants/cli.js';
|
|
1
|
+
import { APP_EXTENSIONS, APP_RUNTIMES, APP_TYPES, TEMPLATE_TYPES } from '../constants/cli.js';
|
|
2
2
|
import * as manifestConstants from '../constants/manifest.js';
|
|
3
3
|
|
|
4
4
|
export function fillManifest(answers) {
|
|
@@ -10,6 +10,13 @@ export function fillManifest(answers) {
|
|
|
10
10
|
runtime,
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
+
const enable_isolation =
|
|
14
|
+
answers.appType === APP_TYPES.UI &&
|
|
15
|
+
answers.runtime === APP_RUNTIMES.UI &&
|
|
16
|
+
answers.extensions.includes(APP_EXTENSIONS.CORVA)
|
|
17
|
+
? false
|
|
18
|
+
: undefined;
|
|
19
|
+
|
|
13
20
|
const manifest = {
|
|
14
21
|
...manifestConstants.defaultManifest,
|
|
15
22
|
...defaultManifestProperties,
|
|
@@ -35,6 +42,7 @@ export function fillManifest(answers) {
|
|
|
35
42
|
...defaultManifestProperties.settings,
|
|
36
43
|
runtime,
|
|
37
44
|
app: defaultAppSettings(answers),
|
|
45
|
+
enable_isolation,
|
|
38
46
|
},
|
|
39
47
|
};
|
|
40
48
|
|
|
@@ -61,8 +61,8 @@ export const IS_WINDOWS = process.platform === 'win32';
|
|
|
61
61
|
|
|
62
62
|
const semverVersionsMapping = {
|
|
63
63
|
node: {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
18: '18.14.0',
|
|
65
|
+
20: '20.16.0',
|
|
66
66
|
},
|
|
67
67
|
python: {
|
|
68
68
|
'3.8': '3.8.16',
|
|
@@ -82,7 +82,7 @@ const semverVersionsMapping = {
|
|
|
82
82
|
*/
|
|
83
83
|
export const resolveAppRuntime = (opts) => {
|
|
84
84
|
if (opts.appType === APP_TYPES.UI) {
|
|
85
|
-
const version = '
|
|
85
|
+
const version = '20';
|
|
86
86
|
|
|
87
87
|
return {
|
|
88
88
|
language: opts.useTypescript ? 'typescript' : 'javascript',
|
package/lib/main.js
CHANGED
|
@@ -14,6 +14,7 @@ import { createCommand } from './commands/create.js';
|
|
|
14
14
|
import { ERROR_ICON } from './constants/messages.js';
|
|
15
15
|
import { StepError } from './flows/lib/step-error.js';
|
|
16
16
|
import debugFn from 'debug';
|
|
17
|
+
import { buildReleasePaasCommand } from './commands/build-release.js';
|
|
17
18
|
|
|
18
19
|
const debug = debugFn('cca:main');
|
|
19
20
|
|
|
@@ -47,6 +48,7 @@ export async function run() {
|
|
|
47
48
|
.addCommand(createCommand, { isDefault: true })
|
|
48
49
|
.addCommand(zipCommand)
|
|
49
50
|
.addCommand(releaseCommand)
|
|
51
|
+
.addCommand(buildReleasePaasCommand)
|
|
50
52
|
.addCommand(rerunCommand)
|
|
51
53
|
.addCommand(attachCommand)
|
|
52
54
|
.showHelpAfterError()
|
package/package.json
CHANGED
|
@@ -1,104 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@corva/create-app",
|
|
3
|
-
"version": "0.0.0-73c49372-test",
|
|
4
|
-
"private": false,
|
|
5
|
-
"description": "Create an app to use it in CORVA.AI",
|
|
6
|
-
"keywords": [
|
|
7
|
-
"react"
|
|
8
|
-
],
|
|
9
|
-
"bugs": {
|
|
10
|
-
"url": "https://github.com/facebook/create-react-app/issues"
|
|
11
|
-
},
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/corva-ai/create-corva-app",
|
|
15
|
-
"directory": "@corva/create-app"
|
|
16
|
-
},
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"type": "module",
|
|
19
|
-
"bin": {
|
|
20
|
-
"create-corva-app": "./bin/create-corva-app.cjs"
|
|
21
|
-
},
|
|
22
|
-
"files": [
|
|
23
|
-
"bin/**/*.cjs",
|
|
24
|
-
"bin/**/*.js",
|
|
25
|
-
"lib/**/*.js",
|
|
26
|
-
"templates",
|
|
27
|
-
"template_extensions",
|
|
28
|
-
"common"
|
|
29
|
-
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"helper-cli": "npx @corva/fe-dev-helper-cli@latest",
|
|
32
|
-
"build": "echo \"build is not configured for package \\\"×\\\", skipping.\"",
|
|
33
|
-
"get-changelog": "conventional-changelog -r 2 -p angular",
|
|
34
|
-
"lint": "eslint . --resolve-plugins-relative-to $(pwd) --max-warnings 0",
|
|
35
|
-
"lint:fix": "eslint . --fix",
|
|
36
|
-
"release": "git add -A && standard-version -a",
|
|
37
|
-
"release-rc": "npm run release -- --prerelease",
|
|
38
|
-
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest"
|
|
39
|
-
},
|
|
40
|
-
"lint-staged": {
|
|
41
|
-
"*.js": "npm run lint:fix"
|
|
42
|
-
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"archiver": "^5.3.0",
|
|
45
|
-
"chalk": "^4.1.0",
|
|
46
|
-
"commander": "^9.1.0",
|
|
47
|
-
"cross-spawn": "^7.0.3",
|
|
48
|
-
"debug": "^4.3.4",
|
|
49
|
-
"dotenv": "^16.0.0",
|
|
50
|
-
"figlet": "^1.5.0",
|
|
51
|
-
"form-data": "^4.0.0",
|
|
52
|
-
"fs-extra": "^9.0.1",
|
|
53
|
-
"glob": "^8.0.1",
|
|
54
|
-
"got": "^12.5.1",
|
|
55
|
-
"inquirer": "^8.2.3",
|
|
56
|
-
"is-glob": "^4.0.3",
|
|
57
|
-
"lodash": "^4.17.21",
|
|
58
|
-
"npm-api": "^1.0.0",
|
|
59
|
-
"semver": "^7.3.2",
|
|
60
|
-
"terminal-link": "^3.0.0"
|
|
61
|
-
},
|
|
62
|
-
"devDependencies": {
|
|
63
|
-
"@babel/core": "^7.11.0",
|
|
64
|
-
"@babel/eslint-parser": "^7.19.1",
|
|
65
|
-
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
66
|
-
"@babel/plugin-syntax-import-assertions": "^7.20.0",
|
|
67
|
-
"@babel/preset-react": "^7.18.6",
|
|
68
|
-
"@commitlint/cli": "^17.3.0",
|
|
69
|
-
"@commitlint/config-conventional": "^17.3.0",
|
|
70
|
-
"@corva/eslint-config-browser": "^0.1.7",
|
|
71
|
-
"@corva/eslint-config-node": "^5.1.1",
|
|
72
|
-
"@corva/node-sdk": "^8.0.1",
|
|
73
|
-
"@types/cross-spawn": "^6.0.2",
|
|
74
|
-
"@types/jest": "^29.5.4",
|
|
75
|
-
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
|
76
|
-
"@typescript-eslint/parser": "^5.42.1",
|
|
77
|
-
"conventional-changelog-cli": "^2.1.0",
|
|
78
|
-
"eslint": "^8.2.0",
|
|
79
|
-
"eslint-config-google": "^0.14.0",
|
|
80
|
-
"eslint-config-prettier": "^8.5.0",
|
|
81
|
-
"eslint-plugin-import": "^2.26.0",
|
|
82
|
-
"eslint-plugin-jest": "^27.1.5",
|
|
83
|
-
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
84
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
85
|
-
"eslint-plugin-react": "^7.32.0",
|
|
86
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
87
|
-
"eslint-plugin-require-sort": "^1.3.0",
|
|
88
|
-
"husky": "^8.0.2",
|
|
89
|
-
"jest": "^29.6.4",
|
|
90
|
-
"prettier": "^2.0.0",
|
|
91
|
-
"prettier-plugin-packagejson": "^2.3.0",
|
|
92
|
-
"standard-version": "^9.0.0",
|
|
93
|
-
"typescript": "^4.8.4",
|
|
94
|
-
"zx": "^7.2.3"
|
|
95
|
-
},
|
|
96
|
-
"engines": {
|
|
97
|
-
"node": ">=18"
|
|
98
|
-
},
|
|
99
|
-
"standard-version": {
|
|
100
|
-
"skip": {
|
|
101
|
-
"tag": true
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
1
|
+
{"name":"@corva/create-app","version":"0.0.0-9a3cf8e","private":false,"description":"Create an app to use it in CORVA.AI","keywords":["react"],"bugs":{"url":"https://github.com/facebook/create-react-app/issues"},"repository":{"type":"git","url":"https://github.com/corva-ai/create-corva-app","directory":"@corva/create-app"},"license":"MIT","type":"module","bin":{"create-corva-app":"./bin/create-corva-app.cjs"},"files":["bin/**/*.cjs","bin/**/*.js","lib/**/*.js","templates","template_extensions","common"],"scripts":{"build":"echo \"build is not configured for package \\\"×\\\", skipping.\"","get-changelog":"conventional-changelog -r 2 -p angular","lint":"eslint . --resolve-plugins-relative-to $(pwd) --max-warnings 0","lint:fix":"eslint . --fix","release":"git add -A && standard-version -a","release-rc":"npm run release -- --prerelease","run:local-ui-ts-completion":"node ./bin/create-corva-app.cjs ../test-app-ui-ts-completions --appName 'TestAppUiTsCompletions' --segments 'completion' --category 'analytics' --appKey 'corva.testappuitscompletions.ui' --appType 'ui' --runtime 'ui' -t --extensions corva","run:local-ui-ts-drilling":"node ./bin/create-corva-app.cjs ../test-app-ui-ts-drilling --appName 'TestAppUiTsDrilling' --segments 'drilling' --category 'analytics' --appKey 'corva.testappuitsdrilling.ui' --appType 'ui' --runtime 'ui' -t --extensions corva","test":"NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest"},"lint-staged":{"*.js":"npm run lint:fix"},"dependencies":{"archiver":"^5.3.0","chalk":"^4.1.0","commander":"^9.1.0","cross-spawn":"^7.0.3","debug":"^4.3.4","dotenv":"^16.0.0","figlet":"^1.5.0","form-data":"^4.0.0","fs-extra":"^9.0.1","glob":"^8.0.1","got":"^12.5.1","inquirer":"^8.2.3","is-glob":"^4.0.3","lodash":"^4.17.21","npm-api":"^1.0.0","semver":"^7.3.2","terminal-link":"^3.0.0"},"devDependencies":{"@babel/core":"^7.11.0","@babel/eslint-parser":"^7.19.1","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-syntax-import-assertions":"^7.20.0","@babel/preset-react":"^7.18.6","@commitlint/cli":"^17.3.0","@commitlint/config-conventional":"^17.3.0","@corva/eslint-config-browser":"^0.1.7","@corva/eslint-config-node":"^5.1.1","@corva/node-sdk":"^8.0.1","@types/cross-spawn":"^6.0.2","@types/jest":"^29.5.4","@typescript-eslint/eslint-plugin":"^5.42.1","@typescript-eslint/parser":"^5.42.1","conventional-changelog-cli":"^2.1.0","eslint":"^8.2.0","eslint-config-google":"^0.14.0","eslint-config-prettier":"^8.5.0","eslint-plugin-import":"^2.26.0","eslint-plugin-jest":"^27.1.5","eslint-plugin-jsx-a11y":"^6.7.1","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"^7.32.0","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-require-sort":"^1.3.0","husky":"^8.0.2","jest":"^29.6.4","prettier":"^2.0.0","prettier-plugin-packagejson":"^2.3.0","standard-version":"^9.0.0","typescript":"^4.8.4","zx":"^7.2.3"},"packageManager":"yarn@1.22.19+sha512.ff4579ab459bb25aa7c0ff75b62acebe576f6084b36aa842971cf250a5d8c6cd3bc9420b22ce63c7f93a0857bc6ef29291db39c3e7a23aab5adfd5a4dd6c5d71","engines":{"node":">=18"},"standard-version":{"skip":{"tag":true}}}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"parser": "@typescript-eslint/parser",
|
|
4
|
+
"parserOptions": {
|
|
5
|
+
"ecmaVersion": 2020,
|
|
6
|
+
"sourceType": "module",
|
|
7
|
+
"ecmaFeature": {
|
|
8
|
+
"jsx": true
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"extends": ["@corva/eslint-config-browser"],
|
|
12
|
+
"overrides": [
|
|
13
|
+
{
|
|
14
|
+
"files": ["*.ts", "*.tsx"],
|
|
15
|
+
"extends": [
|
|
16
|
+
"@corva/eslint-config-browser",
|
|
17
|
+
"plugin:@typescript-eslint/recommended",
|
|
18
|
+
"plugin:@tanstack/eslint-plugin-query/recommended"
|
|
19
|
+
],
|
|
20
|
+
"rules": {
|
|
21
|
+
"@typescript-eslint/no-explicit-any": 2,
|
|
22
|
+
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".ts", ".tsx"] }],
|
|
23
|
+
/* Turned off until adopted by @corva/eslint-config-browser */
|
|
24
|
+
"react/prop-types": 0,
|
|
25
|
+
"react/default-props-match-prop-types": 0,
|
|
26
|
+
"react/no-unused-prop-types": 0,
|
|
27
|
+
"react/require-default-props": 0
|
|
28
|
+
/* Turned off until adopted by @corva/eslint-config-browser */
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -11,6 +11,8 @@ jobs:
|
|
|
11
11
|
- name: develop branch flow
|
|
12
12
|
id: shared-workflow
|
|
13
13
|
uses: corva-ai/gh-actions/shared-dc-workflows/develop@develop
|
|
14
|
+
env:
|
|
15
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
14
16
|
with:
|
|
15
17
|
qa-api-key: ${{ secrets.API_KEY_QA }}
|
|
16
18
|
prod-api-key: ${{ secrets.API_KEY }}
|
|
@@ -9,3 +9,22 @@ import '@testing-library/jest-dom/extend-expect';
|
|
|
9
9
|
|
|
10
10
|
// Set UTC timezone for tests to not use the environment timezone
|
|
11
11
|
process.env.TZ = 'UTC';
|
|
12
|
+
|
|
13
|
+
// Mock ResizeObserver & MutationObserver
|
|
14
|
+
class FakeObserver {
|
|
15
|
+
observe() {}
|
|
16
|
+
unobserve() {}
|
|
17
|
+
disconnect() {}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
global.ResizeObserver = FakeObserver;
|
|
21
|
+
global.MutationObserver = FakeObserver;
|
|
22
|
+
|
|
23
|
+
// Suppressing "Could not parse CSS stylesheet" from JSDOM
|
|
24
|
+
const originalConsoleError = global.console.error;
|
|
25
|
+
global.console.error = (message, ...optionalParams) => {
|
|
26
|
+
if (message.includes('Could not parse CSS stylesheet')) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
originalConsoleError(message, ...optionalParams);
|
|
30
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AppHeader } from '@corva/ui/
|
|
1
|
+
import { AppContainer, AppHeader } from '@corva/ui/componentsV2';
|
|
2
|
+
import { useAppCommons } from '@corva/ui/effects';
|
|
2
3
|
|
|
3
4
|
import { DEFAULT_SETTINGS } from './constants';
|
|
4
5
|
import logo from './assets/logo.svg';
|
|
@@ -8,54 +9,52 @@ import styles from './App.css';
|
|
|
8
9
|
/**
|
|
9
10
|
* @param {Object} props
|
|
10
11
|
* @param {boolean} props.isExampleCheckboxChecked
|
|
11
|
-
* @param {Object} props.appHeaderProps
|
|
12
12
|
* @param {Object} props.fracFleet
|
|
13
13
|
* @param {Object} props.well
|
|
14
14
|
* @param {Object[]} props.wells
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
function App({
|
|
18
|
-
appHeaderProps,
|
|
19
18
|
isExampleCheckboxChecked = DEFAULT_SETTINGS.isExampleCheckboxChecked,
|
|
20
19
|
fracFleet,
|
|
21
20
|
well,
|
|
22
21
|
wells,
|
|
23
22
|
}) {
|
|
23
|
+
const { appKey } = useAppCommons();
|
|
24
24
|
// NOTE: On general type dashboard app receives wells array
|
|
25
25
|
// on asset type dashboard app receives well object
|
|
26
26
|
const wellsList = wells || [well];
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
Settings "Example" checkbox is{' '}
|
|
29
|
+
<AppContainer header={<AppHeader />} testId={appKey}>
|
|
30
|
+
<div className={styles.container}>
|
|
31
|
+
<img src={logo} alt="logo" className={styles.logo} />
|
|
32
|
+
<p>
|
|
33
|
+
Edit <code>src/App.js</code> and save to reload.
|
|
34
|
+
<br />
|
|
35
|
+
<br />
|
|
36
|
+
</p>
|
|
37
|
+
<p>
|
|
38
|
+
Frac Fleet: <span data-testid="fracFleet">{fracFleet?.name || 'No Frac Fleet'}</span>
|
|
39
|
+
<br />
|
|
40
|
+
Wells: <span data-testid="wellsList">{wellsList.map(well => well?.name).join(', ')}</span>
|
|
41
|
+
</p>
|
|
42
|
+
<a
|
|
43
|
+
className="App-link"
|
|
44
|
+
href="https://reactjs.org"
|
|
45
|
+
target="_blank"
|
|
46
|
+
rel="noopener noreferrer"
|
|
47
|
+
>
|
|
48
|
+
Learn React
|
|
49
|
+
</a>
|
|
50
|
+
</div>
|
|
51
|
+
<div>
|
|
52
|
+
Settings "Example" checkbox is{' '}
|
|
53
|
+
<span data-testid="exampleCheckboxChecked">
|
|
55
54
|
{isExampleCheckboxChecked ? 'checked' : 'unchecked'}
|
|
56
|
-
</
|
|
55
|
+
</span>
|
|
57
56
|
</div>
|
|
58
|
-
</
|
|
57
|
+
</AppContainer>
|
|
59
58
|
);
|
|
60
59
|
}
|
|
61
60
|
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
.container {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
height: 100%;
|
|
5
|
-
padding: 12px 12px 30px 12px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.content {
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
2
|
text-align: center;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
flex-grow: 1;
|
|
15
|
-
overflow: auto;
|
|
16
3
|
}
|
|
17
4
|
|
|
18
5
|
@keyframes App-logo-spin {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AppHeader } from '@corva/ui/
|
|
1
|
+
import { AppContainer, AppHeader } from '@corva/ui/componentsV2';
|
|
2
|
+
import { useAppCommons } from '@corva/ui/effects';
|
|
2
3
|
|
|
3
4
|
import { DEFAULT_SETTINGS } from './constants';
|
|
4
5
|
import logo from './assets/logo.svg';
|
|
@@ -7,49 +8,43 @@ import styles from './App.css';
|
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @param {Object} props
|
|
10
|
-
* @param {Object} props.appHeaderProps
|
|
11
11
|
* @param {boolean} props.isExampleCheckboxChecked
|
|
12
12
|
* @param {Object} props.rig
|
|
13
13
|
* @param {Object} props.well
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
|
-
function App({
|
|
17
|
-
|
|
18
|
-
isExampleCheckboxChecked = DEFAULT_SETTINGS.isExampleCheckboxChecked,
|
|
19
|
-
rig,
|
|
20
|
-
well,
|
|
21
|
-
}) {
|
|
16
|
+
function App({ isExampleCheckboxChecked = DEFAULT_SETTINGS.isExampleCheckboxChecked, rig, well }) {
|
|
17
|
+
const { appKey } = useAppCommons();
|
|
22
18
|
return (
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
Settings "Example" checkbox is{' '}
|
|
19
|
+
<AppContainer header={<AppHeader />} testId={appKey}>
|
|
20
|
+
<div className={styles.container}>
|
|
21
|
+
<img src={logo} alt="logo" className={styles.logo} />
|
|
22
|
+
<p>
|
|
23
|
+
Edit <code>src/App.js</code> and save to reload.
|
|
24
|
+
<br />
|
|
25
|
+
<br />
|
|
26
|
+
</p>
|
|
27
|
+
<p>
|
|
28
|
+
Rig: <span data-testid="rig">{rig?.name}</span>
|
|
29
|
+
<br />
|
|
30
|
+
Well: <span data-testid="well">{well?.name}</span>
|
|
31
|
+
</p>
|
|
32
|
+
<a
|
|
33
|
+
className="App-link"
|
|
34
|
+
href="https://reactjs.org"
|
|
35
|
+
target="_blank"
|
|
36
|
+
rel="noopener noreferrer"
|
|
37
|
+
>
|
|
38
|
+
Learn React
|
|
39
|
+
</a>
|
|
40
|
+
</div>
|
|
41
|
+
<div>
|
|
42
|
+
Settings "Example" checkbox is{' '}
|
|
43
|
+
<span data-testid="exampleCheckboxState">
|
|
49
44
|
{isExampleCheckboxChecked ? 'checked' : 'unchecked'}
|
|
50
|
-
</
|
|
45
|
+
</span>
|
|
51
46
|
</div>
|
|
52
|
-
</
|
|
47
|
+
</AppContainer>
|
|
53
48
|
);
|
|
54
49
|
}
|
|
55
50
|
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { AppTestWrapper } from '@corva/ui/testing';
|
|
2
3
|
|
|
3
4
|
import App from '../App';
|
|
4
5
|
import { mockAppProps } from '../__mocks__/mockAppProps';
|
|
5
6
|
|
|
6
7
|
describe('<App />', () => {
|
|
7
8
|
it('should show correct layout', () => {
|
|
8
|
-
render(
|
|
9
|
+
render(
|
|
10
|
+
<AppTestWrapper
|
|
11
|
+
app={mockAppProps.app}
|
|
12
|
+
appId={123}
|
|
13
|
+
maximized={false}
|
|
14
|
+
appSettings={mockAppProps.app.settings}
|
|
15
|
+
onSettingChange={() => {
|
|
16
|
+
/* noop */
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
<App {...mockAppProps} />
|
|
20
|
+
</AppTestWrapper>
|
|
21
|
+
);
|
|
9
22
|
|
|
10
23
|
screen.getByText(/checked/i);
|
|
11
24
|
});
|
|
@@ -14,7 +27,19 @@ describe('<App />', () => {
|
|
|
14
27
|
const propsWithoutSettings = mockAppProps;
|
|
15
28
|
delete propsWithoutSettings.isExampleCheckboxChecked;
|
|
16
29
|
|
|
17
|
-
render(
|
|
30
|
+
render(
|
|
31
|
+
<AppTestWrapper
|
|
32
|
+
app={mockAppProps.app}
|
|
33
|
+
appId={123}
|
|
34
|
+
maximized={false}
|
|
35
|
+
appSettings={mockAppProps.app.settings}
|
|
36
|
+
onSettingChange={() => {
|
|
37
|
+
/* noop */
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
<App {...propsWithoutSettings} />
|
|
41
|
+
</AppTestWrapper>
|
|
42
|
+
);
|
|
18
43
|
|
|
19
44
|
screen.getByText(/unchecked/i);
|
|
20
45
|
});
|