@corva/create-app 0.120.1 → 0.122.0
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/commands/release.js +17 -2
- package/lib/constants/package.js +15 -2
- package/lib/flow.js +6 -0
- package/lib/flows/release.js +4 -0
- package/lib/flows/steps/release/resolve-prebuilt-zip.js +35 -0
- package/lib/flows/zip-simple.js +2 -0
- package/lib/options/zip-file-name.js +18 -0
- package/package.json +6 -7
- package/templates/ui/javascript/config/jest/setupTests.js +3 -0
- package/templates/ui/typescript/config/jest/setupTests.js +3 -0
package/lib/commands/release.js
CHANGED
|
@@ -11,6 +11,8 @@ import { silentOption } from '../options/silent.js';
|
|
|
11
11
|
import { ensureBumpVersion } from '../helpers/cli-version.js';
|
|
12
12
|
import { ERROR_ICON } from '../constants/messages.js';
|
|
13
13
|
import { appKeyOption } from '../options/app-key.js';
|
|
14
|
+
import { zipFileNameOption } from '../options/zip-file-name.js';
|
|
15
|
+
import { logger } from '../helpers/logger.js';
|
|
14
16
|
|
|
15
17
|
export const releaseCommand = new Command('release')
|
|
16
18
|
.description('Release app')
|
|
@@ -35,7 +37,7 @@ export const releaseCommand = new Command('release')
|
|
|
35
37
|
'If package version is already taken - remove the previously published package and upload a new one',
|
|
36
38
|
).default(false),
|
|
37
39
|
)
|
|
38
|
-
|
|
40
|
+
.addOption(zipFileNameOption)
|
|
39
41
|
.addOption(new Option('--author [string]', 'Author name for the audit'))
|
|
40
42
|
.action(async (dirName, patterns, options) => {
|
|
41
43
|
// if author is present in CLI, save it to process.env
|
|
@@ -43,7 +45,20 @@ export const releaseCommand = new Command('release')
|
|
|
43
45
|
process.env.githubUsername = options.author;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
// Only the zip flow bumps the version, and a prebuilt archive skips it — nothing to prompt for.
|
|
49
|
+
if (options.zipFileName) {
|
|
50
|
+
if (options.bumpVersion && options.bumpVersion !== 'skip') {
|
|
51
|
+
logger.log(
|
|
52
|
+
`⚠️ ${chalk.yellow(
|
|
53
|
+
`--bump-version=${options.bumpVersion} is ignored with --zip-file-name: the version inside ${options.zipFileName} is used as is.`,
|
|
54
|
+
)}`,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
options.bumpVersion = 'skip';
|
|
59
|
+
} else {
|
|
60
|
+
options.bumpVersion = await ensureBumpVersion(options.bumpVersion);
|
|
61
|
+
}
|
|
47
62
|
|
|
48
63
|
await runFlow(RELEASE_FLOW, {
|
|
49
64
|
dirName: getRealWorkingDir(dirName, options),
|
package/lib/constants/package.js
CHANGED
|
@@ -12,8 +12,8 @@ const uiDependencies = {
|
|
|
12
12
|
'corva-convert-units': '1.10.33',
|
|
13
13
|
'highcharts': '10.3.3',
|
|
14
14
|
'highcharts-react-official': '2.2.2',
|
|
15
|
-
'lodash': '^4.
|
|
16
|
-
'mapbox
|
|
15
|
+
'lodash': '^4.18.1',
|
|
16
|
+
'mapbox-gl': '3.16.0',
|
|
17
17
|
'moment': '2.29.4',
|
|
18
18
|
'moment-timezone': '0.5.43',
|
|
19
19
|
'react': '17.0.1',
|
|
@@ -38,6 +38,7 @@ const jsUiDevDependencies = {
|
|
|
38
38
|
const tsUiDevDependencies = {
|
|
39
39
|
...jsUiDevDependencies,
|
|
40
40
|
'@tsconfig/create-react-app': '1.0.2',
|
|
41
|
+
// 4.17.7+ uses `infer X extends`, unparsable by this template's typescript 4.6.3
|
|
41
42
|
'@types/lodash': '4.17.5',
|
|
42
43
|
'@types/material-ui': '0.21.9',
|
|
43
44
|
'@types/minimatch': '3.0.5',
|
|
@@ -130,6 +131,10 @@ const uiPackage = {
|
|
|
130
131
|
moduleNameMapper: {
|
|
131
132
|
'~(.*)': '<rootDir>/src/$1',
|
|
132
133
|
'^.+\\.(css|sass|scss)$': 'identity-obj-proxy',
|
|
134
|
+
// @corva/ui's ImageViewer imports photoswipe (ESM-only); stub it so app
|
|
135
|
+
// tests can import @corva/ui without a module-resolution/ESM failure.
|
|
136
|
+
'^photoswipe/lightbox$': 'identity-obj-proxy',
|
|
137
|
+
'^photoswipe$': 'identity-obj-proxy',
|
|
133
138
|
'@corva/ui(.*)': '@corva/ui/cjs-bundle/$1',
|
|
134
139
|
},
|
|
135
140
|
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
|
|
@@ -140,6 +145,7 @@ const uiPackage = {
|
|
|
140
145
|
},
|
|
141
146
|
'resolutions': {
|
|
142
147
|
'@noble/hashes': '1.8.0',
|
|
148
|
+
'lodash': '4.18.1',
|
|
143
149
|
},
|
|
144
150
|
};
|
|
145
151
|
|
|
@@ -250,11 +256,16 @@ const nodeNpmPackage = {
|
|
|
250
256
|
},
|
|
251
257
|
],
|
|
252
258
|
},
|
|
259
|
+
overrides: {
|
|
260
|
+
lodash: '4.18.1',
|
|
261
|
+
},
|
|
253
262
|
};
|
|
254
263
|
|
|
255
264
|
const nodeYarnPackage = {
|
|
256
265
|
...nodeNpmPackage,
|
|
257
266
|
scripts: nodeYarnScripts,
|
|
267
|
+
overrides: undefined,
|
|
268
|
+
resolutions: nodeNpmPackage.overrides,
|
|
258
269
|
};
|
|
259
270
|
|
|
260
271
|
const nodeTsNpmPackage = {
|
|
@@ -271,6 +282,8 @@ const nodeTsNpmPackage = {
|
|
|
271
282
|
const nodeTsYarnPackage = {
|
|
272
283
|
...nodeTsNpmPackage,
|
|
273
284
|
scripts: nodeTsYarnScripts,
|
|
285
|
+
overrides: undefined,
|
|
286
|
+
resolutions: nodeNpmPackage.overrides,
|
|
274
287
|
};
|
|
275
288
|
|
|
276
289
|
const extendWithTsConfig = (packageJson, version) => {
|
package/lib/flow.js
CHANGED
|
@@ -29,6 +29,12 @@ export const runFlow = async (flow, context, indent = '') => {
|
|
|
29
29
|
|
|
30
30
|
const runSteps = async (steps = [], context = {}, indent = '') => {
|
|
31
31
|
for (const step of steps) {
|
|
32
|
+
if (typeof step.skip === 'function' && step.skip(context)) {
|
|
33
|
+
debug('Skipping %s', step.name || step.message);
|
|
34
|
+
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
if (step.name) {
|
|
33
39
|
const result = await runFlow(step, context, indent);
|
|
34
40
|
|
package/lib/flows/release.js
CHANGED
|
@@ -8,6 +8,7 @@ import { ADD_LABEL_STEP } from './steps/release/add-label.js';
|
|
|
8
8
|
import { ADD_NOTES_STEP } from './steps/release/add-notes.js';
|
|
9
9
|
import { PUBLISH_PACKAGE_STEP } from './steps/release/publish.js';
|
|
10
10
|
import { RELEASE_PREPARE_DATA_STEP } from './steps/release/prepare-data.js';
|
|
11
|
+
import { RESOLVE_PREBUILT_ZIP_STEP } from './steps/release/resolve-prebuilt-zip.js';
|
|
11
12
|
|
|
12
13
|
export const RELEASE_FLOW = {
|
|
13
14
|
name: 'release',
|
|
@@ -15,6 +16,9 @@ export const RELEASE_FLOW = {
|
|
|
15
16
|
PREPARE_FLOW,
|
|
16
17
|
SETUP_API_CLIENT_STEP,
|
|
17
18
|
RELEASE_PREPARE_DATA_STEP,
|
|
19
|
+
// With --zip-file-name the archive already exists, so the zip flow is skipped entirely. That
|
|
20
|
+
// also lets runtimes the zip flow has no file list for (e.g. `provided.*`) be released.
|
|
21
|
+
RESOLVE_PREBUILT_ZIP_STEP,
|
|
18
22
|
ZIP_SIMPLE_FLOW,
|
|
19
23
|
UPLOAD_ZIP_TO_CORVA_STEP,
|
|
20
24
|
WAIT_FOR_BUILD_FINISH_STEP,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { StepError } from '../../lib/step-error.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Handles `--zip-file-name`: the caller has already built the package archive, so this records it
|
|
8
|
+
* as the archive to upload and marks the zip flow as a no-op.
|
|
9
|
+
*/
|
|
10
|
+
export const RESOLVE_PREBUILT_ZIP_STEP = {
|
|
11
|
+
message: 'Resolving prebuilt archive...',
|
|
12
|
+
fn: async ({ dirName, options }) => {
|
|
13
|
+
const { zipFileName } = options;
|
|
14
|
+
|
|
15
|
+
if (!zipFileName) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const zipPath = resolve(dirName, zipFileName);
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
await fs.access(zipPath);
|
|
23
|
+
} catch {
|
|
24
|
+
throw new StepError(`Prebuilt archive ${zipFileName} not found in ${dirName}`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
zipFileName,
|
|
29
|
+
skipZip: true,
|
|
30
|
+
// The archive belongs to the caller. Neither flag reaches the context today; this is defensive.
|
|
31
|
+
removeOnSuccess: false,
|
|
32
|
+
removeOnFail: false,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
};
|
package/lib/flows/zip-simple.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InvalidArgumentError, Option } from 'commander';
|
|
2
|
+
|
|
3
|
+
const flags = '--zip-file-name <string>';
|
|
4
|
+
const description =
|
|
5
|
+
'Upload an already-built .zip from the project directory instead of zipping it here. ' +
|
|
6
|
+
'The archive belongs to the caller and is never deleted after upload.';
|
|
7
|
+
|
|
8
|
+
// An unset CI variable arrives as `--zip-file-name=`, and commander 9 takes the next token as the
|
|
9
|
+
// value even when it is another flag — neither should pass for an archive name.
|
|
10
|
+
function argParser(value) {
|
|
11
|
+
if (typeof value !== 'string' || !value.trim() || value.startsWith('-')) {
|
|
12
|
+
throw new InvalidArgumentError('Expected a file name, e.g. --zip-file-name=package.zip.');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const zipFileNameOption = new Option(flags, description).argParser(argParser);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corva/create-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.122.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Create an app to use it in CORVA.AI",
|
|
6
6
|
"keywords": [
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "https://github.com/corva-ai/create-corva-app"
|
|
15
|
-
"directory": "@corva/create-app"
|
|
14
|
+
"url": "https://github.com/corva-ai/create-corva-app"
|
|
16
15
|
},
|
|
17
16
|
"license": "MIT",
|
|
18
17
|
"type": "module",
|
|
@@ -42,6 +41,9 @@
|
|
|
42
41
|
"lint-staged": {
|
|
43
42
|
"*.js": "npm run lint:fix"
|
|
44
43
|
},
|
|
44
|
+
"resolutions": {
|
|
45
|
+
"lodash": "4.18.1"
|
|
46
|
+
},
|
|
45
47
|
"dependencies": {
|
|
46
48
|
"archiver": "^5.3.0",
|
|
47
49
|
"chalk": "^4.1.0",
|
|
@@ -78,10 +80,10 @@
|
|
|
78
80
|
"@typescript-eslint/parser": "^8.58.1",
|
|
79
81
|
"conventional-changelog-cli": "^2.1.0",
|
|
80
82
|
"eslint": "^8.2.0",
|
|
81
|
-
"eslint-plugin-jest": "^27.1.5",
|
|
82
83
|
"eslint-config-google": "^0.14.0",
|
|
83
84
|
"eslint-config-prettier": "^8.5.0",
|
|
84
85
|
"eslint-plugin-import": "^2.26.0",
|
|
86
|
+
"eslint-plugin-jest": "^27.1.5",
|
|
85
87
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
86
88
|
"eslint-plugin-prettier": "^4.2.1",
|
|
87
89
|
"eslint-plugin-react": "^7.32.0",
|
|
@@ -96,9 +98,6 @@
|
|
|
96
98
|
"zx": "^7.2.3"
|
|
97
99
|
},
|
|
98
100
|
"packageManager": "yarn@1.22.19+sha512.ff4579ab459bb25aa7c0ff75b62acebe576f6084b36aa842971cf250a5d8c6cd3bc9420b22ce63c7f93a0857bc6ef29291db39c3e7a23aab5adfd5a4dd6c5d71",
|
|
99
|
-
"engines": {
|
|
100
|
-
"node": ">=24 <25"
|
|
101
|
-
},
|
|
102
101
|
"standard-version": {
|
|
103
102
|
"skip": {
|
|
104
103
|
"tag": true
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
// learn more: https://github.com/testing-library/jest-dom
|
|
7
7
|
// eslint-disable-next-line
|
|
8
8
|
import '@testing-library/jest-dom/extend-expect';
|
|
9
|
+
import { TextEncoder, TextDecoder } from 'util';
|
|
10
|
+
|
|
11
|
+
Object.assign(global, { TextDecoder, TextEncoder });
|
|
9
12
|
|
|
10
13
|
// Set UTC timezone for tests to not use the environment timezone
|
|
11
14
|
process.env.TZ = 'UTC';
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
// learn more: https://github.com/testing-library/jest-dom
|
|
7
7
|
// eslint-disable-next-line
|
|
8
8
|
import '@testing-library/jest-dom/extend-expect';
|
|
9
|
+
import { TextEncoder, TextDecoder } from 'util';
|
|
10
|
+
|
|
11
|
+
Object.assign(global, { TextDecoder, TextEncoder });
|
|
9
12
|
|
|
10
13
|
// Set UTC timezone for tests to not use the environment timezone
|
|
11
14
|
process.env.TZ = 'UTC';
|