@corva/create-app 0.46.0-0-test-2f3568e3 → 0.46.0-rc.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/README.md
CHANGED
|
@@ -178,7 +178,7 @@ Options:
|
|
|
178
178
|
--remove-on-fail [boolean] Remove release if it fails during deployment (default: false)
|
|
179
179
|
--silent [boolean] Only log result of the operation (default: false)
|
|
180
180
|
--remove-on-success App package (.zip) will not be deleted after upload (default: true)
|
|
181
|
-
--remove-existing [boolean] If package version is already taken - remove the
|
|
181
|
+
--remove-existing [boolean] If package.json version is already taken - remove the previously published package and upload a new one (default: false)
|
|
182
182
|
```
|
|
183
183
|
|
|
184
184
|
### Examples
|
package/lib/flows/lib/api.js
CHANGED
|
@@ -17,15 +17,6 @@ export class Api {
|
|
|
17
17
|
constructor(envName, apiKey, authToken = null) {
|
|
18
18
|
const prefixUrl = `https://api${envName === 'production' ? '' : `.${envName}`}.corva.ai`;
|
|
19
19
|
|
|
20
|
-
console.log({
|
|
21
|
-
prefixUrl,
|
|
22
|
-
headers: {
|
|
23
|
-
'Authorization': authToken ? `Bearer` : `API ${apiKey.split('').reverse().join('')}`,
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
'Accept': 'application/json',
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
|
|
29
20
|
this.#api = got.extend({
|
|
30
21
|
prefixUrl,
|
|
31
22
|
retry: { limit: 0 },
|
|
@@ -10,17 +10,15 @@ async function deleteAppPackage({ api, appId, appPkgVersion }) {
|
|
|
10
10
|
(appPackage) => appPackage.attributes.package_code_version === appPkgVersion,
|
|
11
11
|
);
|
|
12
12
|
|
|
13
|
-
console.log({
|
|
14
|
-
appId,
|
|
15
|
-
appPackages,
|
|
16
|
-
appPkgVersion,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
13
|
if (!packageToDelete) {
|
|
20
|
-
throw new StepError('
|
|
14
|
+
throw new StepError('No matching version while trying to remove the existing package, unrecoverable error');
|
|
21
15
|
}
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
try {
|
|
18
|
+
await api.deleteAppUpload(appId, packageToDelete?.id);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
throw new StepError('Failed to remove the package, probably can retry');
|
|
21
|
+
}
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
export const UPLOAD_ZIP_TO_CORVA_STEP = {
|
|
@@ -44,7 +42,7 @@ export const UPLOAD_ZIP_TO_CORVA_STEP = {
|
|
|
44
42
|
try {
|
|
45
43
|
return await uploadAppPackage();
|
|
46
44
|
} catch (error) {
|
|
47
|
-
if (error?.message?.includes('version has already been taken') && options.removeExisting) {
|
|
45
|
+
if (error?.message?.includes('Package code version has already been taken') && options.removeExisting) {
|
|
48
46
|
await deleteAppPackage({ api, appPkgVersion: pkg.version, appId });
|
|
49
47
|
|
|
50
48
|
return uploadAppPackage();
|