@corva/create-app 0.43.0-1 → 0.43.0-3
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/bin/create-corva-app.cjs +15 -4
- package/lib/helpers/resolve-app-runtime.js +9 -10
- package/lib/main.js +27 -1
- package/package.json +3 -2
package/bin/create-corva-app.cjs
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const { spawnSync } = require('
|
|
3
|
+
const { sync: spawnSync } = require('cross-spawn');
|
|
4
4
|
const { resolve } = require('path');
|
|
5
5
|
|
|
6
|
-
const cmd =
|
|
7
|
-
|
|
6
|
+
const cmd = 'node';
|
|
7
|
+
const args = [
|
|
8
8
|
'--no-warnings',
|
|
9
9
|
'--experimental-json-modules',
|
|
10
10
|
resolve(__dirname, 'cca.js'),
|
|
11
11
|
...process.argv.slice(2),
|
|
12
12
|
];
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const { signal, status, error } = spawnSync(cmd, args, {
|
|
15
|
+
stdio: 'inherit',
|
|
16
|
+
shell: true,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (signal) {
|
|
20
|
+
process.exit(signal);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (status || error) {
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
@@ -2,7 +2,7 @@ import { APP_TYPES } from '../constants/cli.js';
|
|
|
2
2
|
import Debug from 'debug';
|
|
3
3
|
|
|
4
4
|
const debug = Debug('cca:resolve-app-runtime');
|
|
5
|
-
import
|
|
5
|
+
import spawn from 'cross-spawn';
|
|
6
6
|
import { promises as fs } from 'fs';
|
|
7
7
|
import semver from 'semver';
|
|
8
8
|
import os from 'os';
|
|
@@ -11,22 +11,22 @@ const checkCliVersion = async (command, version, stdErr = false) =>
|
|
|
11
11
|
new Promise((resolve, reject) => {
|
|
12
12
|
const child = spawn(command, ['--version']);
|
|
13
13
|
|
|
14
|
-
let data;
|
|
14
|
+
let data = '';
|
|
15
15
|
|
|
16
|
-
child.stderr.
|
|
17
|
-
data
|
|
16
|
+
child.stderr.on('data', (buffer) => {
|
|
17
|
+
data += buffer;
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
child.stdout.
|
|
21
|
-
data
|
|
20
|
+
child.stdout.on('data', (buffer) => {
|
|
21
|
+
data += buffer;
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
child.once('close', (code) => {
|
|
25
25
|
if (code !== 0) {
|
|
26
26
|
debug(`Command ${command} exited with code ${code}`);
|
|
27
|
-
debug(data.toString());
|
|
27
|
+
debug('Output:', data.toString());
|
|
28
28
|
|
|
29
|
-
return
|
|
29
|
+
return resolve(false);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
debug(`%s version output: %s`, command, data.toString());
|
|
@@ -77,8 +77,7 @@ export const resolveAppRuntime = (opts) => {
|
|
|
77
77
|
|
|
78
78
|
return {
|
|
79
79
|
language: 'python',
|
|
80
|
-
isRuntimeAvailable:
|
|
81
|
-
(await checkCliVersion('python3', version)) || (await checkCliVersion('python', version)),
|
|
80
|
+
isRuntimeAvailable: () => checkCliVersion('python3', version),
|
|
82
81
|
packageManager: 'pip',
|
|
83
82
|
version,
|
|
84
83
|
};
|
package/lib/main.js
CHANGED
|
@@ -302,12 +302,38 @@ const handleCommanderError = (e) => {
|
|
|
302
302
|
}
|
|
303
303
|
};
|
|
304
304
|
|
|
305
|
+
/**
|
|
306
|
+
*
|
|
307
|
+
* @param {import('./flows/lib/manifest').Manifest} manifest
|
|
308
|
+
*/
|
|
309
|
+
const getEnvManagementLink = (manifest) => {
|
|
310
|
+
const isWindows = process.platform === 'win32';
|
|
311
|
+
|
|
312
|
+
if (manifest.isJs()) {
|
|
313
|
+
if (isWindows) {
|
|
314
|
+
return 'https://github.com/coreybutler/nvm-windows';
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return 'https://github.com/nvm-sh/nvm';
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (isWindows) {
|
|
321
|
+
return 'https://github.com/pyenv-win/pyenv-win';
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return 'https://github.com/pyenv/pyenv';
|
|
325
|
+
};
|
|
326
|
+
|
|
305
327
|
async function initPackage(projectName, opts) {
|
|
306
328
|
const manifest = new Manifest(manifestHelpers.fillManifest(opts));
|
|
307
329
|
const runtime = resolveAppRuntime(opts);
|
|
308
330
|
|
|
309
331
|
if (!(await runtime.isRuntimeAvailable())) {
|
|
310
|
-
throw new Error(
|
|
332
|
+
throw new Error(
|
|
333
|
+
`Runtime "${opts.runtime}" is not available locally. Please proceed to ${chalk.green(
|
|
334
|
+
getEnvManagementLink(manifest)
|
|
335
|
+
)} to install it locally.`
|
|
336
|
+
);
|
|
311
337
|
}
|
|
312
338
|
|
|
313
339
|
if (manifest.isUi()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corva/create-app",
|
|
3
|
-
"version": "0.43.0-
|
|
3
|
+
"version": "0.43.0-3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Create an app to use it in CORVA.AI",
|
|
6
6
|
"keywords": [
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"archiver": "^5.3.0",
|
|
38
38
|
"chalk": "4.1.0",
|
|
39
39
|
"commander": "^9.1.0",
|
|
40
|
-
"cross-spawn": "7.0.3",
|
|
40
|
+
"cross-spawn": "^7.0.3",
|
|
41
41
|
"debug": "^4.3.4",
|
|
42
42
|
"dotenv": "^16.0.0",
|
|
43
43
|
"figlet": "^1.5.0",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@corva/eslint-config-browser": "^0.0.4",
|
|
57
57
|
"@corva/eslint-config-node": "^4.2.0",
|
|
58
|
+
"@types/cross-spawn": "^6.0.2",
|
|
58
59
|
"conventional-changelog-cli": "^2.1.0",
|
|
59
60
|
"prettier": "^2.4.1",
|
|
60
61
|
"standard-version": "^9.0.0"
|