@corva/create-app 0.0.0-73c49372-test → 0.0.0-747377c
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 +7 -0
- package/bin/create-corva-app.cjs +4 -9
- package/common/python/requirements.txt +1 -1
- package/lib/commands/release.js +6 -0
- package/lib/constants/cli.js +14 -3
- package/lib/constants/manifest.js +3 -2
- package/lib/constants/package.js +36 -16
- package/lib/flows/lib/api.js +23 -14
- package/lib/flows/lib/manifest.js +1 -1
- package/lib/flows/steps/release/upload-zip-to-corva.js +74 -0
- package/lib/flows/steps/zip-file-list-resolve.js +13 -7
- package/lib/helpers/cli-version.js +39 -3
- package/lib/helpers/manifest.js +9 -1
- package/lib/helpers/resolve-app-runtime.js +7 -6
- package/lib/helpers/utils.js +7 -1
- package/lib/main.js +1 -5
- package/package.json +1 -104
- package/template_extensions/corva/.eslintrc +32 -0
- package/template_extensions/corva/.github/workflows/develop.yml +2 -0
- package/template_extensions/corva/.release-please-manifest.json +3 -0
- package/template_extensions/corva/release-please-config.json +10 -0
- 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/templates/ui/javascript/.codex/config.toml +3 -0
- package/templates/ui/javascript/.cursor/mcp.json +8 -0
- package/templates/ui/javascript/.mcp.json +8 -0
- package/templates/ui/javascript/AGENTS.md +304 -0
- package/templates/ui/javascript/CLAUDE.md +1 -0
- package/templates/ui/javascript/config/jest/setupTests.js +19 -0
- package/templates/ui/javascript/src/App.completion.js +35 -47
- package/templates/ui/javascript/src/App.drilling.js +36 -45
- package/templates/ui/javascript/src/App.scss +17 -0
- package/templates/ui/javascript/src/AppSettings.js +6 -20
- package/templates/ui/javascript/src/__tests__/App.test.js +11 -6
- package/templates/ui/javascript/src/__tests__/AppSettings.test.js +12 -5
- package/templates/ui/javascript/src/__tests__/TestsExample.test.js +2 -2
- package/templates/ui/javascript/src/index.js +1 -0
- package/templates/ui/typescript/.codex/config.toml +3 -0
- package/templates/ui/typescript/.cursor/mcp.json +8 -0
- package/templates/ui/typescript/.mcp.json +8 -0
- package/templates/ui/typescript/AGENTS.md +344 -0
- package/templates/ui/typescript/CLAUDE.md +1 -0
- package/templates/ui/typescript/config/jest/setupTests.js +19 -0
- package/templates/ui/typescript/src/App.completion.tsx +35 -49
- package/templates/ui/typescript/src/App.drilling.tsx +35 -46
- package/templates/ui/typescript/src/App.scss +17 -0
- package/templates/ui/typescript/src/AppSettings.tsx +4 -14
- package/templates/ui/typescript/src/__mocks__/mockData.ts +22 -0
- package/templates/ui/typescript/src/__tests__/App.test.tsx +12 -6
- package/templates/ui/typescript/src/__tests__/AppSettings.test.tsx +12 -5
- package/templates/ui/typescript/src/__tests__/TestsExample.test.tsx +2 -2
- package/templates/ui/typescript/src/custom.d.ts +10 -0
- package/templates/ui/typescript/src/index.js +1 -0
- package/templates/ui/typescript/src/types.ts +3 -0
- package/templates/ui/typescript/tsconfig.json +0 -1
- package/templates/ui/javascript/src/App.css +0 -30
- package/templates/ui/javascript/src/__mocks__/mockAppProps.js +0 -590
- package/templates/ui/javascript/src/__mocks__/mockAppSettingsProps.js +0 -290
- package/templates/ui/typescript/src/App.css +0 -30
- package/templates/ui/typescript/src/__mocks__/mockAppProps.ts +0 -590
- package/templates/ui/typescript/src/__mocks__/mockAppSettingsProps.ts +0 -290
package/README.md
CHANGED
|
@@ -182,6 +182,7 @@ Options:
|
|
|
182
182
|
--silent [boolean] Only log result of the operation (default: false)
|
|
183
183
|
--remove-on-success App package (.zip) will not be deleted after upload (default: true)
|
|
184
184
|
--remove-existing [boolean] If package.json version is already taken - remove the previously published package and upload a new one (default: false)
|
|
185
|
+
--author [string] Author name for the audit
|
|
185
186
|
```
|
|
186
187
|
|
|
187
188
|
### Examples
|
|
@@ -209,3 +210,9 @@ create-corva-app release test-app --bump-version=patch
|
|
|
209
210
|
```sh
|
|
210
211
|
create-corva-app release test-app --bump-version=4.2.0
|
|
211
212
|
```
|
|
213
|
+
|
|
214
|
+
#### Make a release with author option(by default it will use your GitHub username)
|
|
215
|
+
|
|
216
|
+
```sh
|
|
217
|
+
create-corva-app release test-app --author=MyName
|
|
218
|
+
```
|
package/bin/create-corva-app.cjs
CHANGED
|
@@ -7,18 +7,13 @@ const originalCwd = process.cwd();
|
|
|
7
7
|
|
|
8
8
|
process.chdir(__dirname);
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
.slice(2)
|
|
12
|
-
|
|
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:
|
|
16
|
+
shell: false,
|
|
22
17
|
});
|
|
23
18
|
|
|
24
19
|
if (signal) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
corva-sdk==1.
|
|
1
|
+
corva-sdk==2.1.1
|
|
2
2
|
pytest==7.1.1
|
package/lib/commands/release.js
CHANGED
|
@@ -36,7 +36,13 @@ export const releaseCommand = new Command('release')
|
|
|
36
36
|
).default(false),
|
|
37
37
|
)
|
|
38
38
|
// .addOption(new Option('--zip-file-name [string]', 'Prebuilt zip file name in dir'))
|
|
39
|
+
.addOption(new Option('--author [string]', 'Author name for the audit'))
|
|
39
40
|
.action(async (dirName, patterns, options) => {
|
|
41
|
+
// if author is present in CLI, save it to process.env
|
|
42
|
+
if (options.author) {
|
|
43
|
+
process.env.githubUsername = options.author;
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
options.bumpVersion = await ensureBumpVersion(options.bumpVersion);
|
|
41
47
|
|
|
42
48
|
await runFlow(RELEASE_FLOW, {
|
package/lib/constants/cli.js
CHANGED
|
@@ -2,10 +2,17 @@ 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
|
-
|
|
8
|
-
|
|
7
|
+
NODE20: 'nodejs20.x',
|
|
8
|
+
NODE22: 'nodejs22.x',
|
|
9
|
+
NODE24: 'nodejs24.x',
|
|
10
|
+
// PYTHON3_8: 'python3.8',
|
|
11
|
+
// PYTHON3_9: 'python3.9',
|
|
12
|
+
// PYTHON3_10: 'python3.10',
|
|
13
|
+
PYTHON3_11: 'python3.11',
|
|
14
|
+
PYTHON3_12: 'python3.12',
|
|
15
|
+
PYTHON3_13: 'python3.13',
|
|
9
16
|
};
|
|
10
17
|
|
|
11
18
|
export const TEMPLATE_TYPES = {
|
|
@@ -22,3 +29,7 @@ export const APP_TYPES = {
|
|
|
22
29
|
STREAM: 'stream',
|
|
23
30
|
TASK: 'task',
|
|
24
31
|
};
|
|
32
|
+
|
|
33
|
+
export const APP_EXTENSIONS = {
|
|
34
|
+
CORVA: 'corva',
|
|
35
|
+
};
|
|
@@ -20,7 +20,7 @@ export const defaultManifest = {
|
|
|
20
20
|
summary: 'More information about this app goes here',
|
|
21
21
|
category: '',
|
|
22
22
|
website: 'https://www.oandgexample.com/my-app/',
|
|
23
|
-
segments: ['drilling', 'completion'],
|
|
23
|
+
segments: ['drilling', 'completion', 'intervention'],
|
|
24
24
|
},
|
|
25
25
|
settings: {
|
|
26
26
|
entrypoint: {
|
|
@@ -38,6 +38,7 @@ export const defaultUIAppManifest = {
|
|
|
38
38
|
initial_size: { w: 4, h: 10 },
|
|
39
39
|
multi_rig: false,
|
|
40
40
|
full_screen_report: false,
|
|
41
|
+
use_app_header_v3: true,
|
|
41
42
|
},
|
|
42
43
|
},
|
|
43
44
|
settings: {
|
|
@@ -205,7 +206,7 @@ export const manifestOptions = (projectName = 'Corva Dev Center App') => [
|
|
|
205
206
|
type: 'rawlist',
|
|
206
207
|
name: 'segments',
|
|
207
208
|
message: 'Choose segments',
|
|
208
|
-
choices: ['drilling', 'completion'],
|
|
209
|
+
choices: ['drilling', 'completion', 'intervention'],
|
|
209
210
|
required: true,
|
|
210
211
|
},
|
|
211
212
|
{
|
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',
|
|
@@ -9,7 +10,7 @@ const uiDependencies = {
|
|
|
9
10
|
'@icon-park/react': '1.4.2',
|
|
10
11
|
'classnames': '2.2.6',
|
|
11
12
|
'corva-convert-units': '1.10.33',
|
|
12
|
-
'highcharts': '
|
|
13
|
+
'highcharts': '10.3.3',
|
|
13
14
|
'highcharts-react-official': '2.2.2',
|
|
14
15
|
'lodash': '^4.17.21',
|
|
15
16
|
'mapbox.js': '3.2.1',
|
|
@@ -21,24 +22,30 @@ const uiDependencies = {
|
|
|
21
22
|
|
|
22
23
|
const jsUiDevDependencies = {
|
|
23
24
|
'@corva/dc-platform-shared': 'latest',
|
|
24
|
-
'@corva/eslint-config-browser': '
|
|
25
|
+
'@corva/eslint-config-browser': '0.2.2',
|
|
25
26
|
'@testing-library/jest-dom': '^5.14.1',
|
|
26
27
|
'@testing-library/react': '^12.1.5',
|
|
27
28
|
'@testing-library/react-hooks': '^8.0.1',
|
|
28
29
|
'@testing-library/user-event': '^13.2.1',
|
|
29
|
-
'jest-watch-typeahead': '^1.0.0',
|
|
30
|
-
'jest': '^27.4.3',
|
|
31
30
|
'babel-jest': '^27.4.2',
|
|
32
31
|
'babel-preset-react-app': '^10.0.1',
|
|
33
32
|
'eslint': '7.32.0',
|
|
33
|
+
'identity-obj-proxy': '^3.0.0',
|
|
34
|
+
'jest': '^27.4.3',
|
|
35
|
+
'jest-watch-typeahead': '^1.0.0',
|
|
34
36
|
'postcss-loader': '4.1.0',
|
|
37
|
+
'sass': '^1.89.2',
|
|
38
|
+
'sass-loader': '^16.0.5',
|
|
35
39
|
};
|
|
36
40
|
|
|
37
41
|
const tsUiDevDependencies = {
|
|
38
42
|
...jsUiDevDependencies,
|
|
39
43
|
'@tsconfig/create-react-app': '1.0.2',
|
|
44
|
+
'@types/lodash': '4.17.5',
|
|
40
45
|
'@types/material-ui': '0.21.9',
|
|
41
|
-
'@types/
|
|
46
|
+
'@types/minimatch': '3.0.5',
|
|
47
|
+
'@types/mime': '3.0.1',
|
|
48
|
+
'@types/node': '18.19.47',
|
|
42
49
|
'@types/react': '^17.0.22',
|
|
43
50
|
'@types/react-dom': '^17.0.9',
|
|
44
51
|
'@types/jest': '^27.0.1',
|
|
@@ -52,11 +59,15 @@ const corvaUiExtension = {
|
|
|
52
59
|
scripts: {
|
|
53
60
|
prepare: 'husky install',
|
|
54
61
|
},
|
|
62
|
+
dependencies: {
|
|
63
|
+
'@tanstack/react-query': '4.35.3',
|
|
64
|
+
},
|
|
55
65
|
devDependencies: {
|
|
56
66
|
'@commitlint/cli': '^17.0.0',
|
|
57
67
|
'@commitlint/config-conventional': '^17.0.0',
|
|
58
68
|
'husky': '^8.0.0',
|
|
59
69
|
'lint-staged': '^13.0.0',
|
|
70
|
+
'@tanstack/eslint-plugin-query': '4.34.1',
|
|
60
71
|
},
|
|
61
72
|
};
|
|
62
73
|
|
|
@@ -67,7 +78,7 @@ function applyUiExtension(packageJson, extensionNames) {
|
|
|
67
78
|
|
|
68
79
|
const extensions = extensionNames
|
|
69
80
|
.map((extensionName) => {
|
|
70
|
-
if (extensionName ===
|
|
81
|
+
if (extensionName === APP_EXTENSIONS.CORVA) {
|
|
71
82
|
return corvaUiExtension;
|
|
72
83
|
}
|
|
73
84
|
|
|
@@ -116,12 +127,12 @@ const uiPackage = {
|
|
|
116
127
|
},
|
|
117
128
|
transformIgnorePatterns: [
|
|
118
129
|
'/node_modules/(?!.*@babel/runtime|@icon-park/react/es).+\\.(js|jsx|mjs|cjs|ts|tsx)$',
|
|
119
|
-
'^.+\\.
|
|
130
|
+
'^.+\\.(css|sass|scss)$',
|
|
120
131
|
],
|
|
121
132
|
modulePaths: [],
|
|
122
133
|
moduleNameMapper: {
|
|
123
134
|
'~(.*)': '<rootDir>/src/$1',
|
|
124
|
-
'^.+\\.
|
|
135
|
+
'^.+\\.(css|sass|scss)$': 'identity-obj-proxy',
|
|
125
136
|
'@corva/ui(.*)': '@corva/ui/cjs-bundle/$1',
|
|
126
137
|
},
|
|
127
138
|
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
|
|
@@ -130,43 +141,51 @@ const uiPackage = {
|
|
|
130
141
|
'lint-staged': {
|
|
131
142
|
'src/**/*.{js,jsx,ts,tsx}': 'eslint --fix',
|
|
132
143
|
},
|
|
144
|
+
'resolutions': {
|
|
145
|
+
'@noble/hashes': '1.8.0',
|
|
146
|
+
},
|
|
133
147
|
};
|
|
134
148
|
|
|
135
149
|
const tsUiPackage = {
|
|
136
150
|
...uiPackage,
|
|
137
151
|
devDependencies: tsUiDevDependencies,
|
|
152
|
+
// todo: temporary solution, ref https://github.com/oppia/oppia/issues/22283#issuecomment-2756641371
|
|
153
|
+
resolutions: {
|
|
154
|
+
...uiPackage.resolutions,
|
|
155
|
+
'@types/babel__traverse': '7.20.6',
|
|
156
|
+
},
|
|
138
157
|
};
|
|
139
158
|
|
|
140
159
|
const nodeNpmScripts = {
|
|
141
160
|
'bundle': 'create-corva-app zip .',
|
|
142
|
-
'test': 'npm
|
|
161
|
+
'test': 'npm run unit',
|
|
143
162
|
'unit': 'jest',
|
|
144
163
|
'lint': 'eslint --ext .js,.ts .',
|
|
145
164
|
'lint:fix': 'eslint --ext .js,.ts --fix .',
|
|
146
165
|
};
|
|
147
166
|
|
|
148
167
|
const nodeDependencies = {
|
|
149
|
-
'@corva/node-sdk': '^8.
|
|
168
|
+
'@corva/node-sdk': '^8.5.0',
|
|
150
169
|
};
|
|
151
170
|
|
|
152
171
|
const nodeDevDependencies = {
|
|
153
172
|
'@corva/eslint-config-node': '^5.1.1',
|
|
154
|
-
'jest': '^
|
|
173
|
+
'jest': '^29.7.0',
|
|
155
174
|
'dotenv': '^16.0.3',
|
|
156
175
|
'eslint': '^8.2.0',
|
|
157
176
|
'prettier': '^2.0.0',
|
|
158
|
-
'typescript': '^
|
|
177
|
+
'typescript': '^5.5.4',
|
|
159
178
|
};
|
|
160
179
|
|
|
161
180
|
const nodeTsDevDependencies = {
|
|
162
181
|
...nodeDevDependencies,
|
|
163
|
-
'@types/jest': '^
|
|
164
|
-
'ts-jest': '^
|
|
182
|
+
'@types/jest': '^29.5.12',
|
|
183
|
+
'ts-jest': '^29.2.4',
|
|
165
184
|
};
|
|
166
185
|
|
|
167
186
|
const nodeYarnScripts = {
|
|
168
187
|
...nodeNpmScripts,
|
|
169
|
-
test: 'yarn
|
|
188
|
+
test: 'yarn unit',
|
|
170
189
|
};
|
|
171
190
|
|
|
172
191
|
const commonTsScripts = {
|
|
@@ -226,7 +245,8 @@ const nodeTsYarnPackage = {
|
|
|
226
245
|
|
|
227
246
|
const extendWithTsConfig = (packageJson, version) => {
|
|
228
247
|
packageJson.devDependencies = {
|
|
229
|
-
|
|
248
|
+
// New @tsconfig/nodeX package versioning: it starts with X major version
|
|
249
|
+
[`@tsconfig/node${version}`]: `^${version}`,
|
|
230
250
|
...packageJson.devDependencies,
|
|
231
251
|
};
|
|
232
252
|
|
package/lib/flows/lib/api.js
CHANGED
|
@@ -42,21 +42,30 @@ export class Api {
|
|
|
42
42
|
* @returns {object}
|
|
43
43
|
*/
|
|
44
44
|
async getAppByKey(appKey) {
|
|
45
|
-
|
|
46
|
-
.get(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
)
|
|
45
|
+
try {
|
|
46
|
+
const { data } = await this.#api.get(`v2/apps/${appKey}`).json();
|
|
47
|
+
|
|
48
|
+
if (!data) {
|
|
49
|
+
throw new StepError(
|
|
50
|
+
`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.`,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return data;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (error?.response?.statusCode === 404) {
|
|
57
|
+
throw new StepError(
|
|
58
|
+
`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.`,
|
|
59
|
+
{ cause: error },
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
// If error has a response, it's an API exception
|
|
63
|
+
else if (error?.response) {
|
|
64
|
+
throw new StepError(`getAppByKey request failed, code:${error?.response?.statusCode}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
throw error;
|
|
57
68
|
}
|
|
58
|
-
|
|
59
|
-
return app;
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
/**
|
|
@@ -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, APP_RUNTIMES.NODE22, APP_RUNTIMES.NODE24];
|
|
15
15
|
|
|
16
16
|
export class Manifest {
|
|
17
17
|
constructor(manifest) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import FormData from 'form-data';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
+
import fs from 'fs';
|
|
3
4
|
import { createReadStream } from 'node:fs';
|
|
4
5
|
import { resolve } from 'node:path';
|
|
5
6
|
import { RELEASE } from '../../../constants/messages.js';
|
|
6
7
|
import { StepError } from '../../lib/step-error.js';
|
|
7
8
|
import { logger } from '../../../helpers/logger.js';
|
|
9
|
+
import { execSync } from 'node:child_process';
|
|
8
10
|
|
|
9
11
|
async function deleteAppPackage({ api, appId, appPkgVersion }) {
|
|
10
12
|
const appPackages = await api.getAppPackages(appId);
|
|
@@ -23,6 +25,70 @@ async function deleteAppPackage({ api, appId, appPkgVersion }) {
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
function getRealAuthorFromGithubEvent() {
|
|
29
|
+
if (!process.env.GITHUB_EVENT_PATH) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const event = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));
|
|
35
|
+
|
|
36
|
+
// For push-event
|
|
37
|
+
if (event?.pusher?.name) {
|
|
38
|
+
return event.pusher.name;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// For PR event
|
|
42
|
+
if (event?.pull_request?.user?.login) {
|
|
43
|
+
return event.pull_request.user.login;
|
|
44
|
+
}
|
|
45
|
+
} catch (error) {
|
|
46
|
+
// Catch error in case json file is invalid or absent
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getGithubUsernameActor() {
|
|
54
|
+
// If option passed --author – we firstly take it
|
|
55
|
+
if (process.env.githubUsername) {
|
|
56
|
+
return process.env.githubUsername;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// If no --author passed, try use GITHUB_ACTOR
|
|
60
|
+
const actor = process.env.GITHUB_ACTOR;
|
|
61
|
+
|
|
62
|
+
if (actor && actor !== 'github-actions[bot]') {
|
|
63
|
+
return actor;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// If actor == github-actions[bot], let's try to get a real user
|
|
67
|
+
const realAuthor = getRealAuthorFromGithubEvent();
|
|
68
|
+
|
|
69
|
+
if (realAuthor) {
|
|
70
|
+
return realAuthor;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function getGitConfigUsername() {
|
|
77
|
+
try {
|
|
78
|
+
let username = execSync('git config user.name').toString().trim();
|
|
79
|
+
|
|
80
|
+
if (!username) {
|
|
81
|
+
username = execSync('git config --global user.name').toString().trim();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return username || null;
|
|
85
|
+
} catch (error) {
|
|
86
|
+
logger.log('Unable to fetch git config username:', error.message);
|
|
87
|
+
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
26
92
|
export const UPLOAD_ZIP_TO_CORVA_STEP = {
|
|
27
93
|
message: RELEASE.uploadApp,
|
|
28
94
|
/**
|
|
@@ -36,6 +102,14 @@ export const UPLOAD_ZIP_TO_CORVA_STEP = {
|
|
|
36
102
|
|
|
37
103
|
form.append('package', createReadStream(resolve(dirName, zipFileName)), 'package.zip');
|
|
38
104
|
|
|
105
|
+
let githubUsername = getGithubUsernameActor();
|
|
106
|
+
|
|
107
|
+
if (!githubUsername) {
|
|
108
|
+
githubUsername = getGitConfigUsername();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
form.append('github_username', githubUsername);
|
|
112
|
+
|
|
39
113
|
const { id: packageId, isDeletedDueToLimit } = await api.uploadPackages(appKey, form);
|
|
40
114
|
|
|
41
115
|
if (isDeletedDueToLimit) {
|
|
@@ -98,13 +98,12 @@ const resolveDataToZipUiApp = async (itemsToZip = [], { options, pkg, dirName, m
|
|
|
98
98
|
|
|
99
99
|
itemsToSave.push({
|
|
100
100
|
name: tmpPackageForSourceName,
|
|
101
|
-
content:
|
|
102
|
-
|
|
103
|
-
{
|
|
104
|
-
build:
|
|
101
|
+
content: {
|
|
102
|
+
...pkg,
|
|
103
|
+
scripts: {
|
|
104
|
+
build: pkg.scripts?.build,
|
|
105
105
|
},
|
|
106
|
-
|
|
107
|
-
),
|
|
106
|
+
},
|
|
108
107
|
});
|
|
109
108
|
|
|
110
109
|
const itemsToRemove = [tmpPackageForSourceName];
|
|
@@ -112,7 +111,11 @@ const resolveDataToZipUiApp = async (itemsToZip = [], { options, pkg, dirName, m
|
|
|
112
111
|
itemsToZip.push(
|
|
113
112
|
'manifest.json',
|
|
114
113
|
'config-overrides.js',
|
|
114
|
+
'eslint.config.js',
|
|
115
|
+
'eslint.config.mjs',
|
|
115
116
|
'tsconfig.json',
|
|
117
|
+
'prettier.config.js',
|
|
118
|
+
'.prettierrc',
|
|
116
119
|
'.npmrc',
|
|
117
120
|
'.nvmrc',
|
|
118
121
|
'yarn.lock',
|
|
@@ -121,6 +124,7 @@ const resolveDataToZipUiApp = async (itemsToZip = [], { options, pkg, dirName, m
|
|
|
121
124
|
name: 'package.json',
|
|
122
125
|
},
|
|
123
126
|
...(await transformPatternsIntoFileNames(dirName, ['src/**/*'], options.ignoredFiles)),
|
|
127
|
+
...(await transformPatternsIntoFileNames(dirName, ['config/**/*'], options.ignoredFiles)),
|
|
124
128
|
);
|
|
125
129
|
|
|
126
130
|
if (options.appKey) {
|
|
@@ -183,7 +187,9 @@ const resolveDataForZipNodeJsApp = async (itemsToZip = [], { options, pkg, dirNa
|
|
|
183
187
|
|
|
184
188
|
itemsToZip.push('config', 'manifest.json', 'package.json', '.nvmrc', '.npmrc', '.eslintrc.js');
|
|
185
189
|
|
|
186
|
-
if (packageDirContent.includes('
|
|
190
|
+
if (packageDirContent.includes('pnpm-lock.yaml')) {
|
|
191
|
+
itemsToZip.push('pnpm-lock.yaml');
|
|
192
|
+
} else if (packageDirContent.includes('package-lock.json')) {
|
|
187
193
|
itemsToZip.push('package-lock.json');
|
|
188
194
|
|
|
189
195
|
if (shouldUpdateVersion) {
|
|
@@ -4,9 +4,10 @@ import semver from 'semver';
|
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
5
|
import { join } from 'path';
|
|
6
6
|
import * as url from 'url';
|
|
7
|
+
import fs from 'fs-extra';
|
|
7
8
|
|
|
8
9
|
import { logger } from './logger.js';
|
|
9
|
-
import
|
|
10
|
+
import { StepError } from '../flows/lib/step-error.js';
|
|
10
11
|
|
|
11
12
|
const npm = new NpmApi();
|
|
12
13
|
|
|
@@ -17,13 +18,41 @@ const asterisks = '*************************************************************
|
|
|
17
18
|
|
|
18
19
|
const getCurrentVersion = async () =>
|
|
19
20
|
(await fs.readJSON(join(url.fileURLToPath(new URL('.', import.meta.url)), '../../package.json'))).version;
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
const getLatestVersion = async () => {
|
|
23
|
+
try {
|
|
24
|
+
return await npm.repo('@corva/create-app').prop('version');
|
|
25
|
+
} catch (caughtError) {
|
|
26
|
+
if (caughtError.name === 'FetchError') {
|
|
27
|
+
throw new StepError(`The request to check the latest available version has failed due to the network error. Details:
|
|
28
|
+
|
|
29
|
+
${caughtError}
|
|
30
|
+
|
|
31
|
+
Please check your internet connection and that the above request is not blocked in your network
|
|
32
|
+
`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
throw caughtError;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Utility function to check if a version is a regular semver without prerelease identifiers
|
|
40
|
+
const isRegularVersion = (version) => {
|
|
41
|
+
return semver.prerelease(version) === null;
|
|
42
|
+
};
|
|
21
43
|
|
|
22
44
|
// NOTE: Stop process and show error if version is outdated
|
|
23
45
|
export async function ensureLatestVersion() {
|
|
24
46
|
const currentVersion = await getCurrentVersion();
|
|
25
47
|
const latestVersion = await getLatestVersion();
|
|
26
48
|
|
|
49
|
+
// Skip version check if current version is a prerelease (dev or next)
|
|
50
|
+
if (!isRegularVersion(currentVersion)) {
|
|
51
|
+
logger.write('Skipping version check for prerelease version.\n');
|
|
52
|
+
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
27
56
|
const isCurrentVersionOutdated = semver.gt(latestVersion, currentVersion);
|
|
28
57
|
|
|
29
58
|
if (isCurrentVersionOutdated) {
|
|
@@ -37,7 +66,7 @@ export async function ensureLatestVersion() {
|
|
|
37
66
|
|
|
38
67
|
`);
|
|
39
68
|
console.log(error(asterisks));
|
|
40
|
-
|
|
69
|
+
process.exit(0);
|
|
41
70
|
}
|
|
42
71
|
}
|
|
43
72
|
|
|
@@ -48,6 +77,13 @@ export async function warnIfOutdated() {
|
|
|
48
77
|
const currentVersion = await getCurrentVersion();
|
|
49
78
|
const latestVersion = await getLatestVersion();
|
|
50
79
|
|
|
80
|
+
// Skip version check if current version is a prerelease (dev or next)
|
|
81
|
+
if (!isRegularVersion(currentVersion)) {
|
|
82
|
+
logger.write(' ⚠️ Skipping version check for prerelease version.\n');
|
|
83
|
+
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
51
87
|
const isCurrentVersionOutdated = semver.gt(latestVersion, currentVersion);
|
|
52
88
|
|
|
53
89
|
if (isCurrentVersionOutdated) {
|
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
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import debugFn from 'debug';
|
|
2
2
|
import { APP_TYPES } from '../constants/cli.js';
|
|
3
|
-
|
|
4
|
-
const debug = debugFn('cca:resolve-app-runtime');
|
|
5
|
-
|
|
6
3
|
import spawn from 'cross-spawn';
|
|
7
4
|
import { promises as fs } from 'fs';
|
|
8
5
|
import os from 'os';
|
|
9
6
|
import semver from 'semver';
|
|
10
7
|
|
|
8
|
+
const debug = debugFn('cca:resolve-app-runtime');
|
|
9
|
+
|
|
11
10
|
/**
|
|
12
11
|
*
|
|
13
12
|
* @param {string} command
|
|
@@ -61,14 +60,16 @@ export const IS_WINDOWS = process.platform === 'win32';
|
|
|
61
60
|
|
|
62
61
|
const semverVersionsMapping = {
|
|
63
62
|
node: {
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
18: '18.14.0',
|
|
64
|
+
20: '20.16.0',
|
|
65
|
+
24: '24.14.0',
|
|
66
66
|
},
|
|
67
67
|
python: {
|
|
68
68
|
'3.8': '3.8.16',
|
|
69
69
|
'3.9': '3.9.16',
|
|
70
70
|
'3.10': '3.10.9',
|
|
71
71
|
'3.11': '3.11.1',
|
|
72
|
+
'3.13': '3.13.7',
|
|
72
73
|
},
|
|
73
74
|
};
|
|
74
75
|
|
|
@@ -82,7 +83,7 @@ const semverVersionsMapping = {
|
|
|
82
83
|
*/
|
|
83
84
|
export const resolveAppRuntime = (opts) => {
|
|
84
85
|
if (opts.appType === APP_TYPES.UI) {
|
|
85
|
-
const version = '
|
|
86
|
+
const version = '20';
|
|
86
87
|
|
|
87
88
|
return {
|
|
88
89
|
language: opts.useTypescript ? 'typescript' : 'javascript',
|
package/lib/helpers/utils.js
CHANGED
|
@@ -8,7 +8,13 @@ export const addUiAppFile = (templateFolder, root, runtime, manifest, opts) => {
|
|
|
8
8
|
logger.log(chalk.green('adding app file'));
|
|
9
9
|
|
|
10
10
|
const fileExtension = runtime.language === 'typescript' ? 'tsx' : 'js';
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
const segment =
|
|
13
|
+
{
|
|
14
|
+
drilling: 'drilling',
|
|
15
|
+
completion: 'completion',
|
|
16
|
+
intervention: 'drilling', // same as drilling for now
|
|
17
|
+
}[opts.segments] || 'drilling';
|
|
12
18
|
const appFilePath = join(templateFolder, 'src', `App.${segment}.${fileExtension}`);
|
|
13
19
|
|
|
14
20
|
copyFileSync(appFilePath, join(root, 'src', `App.${fileExtension}`));
|
package/lib/main.js
CHANGED
|
@@ -13,9 +13,6 @@ import { createCommand } from './commands/create.js';
|
|
|
13
13
|
|
|
14
14
|
import { ERROR_ICON } from './constants/messages.js';
|
|
15
15
|
import { StepError } from './flows/lib/step-error.js';
|
|
16
|
-
import debugFn from 'debug';
|
|
17
|
-
|
|
18
|
-
const debug = debugFn('cca:main');
|
|
19
16
|
|
|
20
17
|
function checkNodeVersion() {
|
|
21
18
|
logger.write('Checking node version...');
|
|
@@ -58,9 +55,8 @@ export async function run() {
|
|
|
58
55
|
if (e instanceof StepError) {
|
|
59
56
|
console.error(chalk.red(`${ERROR_ICON} ${e.message}`));
|
|
60
57
|
} else {
|
|
61
|
-
debug(e);
|
|
62
|
-
|
|
63
58
|
console.error(chalk.red(`${ERROR_ICON} Unknown error occured, please contact support`));
|
|
59
|
+
console.error(e);
|
|
64
60
|
}
|
|
65
61
|
|
|
66
62
|
process.exit(1);
|