@corva/create-app 0.34.0-0 → 0.34.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.
@@ -2,6 +2,7 @@ const APP_RUNTIMES = {
2
2
  UI: 'ui',
3
3
  NODE12: 'nodejs12.x',
4
4
  NODE14: 'nodejs14.x',
5
+ NODE16: 'nodejs16.x',
5
6
  PYTHON3: 'python3.8',
6
7
  };
7
8
 
@@ -1,6 +1,6 @@
1
- const { APP_TYPES, APP_RUNTIMES, TEMPLATE_TYPES } = require('../../constants/cli');
1
+ const { APP_TYPES, APP_RUNTIMES } = require('../../constants/cli');
2
2
 
3
- const NODE_RUNTIMES = [APP_RUNTIMES.NODE12, APP_RUNTIMES.NODE14];
3
+ const NODE_RUNTIMES = [APP_RUNTIMES.NODE12, APP_RUNTIMES.NODE14, APP_RUNTIMES.NODE16];
4
4
 
5
5
  class Manifest {
6
6
  constructor(manifest) {
@@ -55,6 +55,7 @@ const transformPatternsIntoFileNames = async (dirName, patterns, ignoredFiles =
55
55
  const files = await glob(pattern, {
56
56
  cwd: dirName,
57
57
  ignore: ['**/node_modules', ...ignoredFiles],
58
+ nodir: true,
58
59
  });
59
60
 
60
61
  filesFromPatterns.push(...files);
@@ -179,7 +180,7 @@ const resolveDataForZipPythonApp = async (itemsToZip = [], { manifest, dirName,
179
180
  const zipFileName = `${manifest.manifest.application.name}.zip`;
180
181
 
181
182
  if (!itemsToZip.length) {
182
- itemsToZip.push(...(await glob('**/*.py', { cwd: dirName, ignore: options.ignoredFiles })));
183
+ itemsToZip.push(...(await glob('**/*.py', { cwd: dirName, ignore: [...(options.ignoredFiles || []), 'venv/**/*'] })));
183
184
  }
184
185
 
185
186
  itemsToZip.push('manifest.json', 'requirements.txt');
package/lib/index.js CHANGED
@@ -302,7 +302,7 @@ async function createApp(dirName, opts) {
302
302
 
303
303
  console.log('Please fill your app Metadata');
304
304
 
305
- const answers = inquirer.prompt(manifestConstants.manifestOptions(dirName), opts);
305
+ const answers = await inquirer.prompt(manifestConstants.manifestOptions(dirName), opts);
306
306
 
307
307
  return initPackage(dirName, answers);
308
308
  }
@@ -355,6 +355,7 @@ async function configureApp(root, manifest, runtime) {
355
355
  }
356
356
 
357
357
  if (manifest.isNode()) {
358
+ await addNvmRc(root, manifest, runtime);
358
359
  await addTsConfigs(root, manifest, runtime);
359
360
  }
360
361
 
@@ -363,6 +364,10 @@ async function configureApp(root, manifest, runtime) {
363
364
  }
364
365
  }
365
366
 
367
+ const addNvmRc = async (root, manifest, runtime) => {
368
+ await fs.outputFile(path.join(root, '.nvmrc'), `${runtime.version}\n`);
369
+ }
370
+
366
371
  const addTsConfigs = (root, manifest, runtime) => {
367
372
  if (runtime.language !== 'typescript') {
368
373
  return;
@@ -430,8 +435,7 @@ function addPackageJSON(root, manifest, runtime) {
430
435
  version: defaults.version,
431
436
  description: manifest.description || defaults.description,
432
437
  engines: {
433
- node: '>=16',
434
- // node: `>=${runtime.version}`,
438
+ node: `^${runtime.version}`,
435
439
  [runtime.packageManager]: '*',
436
440
  },
437
441
  scripts: defaults.scripts,
@@ -450,9 +454,12 @@ function addPackageJSON(root, manifest, runtime) {
450
454
  async function installApp(root, manifest, runtime) {
451
455
  const command = manifest.isJs() ? runtime.packageManager : 'make';
452
456
  const args = ['install'];
457
+ const opts = { stdio: ['inherit', 'inherit', 'pipe'], cwd: root }
453
458
 
454
459
  console.log(chalk.yellow(`Installing template dependencies using ${runtime.packageManager}...`));
455
- const proc = spawn.sync(command, args, { stdio: ['inherit', 'inherit', 'pipe'], cwd: root });
460
+ const proc = manifest.isJs() ?
461
+ spawn.sync(`\\. ~/.nvm/nvm.sh && nvm use && ${command} ${args.join(' ')}`, { shell: true, ...opts }) :
462
+ spawn.sync(command, args, opts);
456
463
 
457
464
  if (proc.stderr) {
458
465
  const error = proc.stderr
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/create-app",
3
- "version": "0.34.0-0",
3
+ "version": "0.34.0-3",
4
4
  "private": false,
5
5
  "description": "Create app to use it in CORVA.AI",
6
6
  "keywords": [
@@ -1,5 +1,3 @@
1
- jest.mock('@corva/node-api-client');
2
-
3
1
  const Processor = require('../src/processor');
4
2
 
5
3
  test('process event', async () => {