@corva/create-app 0.39.0-0-test-commit-42ee519 → 0.39.0-0-test-commit-99d5264

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.
@@ -1,25 +1,18 @@
1
1
  const { RELEASE } = require('../../constants/messages');
2
- const { promises: fs } = require('fs');
3
- const dotenv = require('dotenv');
4
- const { resolve } = require('path');
5
2
  const { StepError } = require('../lib/step-error');
6
3
 
7
4
  const GET_RELEASE_CONFIG_STEP = {
8
5
  message: RELEASE.getAuthToken,
9
- fn: async ({ dirName }) => {
10
- const env = await fs.readFile(resolve(dirName, '.env')).catch((e) => {
11
- if (e.code === 'ENOENT') {
12
- throw new StepError('Mising .env file', { cause: e });
13
- }
14
-
15
- throw e;
16
- });
17
- const { CORVA_API_ENV, AUTH_TOKEN, CORVA_API_KEY } = dotenv.parse(env);
6
+ fn: async () => {
7
+ const { CORVA_API_ENV, AUTH_TOKEN, CORVA_API_KEY } = process.env;
18
8
 
19
9
  if (!AUTH_TOKEN && !CORVA_API_KEY) {
20
10
  throw new StepError(RELEASE.getAuthTokenError);
21
11
  }
22
12
 
13
+ console.log('DEBUG');
14
+ console.log({ CORVA_API_ENV, AUTH_TOKEN, CORVA_API_KEY });
15
+
23
16
  return {
24
17
  CORVA_API_ENV: CORVA_API_ENV || 'production',
25
18
  AUTH_TOKEN,
package/lib/index.js CHANGED
@@ -10,6 +10,7 @@ const inquirer = require('inquirer');
10
10
  const os = require('os');
11
11
  const path = require('path');
12
12
  const semver = require('semver');
13
+ require('dotenv').config();
13
14
 
14
15
  const {
15
16
  ensureLatestVersion,
@@ -55,7 +56,7 @@ function checkNodeVersion() {
55
56
  console.log(
56
57
  chalk.red(
57
58
  `\nYou are using Node ${process.version}.\n\n` +
58
- `Please update to Node 16 or higher for a better, fully supported experience.\n`
59
+ `Please update to Node 16 or higher for a better, fully supported experience.\n`
59
60
  )
60
61
  );
61
62
  // Fall back to latest supported react-scripts on Node 4
@@ -85,7 +86,7 @@ function checkOptions(opts) {
85
86
  const printDeprecationNotice = (param) =>
86
87
  console.warn(
87
88
  chalk.bgYellowBright`DEPRECATED OPTION: ${param}` +
88
- ` Use ${chalk.cyan(`create-corva-app ${param} .`)} instead`
89
+ ` Use ${chalk.cyan(`create-corva-app ${param} .`)} instead`
89
90
  );
90
91
 
91
92
  async function initialChecks() {
@@ -107,7 +108,8 @@ async function initialChecks() {
107
108
  manifestConstants.manifestOptions().forEach((value) => {
108
109
  const type = typeof value.default;
109
110
  const option = new Option(
110
- `${value.alias ? `-${value.alias}, ` : ''}--${value.name} [${(type !== 'undefined' && type) || 'string'
111
+ `${value.alias ? `-${value.alias}, ` : ''}--${value.name} [${
112
+ (type !== 'undefined' && type) || 'string'
111
113
  }]`,
112
114
  value.message
113
115
  );
@@ -268,7 +270,7 @@ async function initPackage(projectName, opts) {
268
270
  const manifest = new Manifest(manifestHelpers.fillManifest(opts));
269
271
  const runtime = resolveAppRuntime(opts);
270
272
 
271
- if (!await runtime.isRuntimeAvailable()) {
273
+ if (!(await runtime.isRuntimeAvailable())) {
272
274
  throw new Error(`Runtime "${opts.runtime}" is not available locally`);
273
275
  }
274
276
 
@@ -370,7 +372,7 @@ async function configureApp(root, manifest, runtime) {
370
372
 
371
373
  const addNvmRc = async (root, manifest, runtime) => {
372
374
  await fs.outputFile(path.join(root, '.nvmrc'), `${runtime.version}\n`);
373
- }
375
+ };
374
376
 
375
377
  const addTsConfigs = (root, manifest, runtime) => {
376
378
  if (runtime.language !== 'typescript') {
@@ -445,7 +447,7 @@ function addPackageJSON(root, manifest, runtime) {
445
447
  scripts: defaults.scripts,
446
448
  dependencies: defaults.dependencies,
447
449
  devDependencies: defaults.devDependencies,
448
- ...(defaults.jest && { jest: defaults.jest })
450
+ ...(defaults.jest && { jest: defaults.jest }),
449
451
  };
450
452
 
451
453
  return fs.writeJSON(path.join(root, 'package.json'), packageJson, writejsonOptions);
@@ -459,12 +461,16 @@ function addPackageJSON(root, manifest, runtime) {
459
461
  async function installApp(root, manifest, runtime) {
460
462
  const command = manifest.isJs() ? runtime.packageManager : 'make';
461
463
  const args = ['install'];
462
- const opts = { stdio: ['inherit', 'inherit', 'pipe'], cwd: root }
464
+ const opts = { stdio: ['inherit', 'inherit', 'pipe'], cwd: root };
463
465
 
464
466
  console.log(chalk.yellow(`Installing template dependencies using ${runtime.packageManager}...`));
465
- const proc = manifest.isJs() && existsSync(`${os.homedir()}/.nvm/nvm.sh`) ?
466
- spawn.sync(`\\. ${os.homedir()}/.nvm/nvm.sh && nvm i && ${command} ${args.join(' ')}`, { shell: true, ...opts }) :
467
- spawn.sync(command, args, opts);
467
+ const proc =
468
+ manifest.isJs() && existsSync(`${os.homedir()}/.nvm/nvm.sh`)
469
+ ? spawn.sync(`\\. ${os.homedir()}/.nvm/nvm.sh && nvm i && ${command} ${args.join(' ')}`, {
470
+ shell: true,
471
+ ...opts,
472
+ })
473
+ : spawn.sync(command, args, opts);
468
474
 
469
475
  if (proc.stderr) {
470
476
  const error = proc.stderr
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/create-app",
3
- "version": "0.39.0-0-test-commit-42ee519",
3
+ "version": "0.39.0-0-test-commit-99d5264",
4
4
  "private": false,
5
5
  "description": "Create app to use it in CORVA.AI",
6
6
  "keywords": [