@corva/create-app 0.42.0-0 → 0.42.0-2

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.
Files changed (32) hide show
  1. package/README.md +2 -0
  2. package/lib/bump-version.option.js +12 -5
  3. package/lib/flow.js +1 -1
  4. package/lib/flows/attach.js +8 -0
  5. package/lib/flows/lib/api.js +109 -79
  6. package/lib/flows/lib/notification.js +139 -0
  7. package/lib/flows/lib/waitForMs.js +1 -1
  8. package/lib/flows/release.js +1 -1
  9. package/lib/flows/steps/attach/add-app-to-stream.js +24 -0
  10. package/lib/flows/steps/attach/get-all-live-assets.js +142 -0
  11. package/lib/flows/steps/attach/index.js +9 -0
  12. package/lib/flows/steps/attach/prepare-data.js +20 -0
  13. package/lib/flows/steps/release/add-label.js +2 -3
  14. package/lib/flows/steps/release/add-notes.js +2 -2
  15. package/lib/flows/steps/release/get-config.js +4 -1
  16. package/lib/flows/steps/release/prepare-data.js +3 -3
  17. package/lib/flows/steps/release/publish.js +6 -4
  18. package/lib/flows/steps/release/remove-failed-upload.js +18 -7
  19. package/lib/flows/steps/release/upload-zip-to-corva.js +9 -6
  20. package/lib/flows/steps/release/wait-for-build.js +4 -4
  21. package/lib/flows/steps/rerun/create-task.js +12 -15
  22. package/lib/flows/steps/rerun/ensure-that-app-in-stream.js +33 -25
  23. package/lib/flows/steps/rerun/get-app-version.js +14 -12
  24. package/lib/flows/steps/rerun/prepare-data.js +6 -8
  25. package/lib/flows/steps/rerun/prepare-well-and-stream-data.js +29 -36
  26. package/lib/flows/steps/rerun/rerun.js +5 -5
  27. package/lib/helpers/logger.js +22 -22
  28. package/lib/main.js +61 -31
  29. package/package.json +4 -3
  30. package/templates/python/scheduler/README.md +1 -1
  31. package/templates/python/stream/README.md +1 -1
  32. package/templates/python/task/README.md +1 -1
package/lib/main.js CHANGED
@@ -7,11 +7,7 @@ import os from 'node:os';
7
7
  import path from 'node:path';
8
8
  import semver from 'semver';
9
9
 
10
- import {
11
- ensureLatestVersion,
12
- warnIfOutdated,
13
- ensureBumpVersion,
14
- } from './scripts/utils/version.js';
10
+ import { ensureLatestVersion, warnIfOutdated, ensureBumpVersion } from './scripts/utils/version.js';
15
11
  import * as utils from './helpers/utils.js';
16
12
  import * as manifestHelpers from './helpers/manifest.js';
17
13
  import * as versioning from './helpers/versioning.js';
@@ -27,8 +23,15 @@ import { ERROR_ICON } from './constants/messages.js';
27
23
  import { StepError } from './flows/lib/step-error.js';
28
24
  import { RELEASE_FLOW } from './flows/release.js';
29
25
  import { RERUN_FLOW } from './flows/rerun.js';
26
+ import { ATTACH_FLOW } from './flows/attach.js';
30
27
  import { ZIP_FLOW } from './flows/zip.js';
31
- import { bumpVersionOptionDeprecated, bumpVersionOption, apiKeyOption, envOption, silentOption } from './bump-version.option.js';
28
+ import {
29
+ bumpVersionOption,
30
+ apiKeyOption,
31
+ envOption,
32
+ silentOption,
33
+ appVersion,
34
+ } from './bump-version.option.js';
32
35
  import { Manifest } from './flows/lib/manifest.js';
33
36
  import { resolveAppRuntime } from './helpers/resolve-app-runtime.js';
34
37
  import { existsSync } from 'node:fs';
@@ -44,13 +47,15 @@ const writejsonOptions = {
44
47
  EOL: os.EOL,
45
48
  };
46
49
 
47
- const silencer = handler => async (...args) => {
48
- const result = await handler(...args);
50
+ const silencer =
51
+ (handler) =>
52
+ async (...args) => {
53
+ const result = await handler(...args);
49
54
 
50
- if (args[args.length - 2].silent && result) {
51
- console.log(result);
52
- }
53
- }
55
+ if (args[args.length - 2].silent && result) {
56
+ console.log(result);
57
+ }
58
+ };
54
59
 
