@corva/create-app 0.0.0-73c49372 → 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.
- package/lib/constants/cli.js +7 -1
- package/lib/constants/package.js +9 -6
- package/lib/flows/lib/api.js +3 -9
- package/lib/flows/lib/manifest.js +1 -1
- package/lib/flows/steps/release/upload-zip-to-corva.js +51 -0
- package/lib/helpers/manifest.js +9 -1
- package/lib/helpers/resolve-app-runtime.js +1 -1
- package/package.json +3 -2
- package/templates/scheduler_data-time/javascript/__tests__/processor.spec.js +1 -1
- package/templates/scheduler_data-time/typescript/__tests__/processor.spec.ts +1 -1
- package/templates/scheduler_depth/javascript/__tests__/processor.spec.js +1 -1
- package/templates/scheduler_depth/typescript/__tests__/processor.spec.ts +1 -1
- package/templates/scheduler_natural-time/javascript/__tests__/processor.spec.js +1 -1
- package/templates/scheduler_natural-time/typescript/__tests__/processor.spec.ts +1 -1
- package/templates/stream_depth/javascript/__tests__/processor.spec.js +1 -1
- package/templates/stream_depth/typescript/__tests__/processor.spec.ts +1 -1
- package/templates/stream_time/javascript/__tests__/processor.spec.js +1 -1
- package/templates/stream_time/typescript/__tests__/processor.spec.ts +1 -1
- package/templates/task/javascript/__tests__/processor.spec.js +1 -1
- package/templates/task/typescript/__tests__/processor.spec.ts +1 -1
package/lib/constants/cli.js
CHANGED
|
@@ -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
|
+
};
|
package/lib/constants/package.js
CHANGED
|
@@ -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 ===
|
|
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': '^
|
|
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': '^
|
|
161
|
+
'typescript': '^5.5.4',
|
|
159
162
|
};
|
|
160
163
|
|
|
161
164
|
const nodeTsDevDependencies = {
|
|
162
165
|
...nodeDevDependencies,
|
|
163
|
-
'@types/jest': '^
|
|
164
|
-
'ts-jest': '^
|
|
166
|
+
'@types/jest': '^29.5.12',
|
|
167
|
+
'ts-jest': '^29.2.4',
|
|
165
168
|
};
|
|
166
169
|
|
|
167
170
|
const nodeYarnScripts = {
|
package/lib/flows/lib/api.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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.
|
|
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) {
|
package/lib/helpers/manifest.js
CHANGED
|
@@ -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
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corva/create-app",
|
|
3
|
-
"version": "0.0.0-
|
|
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
|
}
|