@corva/create-app 0.0.0-2576df8
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 +218 -0
- package/bin/cca.js +5 -0
- package/bin/create-corva-app.cjs +25 -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 +58 -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 +35 -0
- package/lib/constants/manifest.js +263 -0
- package/lib/constants/messages.js +15 -0
- package/lib/constants/package.js +288 -0
- package/lib/flow.js +53 -0
- package/lib/flows/attach.js +8 -0
- package/lib/flows/lib/api.js +385 -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 +136 -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 +266 -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 +150 -0
- package/lib/helpers/commands.js +13 -0
- package/lib/helpers/logger.js +35 -0
- package/lib/helpers/manifest.js +82 -0
- package/lib/helpers/resolve-app-runtime.js +132 -0
- package/lib/helpers/utils.js +97 -0
- package/lib/helpers/versioning.js +94 -0
- package/lib/main.js +64 -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 +1 -0
- package/template_extensions/corva/.commitlintrc.json +6 -0
- package/template_extensions/corva/.eslintrc +32 -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 +19 -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/template_extensions/corva/.release-please-manifest.json +3 -0
- package/template_extensions/corva/release-please-config.json +10 -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/.codex/config.toml +3 -0
- package/templates/ui/javascript/.cursor/mcp.json +8 -0
- package/templates/ui/javascript/.eslintrc +11 -0
- package/templates/ui/javascript/.mcp.json +8 -0
- package/templates/ui/javascript/.prettierrc +1 -0
- package/templates/ui/javascript/AGENTS.md +304 -0
- package/templates/ui/javascript/CLAUDE.md +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 +30 -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 +52 -0
- package/templates/ui/javascript/src/App.drilling.js +49 -0
- package/templates/ui/javascript/src/App.scss +17 -0
- package/templates/ui/javascript/src/AppSettings.js +28 -0
- package/templates/ui/javascript/src/__tests__/App.test.js +26 -0
- package/templates/ui/javascript/src/__tests__/AppSettings.test.js +28 -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 +8 -0
- package/templates/ui/typescript/.codex/config.toml +3 -0
- package/templates/ui/typescript/.cursor/mcp.json +8 -0
- package/templates/ui/typescript/.eslintrc +28 -0
- package/templates/ui/typescript/.mcp.json +8 -0
- package/templates/ui/typescript/.prettierrc +1 -0
- package/templates/ui/typescript/AGENTS.md +344 -0
- package/templates/ui/typescript/CLAUDE.md +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 +30 -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 +52 -0
- package/templates/ui/typescript/src/App.drilling.tsx +49 -0
- package/templates/ui/typescript/src/App.scss +17 -0
- package/templates/ui/typescript/src/AppSettings.tsx +28 -0
- package/templates/ui/typescript/src/__mocks__/mockData.ts +22 -0
- package/templates/ui/typescript/src/__tests__/App.test.tsx +27 -0
- package/templates/ui/typescript/src/__tests__/AppSettings.test.tsx +28 -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 +19 -0
- package/templates/ui/typescript/src/index.js +8 -0
- package/templates/ui/typescript/src/types.ts +3 -0
- package/templates/ui/typescript/tsconfig.json +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# @corva/create-app
|
|
2
|
+
|
|
3
|
+
Apps generator for [corva.ai](https://corva.ai).
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- NodeJs >= 16.14.0 (https://nodejs.org/en/download/)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm i -g @corva/create-app
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
`corva-create-app` provides a user-friendly CLI wizard to create an app.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
Usage: create-corva-app [options] [command]
|
|
21
|
+
|
|
22
|
+
Options:
|
|
23
|
+
-h, --help display help for command
|
|
24
|
+
|
|
25
|
+
Commands:
|
|
26
|
+
create [options] [project-directory] Create a new app
|
|
27
|
+
zip [options] <project-directory> [patterns...] Bundle app
|
|
28
|
+
release [options] <project-directory> [patterns...] Release app
|
|
29
|
+
rerun [options] <project-directory> Rerun app
|
|
30
|
+
attach [options] <project-directory> Add app to live assets streams
|
|
31
|
+
help [command] display help for command
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Create an app
|
|
35
|
+
|
|
36
|
+
To create a new app use `create` command.
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
Usage: create-corva-app create <project-directory> [options]
|
|
40
|
+
|
|
41
|
+
Create a new app
|
|
42
|
+
|
|
43
|
+
Arguments:
|
|
44
|
+
project-directory Project directory to work with (default: "Current working dir")
|
|
45
|
+
|
|
46
|
+
Options:
|
|
47
|
+
--developerName [string] Enter the Developer Name (default: "O&G Company")
|
|
48
|
+
--developerIdentifier [string] Enter the Developer Identifier (default: "oandgc")
|
|
49
|
+
--appType Choose the App Type (choices: "ui", "scheduler", "stream", "task")
|
|
50
|
+
--schedulerType Choose the scheduler type (choices: "1", "2", "4")
|
|
51
|
+
--cronString [string] Provide CRON string for the scheduler (default: "*/5 * * * *")
|
|
52
|
+
--depthMilestone [number] Provide depth milestone for the scheduler (default: 1)
|
|
53
|
+
--logType Choose the log type (choices: "time", "depth")
|
|
54
|
+
--appName [string] Enter the App Name (default: "Corva Dev Center App")
|
|
55
|
+
--description [string] Enter description (default: "This is the description of my app. You can do great things with it!")
|
|
56
|
+
--summary [string] Enter summary (default: "More information about this app goes here")
|
|
57
|
+
--category [string] Enter category (default: "")
|
|
58
|
+
--website [string] Enter website (default: "https://www.oandgexample.com/my-app/")
|
|
59
|
+
--segments Choose segments (choices: "drilling", "completion")
|
|
60
|
+
--runtime Choose runtime (choices: "ui", "nodejs16.x", "python3.8", "python3.9")
|
|
61
|
+
-p, --packageManager Please select the desired package manager (choices: "yarn", "npm")
|
|
62
|
+
-t, --useTypescript [boolean] Would you like to use TypesScript? (default: false)
|
|
63
|
+
--silent [boolean] Only log result of the operation (default: false)
|
|
64
|
+
--no-dependencies-install Skip installing dependencies
|
|
65
|
+
--no-git-init Skip initializing git repository
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Examples
|
|
69
|
+
|
|
70
|
+
#### Create a UI application
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
create-corva-app test --appName "Test" --segments "drilling" --category "wellDesign" --appKey "some-company.test.ui" --appType "ui" --runtime "ui"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### Create a NodeJs TypeScript application
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
create-corva-app test --appName "Test" --segments "drilling" --category "wellDesign" --appKey "some-company.test.scheduler" --appType "scheduler" --runtime "nodejs12.x" -t
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### Create a Python application
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
create-corva-app test --appName "Test" --segments "drilling" --category "analytics" --appKey "some-company.test.stream" --appType "stream" --runtime "python3.8"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Zip
|
|
89
|
+
|
|
90
|
+
To create a zip that contains app ready to be deployed to Corva use `zip` command.
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
Usage: create-corva-app zip [options] <project-directory> [patterns...]
|
|
94
|
+
|
|
95
|
+
Bundle app
|
|
96
|
+
|
|
97
|
+
Arguments:
|
|
98
|
+
project-directory Project directory to work with
|
|
99
|
+
patterns Additional patterns to zip (default: [])
|
|
100
|
+
|
|
101
|
+
Options:
|
|
102
|
+
--bump-version <string> Bump version (choices: "major", "minor", "patch", "skip")
|
|
103
|
+
--ignored-files [ignoredFiles...] Patterns to skip zip
|
|
104
|
+
--silent [boolean] Only log result of the operation (default: false)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### What is getting zipped?
|
|
108
|
+
|
|
109
|
+
By default next files will be included.
|
|
110
|
+
|
|
111
|
+
For `frontend` apps:
|
|
112
|
+
|
|
113
|
+
- `manifest.json`
|
|
114
|
+
- `package.json`
|
|
115
|
+
- `yarn.lock`
|
|
116
|
+
- `.npmrc`
|
|
117
|
+
- `config-overrides.js`
|
|
118
|
+
- all files under `src`
|
|
119
|
+
- `tsconfig.json`
|
|
120
|
+
|
|
121
|
+
For apps that written in `node`:
|
|
122
|
+
|
|
123
|
+
- `manifest.json`
|
|
124
|
+
- `package.json`
|
|
125
|
+
- either `package-lock.json` or `yarn.lock`
|
|
126
|
+
- all files under `config` folder
|
|
127
|
+
- all `*.js` files under `src` and `lib` folders (if `typescript` is not used)
|
|
128
|
+
- `tsconfig.json`, `tsconfig.build.json` (if `typescript` is used)
|
|
129
|
+
- all `*.ts` files under `src` and `lib` folders (if `typescript` is used)
|
|
130
|
+
|
|
131
|
+
For apps that written in `python`:
|
|
132
|
+
|
|
133
|
+
- `manifest.json`
|
|
134
|
+
- `requirements.txt`
|
|
135
|
+
- all `*.py` files
|
|
136
|
+
|
|
137
|
+
If you want to zip some files that are not included pass that as `patterns` arguments.
|
|
138
|
+
To skip some files from zipping please use `--ignored-files` option.
|
|
139
|
+
|
|
140
|
+
### Examples
|
|
141
|
+
|
|
142
|
+
#### Create a zip file from the content of `test-app` folder & put zip file in it.
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
create-corva-app zip test-app
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Create a zip file & automatically bump version
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
create-corva-app zip test-app --bump-version=patch
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### Create a zip file from the content of `test-app` folder with custom content ([globs](<https://en.wikipedia.org/wiki/Glob_(programming)>) are supported)
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
create-corva-app zip test-app some/missing/file1 some/other/missing/file2 all/files/*.glob
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Release
|
|
161
|
+
|
|
162
|
+
To push app to Corva use `release` command.
|
|
163
|
+
|
|
164
|
+
```sh
|
|
165
|
+
Usage: create-corva-app release [options] <project-directory> [patterns...]
|
|
166
|
+
|
|
167
|
+
Release app
|
|
168
|
+
|
|
169
|
+
Arguments:
|
|
170
|
+
project-directory Project directory to work with
|
|
171
|
+
patterns Additional patterns to zip (default: [])
|
|
172
|
+
|
|
173
|
+
Options:
|
|
174
|
+
--bump-version <string> Bump version (choices: "major", "minor", "patch", "skip")
|
|
175
|
+
--ignored-files [string...] Patterns to skip zip (default: [])
|
|
176
|
+
--env [string] Environment to use (choices: "qa", "staging", "production", default: "qa")
|
|
177
|
+
--api-key [string] Pre generated API key for authorization during app upload
|
|
178
|
+
--app-key [string] Explicitly set appKey that CLI is going to use. Otherwise it will be taken from manifest.json file. [works only for Front-End apps currently]
|
|
179
|
+
--notes [string] Add custom notes to published app
|
|
180
|
+
--label [string] Put a label on the release (choices: "DEV", "BETA", "PROD")
|
|
181
|
+
--remove-on-fail [boolean] Remove release if it fails during deployment (default: false)
|
|
182
|
+
--silent [boolean] Only log result of the operation (default: false)
|
|
183
|
+
--remove-on-success App package (.zip) will not be deleted after upload (default: true)
|
|
184
|
+
--remove-existing [boolean] If package.json version is already taken - remove the previously published package and upload a new one (default: false)
|
|
185
|
+
--author [string] Author name for the audit
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Examples
|
|
189
|
+
|
|
190
|
+
#### Make a release with ask for version
|
|
191
|
+
|
|
192
|
+
```sh
|
|
193
|
+
create-corva-app release test-app
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### Make a release without version increase
|
|
197
|
+
|
|
198
|
+
```sh
|
|
199
|
+
create-corva-app release test-app --bump-version=skip
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Make a release with increased version
|
|
203
|
+
|
|
204
|
+
```sh
|
|
205
|
+
create-corva-app release test-app --bump-version=patch
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
#### Make a release with custom version
|
|
209
|
+
|
|
210
|
+
```sh
|
|
211
|
+
create-corva-app release test-app --bump-version=4.2.0
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### Make a release with author option(by default it will use your GitHub username)
|
|
215
|
+
|
|
216
|
+
```sh
|
|
217
|
+
create-corva-app release test-app --author=MyName
|
|
218
|
+
```
|
package/bin/cca.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { sync: spawnSync } = require('cross-spawn');
|
|
4
|
+
|
|
5
|
+
const cmd = 'node';
|
|
6
|
+
const originalCwd = process.cwd();
|
|
7
|
+
|
|
8
|
+
process.chdir(__dirname);
|
|
9
|
+
|
|
10
|
+
const args = ['--no-warnings', '--experimental-json-modules', 'cca.js']
|
|
11
|
+
.concat(process.argv.slice(2))
|
|
12
|
+
.concat(['--original-cwd', originalCwd]);
|
|
13
|
+
|
|
14
|
+
const { signal, status, error } = spawnSync(cmd, args, {
|
|
15
|
+
stdio: 'inherit',
|
|
16
|
+
shell: false,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (signal) {
|
|
20
|
+
process.exit(signal);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (status || error) {
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
package/common/node/.env
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
API_KEY=
|
|
2
|
+
APP_KEY=${APP_KEY}
|
|
3
|
+
APP_NAME=${APP_NAME}
|
|
4
|
+
PROVIDER=${PROVIDER}
|
|
5
|
+
|
|
6
|
+
API_ROOT_URL=https://api.corva.ai
|
|
7
|
+
DATA_API_ROOT_URL=https://data.corva.ai
|
|
8
|
+
CACHE_URL=redis://localhost:6379
|
|
9
|
+
|
|
10
|
+
LOG_LEVEL=debug
|
|
11
|
+
LOG_THRESHOLD_MESSAGE_SIZE=99999
|
|
12
|
+
LOG_THRESHOLD_MESSAGE_COUNT=99999
|
|
13
|
+
|
|
14
|
+
ENVIRONMENT=development
|
|
15
|
+
NODE_ENV=development
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Corva API key to perform actions with the API
|
|
2
|
+
API_KEY=
|
|
3
|
+
# Unique ID of the app
|
|
4
|
+
APP_KEY=
|
|
5
|
+
# Human readable name of the app
|
|
6
|
+
APP_NAME=
|
|
7
|
+
# Company identifier
|
|
8
|
+
PROVIDER=
|
|
9
|
+
|
|
10
|
+
# Root URL for Corva API
|
|
11
|
+
API_ROOT_URL=
|
|
12
|
+
# Root URL for Corva Data API
|
|
13
|
+
DATA_API_ROOT_URL=
|
|
14
|
+
# Redis cache url for caching data in Stream/Scheduler apps
|
|
15
|
+
CACHE_URL=
|
|
16
|
+
|
|
17
|
+
# Logging configuration, see https://corva-ai.github.io/node-sdk/docs/v7.2.0/classes/CorvaLogger
|
|
18
|
+
LOG_LEVEL=debug
|
|
19
|
+
LOG_THRESHOLD_MESSAGE_SIZE=99999
|
|
20
|
+
LOG_THRESHOLD_MESSAGE_COUNT=99999
|
|
21
|
+
|
|
22
|
+
# Working environment
|
|
23
|
+
ENVIRONMENT=development
|
|
24
|
+
|
|
25
|
+
# nodejs-specific settings
|
|
26
|
+
NODE_ENV=development
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
lerna-debug.log*
|
|
8
|
+
.pnpm-debug.log*
|
|
9
|
+
|
|
10
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
+
|
|
13
|
+
# Runtime data
|
|
14
|
+
pids
|
|
15
|
+
*.pid
|
|
16
|
+
*.seed
|
|
17
|
+
*.pid.lock
|
|
18
|
+
|
|
19
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
20
|
+
lib-cov
|
|
21
|
+
|
|
22
|
+
# Coverage directory used by tools like istanbul
|
|
23
|
+
coverage
|
|
24
|
+
*.lcov
|
|
25
|
+
|
|
26
|
+
# nyc test coverage
|
|
27
|
+
.nyc_output
|
|
28
|
+
|
|
29
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
30
|
+
.grunt
|
|
31
|
+
|
|
32
|
+
# Bower dependency directory (https://bower.io/)
|
|
33
|
+
bower_components
|
|
34
|
+
|
|
35
|
+
# node-waf configuration
|
|
36
|
+
.lock-wscript
|
|
37
|
+
|
|
38
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
39
|
+
build/Release
|
|
40
|
+
|
|
41
|
+
# Dependency directories
|
|
42
|
+
node_modules/
|
|
43
|
+
jspm_packages/
|
|
44
|
+
|
|
45
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
|
46
|
+
web_modules/
|
|
47
|
+
|
|
48
|
+
# TypeScript cache
|
|
49
|
+
*.tsbuildinfo
|
|
50
|
+
|
|
51
|
+
# Optional npm cache directory
|
|
52
|
+
.npm
|
|
53
|
+
|
|
54
|
+
# Optional eslint cache
|
|
55
|
+
.eslintcache
|
|
56
|
+
|
|
57
|
+
# Optional stylelint cache
|
|
58
|
+
.stylelintcache
|
|
59
|
+
|
|
60
|
+
# Microbundle cache
|
|
61
|
+
.rpt2_cache/
|
|
62
|
+
.rts2_cache_cjs/
|
|
63
|
+
.rts2_cache_es/
|
|
64
|
+
.rts2_cache_umd/
|
|
65
|
+
|
|
66
|
+
# Optional REPL history
|
|
67
|
+
.node_repl_history
|
|
68
|
+
|
|
69
|
+
# Output of 'npm pack'
|
|
70
|
+
*.tgz
|
|
71
|
+
|
|
72
|
+
# Yarn Integrity file
|
|
73
|
+
.yarn-integrity
|
|
74
|
+
|
|
75
|
+
# dotenv environment variable files
|
|
76
|
+
.env
|
|
77
|
+
.env.development.local
|
|
78
|
+
.env.test.local
|
|
79
|
+
.env.production.local
|
|
80
|
+
.env.local
|
|
81
|
+
|
|
82
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
83
|
+
.cache
|
|
84
|
+
.parcel-cache
|
|
85
|
+
|
|
86
|
+
# Next.js build output
|
|
87
|
+
.next
|
|
88
|
+
out
|
|
89
|
+
|
|
90
|
+
# Nuxt.js build / generate output
|
|
91
|
+
.nuxt
|
|
92
|
+
dist
|
|
93
|
+
|
|
94
|
+
# Gatsby files
|
|
95
|
+
.cache/
|
|
96
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
97
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
98
|
+
# public
|
|
99
|
+
|
|
100
|
+
# vuepress build output
|
|
101
|
+
.vuepress/dist
|
|
102
|
+
|
|
103
|
+
# vuepress v2.x temp and cache directory
|
|
104
|
+
.temp
|
|
105
|
+
.cache
|
|
106
|
+
|
|
107
|
+
# Docusaurus cache and generated files
|
|
108
|
+
.docusaurus
|
|
109
|
+
|
|
110
|
+
# Serverless directories
|
|
111
|
+
.serverless/
|
|
112
|
+
|
|
113
|
+
# FuseBox cache
|
|
114
|
+
.fusebox/
|
|
115
|
+
|
|
116
|
+
# DynamoDB Local files
|
|
117
|
+
.dynamodb/
|
|
118
|
+
|
|
119
|
+
# TernJS port file
|
|
120
|
+
.tern-port
|
|
121
|
+
|
|
122
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
123
|
+
.vscode-test
|
|
124
|
+
|
|
125
|
+
# yarn v2
|
|
126
|
+
.yarn/cache
|
|
127
|
+
.yarn/unplugged
|
|
128
|
+
.yarn/build-state.yml
|
|
129
|
+
.yarn/install-state.gz
|
|
130
|
+
.pnp.*
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.PHONY: default install bundle release test
|
|
2
|
+
.DEFAULT_GOAL := default
|
|
3
|
+
|
|
4
|
+
default: install
|
|
5
|
+
install: prepare-venv
|
|
6
|
+
@. venv/bin/activate && pip install -r requirements.txt
|
|
7
|
+
prepare-venv:
|
|
8
|
+
@which python3 > /dev/null || (echo "python3 not found, please install it first" && exit 1;)
|
|
9
|
+
@test -d venv || python3 -m venv venv
|
|
10
|
+
bundle:
|
|
11
|
+
@create-corva-app zip . --bump-version=skip
|
|
12
|
+
release:
|
|
13
|
+
@create-corva-app release . --bump-version=skip
|
|
14
|
+
test: prepare-venv
|
|
15
|
+
@. venv/bin/activate && pytest
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
158
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
159
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
160
|
+
#.idea/
|
|
161
|
+
venv
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { ERROR_ICON } from '../constants/messages.js';
|
|
4
|
+
import { runFlow } from '../flow.js';
|
|
5
|
+
import { ATTACH_FLOW } from '../flows/attach.js';
|
|
6
|
+
import { getRealWorkingDir } from '../helpers/commands.js';
|
|
7
|
+
import { apiKeyOption } from '../options/api-key.js';
|
|
8
|
+
import { appVersion } from '../options/app-version.js';
|
|
9
|
+
import { envOption } from '../options/env.js';
|
|
10
|
+
import { originalCwdOption } from '../options/original-cwd.js';
|
|
11
|
+
import { silentOption } from '../options/silent.js';
|
|
12
|
+
|
|
13
|
+
export const attachCommand = new Command('attach')
|
|
14
|
+
.description('Add app to live assets streams')
|
|
15
|
+
.argument('<project-directory>', 'Project directory to work with')
|
|
16
|
+
.addOption(apiKeyOption)
|
|
17
|
+
.addOption(envOption)
|
|
18
|
+
.addOption(silentOption)
|
|
19
|
+
.addOption(appVersion)
|
|
20
|
+
.addOption(originalCwdOption)
|
|
21
|
+
.action(async (dirName, options) => {
|
|
22
|
+
await runFlow(ATTACH_FLOW, { dirName: getRealWorkingDir(dirName, options), options });
|
|
23
|
+
})
|
|
24
|
+
.showHelpAfterError()
|
|
25
|
+
.showSuggestionAfterError(true)
|
|
26
|
+
.configureOutput({
|
|
27
|
+
outputError: (str, write) => write(chalk.red(`${ERROR_ICON} ${str}`)),
|
|
28
|
+
});
|