55
60
  function startingMessage() {
56
61
  clear();
@@ -66,7 +71,7 @@ function checkNodeVersion() {
66
71
  logger.log(
67
72
  chalk.red(
68
73
  `\nYou are using Node ${process.version}.\n\n` +
69
- `Please update to Node 16 or higher for a better, fully supported experience.\n`
74
+ `Please update to Node 16 or higher for a better, fully supported experience.\n`
70
75
  )
71
76
  );
72
77
  // Fall back to latest supported react-scripts on Node 4
@@ -96,7 +101,7 @@ function checkOptions(opts) {
96
101
  const printDeprecationNotice = (param) =>
97
102
  console.warn(
98
103
  chalk.bgYellowBright`DEPRECATED OPTION: ${param}` +
99
- ` Use ${chalk.cyan(`create-corva-app ${param} .`)} instead`
104
+ ` Use ${chalk.cyan(`create-corva-app ${param} .`)} instead`
100
105
  );
101
106
 
102
107
  export async function run() {
@@ -118,9 +123,10 @@ export async function run() {
118
123
  manifestConstants.manifestOptions().forEach((value) => {
119
124
  const type = typeof value.default;
120
125
  const option = new Option(
121
- `${value.alias ? `-${value.alias}, ` : ''}--${value.name} [${(type !== 'undefined' && type) || 'string'
126
+ `${value.alias ? `-${value.alias}, ` : ''}--${value.name} [${
127
+ (type !== 'undefined' && type) || 'string'
122
128
  }]`,
123
- value.message,
129
+ value.message
124
130
  );
125
131
 
126
132
  if (value.choices) {
@@ -144,8 +150,7 @@ export async function run() {
144
150
  createCommand.addOption(option);
145
151
  });
146
152
 
147
- createCommand
148
- .version(packageJson.version)
153
+ createCommand.version(packageJson.version);
149
154
 
150
155
  createCommand.action(async (dirName, options) => {
151
156
  if (options.zip || options.release) {
@@ -166,11 +171,13 @@ export async function run() {
166
171
  .addOption(bumpVersionOption)
167
172
  .addOption(new Option('--ignored-files [ignoredFiles...]', 'Patterns to skip zip', []))
168
173
  .addOption(silentOption)
169
- .action(silencer(async (dirName, patterns, options) => {
170
- options.bumpVersion = await ensureBumpVersion(options.bumpVersion);
174
+ .action(
175
+ silencer(async (dirName, patterns, options) => {
176
+ options.bumpVersion = await ensureBumpVersion(options.bumpVersion);
171
177
 
172
- return runFlow(ZIP_FLOW, { dirName, patterns, options }).then(_.get('zipFileName'))
173
- }));
178
+ return runFlow(ZIP_FLOW, { dirName, patterns, options }).then(_.get('zipFileName'));
179
+ })
180
+ );
174
181
 
175
182
  program
176
183
  .command('release')
@@ -183,8 +190,21 @@ export async function run() {
183
190
  .addOption(envOption)
184
191
  .addOption(apiKeyOption)
185
192
  .addOption(new Option('--notes [string]', 'Add custom notes to published app'))
186
- .addOption(new Option('--label [string]', 'Put a label on the release').choices(['BETA', 'PROD']))
187
- .addOption(new Option('--remove-on-fail [boolean]', 'Remove release if it fails during deployment').default(false))
193
+ .addOption(
194
+ new Option('--label [string]', 'Put a label on the release').choices(['BETA', 'PROD'])
195
+ )
196
+ .addOption(
197
+ new Option(
198
+ '--remove-on-fail [boolean]',
199
+ 'Remove release if it fails during deployment'
200
+ ).default(false)
201
+ )
202
+ .addOption(
203
+ new Option(
204
+ '--remove-on-success [boolean]',
205
+ 'App package (.zip) will not be deleted after upload'
206
+ ).default(true)
207
+ )
188
208
  // .addOption(new Option('--zip-file-name [string]', 'Prebuilt zip file name in dir'))
189
209
  .action(async (dirName, patterns, options) => {
190
210
  options.bumpVersion = await ensureBumpVersion(options.bumpVersion);
@@ -199,13 +219,25 @@ export async function run() {
199
219
  .addOption(apiKeyOption)
200
220
  .addOption(envOption)
201
221
  .addOption(silentOption)
222
+ .addOption(appVersion)
202
223
  .addOption(new Option('--assets [assets...]', 'Assets ids list', []))
203
- .addOption(new Option('--app-version [number]', 'App version (exp. 1, 2, 3)'))
204
224
  .addOption(new Option('--interval [number]', 'Interval for scheduler apps (exp. 1200)'))
205
225
  .action(async (dirName, options) => {
206
226
  await runFlow(RERUN_FLOW, { dirName, options });
207
227
  });
208
228
 
229
+ program
230
+ .command('attach')
231
+ .description('Add app to live assets streams')
232
+ .argument('<project-directory>', 'Project directory to work with')
233
+ .addOption(apiKeyOption)
234
+ .addOption(envOption)
235
+ .addOption(silentOption)
236
+ .addOption(appVersion)
237
+ .action(async (dirName, options) => {
238
+ await runFlow(ATTACH_FLOW, { dirName, options });
239
+ });
240
+
209
241
  try {
210
242
  await program.parseAsync(process.argv);
211
243
  } catch (e) {
@@ -248,9 +280,7 @@ const handleCommanderError = (e) => {
248
280
  );
249
281
  logger.log();
250
282
  logger.log('For example:');
251
- logger.log(
252
- ` ${chalk.cyan(program.name())} ${commandName} ${chalk.green('my-react-app')}`
253
- );
283
+ logger.log(` ${chalk.cyan(program.name())} ${commandName} ${chalk.green('my-react-app')}`);
254
284
  logger.log();
255
285
  logger.log(
256
286
  `Run ${chalk.cyan(`${program.name()} help ${commandName}`)} to see all options.`
@@ -477,9 +507,9 @@ async function installApp(root, manifest, runtime) {
477
507
  const proc =
478
508
  manifest.isJs() && existsSync(`${os.homedir()}/.nvm/nvm.sh`)
479
509
  ? spawn.sync(`\\. ${os.homedir()}/.nvm/nvm.sh && nvm i && ${command} ${args.join(' ')}`, {
480
- shell: true,
481
- ...opts,
482
- })
510
+ shell: true,
511
+ ...opts,
512
+ })
483
513
  : spawn.sync(command, args, opts);
484
514
 
485
515
  if (proc.stderr) {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@corva/create-app",
3
- "version": "0.42.0-0",
3
+ "version": "0.42.0-2",
4
4
  "private": false,
5
- "description": "Create app to use it in CORVA.AI",
5
+ "description": "Create an app to use it in CORVA.AI",
6
6
  "keywords": [
7
7
  "react"
8
8
  ],
@@ -49,7 +49,8 @@
49
49
  "is-glob": "^4.0.3",
50
50
  "lodash": "^4.17.21",
51
51
  "npm-api": "^1.0.0",
52
- "semver": "7.3.2"
52
+ "semver": "7.3.2",
53
+ "terminal-link": "^3.0.0"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@corva/eslint-config-browser": "^0.0.4",
@@ -7,7 +7,7 @@
7
7
  ### 1. Install
8
8
 
9
9
  You need to have `make` installed:
10
-
10
+
11
11
  - Windows: [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install)
12
12
  - OS X: [Command Line Tools for Xcode](https://developer.apple.com/download/more/)
13
13
  - Linux: refer to your distro-specific docs
@@ -7,7 +7,7 @@
7
7
  ### 1. Install
8
8
 
9
9
  You need to have `make` installed:
10
-
10
+
11
11
  - Windows: [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install)
12
12
  - OS X: [Command Line Tools for Xcode](https://developer.apple.com/download/more/)
13
13
  - Linux: refer to your distro-specific docs
@@ -7,7 +7,7 @@
7
7
  ### 1. Install
8
8
 
9
9
  You need to have `make` installed:
10
-
10
+
11
11
  - Windows: [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install)
12
12
  - OS X: [Command Line Tools for Xcode](https://developer.apple.com/download/more/)
13
13
  - Linux: refer to your distro-specific docs