@corva/create-app 0.0.0-73c49372
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 +211 -0
- package/bin/cca.js +5 -0
- package/bin/create-corva-app.cjs +30 -0
- package/common/node/.env +15 -0
- package/common/node/.env.sample +26 -0
- package/common/node/gitignore +130 -0
- package/common/package.json +3 -0
- package/common/python/.env +5 -0
- package/common/python/.env.sample +7 -0
- package/common/python/Makefile +15 -0
- package/common/python/gitignore +161 -0
- package/common/python/requirements.txt +2 -0
- package/lib/commands/attach.js +28 -0
- package/lib/commands/create.js +463 -0
- package/lib/commands/release.js +52 -0
- package/lib/commands/rerun.js +34 -0
- package/lib/commands/zip.js +39 -0
- package/lib/constants/cache.js +5 -0
- package/lib/constants/cli.js +24 -0
- package/lib/constants/manifest.js +262 -0
- package/lib/constants/messages.js +15 -0
- package/lib/constants/package.js +269 -0
- package/lib/flow.js +53 -0
- package/lib/flows/attach.js +8 -0
- package/lib/flows/lib/api.js +376 -0
- package/lib/flows/lib/create-zip-archive.js +83 -0
- package/lib/flows/lib/json.js +30 -0
- package/lib/flows/lib/manifest.js +81 -0
- package/lib/flows/lib/notification.js +142 -0
- package/lib/flows/lib/step-error.js +10 -0
- package/lib/flows/lib/waitForMs.js +3 -0
- package/lib/flows/prepare.js +6 -0
- package/lib/flows/release.js +26 -0
- package/lib/flows/rerun.js +8 -0
- package/lib/flows/steps/attach/add-app-to-stream.js +23 -0
- package/lib/flows/steps/attach/get-all-live-assets.js +135 -0
- package/lib/flows/steps/attach/index.js +5 -0
- package/lib/flows/steps/attach/prepare-data.js +19 -0
- package/lib/flows/steps/prepare-load-app-files.js +12 -0
- package/lib/flows/steps/release/add-label.js +10 -0
- package/lib/flows/steps/release/add-notes.js +10 -0
- package/lib/flows/steps/release/get-config.js +41 -0
- package/lib/flows/steps/release/prepare-data.js +12 -0
- package/lib/flows/steps/release/publish.js +11 -0
- package/lib/flows/steps/release/remove-failed-upload.js +21 -0
- package/lib/flows/steps/release/upload-zip-to-corva.js +62 -0
- package/lib/flows/steps/release/wait-for-build.js +36 -0
- package/lib/flows/steps/rerun/create-task.js +77 -0
- package/lib/flows/steps/rerun/ensure-that-app-in-stream.js +68 -0
- package/lib/flows/steps/rerun/get-app-version.js +111 -0
- package/lib/flows/steps/rerun/prepare-data.js +162 -0
- package/lib/flows/steps/rerun/prepare-well-and-stream-data.js +188 -0
- package/lib/flows/steps/rerun/rerun.js +13 -0
- package/lib/flows/steps/zip-cleanup.js +17 -0
- package/lib/flows/steps/zip-create-archive.js +15 -0
- package/lib/flows/steps/zip-file-list-resolve.js +260 -0
- package/lib/flows/steps/zip-prepare.js +20 -0
- package/lib/flows/steps/zip.js +6 -0
- package/lib/flows/zip-simple.js +6 -0
- package/lib/flows/zip.js +7 -0
- package/lib/helpers/cli-version.js +114 -0
- package/lib/helpers/commands.js +13 -0
- package/lib/helpers/logger.js +35 -0
- package/lib/helpers/manifest.js +74 -0
- package/lib/helpers/resolve-app-runtime.js +128 -0
- package/lib/helpers/utils.js +91 -0
- package/lib/helpers/versioning.js +94 -0
- package/lib/main.js +68 -0
- package/lib/options/api-key.js +6 -0
- package/lib/options/app-key.js +6 -0
- package/lib/options/app-version.js +3 -0
- package/lib/options/bump-version.js +19 -0
- package/lib/options/cache.js +11 -0
- package/lib/options/env.js +3 -0
- package/lib/options/original-cwd.js +3 -0
- package/lib/options/silent.js +3 -0
- package/package.json +104 -0
- package/template_extensions/corva/.commitlintrc.json +6 -0
- package/template_extensions/corva/.github/pull_request_template.md +14 -0
- package/template_extensions/corva/.github/workflows/code-checks.yml +15 -0
- package/template_extensions/corva/.github/workflows/develop.yml +17 -0
- package/template_extensions/corva/.github/workflows/feat-fix-delete.yml +14 -0
- package/template_extensions/corva/.github/workflows/feat-fix.yml +23 -0
- package/template_extensions/corva/.github/workflows/release-fix-X.X.X.yml +16 -0
- package/template_extensions/corva/.github/workflows/validate-pr-title.yml +19 -0
- package/template_extensions/corva/.husky/commit-msg +5 -0
- package/template_extensions/corva/.husky/pre-commit +4 -0
- package/templates/scheduler_data-time/javascript/README.md +19 -0
- package/templates/scheduler_data-time/javascript/__tests__/processor.spec.js +15 -0
- package/templates/scheduler_data-time/javascript/index.js +15 -0
- package/templates/scheduler_data-time/python/README.md +31 -0
- package/templates/scheduler_data-time/python/lambda_function.py +7 -0
- package/templates/scheduler_data-time/python/test/__init__.py +0 -0
- package/templates/scheduler_data-time/python/test/app_test.py +10 -0
- package/templates/scheduler_data-time/typescript/README.md +25 -0
- package/templates/scheduler_data-time/typescript/__tests__/processor.spec.ts +15 -0
- package/templates/scheduler_data-time/typescript/index.ts +8 -0
- package/templates/scheduler_depth/javascript/README.md +19 -0
- package/templates/scheduler_depth/javascript/__tests__/processor.spec.js +17 -0
- package/templates/scheduler_depth/javascript/index.js +15 -0
- package/templates/scheduler_depth/python/README.md +31 -0
- package/templates/scheduler_depth/python/lambda_function.py +7 -0
- package/templates/scheduler_depth/python/test/__init__.py +0 -0
- package/templates/scheduler_depth/python/test/app_test.py +10 -0
- package/templates/scheduler_depth/typescript/README.md +25 -0
- package/templates/scheduler_depth/typescript/__tests__/processor.spec.ts +17 -0
- package/templates/scheduler_depth/typescript/index.ts +8 -0
- package/templates/scheduler_natural-time/javascript/README.md +19 -0
- package/templates/scheduler_natural-time/javascript/__tests__/processor.spec.js +15 -0
- package/templates/scheduler_natural-time/javascript/index.js +15 -0
- package/templates/scheduler_natural-time/python/README.md +31 -0
- package/templates/scheduler_natural-time/python/lambda_function.py +7 -0
- package/templates/scheduler_natural-time/python/test/__init__.py +0 -0
- package/templates/scheduler_natural-time/python/test/app_test.py +10 -0
- package/templates/scheduler_natural-time/typescript/README.md +25 -0
- package/templates/scheduler_natural-time/typescript/__tests__/processor.spec.ts +15 -0
- package/templates/scheduler_natural-time/typescript/index.ts +8 -0
- package/templates/stream_depth/javascript/README.md +19 -0
- package/templates/stream_depth/javascript/__tests__/processor.spec.js +20 -0
- package/templates/stream_depth/javascript/index.js +14 -0
- package/templates/stream_depth/python/README.md +31 -0
- package/templates/stream_depth/python/lambda_function.py +7 -0
- package/templates/stream_depth/python/test/__init__.py +0 -0
- package/templates/stream_depth/python/test/app_test.py +16 -0
- package/templates/stream_depth/typescript/README.md +25 -0
- package/templates/stream_depth/typescript/__tests__/processor.spec.ts +20 -0
- package/templates/stream_depth/typescript/index.ts +8 -0
- package/templates/stream_time/javascript/README.md +19 -0
- package/templates/stream_time/javascript/__tests__/processor.spec.js +14 -0
- package/templates/stream_time/javascript/index.js +14 -0
- package/templates/stream_time/python/README.md +31 -0
- package/templates/stream_time/python/lambda_function.py +7 -0
- package/templates/stream_time/python/test/__init__.py +0 -0
- package/templates/stream_time/python/test/app_test.py +16 -0
- package/templates/stream_time/typescript/README.md +25 -0
- package/templates/stream_time/typescript/__tests__/processor.spec.ts +14 -0
- package/templates/stream_time/typescript/index.ts +8 -0
- package/templates/task/javascript/README.md +19 -0
- package/templates/task/javascript/__tests__/processor.spec.js +16 -0
- package/templates/task/javascript/index.js +15 -0
- package/templates/task/python/README.md +31 -0
- package/templates/task/python/lambda_function.py +7 -0
- package/templates/task/python/test/__init__.py +0 -0
- package/templates/task/python/test/app_test.py +8 -0
- package/templates/task/typescript/README.md +25 -0
- package/templates/task/typescript/__tests__/processor.spec.ts +16 -0
- package/templates/task/typescript/index.ts +8 -0
- package/templates/ui/javascript/.eslintrc +11 -0
- package/templates/ui/javascript/.prettierrc +1 -0
- package/templates/ui/javascript/README.md +31 -0
- package/templates/ui/javascript/config/jest/babelTransform.js +16 -0
- package/templates/ui/javascript/config/jest/cssTransform.js +16 -0
- package/templates/ui/javascript/config/jest/fileTransform.js +48 -0
- package/templates/ui/javascript/config/jest/globalSetup.js +5 -0
- package/templates/ui/javascript/config/jest/setupTests.js +11 -0
- package/templates/ui/javascript/config-overrides.js +10 -0
- package/templates/ui/javascript/gitignore +27 -0
- package/templates/ui/javascript/src/App.completion.js +64 -0
- package/templates/ui/javascript/src/App.css +30 -0
- package/templates/ui/javascript/src/App.drilling.js +58 -0
- package/templates/ui/javascript/src/AppSettings.js +42 -0
- package/templates/ui/javascript/src/__mocks__/mockAppProps.js +590 -0
- package/templates/ui/javascript/src/__mocks__/mockAppSettingsProps.js +290 -0
- package/templates/ui/javascript/src/__tests__/App.test.js +21 -0
- package/templates/ui/javascript/src/__tests__/AppSettings.test.js +21 -0
- package/templates/ui/javascript/src/__tests__/TestsExample.test.js +37 -0
- package/templates/ui/javascript/src/assets/logo.svg +7 -0
- package/templates/ui/javascript/src/constants.js +3 -0
- package/templates/ui/javascript/src/index.js +7 -0
- package/templates/ui/typescript/.eslintrc +28 -0
- package/templates/ui/typescript/.prettierrc +1 -0
- package/templates/ui/typescript/README.md +31 -0
- package/templates/ui/typescript/config/jest/babelTransform.js +16 -0
- package/templates/ui/typescript/config/jest/cssTransform.js +16 -0
- package/templates/ui/typescript/config/jest/fileTransform.js +48 -0
- package/templates/ui/typescript/config/jest/globalSetup.js +5 -0
- package/templates/ui/typescript/config/jest/setupTests.js +11 -0
- package/templates/ui/typescript/config-overrides.js +10 -0
- package/templates/ui/typescript/gitignore +27 -0
- package/templates/ui/typescript/src/App.completion.tsx +66 -0
- package/templates/ui/typescript/src/App.css +30 -0
- package/templates/ui/typescript/src/App.drilling.tsx +60 -0
- package/templates/ui/typescript/src/AppSettings.tsx +38 -0
- package/templates/ui/typescript/src/__mocks__/mockAppProps.ts +590 -0
- package/templates/ui/typescript/src/__mocks__/mockAppSettingsProps.ts +290 -0
- package/templates/ui/typescript/src/__tests__/App.test.tsx +21 -0
- package/templates/ui/typescript/src/__tests__/AppSettings.test.tsx +21 -0
- package/templates/ui/typescript/src/__tests__/TestsExample.test.tsx +37 -0
- package/templates/ui/typescript/src/assets/logo.svg +7 -0
- package/templates/ui/typescript/src/constants.ts +3 -0
- package/templates/ui/typescript/src/custom.d.ts +9 -0
- package/templates/ui/typescript/src/index.js +7 -0
- package/templates/ui/typescript/tsconfig.json +8 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from corva import StreamTimeEvent, StreamTimeRecord
|
|
2
|
+
from lambda_function import lambda_handler
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def test_app(app_runner):
|
|
6
|
+
event = StreamTimeEvent(
|
|
7
|
+
company_id=1,
|
|
8
|
+
asset_id=1234,
|
|
9
|
+
records=[
|
|
10
|
+
StreamTimeRecord(
|
|
11
|
+
data={'bit_depth': 4980, 'hole_depth': 5000}, timestamp=1620905165
|
|
12
|
+
)
|
|
13
|
+
],
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
app_runner(lambda_handler, event=event)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Dev Center Node.js TypeScript Real-Time Stream Data App
|
|
2
|
+
|
|
3
|
+
## Getting started
|
|
4
|
+
|
|
5
|
+
### 1. Install Dependencies
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### 2. Run Tests
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
npm test
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### 3. Build
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
npm run build
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 4. Deploy
|
|
24
|
+
|
|
25
|
+
Run `npm run bundle` to create a zip package that can be uploaded to Dev Center
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { app_runner } from '@corva/node-sdk/lib/testing';
|
|
2
|
+
import { StreamTimeEvent, StreamTimeRecord } from '@corva/node-sdk';
|
|
3
|
+
|
|
4
|
+
import { processor } from '..';
|
|
5
|
+
|
|
6
|
+
test('processes event', async () => {
|
|
7
|
+
const event = new StreamTimeEvent({
|
|
8
|
+
company_id: 1,
|
|
9
|
+
asset_id: 1234,
|
|
10
|
+
records: [new StreamTimeRecord({ data: { bit_depth: 4980, hole_depth: 5000 }, timestamp: 1620905165 })],
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
expect(await app_runner(processor, event)).toBeUndefined();
|
|
14
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Corva, StatefulContext, StreamTimeEvent } from '@corva/node-sdk';
|
|
2
|
+
|
|
3
|
+
export const processor = async (event: StreamTimeEvent, context: StatefulContext) => {
|
|
4
|
+
// Insert your logic here
|
|
5
|
+
context.logger.info('Hello, World!');
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const handler = new Corva().stream(processor);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Dev Center Node.js Task Data App
|
|
2
|
+
|
|
3
|
+
## Getting started
|
|
4
|
+
|
|
5
|
+
### 1. Install Dependencies
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### 2. Run Tests
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
npm test
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### 3. Deploy
|
|
18
|
+
|
|
19
|
+
Run `npm run bundle` to create a zip package that can be uploaded to Dev Center
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const { TaskEvent } = require('@corva/node-sdk');
|
|
2
|
+
const { app_runner } = require('@corva/node-sdk/lib/testing');
|
|
3
|
+
|
|
4
|
+
const { processor } = require('..');
|
|
5
|
+
|
|
6
|
+
test('processes event', async () => {
|
|
7
|
+
const event = new TaskEvent({
|
|
8
|
+
company_id: 1,
|
|
9
|
+
asset_id: 1234,
|
|
10
|
+
properties: {
|
|
11
|
+
foo: 'bar',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
expect(await app_runner(processor, event)).toBeUndefined();
|
|
16
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { Corva } = require('@corva/node-sdk');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {import('@corva/node-sdk').TaskEvent} event
|
|
6
|
+
* @param {import('@corva/node-sdk').StatelessContext} context
|
|
7
|
+
*/
|
|
8
|
+
const processor = async (event, context) => {
|
|
9
|
+
// Insert your logic here
|
|
10
|
+
context.logger.info('Hello, World!');
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
exports.processor = processor;
|
|
14
|
+
|
|
15
|
+
exports.handler = new Corva().task(processor);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Dev Center Python Task Data App
|
|
2
|
+
|
|
3
|
+
## Getting started
|
|
4
|
+
|
|
5
|
+
[Python SDK Documentation](https://corva-ai.github.io/python-sdk)
|
|
6
|
+
|
|
7
|
+
### 1. Install
|
|
8
|
+
|
|
9
|
+
You need to have `make` installed:
|
|
10
|
+
|
|
11
|
+
- Windows: [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install)
|
|
12
|
+
- OS X: [Command Line Tools for Xcode](https://developer.apple.com/download/more/)
|
|
13
|
+
- Linux: refer to your distro-specific docs
|
|
14
|
+
|
|
15
|
+
To install dependencies run:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
make
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 2. Run Tests
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
make test
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 3. Create app zip
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
make bundle
|
|
31
|
+
```
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Dev Center Node.js Task Data App
|
|
2
|
+
|
|
3
|
+
## Getting started
|
|
4
|
+
|
|
5
|
+
### 1. Install Dependencies
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### 2. Run Tests
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
npm test
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### 3. Build
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
npm run build
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 4. Deploy
|
|
24
|
+
|
|
25
|
+
Run `npm run bundle` to create a zip package that can be uploaded to Dev Center
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { app_runner } from '@corva/node-sdk/lib/testing';
|
|
2
|
+
import { TaskEvent } from '@corva/node-sdk';
|
|
3
|
+
|
|
4
|
+
import { processor } from '..';
|
|
5
|
+
|
|
6
|
+
test('processes event', async () => {
|
|
7
|
+
const event = new TaskEvent({
|
|
8
|
+
company_id: 1,
|
|
9
|
+
asset_id: 1234,
|
|
10
|
+
properties: {
|
|
11
|
+
foo: 'bar',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
expect(await app_runner(processor, event)).toBeUndefined();
|
|
16
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Corva, StatelessContext, TaskEvent } from '@corva/node-sdk';
|
|
2
|
+
|
|
3
|
+
export const processor = async (event: TaskEvent, context: StatelessContext) => {
|
|
4
|
+
// Insert your logic here
|
|
5
|
+
context.logger.info('Hello, World!');
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const handler = new Corva().task(processor);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"@corva/eslint-config-browser/prettier"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Getting Started with Create Corva App
|
|
2
|
+
|
|
3
|
+
## Available Scripts
|
|
4
|
+
|
|
5
|
+
In the project directory, you can run:
|
|
6
|
+
|
|
7
|
+
### `yarn start`
|
|
8
|
+
|
|
9
|
+
Runs the app in the development mode.\
|
|
10
|
+
Open [http://app.local.corva.ai:8080](http://app.local.corva.ai:8080/) to view it in the browser.
|
|
11
|
+
|
|
12
|
+
The page will reload if you make edits.\
|
|
13
|
+
You will also see any lint errors in the console.
|
|
14
|
+
|
|
15
|
+
### `yarn build`
|
|
16
|
+
|
|
17
|
+
Bundles the app into static files for production.
|
|
18
|
+
|
|
19
|
+
### `yarn zip`
|
|
20
|
+
|
|
21
|
+
Bundles the app into ZIP file in app root directory
|
|
22
|
+
|
|
23
|
+
### `yarn release`
|
|
24
|
+
|
|
25
|
+
Releases the app into Corva
|
|
26
|
+
|
|
27
|
+
## Documentation
|
|
28
|
+
|
|
29
|
+
- [Dev Center documentation](https://dc-docs.corva.ai/) – information about development process
|
|
30
|
+
- [Component Library](https://dc-docs.corva.ai/docs/Frontend/Data%20visualization/Components%20library)
|
|
31
|
+
- [Datasets documentation](https://dc-docs.corva.ai/docs/Datasets/Link%20App%20to%20Dataset)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
const babelJest = require('babel-jest').default;
|
|
4
|
+
|
|
5
|
+
module.exports = babelJest.createTransformer({
|
|
6
|
+
presets: [
|
|
7
|
+
[
|
|
8
|
+
require.resolve('babel-preset-react-app'),
|
|
9
|
+
{
|
|
10
|
+
runtime: 'automatic',
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
],
|
|
14
|
+
babelrc: false,
|
|
15
|
+
configFile: false,
|
|
16
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
// This is a custom Jest transformer turning style imports into empty objects.
|
|
4
|
+
// http://facebook.github.io/jest/docs/en/webpack.html
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
process() {
|
|
8
|
+
return {
|
|
9
|
+
code: 'module.exports = {};',
|
|
10
|
+
};
|
|
11
|
+
},
|
|
12
|
+
getCacheKey() {
|
|
13
|
+
// The output is always the same.
|
|
14
|
+
return 'cssTransform';
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
// This is a custom Jest transformer turning file imports into filenames.
|
|
6
|
+
// http://facebook.github.io/jest/docs/en/webpack.html
|
|
7
|
+
|
|
8
|
+
const toPascalCase = str => {
|
|
9
|
+
const allWordsIterator = str.matchAll(/\w+/g);
|
|
10
|
+
|
|
11
|
+
return Array.from(allWordsIterator).reduce((acc, matchResult) => {
|
|
12
|
+
const word = matchResult[0];
|
|
13
|
+
return acc + word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
14
|
+
}, '');
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
process(src, filename) {
|
|
19
|
+
const assetFilename = JSON.stringify(path.basename(filename));
|
|
20
|
+
|
|
21
|
+
if (filename.match(/\.svg$/)) {
|
|
22
|
+
// Based on how SVGR generates a component name:
|
|
23
|
+
// https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6
|
|
24
|
+
const pascalCaseFilename = toPascalCase(path.parse(filename).name);
|
|
25
|
+
const componentName = `Svg${pascalCaseFilename}`;
|
|
26
|
+
return {
|
|
27
|
+
code: `const React = require('react');
|
|
28
|
+
module.exports = {
|
|
29
|
+
__esModule: true,
|
|
30
|
+
default: ${assetFilename},
|
|
31
|
+
ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
|
|
32
|
+
return {
|
|
33
|
+
$$typeof: Symbol.for('react.element'),
|
|
34
|
+
type: 'svg',
|
|
35
|
+
ref: ref,
|
|
36
|
+
key: null,
|
|
37
|
+
props: Object.assign({}, props, {
|
|
38
|
+
children: ${assetFilename}
|
|
39
|
+
})
|
|
40
|
+
};
|
|
41
|
+
}),
|
|
42
|
+
};`,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return { code: `module.exports = ${assetFilename};` };
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
|
4
|
+
// allows you to do things like:
|
|
5
|
+
// expect(element).toHaveTextContent(/react/i)
|
|
6
|
+
// learn more: https://github.com/testing-library/jest-dom
|
|
7
|
+
// eslint-disable-next-line
|
|
8
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
9
|
+
|
|
10
|
+
// Set UTC timezone for tests to not use the environment timezone
|
|
11
|
+
process.env.TZ = 'UTC';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const { getWebpackConfig } = require('@corva/dc-platform-shared/cjs');
|
|
2
|
+
const { merge } = require('webpack-merge');
|
|
3
|
+
|
|
4
|
+
module.exports = (env, argv) => {
|
|
5
|
+
return merge(
|
|
6
|
+
getWebpackConfig(env, argv),
|
|
7
|
+
// NOTE: Custom webpack 5 plugins and module rules can be provided here
|
|
8
|
+
{}
|
|
9
|
+
);
|
|
10
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# dependencies
|
|
4
|
+
/node_modules
|
|
5
|
+
/.pnp
|
|
6
|
+
.pnp.js
|
|
7
|
+
|
|
8
|
+
# testing
|
|
9
|
+
/coverage
|
|
10
|
+
|
|
11
|
+
# production
|
|
12
|
+
/build
|
|
13
|
+
/dist
|
|
14
|
+
|
|
15
|
+
# misc
|
|
16
|
+
.env
|
|
17
|
+
.DS_Store
|
|
18
|
+
.env.local
|
|
19
|
+
.env.development.local
|
|
20
|
+
.env.test.local
|
|
21
|
+
.env.production.local
|
|
22
|
+
.idea
|
|
23
|
+
|
|
24
|
+
npm-debug.log*
|
|
25
|
+
yarn-debug.log*
|
|
26
|
+
yarn-error.log*
|
|
27
|
+
.eslintcache
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { AppHeader } from '@corva/ui/components';
|
|
2
|
+
|
|
3
|
+
import { DEFAULT_SETTINGS } from './constants';
|
|
4
|
+
import logo from './assets/logo.svg';
|
|
5
|
+
|
|
6
|
+
import styles from './App.css';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {Object} props
|
|
10
|
+
* @param {boolean} props.isExampleCheckboxChecked
|
|
11
|
+
* @param {Object} props.appHeaderProps
|
|
12
|
+
* @param {Object} props.fracFleet
|
|
13
|
+
* @param {Object} props.well
|
|
14
|
+
* @param {Object[]} props.wells
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
function App({
|
|
18
|
+
appHeaderProps,
|
|
19
|
+
isExampleCheckboxChecked = DEFAULT_SETTINGS.isExampleCheckboxChecked,
|
|
20
|
+
fracFleet,
|
|
21
|
+
well,
|
|
22
|
+
wells,
|
|
23
|
+
}) {
|
|
24
|
+
// NOTE: On general type dashboard app receives wells array
|
|
25
|
+
// on asset type dashboard app receives well object
|
|
26
|
+
const wellsList = wells || [well];
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className={styles.container}>
|
|
30
|
+
<AppHeader {...appHeaderProps} />
|
|
31
|
+
<div className={styles.content}>
|
|
32
|
+
<div>
|
|
33
|
+
<img src={logo} alt="logo" className={styles.logo} />
|
|
34
|
+
<p>
|
|
35
|
+
Edit <code>src/App.js</code> and save to reload.
|
|
36
|
+
<br />
|
|
37
|
+
<br />
|
|
38
|
+
</p>
|
|
39
|
+
<p>
|
|
40
|
+
Frac Fleet: {fracFleet?.name || 'No Frac Fleet'}
|
|
41
|
+
<br />
|
|
42
|
+
Wells: {wellsList.map(well => well.name).join(', ')}
|
|
43
|
+
</p>
|
|
44
|
+
<a
|
|
45
|
+
className="App-link"
|
|
46
|
+
href="https://reactjs.org"
|
|
47
|
+
target="_blank"
|
|
48
|
+
rel="noopener noreferrer"
|
|
49
|
+
>
|
|
50
|
+
Learn React
|
|
51
|
+
</a>
|
|
52
|
+
</div>
|
|
53
|
+
<div>
|
|
54
|
+
Settings "Example" checkbox is{' '}
|
|
55
|
+
{isExampleCheckboxChecked ? 'checked' : 'unchecked'}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Important: Do not change root component default export (App.js). Use it as container
|
|
63
|
+
// for your App. It's required to make build and zip scripts work as expected;
|
|
64
|
+
export default App;
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
text-align: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
flex-grow: 1;
|
|
15
|
+
overflow: auto;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@keyframes App-logo-spin {
|
|
19
|
+
from {
|
|
20
|
+
transform: rotate(0deg);
|
|
21
|
+
}
|
|
22
|
+
to {
|
|
23
|
+
transform: rotate(-360deg);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.logo {
|
|
28
|
+
animation: App-logo-spin infinite 20s linear;
|
|
29
|
+
height: 50px;
|
|
30
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { AppHeader } from '@corva/ui/components';
|
|
2
|
+
|
|
3
|
+
import { DEFAULT_SETTINGS } from './constants';
|
|
4
|
+
import logo from './assets/logo.svg';
|
|
5
|
+
|
|
6
|
+
import styles from './App.css';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {Object} props
|
|
10
|
+
* @param {Object} props.appHeaderProps
|
|
11
|
+
* @param {boolean} props.isExampleCheckboxChecked
|
|
12
|
+
* @param {Object} props.rig
|
|
13
|
+
* @param {Object} props.well
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
function App({
|
|
17
|
+
appHeaderProps,
|
|
18
|
+
isExampleCheckboxChecked = DEFAULT_SETTINGS.isExampleCheckboxChecked,
|
|
19
|
+
rig,
|
|
20
|
+
well,
|
|
21
|
+
}) {
|
|
22
|
+
return (
|
|
23
|
+
<div className={styles.container}>
|
|
24
|
+
<AppHeader {...appHeaderProps} />
|
|
25
|
+
<div className={styles.content}>
|
|
26
|
+
<div>
|
|
27
|
+
<img src={logo} alt="logo" className={styles.logo} />
|
|
28
|
+
<p>
|
|
29
|
+
Edit <code>src/App.js</code> and save to reload.
|
|
30
|
+
<br />
|
|
31
|
+
<br />
|
|
32
|
+
</p>
|
|
33
|
+
<p>
|
|
34
|
+
Rig: {rig.name}
|
|
35
|
+
<br />
|
|
36
|
+
Well: {well.name}
|
|
37
|
+
</p>
|
|
38
|
+
<a
|
|
39
|
+
className="App-link"
|
|
40
|
+
href="https://reactjs.org"
|
|
41
|
+
target="_blank"
|
|
42
|
+
rel="noopener noreferrer"
|
|
43
|
+
>
|
|
44
|
+
Learn React
|
|
45
|
+
</a>
|
|
46
|
+
</div>
|
|
47
|
+
<div>
|
|
48
|
+
Settings "Example" checkbox is{' '}
|
|
49
|
+
{isExampleCheckboxChecked ? 'checked' : 'unchecked'}
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Important: Do not change root component default export (App.js). Use it as container
|
|
57
|
+
// for your App. It's required to make build and zip scripts work as expected;
|
|
58
|
+
export default App;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Checkbox, FormControlLabel } from '@material-ui/core';
|
|
2
|
+
|
|
3
|
+
import { DEFAULT_SETTINGS } from './constants';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {Object} props
|
|
7
|
+
* @param {Object} props.app
|
|
8
|
+
* @param {Object} props.appData
|
|
9
|
+
* @param {Object} props.company
|
|
10
|
+
* @param {(key: string, value: any) => void} props.onSettingChange
|
|
11
|
+
* @param {{isExampleCheckboxChecked: boolean}} props.settings
|
|
12
|
+
* @param {Object} props.user
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
function AppSettings({
|
|
16
|
+
settings: apiSettings,
|
|
17
|
+
onSettingChange,
|
|
18
|
+
// appData,
|
|
19
|
+
// app,
|
|
20
|
+
// user = {},
|
|
21
|
+
// company = {},
|
|
22
|
+
}) {
|
|
23
|
+
const settings = { ...DEFAULT_SETTINGS, ...apiSettings };
|
|
24
|
+
return (
|
|
25
|
+
<div>
|
|
26
|
+
<FormControlLabel
|
|
27
|
+
label="Example checkbox"
|
|
28
|
+
control={
|
|
29
|
+
<Checkbox
|
|
30
|
+
data-testid="exampleCheckbox"
|
|
31
|
+
checked={settings.isExampleCheckboxChecked}
|
|
32
|
+
onChange={e => onSettingChange('isExampleCheckboxChecked', e.target.checked)}
|
|
33
|
+
/>
|
|
34
|
+
}
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Important: Do not change root component default export (AppSettings.js). Use it as container
|
|
41
|
+
// for your App Settings. It's required to make build and zip scripts work as expected;
|
|
42
|
+
export default AppSettings;
|