@corva/create-app 0.43.0-0 → 0.43.0-2

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.
@@ -11,4 +11,12 @@ const cmd = [
11
11
  ...process.argv.slice(2),
12
12
  ];
13
13
 
14
- spawnSync(cmd.join(' '), { stdio: 'inherit', shell: true });
14
+ const { signal, status, error } = spawnSync(cmd.map((a) => `"${a}"`).join(' '), { stdio: 'inherit', shell: true });
15
+
16
+ if (signal) {
17
+ process.exit(signal);
18
+ }
19
+
20
+ if (status || error) {
21
+ process.exit(1);
22
+ }
@@ -0,0 +1,15 @@
1
+ API_KEY=
2
+ APP_KEY=${APP_KEY}
3
+ APP_NAME=${APP_NAME}
4
+ PROVIDER=${PROVIDER}
5
+
6
+ API_ROOT_URL=https://api.corva.ai
7
+ DATA_API_ROOT_URL=https://data.corva.ai
8
+ CACHE_URL=redis://localhost:6379
9
+
10
+ LOG_LEVEL=debug
11
+ LOG_THRESHOLD_MESSAGE_SIZE=99999
12
+ LOG_THRESHOLD_MESSAGE_COUNT=99999
13
+
14
+ ENVIRONMENT=development
15
+ NODE_ENV=development
@@ -0,0 +1,26 @@
1
+ # Corva API key to perform actions with the API
2
+ API_KEY=
3
+ # Unique ID of the app
4
+ APP_KEY=
5
+ # Human readable name of the app
6
+ APP_NAME=
7
+ # Company identifier
8
+ PROVIDER=
9
+
10
+ # Root URL for Corva API
11
+ API_ROOT_URL=
12
+ # Root URL for Corva Data API
13
+ DATA_API_ROOT_URL=
14
+ # Redis cache url for caching data in Stream/Scheduler apps
15
+ CACHE_URL=
16
+
17
+ # Logging configuration, see https://corva-ai.github.io/node-sdk/docs/v7.2.0/classes/CorvaLogger
18
+ LOG_LEVEL=debug
19
+ LOG_THRESHOLD_MESSAGE_SIZE=99999
20
+ LOG_THRESHOLD_MESSAGE_COUNT=99999
21
+
22
+ # Working environment
23
+ ENVIRONMENT=development
24
+
25
+ # nodejs-specific settings
26
+ NODE_ENV=development
@@ -0,0 +1,14 @@
1
+ API_KEY=
2
+ APP_KEY=${APP_KEY}
3
+ APP_NAME=${APP_NAME}
4
+ PROVIDER=${PROVIDER}
5
+
6
+ API_ROOT_URL=https://api.corva.ai
7
+ DATA_API_ROOT_URL=https://data.corva.ai
8
+ CACHE_URL=redis://localhost:6379
9
+
10
+ LOG_LEVEL=DEBUG
11
+ LOG_THRESHOLD_MESSAGE_SIZE=99999
12
+ LOG_THRESHOLD_MESSAGE_COUNT=99999
13
+
14
+ ENVIRONMENT=development
@@ -0,0 +1,23 @@
1
+ # Corva API key to perform actions with the API
2
+ API_KEY=
3
+ # Unique ID of the app
4
+ APP_KEY=
5
+ # Human readable name of the app
6
+ APP_NAME=
7
+ # Company short identifier
8
+ PROVIDER=
9
+
10
+ # Root URL for Corva API
11
+ API_ROOT_URL=
12
+ # Root URL for Corva Data API
13
+ DATA_API_ROOT_URL=
14
+ # Redis cache url for caching data in Stream/Scheduler apps
15
+ CACHE_URL=
16
+
17
+ # Logging configuration, see https://corva-ai.github.io/python-sdk/corva-sdk/1.7.0/index.html#_logging
18
+ LOG_LEVEL=DEBUG
19
+ LOG_THRESHOLD_MESSAGE_SIZE=99999
20
+ LOG_THRESHOLD_MESSAGE_COUNT=99999
21
+
22
+ # Working environment
23
+ ENVIRONMENT=development
@@ -75,7 +75,7 @@ const nodeNpmScripts = {
75
75
  };
76
76
 
77
77
  const nodeDependencies = {
78
- '@corva/node-sdk': '^6.2.0',
78
+ '@corva/node-sdk': '^7.2.0',
79
79
  };
80
80
 
81
81
  const nodeDevDependencies = {
@@ -1,4 +1,4 @@
1
- import path from 'node:path';
1
+ import path, { join } from 'node:path';
2
2
  import fs from 'fs-extra';
3
3
 
4
4
  export function copyFileSync(source, target) {
@@ -38,3 +38,21 @@ export function copyFolderRecursiveSync(sourceFolder, targetFolder) {
38
38
  copyFileSync(curSource, targetFolder);
39
39
  }
40
40
  }
41
+
42
+ /**
43
+ *
44
+ * @param {string} root
45
+ * @param {import('../flows/lib/manifest').Manifest} manifest
46
+ */
47
+ export const putVariablesInEnvFile = async (root, manifest) => {
48
+ const pathToEnvFile = join(root, '.env');
49
+ const envFileContent = await fs.readFile(pathToEnvFile, 'utf8');
50
+
51
+ await fs.writeFile(
52
+ pathToEnvFile,
53
+ envFileContent
54
+ .replace(new RegExp('\\${APP_KEY}', 'g'), manifest.manifest.application.key)
55
+ .replace(new RegExp('\\${PROVIDER}', 'g'), manifest.manifest.application.key.split('.')[0])
56
+ .replace(new RegExp('\\${APP_NAME}', 'g'), manifest.manifest.application.name)
57
+ );
58
+ };
package/lib/main.js CHANGED
@@ -377,6 +377,10 @@ async function addTemplate(root, manifest, runtime) {
377
377
  utils.copyFolderRecursiveSync(path.resolve(__dirname, '..', 'common', 'python'), root);
378
378
  }
379
379
 
380
+ if (!manifest.isUi()) {
381
+ await utils.putVariablesInEnvFile(root, manifest);
382
+ }
383
+
380
384
  // We can't have .gitignore file in our templates.
381
385
  // It's missing when @corva/create-app is installed.
382
386
  // That's why we manually rename gitignore to .gitignore after copying template
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/create-app",
3
- "version": "0.43.0-0",
3
+ "version": "0.43.0-2",
4
4
  "private": false,
5
5
  "description": "Create an app to use it in CORVA.AI",
6
6
  "keywords": [