@corva/create-app 0.65.0-2 → 0.65.0-4
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 +1 -0
- package/lib/commands/create.js +2 -2
- package/lib/commands/release.js +2 -0
- package/lib/flows/steps/release/prepare-data.js +4 -2
- package/lib/flows/steps/release/upload-zip-to-corva.js +2 -3
- package/lib/flows/steps/zip-file-list-resolve.js +23 -1
- package/lib/helpers/resolve-app-runtime.js +2 -2
- package/lib/options/app-key.js +6 -0
- package/package.json +1 -1
- package/templates/stream_depth/python/test/app_test.py +1 -1
package/README.md
CHANGED
|
@@ -175,6 +175,7 @@ Options:
|
|
|
175
175
|
--ignored-files [string...] Patterns to skip zip (default: [])
|
|
176
176
|
--env [string] Environment to use (choices: "qa", "staging", "production", default: "qa")
|
|
177
177
|
--api-key [string] Pre generated API key for authorization during app upload
|
|
178
|
+
--app-key [string] Explicitly set appKey that CLI is going to use. Otherwise it will be taken from manifest.json file.
|
|
178
179
|
--notes [string] Add custom notes to published app
|
|
179
180
|
--label [string] Put a label on the release (choices: "DEV", "BETA", "PROD")
|
|
180
181
|
--remove-on-fail [boolean] Remove release if it fails during deployment (default: false)
|
package/lib/commands/create.js
CHANGED
|
@@ -276,10 +276,10 @@ const addNvmRc = async (root, manifest, runtime) => {
|
|
|
276
276
|
*
|
|
277
277
|
* @param {string} root
|
|
278
278
|
* @param {Manifest} manifest
|
|
279
|
-
* @param {import('
|
|
279
|
+
* @param {import('../helpers/resolve-app-runtime.js').Runtime} runtime
|
|
280
280
|
*/
|
|
281
281
|
const addPythonConfigs = async (root, manifest, runtime) => {
|
|
282
|
-
await fs.writeFile(resolve(root, '.python-version'), `${runtime.
|
|
282
|
+
await fs.writeFile(resolve(root, '.python-version'), `${runtime.version}\n`);
|
|
283
283
|
await fs.writeFile(resolve(root, '.python-virtualenv'), `${manifest.unix_name}\n`);
|
|
284
284
|
};
|
|
285
285
|
|
package/lib/commands/release.js
CHANGED
|
@@ -10,6 +10,7 @@ import { originalCwdOption } from '../options/original-cwd.js';
|
|
|
10
10
|
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
|
+
import { appKeyOption } from '../options/app-key.js';
|
|
13
14
|
|
|
14
15
|
export const releaseCommand = new Command('release')
|
|
15
16
|
.description('Release app')
|
|
@@ -20,6 +21,7 @@ export const releaseCommand = new Command('release')
|
|
|
20
21
|
.addOption(silentOption)
|
|
21
22
|
.addOption(envOption)
|
|
22
23
|
.addOption(apiKeyOption)
|
|
24
|
+
.addOption(appKeyOption)
|
|
23
25
|
.addOption(originalCwdOption)
|
|
24
26
|
.addOption(new Option('--notes [string]', 'Add custom notes to published app'))
|
|
25
27
|
.addOption(new Option('--label [string]', 'Put a label on the release').choices(['DEV', 'BETA', 'PROD']))
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export const RELEASE_PREPARE_DATA_STEP = {
|
|
2
2
|
message: 'Preparing data...',
|
|
3
|
-
async fn({ api, manifest }) {
|
|
4
|
-
const
|
|
3
|
+
async fn({ api, manifest, options }) {
|
|
4
|
+
const appKey = options.appKey || manifest.manifest.application.key;
|
|
5
|
+
const app = await api.getAppByKey(appKey);
|
|
5
6
|
|
|
6
7
|
return {
|
|
7
8
|
appId: app.id,
|
|
9
|
+
appKey,
|
|
8
10
|
};
|
|
9
11
|
},
|
|
10
12
|
};
|
|
@@ -27,15 +27,14 @@ export const UPLOAD_ZIP_TO_CORVA_STEP = {
|
|
|
27
27
|
*
|
|
28
28
|
* @param {object} param0
|
|
29
29
|
* @param {import('../../lib/api').Api} param0.api
|
|
30
|
-
* @param {import('../../lib/manifest').Manifest} param0.manifest
|
|
31
30
|
*/
|
|
32
|
-
fn: async ({ zipFileName,
|
|
31
|
+
fn: async ({ zipFileName, api, appId, appKey, dirName, options, pkg }) => {
|
|
33
32
|
async function uploadAppPackage() {
|
|
34
33
|
const form = new FormData();
|
|
35
34
|
|
|
36
35
|
form.append('package', createReadStream(resolve(dirName, zipFileName)), 'package.zip');
|
|
37
36
|
|
|
38
|
-
const { id: packageId } = await api.uploadPackages(
|
|
37
|
+
const { id: packageId } = await api.uploadPackages(appKey, form);
|
|
39
38
|
|
|
40
39
|
return { packageId };
|
|
41
40
|
}
|
|
@@ -75,7 +75,7 @@ const transformPatternsIntoFileNames = async (dirName, patterns, ignoredFiles =
|
|
|
75
75
|
* @param {import('../lib/manifest').Manifest} param1.manifest
|
|
76
76
|
* @returns
|
|
77
77
|
*/
|
|
78
|
-
const resolveDataToZipUiApp = async (itemsToZip = [], { options, pkg, dirName, manifest }) => {
|
|
78
|
+
const resolveDataToZipUiApp = async (itemsToZip = [], { options, pkg, dirName, manifest, appKey }) => {
|
|
79
79
|
const version = await getIncreasedVersion(pkg.version, options);
|
|
80
80
|
const randomSuffix = generateRandomString(); // Random suffix is needed to not cause a conflict when we call 2 parallel commands at the same time.
|
|
81
81
|
const zipFileName = `${manifest.unix_name}-${version}-${randomSuffix}.zip`;
|
|
@@ -123,6 +123,28 @@ const resolveDataToZipUiApp = async (itemsToZip = [], { options, pkg, dirName, m
|
|
|
123
123
|
...(await transformPatternsIntoFileNames(dirName, ['src/**/*'], options.ignoredFiles)),
|
|
124
124
|
);
|
|
125
125
|
|
|
126
|
+
if (options.appKey) {
|
|
127
|
+
/**
|
|
128
|
+
* Both manifest.json appKey in zip and the provided
|
|
129
|
+
* appKey param should match. That's why we set it for cases when appKey option
|
|
130
|
+
* is specified to override the one from manifest.json
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
const tmpManifestForSourceName = `manifestForSource_${randomSuffix}.json`;
|
|
134
|
+
|
|
135
|
+
itemsToSave.push({
|
|
136
|
+
name: tmpManifestForSourceName,
|
|
137
|
+
content: _.set('application.key', appKey, manifest.manifest),
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
itemsToRemove.push(tmpManifestForSourceName);
|
|
141
|
+
|
|
142
|
+
itemsToZip.push({
|
|
143
|
+
path: resolve(dirName, tmpManifestForSourceName),
|
|
144
|
+
name: 'manifest.json',
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
126
148
|
return {
|
|
127
149
|
zipFileName,
|
|
128
150
|
itemsToZip,
|
|
@@ -105,13 +105,13 @@ export const resolveAppRuntime = (opts) => {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
const version = /python(\d\.\d)/.exec(opts.runtime)[1];
|
|
108
|
+
const version = /python(\d\.\d+)/.exec(opts.runtime)[1];
|
|
109
109
|
|
|
110
110
|
return {
|
|
111
111
|
language: 'python',
|
|
112
112
|
isRuntimeAvailable: async () => {
|
|
113
113
|
if (!IS_WINDOWS) {
|
|
114
|
-
return checkCliVersion(`
|
|
114
|
+
return checkCliVersion(`python3`, version);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
return (
|
package/package.json
CHANGED