@corva/create-app 0.0.0-73c49372-test → 0.0.0-types-node

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.
@@ -2,8 +2,10 @@ export const APP_RUNTIMES = {
2
2
  UI: 'ui',
3
3
  // NODE12: 'nodejs12.x',
4
4
  // NODE14: 'nodejs14.x',
5
- NODE16: 'nodejs16.x',
5
+ // NODE16: 'nodejs16.x',
6
6
  NODE18: 'nodejs18.x',
7
+ NODE20: 'nodejs20.x',
8
+ // NODE22: 'nodejs22.x',
7
9
  PYTHON3_8: 'python3.8',
8
10
  PYTHON3_9: 'python3.9',
9
11
  };
@@ -22,3 +24,7 @@ export const APP_TYPES = {
22
24
  STREAM: 'stream',
23
25
  TASK: 'task',
24
26
  };
27
+
28
+ export const APP_EXTENSIONS = {
29
+ CORVA: 'corva',
30
+ };
@@ -1,4 +1,5 @@
1
1
  import _ from 'lodash';
2
+ import { APP_EXTENSIONS } from './cli.js';
2
3
 
3
4
  const uiDependencies = {
4
5
  '@corva/ui': 'latest',
@@ -37,8 +38,10 @@ const jsUiDevDependencies = {
37
38
  const tsUiDevDependencies = {
38
39
  ...jsUiDevDependencies,
39
40
  '@tsconfig/create-react-app': '1.0.2',
41
+ '@types/lodash': '4.17.5',
40
42
  '@types/material-ui': '0.21.9',
41
- '@types/mime': '3',
43
+ '@types/mime': '3.0.1',
44
+ '@types/node': '18.19.47',
42
45
  '@types/react': '^17.0.22',
43
46
  '@types/react-dom': '^17.0.9',
44
47
  '@types/jest': '^27.0.1',
@@ -67,7 +70,7 @@ function applyUiExtension(packageJson, extensionNames) {
67
70
 
68
71
  const extensions = extensionNames
69
72
  .map((extensionName) => {
70
- if (extensionName === 'corva') {
73
+ if (extensionName === APP_EXTENSIONS.CORVA) {
71
74
  return corvaUiExtension;
72
75
  }
73
76
 
@@ -151,17 +154,17 @@ const nodeDependencies = {
151
154
 
152
155
  const nodeDevDependencies = {
153
156
  '@corva/eslint-config-node': '^5.1.1',
154
- 'jest': '^27.5.1',
157
+ 'jest': '^29.7.0',
155
158
  'dotenv': '^16.0.3',
156
159
  'eslint': '^8.2.0',
157
160
  'prettier': '^2.0.0',
158
- 'typescript': '^4.9.4',
161
+ 'typescript': '^5.5.4',
159
162
  };
160
163
 
161
164
  const nodeTsDevDependencies = {
162
165
  ...nodeDevDependencies,
163
- '@types/jest': '^27.4.1',
164
- 'ts-jest': '^27.1.4',
166
+ '@types/jest': '^29.5.12',
167
+ 'ts-jest': '^29.2.4',
165
168
  };
166
169
 
167
170
  const nodeYarnScripts = {
@@ -42,21 +42,15 @@ export class Api {
42
42
  * @returns {object}
43
43
  */
44
44
  async getAppByKey(appKey) {
45
- const { data } = await this.#api
46
- .get('v2/apps', {
47
- searchParams: { per_page: 2, search: appKey },
48
- })
49
- .json();
45
+ const { data } = await this.#api.get(`v2/apps/${appKey}`).json();
50
46
 
51
- const app = data.find((app) => app.attributes.app_key === appKey);
52
-
53
- if (!app) {
47
+ if (!data) {
54
48
  throw new StepError(
55
49
  `App with key - ${appKey}, does not exist.\nThe key search is case-sensitive. You might need to update the app key in your app to exactly match the key.`,
56
50
  );
57
51
  }
58
52
 
59
- return app;
53
+ return data;
60
54
  }
61
55
 
62
56
  /**
@@ -11,7 +11,7 @@ const SCHEDULER_MAPPING = [SCHEDULER_TYPE_DATA_TIME, SCHEDULER_TYPE_DEPTH, SCHED
11
11
  {},
12
12
  );
13
13
 
14
- const NODE_RUNTIMES = [APP_RUNTIMES.NODE16, APP_RUNTIMES.NODE18];
14
+ const NODE_RUNTIMES = [APP_RUNTIMES.NODE18, APP_RUNTIMES.NODE20];
15
15
 
16
16
  export class Manifest {
17
17
  constructor(manifest) {
@@ -5,6 +5,7 @@ import { resolve } from 'node:path';
5
5
  import { RELEASE } from '../../../constants/messages.js';
6
6
  import { StepError } from '../../lib/step-error.js';
7
7
  import { logger } from '../../../helpers/logger.js';
8
+ import { execSync } from 'node:child_process';
8
9
 
9
10
  async function deleteAppPackage({ api, appId, appPkgVersion }) {
10
11
  const appPackages = await api.getAppPackages(appId);
@@ -23,6 +24,37 @@ async function deleteAppPackage({ api, appId, appPkgVersion }) {
23
24
  }
24
25
  }
25
26
 
27
+ async function getGithubUsername() {
28
+ return process.env.githubUsername || null;
29
+ }
30
+
31
+ function getGitConfigUsername() {
32
+ try {
33
+ const username = execSync('git config user.name').toString().trim();
34
+
35
+ return username || null;
36
+ } catch (error) {
37
+ logger.log('Unable to fetch git config username:', error.message);
38
+
39
+ return null;
40
+ }
41
+ }
42
+
43
+ async function promptForUsername() {
44
+ const readline = require('readline');
45
+ const rl = readline.createInterface({
46
+ input: process.stdin,
47
+ output: process.stdout,
48
+ });
49
+
50
+ return new Promise((resolve) => {
51
+ rl.question('Please enter your GitHub username: ', (answer) => {
52
+ rl.close();
53
+ resolve(answer);
54
+ });
55
+ });
56
+ }
57
+
26
58
  export const UPLOAD_ZIP_TO_CORVA_STEP = {
27
59
  message: RELEASE.uploadApp,
28
60
  /**
@@ -36,6 +68,25 @@ export const UPLOAD_ZIP_TO_CORVA_STEP = {
36
68
 
37
69
  form.append('package', createReadStream(resolve(dirName, zipFileName)), 'package.zip');
38
70
 
71
+ let githubUsername = await getGithubUsername();
72
+
73
+ if (!githubUsername) {
74
+ githubUsername = getGitConfigUsername();
75
+ }
76
+
77
+ if (!githubUsername) {
78
+ try {
79
+ githubUsername = await Promise.race([
80
+ promptForUsername(),
81
+ new Promise((_, reject) => setTimeout(() => reject(new Error('Prompt timed out')), 10000)),
82
+ ]);
83
+ } catch (error) {
84
+ logger.log('Username prompt timed out or failed: ' + error.message);
85
+ }
86
+ }
87
+
88
+ form.append('github_username', githubUsername);
89
+
39
90
  const { id: packageId, isDeletedDueToLimit } = await api.uploadPackages(appKey, form);
40
91
 
41
92
  if (isDeletedDueToLimit) {
@@ -37,7 +37,7 @@ export async function ensureLatestVersion() {
37
37
 
38
38
  `);
39
39
  console.log(error(asterisks));
40
- // process.exit(0);
40
+ process.exit(0);
41
41
  }
42
42
  }
43
43
 
@@ -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
- 16: '16.19.0',
65
64
  18: '18.13.0',
65
+ 20: '20.16.0',
66
66
  },
67
67
  python: {
68
68
  '3.8': '3.8.16',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/create-app",
3
- "version": "0.0.0-73c49372-test",
3
+ "version": "0.0.0-types-node",
4
4
  "private": false,
5
5
  "description": "Create an app to use it in CORVA.AI",
6
6
  "keywords": [
@@ -100,5 +100,6 @@
100
100
  "skip": {
101
101
  "tag": true
102
102
  }
103
- }
103
+ },
104
+ "packageManager": "yarn@1.22.19+sha512.ff4579ab459bb25aa7c0ff75b62acebe576f6084b36aa842971cf250a5d8c6cd3bc9420b22ce63c7f93a0857bc6ef29291db39c3e7a23aab5adfd5a4dd6c5d71"
104
105
  }
@@ -1,5 +1,5 @@
1
1
  const { ScheduledDataTimeEvent } = require('@corva/node-sdk');
2
- const { app_runner } = require('@corva/node-sdk/lib/testing');
2
+ const { app_runner } = require('@corva/node-sdk/testing');
3
3
 
4
4
  const { processor } = require('..');
5
5
 
@@ -1,4 +1,4 @@
1
- import { app_runner } from '@corva/node-sdk/lib/testing';
1
+ import { app_runner } from '@corva/node-sdk/testing';
2
2
  import { ScheduledDataTimeEvent } from '@corva/node-sdk';
3
3
 
4
4
  import { processor } from '..';
@@ -1,5 +1,5 @@
1
1
  const { ScheduledDepthEvent } = require('@corva/node-sdk');
2
- const { app_runner } = require('@corva/node-sdk/lib/testing');
2
+ const { app_runner } = require('@corva/node-sdk/testing');
3
3
 
4
4
  const { processor } = require('..');
5
5
 
@@ -1,4 +1,4 @@
1
- import { app_runner } from '@corva/node-sdk/lib/testing';
1
+ import { app_runner } from '@corva/node-sdk/testing';
2
2
  import { ScheduledDepthEvent } from '@corva/node-sdk';
3
3
 
4
4
  import { processor } from '..';
@@ -1,5 +1,5 @@
1
1
  const { ScheduledNaturalTimeEvent } = require('@corva/node-sdk');
2
- const { app_runner } = require('@corva/node-sdk/lib/testing');
2
+ const { app_runner } = require('@corva/node-sdk/testing');
3
3
 
4
4
  const { processor } = require('..');
5
5
 
@@ -1,4 +1,4 @@
1
- import { app_runner } from '@corva/node-sdk/lib/testing';
1
+ import { app_runner } from '@corva/node-sdk/testing';
2
2
  import { ScheduledNaturalTimeEvent } from '@corva/node-sdk';
3
3
 
4
4
  import { processor } from '..';
@@ -1,5 +1,5 @@
1
1
  const { StreamDepthEvent, StreamDepthRecord } = require('@corva/node-sdk');
2
- const { app_runner } = require('@corva/node-sdk/lib/testing');
2
+ const { app_runner } = require('@corva/node-sdk/testing');
3
3
 
4
4
  const { processor } = require('..');
5
5
 
@@ -1,4 +1,4 @@
1
- import { app_runner } from '@corva/node-sdk/lib/testing';
1
+ import { app_runner } from '@corva/node-sdk/testing';
2
2
  import { StreamDepthEvent, StreamDepthRecord } from '@corva/node-sdk';
3
3
 
4
4
  import { processor } from '..';
@@ -1,5 +1,5 @@
1
1
  const { StreamTimeEvent, StreamTimeRecord } = require('@corva/node-sdk');
2
- const { app_runner } = require('@corva/node-sdk/lib/testing');
2
+ const { app_runner } = require('@corva/node-sdk/testing');
3
3
 
4
4
  const { processor } = require('..');
5
5
 
@@ -1,4 +1,4 @@
1
- import { app_runner } from '@corva/node-sdk/lib/testing';
1
+ import { app_runner } from '@corva/node-sdk/testing';
2
2
  import { StreamTimeEvent, StreamTimeRecord } from '@corva/node-sdk';
3
3
 
4
4
  import { processor } from '..';
@@ -1,5 +1,5 @@
1
1
  const { TaskEvent } = require('@corva/node-sdk');
2
- const { app_runner } = require('@corva/node-sdk/lib/testing');
2
+ const { app_runner } = require('@corva/node-sdk/testing');
3
3
 
4
4
  const { processor } = require('..');
5
5
 
@@ -1,4 +1,4 @@
1
- import { app_runner } from '@corva/node-sdk/lib/testing';
1
+ import { app_runner } from '@corva/node-sdk/testing';
2
2
  import { TaskEvent } from '@corva/node-sdk';
3
3
 
4
4
  import { processor } from '..';