@kumologica/sdk 3.0.27-beta18 → 3.0.27-beta19

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,6 +1,6 @@
1
1
  const pathlib = require('path');
2
2
  const { prompt, Select } = require('enquirer');
3
- const { logNotice, logError } = require('../utils');
3
+ const { logNotice, logError } = require('../../utils/logger');
4
4
  const { downloadTemplateFromRepo, listAvailableTemplates } = require('../../utils/download-template-from-repo');
5
5
 
6
6
  async function createProjectIteratively(){
@@ -1,35 +1,32 @@
1
1
  const pathlib = require('path');
2
- const { logNotice, logError, readerFriendly } = require('./utils');
3
2
  const { codegen } = require('@kumologica/builder');
4
- const { createProjectIteratively } = require('./create-commands');
5
- const { downloadTemplateFromRepo, listAvailableTemplates } = require('../utils/download-template-from-repo');
6
3
 
4
+ const { logNotice, logError } = require('../utils/logger');
5
+ const { downloadTemplateFromRepo } = require('../utils/download-template-from-repo');
6
+ const { createProjectIteratively } = require('./create-commands');
7
7
 
8
- exports.builder = async (yargs) => {
8
+ exports.command = 'create [options]'
9
+ exports.builder = (yargs) => {
9
10
  yargs.option(`path`, {
10
11
  describe: "The project path where the project will be created",
11
12
  // demandOption: "The path is required.",
12
- type: 'string',
13
- alias: 'p',
14
- nargs: 0
15
- })
13
+ type: 'string',
14
+ alias: 'p',
15
+ nargs: 1
16
+ })
16
17
  yargs.option(`template`, {
17
18
  describe: `Template for the project`,
18
19
  type: 'string',
19
20
  alias: 't',
20
- nargs: 0
21
+ nargs: 1
21
22
  })
22
- yargs.epilog(`Available Templates:
23
- ${await readerFriendly(listAvailableTemplates())}
24
- `)
25
-
26
23
  }
27
24
 
28
25
 
29
26
  exports.desc = 'Create a kumologica project. Do not pass any options to create iteratively.'
30
27
  exports.handler = async ({ path, template }) => {
31
28
  const { version } = require('../../package.json');
32
-
29
+
33
30
  if (!path && !template) {
34
31
  await createProjectIteratively();
35
32
  } else if (!path && template) {
@@ -0,0 +1,24 @@
1
+ const { listAvailableTemplates } = require('../utils/download-template-from-repo');
2
+ const { logNotice, logError, logInfo } = require('../utils/logger');
3
+
4
+ exports.command = 'list-templates'
5
+ exports.desc = 'List of available templates'
6
+ exports.handler = async function (argv) {
7
+ try {
8
+ logInfo('List of available templates:');
9
+ let templates = await readerFriendly(listAvailableTemplates())
10
+ logNotice(templates);
11
+ }catch(e){
12
+ logError(e.message);
13
+ }
14
+ }
15
+
16
+ // Utils
17
+ async function readerFriendly(templates) {
18
+ let result = [];
19
+ templates = await templates;
20
+ templates.forEach(t => {
21
+ result.push(`"${t}"`);
22
+ });
23
+ return result.join(',')
24
+ }
@@ -1,5 +1,5 @@
1
1
  const path = require('path');
2
- const { logError } = require('./utils');
2
+ const { logError } = require('../utils/logger');
3
3
 
4
4
  const rootPath = path.join(__dirname, '..', '..',);
5
5
 
@@ -5,7 +5,6 @@ const path = require('path');
5
5
  const chalk = require('chalk');
6
6
  const { error } = require('./util/output');
7
7
  const got = require('got');
8
- const { logError } = require('../utils');
9
8
  const log = console.log;
10
9
 
11
10
 
@@ -1,14 +1,15 @@
1
1
  const chalk = require('chalk');
2
2
  const { Select } = require('enquirer');
3
3
  const fs = require('fs');
4
- const { logError } = require('./utils');
5
4
  const path = require('path');
6
5
  const wcmatch = require('wildcard-match');
7
6
 
8
7
  const { AppServer } = require('@kumologica/runtime');
9
- const { TestSuiteController } = require('./test-utils/TestSuiteController');
10
8
  const { codegen } = require('@kumologica/builder');
11
9
 
10
+ const { TestSuiteController } = require('./test-utils/TestSuiteController');
11
+ const { logError } = require('../utils/logger');
12
+
12
13
  const log = console.log;
13
14
  const APP_SERVER_PORT = 1990;
14
15
 
@@ -297,7 +297,7 @@ async function downloadTemplateFromRepo(repoUrl, templateName, projectPath, proj
297
297
  fse.removeSync(tempBaseDirectory);
298
298
  if (renamed) renameService(targetProjectDir, projectName);
299
299
  }catch(err){
300
- throw new KumologicaError(`Template name: "${templateName}" does not exist. Run "kl create -help" to see list of available templates.`);
300
+ throw new KumologicaError(`Template name: "${templateName}" does not exist. Run "kl list-templates" to see list of available templates.`);
301
301
  }
302
302
  return "";
303
303
  });
@@ -1,14 +1,5 @@
1
1
  const chalk = require('chalk');
2
2
 
3
- async function readerFriendly(templates) {
4
- let result = [];
5
- templates = await templates;
6
- templates.forEach(t => {
7
- result.push(`"${t}"`);
8
- });
9
- return result.join(',')
10
-
11
- }
12
3
  /* Loggers */
13
4
  function logError(message) {
14
5
  console.log(chalk.red(message));
@@ -18,8 +9,12 @@ function logNotice(message) {
18
9
  console.log(chalk.yellow(message));
19
10
  }
20
11
 
12
+ function logInfo(message) {
13
+ console.log(message);
14
+ }
15
+
21
16
  module.exports = {
22
17
  logError,
23
18
  logNotice,
24
- readerFriendly
19
+ logInfo
25
20
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "productName": "Kumologica Designer",
4
4
  "copyright": "Copyright 2020 Kumologica Pty Ltd, All Rights Reserved.",
5
5
  "author": "Kumologica Pty Ltd <contact@kumologica.com>",
6
- "version": "3.0.27-beta18",
6
+ "version": "3.0.27-beta19",
7
7
  "description": "Kumologica Designer, harnessing Serverless for your cloud integration needs",
8
8
  "main": "src/app/main.js",
9
9
  "files": [
@@ -65,9 +65,9 @@
65
65
  "license": "Proprietary",
66
66
  "dependencies": {
67
67
  "@electron/remote": "^2.0.8",
68
- "@kumologica/builder": "3.0.27-beta18",
69
- "@kumologica/devkit": "3.0.27-beta18",
70
- "@kumologica/runtime": "3.0.27-beta18",
68
+ "@kumologica/builder": "3.0.27-beta19",
69
+ "@kumologica/devkit": "3.0.27-beta19",
70
+ "@kumologica/runtime": "3.0.27-beta19",
71
71
  "adm-zip": "0.4.13",
72
72
  "ajv": "8.10.0",
73
73
  "archive-type": "^4.0.0",