@corva/create-app 0.40.0-0 → 0.41.0-1
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 +19 -17
- package/bin/cca.js +5 -0
- package/bin/create-corva-app.cjs +14 -0
- package/lib/bump-version.option.js +17 -8
- package/lib/constants/cli.js +5 -11
- package/lib/constants/manifest.js +15 -22
- package/lib/constants/messages.js +4 -10
- package/lib/constants/package.js +6 -8
- package/lib/flow.js +16 -13
- package/lib/flows/lib/api.js +153 -84
- package/lib/flows/lib/create-zip-archive.js +7 -7
- package/lib/flows/lib/json.js +8 -8
- package/lib/flows/lib/manifest.js +5 -7
- package/lib/flows/lib/step-error.js +1 -3
- package/lib/flows/prepare.js +2 -4
- package/lib/flows/release.js +18 -10
- package/lib/flows/rerun.js +5 -7
- package/lib/flows/steps/prepare-load-app-files.js +3 -7
- package/lib/flows/steps/release/add-label.js +11 -0
- package/lib/flows/steps/release/add-notes.js +10 -0
- package/lib/flows/steps/release/get-config.js +37 -0
- package/lib/flows/steps/release/prepare-data.js +10 -0
- package/lib/flows/steps/release/publish.js +9 -0
- package/lib/flows/steps/release/remove-failed-upload.js +20 -0
- package/lib/flows/steps/release/upload-zip-to-corva.js +25 -0
- package/lib/flows/steps/release/wait-for-build.js +29 -0
- package/lib/flows/steps/rerun-create-task.js +22 -15
- package/lib/flows/steps/rerun-prepare-data.js +150 -127
- package/lib/flows/steps/rerun.js +3 -7
- package/lib/flows/steps/zip-cleanup.js +6 -6
- package/lib/flows/steps/zip-create-archive.js +5 -5
- package/lib/flows/steps/zip-file-list-resolve.js +34 -29
- package/lib/flows/steps/zip-prepare.js +7 -8
- package/lib/flows/steps/zip.js +5 -9
- package/lib/flows/zip-simple.js +2 -4
- package/lib/flows/zip.js +3 -5
- package/lib/helpers/logger.js +35 -0
- package/lib/helpers/manifest.js +6 -10
- package/lib/helpers/resolve-app-runtime.js +47 -45
- package/lib/helpers/utils.js +4 -9
- package/lib/helpers/versioning.js +8 -13
- package/lib/{index.js → main.js} +118 -116
- package/lib/scripts/utils/version.js +12 -13
- package/package.json +5 -3
- package/bin/create-corva-app.js +0 -5
- package/lib/app.js +0 -9
- package/lib/flows/steps/release-get-app-key.js +0 -16
- package/lib/flows/steps/release-get-config.js +0 -37
- package/lib/flows/steps/release-upload-zip-to-corva.js +0 -25
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Apps generator for [corva.ai](https://corva.ai).
|
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
|
-
- NodeJs
|
|
7
|
+
- NodeJs >= 16.14.0 (https://nodejs.org/en/download/)
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -46,25 +46,20 @@ Options:
|
|
|
46
46
|
--appKey [string] Enter the App Key (default: "app.key-goes-here")
|
|
47
47
|
--appName [string] Enter the App Name
|
|
48
48
|
--appType [string] Choose the App Type (choices: "ui", "scheduler", "stream", "task", default: "ui")
|
|
49
|
-
--bump-version <string> DEPRECATED Use with zip or release command instead (choices: "major", "minor", "patch", "skip")
|
|
50
49
|
--category [string] Enter category (default: "")
|
|
51
50
|
--cronString [string] Provide CRON string for the scheduler (default: "*/5 * * * *")
|
|
52
51
|
--depthMilestone [number] Provide depth milestone for the scheduler (default: 1)
|
|
53
52
|
--description [string] Enter description (default: "This is the description of my app. You can do great things with it!")
|
|
54
53
|
--developerIdentifier [string] Enter the Developer Identifier (default: "oandgc")
|
|
55
54
|
--developerName [string] Enter the Developer Name (default: "O&G Company")
|
|
56
|
-
--
|
|
57
|
-
--release DEPRECATED Use release command instead
|
|
58
|
-
--runtime [string] Choose runtime (choices: "ui", "nodejs12.x", "nodejs14.x", "python3.8")
|
|
55
|
+
--runtime [string] Choose runtime (choices: "ui", "nodejs16.x", "python3.8")
|
|
59
56
|
--schedulerType [number] Choose the scheduler type (choices: "1", "2", "4", default: 1)
|
|
60
57
|
--segments [string] Choose segments (choices: "drilling", "completion")
|
|
61
58
|
--summary [string] Enter summary (default: "More information about this app goes here")
|
|
62
59
|
--website [string] Enter website (default: "https://www.oandgexample.com/my-app/")
|
|
63
|
-
-V, --version output the version number
|
|
64
|
-
-h, --help display help for command
|
|
65
60
|
-p, --packageManager [string] Please select the desired package manager (choices: "yarn", "npm", default: "yarn")
|
|
66
61
|
-t, --useTypescript [boolean] Would you like to use TypesScript? (default: false)
|
|
67
|
-
|
|
62
|
+
--silent [boolean] Only log result of the operation (default: false)
|
|
68
63
|
```
|
|
69
64
|
|
|
70
65
|
### Examples
|
|
@@ -97,12 +92,13 @@ Usage: create-corva-app zip [options] <project-directory> [patterns...]
|
|
|
97
92
|
Bundle app
|
|
98
93
|
|
|
99
94
|
Arguments:
|
|
100
|
-
project-directory
|
|
101
|
-
patterns
|
|
95
|
+
project-directory Project directory to work with
|
|
96
|
+
patterns Additional patterns to zip (default: [])
|
|
102
97
|
|
|
103
98
|
Options:
|
|
104
|
-
--bump-version <string>
|
|
105
|
-
-
|
|
99
|
+
--bump-version <string> Bump version (choices: "major", "minor", "patch", "skip")
|
|
100
|
+
--ignored-files [ignoredFiles...] Patterns to skip zip
|
|
101
|
+
--silent [boolean] Only log result of the operation (default: false)
|
|
106
102
|
```
|
|
107
103
|
|
|
108
104
|
### What is getting zipped?
|
|
@@ -168,12 +164,18 @@ Usage: create-corva-app release [options] <project-directory> [patterns...]
|
|
|
168
164
|
Release app
|
|
169
165
|
|
|
170
166
|
Arguments:
|
|
171
|
-
project-directory
|
|
172
|
-
patterns
|
|
167
|
+
project-directory Project directory to work with
|
|
168
|
+
patterns Additional patterns to zip (default: [])
|
|
173
169
|
|
|
174
170
|
Options:
|
|
175
|
-
--bump-version <string>
|
|
176
|
-
-
|
|
171
|
+
--bump-version <string> Bump version (choices: "major", "minor", "patch", "skip")
|
|
172
|
+
--ignored-files [string...] Patterns to skip zip (default: [])
|
|
173
|
+
--env [string] Environment to use (choices: "qa", "staging", "production", default: "qa")
|
|
174
|
+
--api-key [string] Pre generated API key for authorization during app upload
|
|
175
|
+
--notes [string] Add custom notes to published app
|
|
176
|
+
--label [string] Put a label on the release (choices: "BETA", "STABLE")
|
|
177
|
+
--remove-on-fail [boolean] Remove release if it fails during deployment (default: false)
|
|
178
|
+
--silent [boolean] Only log result of the operation (default: false)
|
|
177
179
|
```
|
|
178
180
|
|
|
179
181
|
### Examples
|
|
@@ -200,4 +202,4 @@ create-corva-app release test-app --bump-version=patch
|
|
|
200
202
|
|
|
201
203
|
```sh
|
|
202
204
|
create-corva-app release test-app --bump-version=4.2.0
|
|
203
|
-
```
|
|
205
|
+
```
|
package/bin/cca.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require('child_process');
|
|
4
|
+
const { resolve } = require('path');
|
|
5
|
+
|
|
6
|
+
const cmd = [
|
|
7
|
+
'node',
|
|
8
|
+
'--no-warnings',
|
|
9
|
+
'--experimental-json-modules',
|
|
10
|
+
resolve(__dirname, 'cca.js'),
|
|
11
|
+
...process.argv.slice(2),
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
spawnSync(cmd.join(' '), { stdio: 'inherit', shell: true });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Option, InvalidArgumentError } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import semver from 'semver';
|
|
4
4
|
|
|
5
5
|
const flags = '--bump-version <string>';
|
|
6
6
|
const description = 'Bump version';
|
|
@@ -17,14 +17,23 @@ function argParser(value, previous) {
|
|
|
17
17
|
.join(', ')} or a valid semver version.`
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
|
-
const bumpVersionOption = new Option(flags, description)
|
|
20
|
+
export const bumpVersionOption = new Option(flags, description)
|
|
21
|
+
.choices(choices)
|
|
22
|
+
.argParser(argParser);
|
|
23
|
+
|
|
24
|
+
export const apiKeyOption = new Option('--api-key [string]',
|
|
25
|
+
'Pre generated API key for authorization during app upload')
|
|
21
26
|
|
|
22
|
-
const
|
|
27
|
+
export const envOption = new Option('--env [string]', 'Environment to use')
|
|
28
|
+
.choices(['qa', 'staging', 'production'])
|
|
29
|
+
.default('qa')
|
|
30
|
+
|
|
31
|
+
export const silentOption = new Option('--silent [boolean]', 'Only log result of the operation').default(false)
|
|
32
|
+
|
|
33
|
+
export const bumpVersionOptionDeprecated = new Option(
|
|
23
34
|
flags,
|
|
24
35
|
chalk.bgYellow`DEPRECATED` +
|
|
25
|
-
|
|
36
|
+
` Use with ${chalk.cyan`zip`} or ${chalk.cyan`release`} command instead`
|
|
26
37
|
)
|
|
27
38
|
.choices(choices)
|
|
28
39
|
.argParser(argParser);
|
|
29
|
-
|
|
30
|
-
module.exports = { bumpVersionOption, bumpVersionOptionDeprecated };
|
package/lib/constants/cli.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const APP_RUNTIMES = {
|
|
1
|
+
export const APP_RUNTIMES = {
|
|
2
2
|
UI: 'ui',
|
|
3
|
-
NODE12: 'nodejs12.x',
|
|
4
|
-
NODE14: 'nodejs14.x',
|
|
3
|
+
// NODE12: 'nodejs12.x',
|
|
4
|
+
// NODE14: 'nodejs14.x',
|
|
5
5
|
NODE16: 'nodejs16.x',
|
|
6
6
|
PYTHON3: 'python3.8',
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const TEMPLATE_TYPES = {
|
|
9
|
+
export const TEMPLATE_TYPES = {
|
|
10
10
|
UI: 'js',
|
|
11
11
|
UI_TS: 'ts',
|
|
12
12
|
NODE: 'node',
|
|
@@ -14,15 +14,9 @@ const TEMPLATE_TYPES = {
|
|
|
14
14
|
PYTHON: 'python',
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const APP_TYPES = {
|
|
17
|
+
export const APP_TYPES = {
|
|
18
18
|
UI: 'ui',
|
|
19
19
|
SCHEDULER: 'scheduler',
|
|
20
20
|
STREAM: 'stream',
|
|
21
21
|
TASK: 'task',
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
module.exports = {
|
|
25
|
-
TEMPLATE_TYPES,
|
|
26
|
-
APP_RUNTIMES,
|
|
27
|
-
APP_TYPES,
|
|
28
|
-
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { APP_RUNTIMES, APP_TYPES, TEMPLATE_TYPES } from './cli.js';
|
|
2
2
|
|
|
3
|
-
const defaultManifest = {
|
|
3
|
+
export const defaultManifest = {
|
|
4
4
|
format: 1,
|
|
5
5
|
license: {
|
|
6
6
|
type: 'MIT',
|
|
@@ -32,7 +32,7 @@ const defaultManifest = {
|
|
|
32
32
|
datasets: {},
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
const defaultUIAppManifest = {
|
|
35
|
+
export const defaultUIAppManifest = {
|
|
36
36
|
application: {
|
|
37
37
|
ui: { initial_size: { w: 4, h: 10 } },
|
|
38
38
|
},
|
|
@@ -45,7 +45,7 @@ const defaultUIAppManifest = {
|
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
const defaultDataAppNodeManifest = {
|
|
48
|
+
export const defaultDataAppNodeManifest = {
|
|
49
49
|
settings: {
|
|
50
50
|
entrypoint: {
|
|
51
51
|
file: 'index.js',
|
|
@@ -57,7 +57,7 @@ const defaultDataAppNodeManifest = {
|
|
|
57
57
|
},
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
const defaultDataAppPythonManifest = {
|
|
60
|
+
export const defaultDataAppPythonManifest = {
|
|
61
61
|
settings: {
|
|
62
62
|
entrypoint: {
|
|
63
63
|
file: 'lambda_function',
|
|
@@ -69,7 +69,7 @@ const defaultDataAppPythonManifest = {
|
|
|
69
69
|
},
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
const getManifestMandatoryKeys = (opts) => {
|
|
72
|
+
export const getManifestMandatoryKeys = (opts) => {
|
|
73
73
|
const keys = manifestOptions(opts.projectName).reduce((acc, option) => {
|
|
74
74
|
if (option.required) {
|
|
75
75
|
acc.push(option.name);
|
|
@@ -99,11 +99,11 @@ const getManifestMandatoryKeys = (opts) => {
|
|
|
99
99
|
return keys;
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
-
const SCHEDULER_TYPE_NATURAL_TIME = { name: 'Natural Time', value: 1 };
|
|
103
|
-
const SCHEDULER_TYPE_DATA_TIME = { name: 'Data Time', value: 2 };
|
|
104
|
-
const SCHEDULER_TYPE_DEPTH = { name: 'Date Depth', value: 4 };
|
|
102
|
+
export const SCHEDULER_TYPE_NATURAL_TIME = { name: 'Natural Time', value: 1 };
|
|
103
|
+
export const SCHEDULER_TYPE_DATA_TIME = { name: 'Data Time', value: 2 };
|
|
104
|
+
export const SCHEDULER_TYPE_DEPTH = { name: 'Date Depth', value: 4 };
|
|
105
105
|
|
|
106
|
-
const manifestOptions = (projectName = 'Corva Dev Center App') => [
|
|
106
|
+
export const manifestOptions = (projectName = 'Corva Dev Center App') => [
|
|
107
107
|
{ name: 'developerName', message: 'Enter the Developer Name', default: 'O&G Company' },
|
|
108
108
|
{ name: 'developerIdentifier', message: 'Enter the Developer Identifier', default: 'oandgc' },
|
|
109
109
|
{
|
|
@@ -204,16 +204,9 @@ const manifestOptions = (projectName = 'Corva Dev Center App') => [
|
|
|
204
204
|
(answers.runtime && answers.runtime.startsWith(TEMPLATE_TYPES.NODE)) ||
|
|
205
205
|
answers.appType === APP_TYPES.UI,
|
|
206
206
|
},
|
|
207
|
+
{
|
|
208
|
+
name: 'silent',
|
|
209
|
+
message: 'Only log result of the operation',
|
|
210
|
+
default: false,
|
|
211
|
+
},
|
|
207
212
|
];
|
|
208
|
-
|
|
209
|
-
module.exports = {
|
|
210
|
-
defaultManifest,
|
|
211
|
-
defaultUIAppManifest,
|
|
212
|
-
defaultDataAppNodeManifest,
|
|
213
|
-
defaultDataAppPythonManifest,
|
|
214
|
-
manifestOptions,
|
|
215
|
-
getManifestMandatoryKeys,
|
|
216
|
-
SCHEDULER_TYPE_NATURAL_TIME,
|
|
217
|
-
SCHEDULER_TYPE_DATA_TIME,
|
|
218
|
-
SCHEDULER_TYPE_DEPTH,
|
|
219
|
-
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import chalk from 'chalk';
|
|
2
2
|
|
|
3
|
-
const SUCCESS_ICON = ' ✅ \n';
|
|
4
|
-
const ERROR_ICON = ' ❌ \n';
|
|
3
|
+
export const SUCCESS_ICON = ' ✅ \n';
|
|
4
|
+
export const ERROR_ICON = ' ❌ \n';
|
|
5
5
|
|
|
6
|
-
const RELEASE = {
|
|
6
|
+
export const RELEASE = {
|
|
7
7
|
createZip: 'Creating zip archive...\n',
|
|
8
8
|
createZipError: 'Could not create zip archive.',
|
|
9
9
|
createZipSuccess: `Zip archive has been created ${SUCCESS_ICON}`,
|
|
@@ -13,9 +13,3 @@ const RELEASE = {
|
|
|
13
13
|
getAppKeyError: "Could not find app key. Please make sure it's defined in manifest.json",
|
|
14
14
|
uploadApp: 'Uploading app...',
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
module.exports = {
|
|
18
|
-
RELEASE,
|
|
19
|
-
SUCCESS_ICON,
|
|
20
|
-
ERROR_ICON,
|
|
21
|
-
};
|
package/lib/constants/package.js
CHANGED
|
@@ -129,13 +129,13 @@ const nodeTsYarnPackage = {
|
|
|
129
129
|
scripts: nodeTsYarnScripts,
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
-
const extendWithTsConfig = (
|
|
133
|
-
|
|
132
|
+
const extendWithTsConfig = (packageJson, version) => {
|
|
133
|
+
packageJson.devDependencies = {
|
|
134
134
|
[`@tsconfig/node${version}`]: `^${version === '12' ? '1.0.9' : '1.0.1'}`,
|
|
135
|
-
...
|
|
135
|
+
...packageJson.devDependencies,
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
-
return
|
|
138
|
+
return packageJson;
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
const defaults = {
|
|
@@ -169,8 +169,6 @@ const defaults = {
|
|
|
169
169
|
},
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return defaults[runtime.language][runtime.packageManager][manifest.type](runtime);
|
|
175
|
-
},
|
|
172
|
+
export const getDefaultsForPackageJson = (manifest, runtime) => {
|
|
173
|
+
return defaults[runtime.language][runtime.packageManager][manifest.type](runtime);
|
|
176
174
|
};
|
package/lib/flow.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { SUCCESS_ICON } from './constants/messages.js';
|
|
3
|
+
import { resolve, sep } from 'node:path';
|
|
4
|
+
import { logger } from './helpers/logger.js';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
const { SUCCESS_ICON } = require('./constants/messages');
|
|
5
|
-
const { resolve, sep } = require('path');
|
|
6
|
+
import Debug from 'debug';
|
|
6
7
|
|
|
7
|
-
const debug =
|
|
8
|
+
const debug = Debug('cca:flow');
|
|
8
9
|
|
|
9
|
-
const runFlow = async (flow, context, indent = '') => {
|
|
10
|
-
|
|
11
|
-
`${indent}Running ${chalk.cyan(flow.name)} in ${chalk.cyan(
|
|
10
|
+
export const runFlow = async (flow, context, indent = '') => {
|
|
11
|
+
logger.write(
|
|
12
|
+
`${indent}Running ${chalk.cyan(flow.name)} in ${chalk.cyan(
|
|
13
|
+
resolve(context.dirName).split(sep).pop()
|
|
14
|
+
)}\n`
|
|
12
15
|
);
|
|
13
16
|
|
|
17
|
+
context.progress = () => logger.write('.')
|
|
18
|
+
|
|
14
19
|
const result = await runSteps(flow.steps, context, indent + ' ');
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
logger.write(`${indent}Done!` + SUCCESS_ICON);
|
|
17
22
|
|
|
18
23
|
return result;
|
|
19
24
|
};
|
|
@@ -30,17 +35,15 @@ const runSteps = async (steps = [], context = {}, indent = '') => {
|
|
|
30
35
|
|
|
31
36
|
const message = indent + step.message;
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
logger.write(message);
|
|
34
39
|
debug('Context: %o', context);
|
|
35
40
|
|
|
36
41
|
const result = await step.fn(context);
|
|
37
42
|
|
|
38
43
|
Object.assign(context, result);
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
logger.write(SUCCESS_ICON);
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
return context;
|
|
44
49
|
};
|
|
45
|
-
|
|
46
|
-
module.exports = { runFlow };
|