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

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.
@@ -7,18 +7,13 @@ const originalCwd = process.cwd();
7
7
 
8
8
  process.chdir(__dirname);
9
9
 
10
- const preparedOriginalArgs = process.argv
11
- .slice(2)
12
- // after changing the cwd need to pass the original path
13
- .concat(['--original-cwd', originalCwd])
14
- // leave spaces in place for arguments
15
- .map((a) => (a.includes(' ') ? `"${a}"` : a));
16
-
17
- const args = ['--no-warnings', '--experimental-json-modules', 'cca.js'].concat(preparedOriginalArgs);
10
+ const args = ['--no-warnings', '--experimental-json-modules', 'cca.js']
11
+ .concat(process.argv.slice(2))
12
+ .concat(['--original-cwd', originalCwd]);
18
13
 
19
14
  const { signal, status, error } = spawnSync(cmd, args, {
20
15
  stdio: 'inherit',
21
- shell: true,
16
+ shell: false,
22
17
  });
23
18
 
24
19
  if (signal) {
@@ -2,10 +2,16 @@ 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',
11
+ PYTHON3_10: 'python3.10',
12
+ PYTHON3_11: 'python3.11',
13
+ PYTHON3_12: 'python3.12',
14
+ // PYTHON3_13: 'python3.13',
9
15
  };
10
16
 
11
17
  export const TEMPLATE_TYPES = {
@@ -22,3 +28,7 @@ export const APP_TYPES = {
22
28
  STREAM: 'stream',
23
29
  TASK: 'task',
24
30
  };
31
+
32
+ export const APP_EXTENSIONS = {
33
+ CORVA: 'corva',
34
+ };
@@ -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,27 @@ async function deleteAppPackage({ api, appId, appPkgVersion }) {
23
24
  }
24
25
  }
25
26
 
27
+ function getGithubUsernameActor() {
28
+ // It is fetched from CI github.actor variable
29
+ return process.env.githubUsername || null;
30
+ }
31
+
32
+ function getGitConfigUsername() {
33
+ try {
34
+ let username = execSync('git config user.name').toString().trim();
35
+
36
+ if (!username) {
37
+ username = execSync('git config --global user.name').toString().trim();
38
+ }
39
+
40
+ return username || null;
41
+ } catch (error) {
42
+ logger.log('Unable to fetch git config username:', error.message);
43
+
44
+ return null;
45
+ }
46
+ }
47
+
26
48
  export const UPLOAD_ZIP_TO_CORVA_STEP = {
27
49
  message: RELEASE.uploadApp,
28
50
  /**
@@ -36,6 +58,14 @@ export const UPLOAD_ZIP_TO_CORVA_STEP = {
36
58
 
37
59
  form.append('package', createReadStream(resolve(dirName, zipFileName)), 'package.zip');
38
60
 
61
+ let githubUsername = getGithubUsernameActor();
62
+
63
+ if (!githubUsername) {
64
+ githubUsername = getGitConfigUsername();
65
+ }
66
+
67
+ form.append('github_username', githubUsername);
68
+
39
69
  const { id: packageId, isDeletedDueToLimit } = await api.uploadPackages(appKey, form);
40
70
 
41
71
  if (isDeletedDueToLimit) {
@@ -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',
@@ -82,7 +82,7 @@ const semverVersionsMapping = {
82
82
  */
83
83
  export const resolveAppRuntime = (opts) => {
84
84
  if (opts.appType === APP_TYPES.UI) {
85
- const version = '18';
85
+ const version = '20';
86
86
 
87
87
  return {
88
88
  language: opts.useTypescript ? 'typescript' : 'javascript',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/create-app",
3
- "version": "0.0.0-73c49372",
3
+ "version": "0.0.0-node-test",
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
  }
@@ -11,6 +11,8 @@ jobs:
11
11
  - name: develop branch flow
12
12
  id: shared-workflow
13
13
  uses: corva-ai/gh-actions/shared-dc-workflows/develop@develop
14
+ env:
15
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14
16
  with:
15
17
  qa-api-key: ${{ secrets.API_KEY_QA }}
16
18
  prod-api-key: ${{ secrets.API_KEY }}
@@ -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 '..';