@corva/create-app 0.111.0 → 0.112.1

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,2 +1,2 @@
1
- corva-sdk==1.8.1
1
+ corva-sdk==1.14.0
2
2
  pytest==7.1.1
@@ -22,7 +22,7 @@ const uiDependencies = {
22
22
 
23
23
  const jsUiDevDependencies = {
24
24
  '@corva/dc-platform-shared': 'latest',
25
- '@corva/eslint-config-browser': 'latest',
25
+ '@corva/eslint-config-browser': '0.2.2',
26
26
  '@testing-library/jest-dom': '^5.14.1',
27
27
  '@testing-library/react': '^12.1.5',
28
28
  '@testing-library/react-hooks': '^8.0.1',
@@ -155,7 +155,7 @@ const tsUiPackage = {
155
155
 
156
156
  const nodeNpmScripts = {
157
157
  'bundle': 'create-corva-app zip .',
158
- 'test': 'npm audit --production && npm run unit',
158
+ 'test': 'npm run unit',
159
159
  'unit': 'jest',
160
160
  'lint': 'eslint --ext .js,.ts .',
161
161
  'lint:fix': 'eslint --ext .js,.ts --fix .',
@@ -182,7 +182,7 @@ const nodeTsDevDependencies = {
182
182
 
183
183
  const nodeYarnScripts = {
184
184
  ...nodeNpmScripts,
185
- test: 'yarn audit --groups dependencies && yarn unit',
185
+ test: 'yarn unit',
186
186
  };
187
187
 
188
188
  const commonTsScripts = {
@@ -42,15 +42,30 @@ export class Api {
42
42
  * @returns {object}
43
43
  */
44
44
  async getAppByKey(appKey) {
45
- const { data } = await this.#api.get(`v2/apps/${appKey}`).json();
46
-
47
- if (!data) {
48
- throw new StepError(
49
- `App with key - ${appKey}, does not exist.\nThe key search is case-sensitive. You might need to update the app key in your app to exactly match the key.`,
50
- );
45
+ try {
46
+ const { data } = await this.#api.get(`v2/apps/${appKey}`).json();
47
+
48
+ if (!data) {
49
+ throw new StepError(
50
+ `App with key - ${appKey}, does not exist.\nThe key search is case-sensitive. You might need to update the app key in your app to exactly match the key.`,
51
+ );
52
+ }
53
+
54
+ return data;
55
+ } catch (error) {
56
+ if (error?.response?.statusCode === 404) {
57
+ throw new StepError(
58
+ `App with key - ${appKey}, does not exist.\nThe key search is case-sensitive. You might need to update the app key in your app to exactly match the key.`,
59
+ { cause: error },
60
+ );
61
+ }
62
+ // If error has a response, it's an API exception
63
+ else if (error?.response) {
64
+ throw new StepError(`getAppByKey request failed, code:${error?.response?.statusCode}`);
65
+ }
66
+
67
+ throw error;
51
68
  }
52
-
53
- return data;
54
69
  }
55
70
 
56
71
  /**
@@ -98,13 +98,12 @@ const resolveDataToZipUiApp = async (itemsToZip = [], { options, pkg, dirName, m
98
98
 
99
99
  itemsToSave.push({
100
100
  name: tmpPackageForSourceName,
101
- content: _.set(
102
- 'scripts',
103
- {
104
- build: 'webpack --config=./config-overrides.js --mode production',
101
+ content: {
102
+ ...pkg,
103
+ scripts: {
104
+ build: pkg.scripts?.build,
105
105
  },
106
- pkg,
107
- ),
106
+ },
108
107
  });
109
108
 
110
109
  const itemsToRemove = [tmpPackageForSourceName];
@@ -112,6 +111,8 @@ const resolveDataToZipUiApp = async (itemsToZip = [], { options, pkg, dirName, m
112
111
  itemsToZip.push(
113
112
  'manifest.json',
114
113
  'config-overrides.js',
114
+ 'eslint.config.js',
115
+ 'eslint.config.mjs',
115
116
  'tsconfig.json',
116
117
  '.npmrc',
117
118
  '.nvmrc',
package/lib/main.js CHANGED
@@ -13,9 +13,6 @@ import { createCommand } from './commands/create.js';
13
13
 
14
14
  import { ERROR_ICON } from './constants/messages.js';
15
15
  import { StepError } from './flows/lib/step-error.js';
16
- import debugFn from 'debug';
17
-
18
- const debug = debugFn('cca:main');
19
16
 
20
17
  function checkNodeVersion() {
21
18
  logger.write('Checking node version...');
@@ -58,9 +55,8 @@ export async function run() {
58
55
  if (e instanceof StepError) {
59
56
  console.error(chalk.red(`${ERROR_ICON} ${e.message}`));
60
57
  } else {
61
- debug(e);
62
-
63
58
  console.error(chalk.red(`${ERROR_ICON} Unknown error occured, please contact support`));
59
+ console.error(e);
64
60
  }
65
61
 
66
62
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/create-app",
3
- "version": "0.111.0",
3
+ "version": "0.112.1",
4
4
  "private": false,
5
5
  "description": "Create an app to use it in CORVA.AI",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react';
2
2
  import { render, screen, waitFor } from '@testing-library/react';
3
- import { components } from '@corva/ui';
3
+ import { Button } from '@corva/ui/componentsV2';
4
4
  import userEvent from '@testing-library/user-event';
5
5
 
6
6
  const Toggle = () => {
@@ -9,7 +9,7 @@ const Toggle = () => {
9
9
  return (
10
10
  <>
11
11
  {isOn ? 'ON' : 'OFF'}
12
- <components.Button onClick={() => setIsOn(value => !value)}>toggle</components.Button>
12
+ <Button onClick={() => setIsOn(value => !value)}>toggle</Button>
13
13
  </>
14
14
  );
15
15
  };
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react';
2
2
  import { render, screen, waitFor } from '@testing-library/react';
3
- import { components } from '@corva/ui';
3
+ import { Button } from '@corva/ui/componentsV2';
4
4
  import userEvent from '@testing-library/user-event';
5
5
 
6
6
  const Toggle = () => {
@@ -9,7 +9,7 @@ const Toggle = () => {
9
9
  return (
10
10
  <>
11
11
  {isOn ? 'ON' : 'OFF'}
12
- <components.Button onClick={() => setIsOn(value => !value)}>toggle</components.Button>
12
+ <Button onClick={() => setIsOn(value => !value)}>toggle</Button>
13
13
  </>
14
14
  );
15
15
  };