@trayio/cdk-cli 0.0.8 → 0.0.10

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.
package/README.md CHANGED
@@ -24,7 +24,7 @@ $ npm install -g @trayio/cdk-cli
24
24
  $ tray-cdk COMMAND
25
25
  running command...
26
26
  $ tray-cdk (--version|-v)
27
- @trayio/cdk-cli/0.0.8 linux-x64 node-v18.16.1
27
+ @trayio/cdk-cli/0.0.10 linux-x64 node-v18.17.0
28
28
  $ tray-cdk --help [COMMAND]
29
29
  USAGE
30
30
  $ tray-cdk COMMAND
@@ -36,10 +36,11 @@ USAGE
36
36
 
37
37
  <!-- commands -->
38
38
  * [`tray-cdk`](#tray-cdk)
39
+ * [`tray-cdk add-operation [OPERATIONNAME] [OPERATIONTYPE]`](#tray-cdk-add-operation-operationname-operationtype)
39
40
  * [`tray-cdk autocomplete [SHELL]`](#tray-cdk-autocomplete-shell)
40
- * [`tray-cdk connector init [CONNECTORNAME]`](#tray-cdk-connector-init-connectorname)
41
- * [`tray-cdk connector operation add [OPERATIONNAME] [OPERATIONTYPE]`](#tray-cdk-connector-operation-add-operationname-operationtype)
42
41
  * [`tray-cdk help [COMMANDS]`](#tray-cdk-help-commands)
42
+ * [`tray-cdk init [CONNECTORNAME]`](#tray-cdk-init-connectorname)
43
+ * [`tray-cdk test`](#tray-cdk-test)
43
44
  * [`tray-cdk version`](#tray-cdk-version)
44
45
 
45
46
  ## `tray-cdk`
@@ -49,6 +50,22 @@ USAGE
49
50
  $ tray-cdk
50
51
  ```
51
52
 
53
+ ## `tray-cdk add-operation [OPERATIONNAME] [OPERATIONTYPE]`
54
+
55
+ Add an operation to connector project
56
+
57
+ ```
58
+ USAGE
59
+ $ tray-cdk add-operation [OPERATIONNAME] [OPERATIONTYPE]
60
+
61
+ ARGUMENTS
62
+ OPERATIONNAME Operation name
63
+ OPERATIONTYPE (http|composite) Operation type
64
+
65
+ DESCRIPTION
66
+ Add an operation to connector project
67
+ ```
68
+
52
69
  ## `tray-cdk autocomplete [SHELL]`
53
70
 
54
71
  display autocomplete installation instructions
@@ -78,57 +95,56 @@ EXAMPLES
78
95
 
79
96
  _See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v2.1.9/src/commands/autocomplete/index.ts)_
80
97
 
81
- ## `tray-cdk connector init [CONNECTORNAME]`
98
+ ## `tray-cdk help [COMMANDS]`
82
99
 
83
- Initialize a connector project
100
+ Display help for tray-cdk.
84
101
 
85
102
  ```
86
103
  USAGE
87
- $ tray-cdk connector init [CONNECTORNAME]
104
+ $ tray-cdk help [COMMANDS] [-n]
88
105
 
89
106
  ARGUMENTS
90
- CONNECTORNAME Connector directory name to generate template files
107
+ COMMANDS Command to show help for.
108
+
109
+ FLAGS
110
+ -n, --nested-commands Include all nested commands in the output.
91
111
 
92
112
  DESCRIPTION
93
- Initialize a connector project
113
+ Display help for tray-cdk.
94
114
  ```
95
115
 
96
- ## `tray-cdk connector operation add [OPERATIONNAME] [OPERATIONTYPE]`
116
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.9/src/commands/help.ts)_
97
117
 
98
- Add an operation to connector project
118
+ ## `tray-cdk init [CONNECTORNAME]`
119
+
120
+ Initialize a connector project
99
121
 
100
122
  ```
101
123
  USAGE
102
- $ tray-cdk connector operation add [OPERATIONNAME] [OPERATIONTYPE]
124
+ $ tray-cdk init [CONNECTORNAME] [-i]
103
125
 
104
126
  ARGUMENTS
105
- OPERATIONNAME Operation name
106
- OPERATIONTYPE (http|composite) Operation type
127
+ CONNECTORNAME Connector directory name to generate template files
128
+
129
+ FLAGS
130
+ -i, --install Runs `npm install` after successful generation
107
131
 
108
132
  DESCRIPTION
109
- Add an operation to connector project
133
+ Initialize a connector project
110
134
  ```
111
135
 
112
- ## `tray-cdk help [COMMANDS]`
136
+ ## `tray-cdk test`
113
137
 
114
- Display help for tray-cdk.
138
+ Build and test connector project
115
139
 
116
140
  ```
117
141
  USAGE
118
- $ tray-cdk help [COMMANDS] [-n]
119
-
120
- ARGUMENTS
121
- COMMANDS Command to show help for.
122
-
123
- FLAGS
124
- -n, --nested-commands Include all nested commands in the output.
142
+ $ tray-cdk test
125
143
 
126
144
  DESCRIPTION
127
- Display help for tray-cdk.
145
+ Build and test connector project
128
146
  ```
129
147
 
130
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.9/src/commands/help.ts)_
131
-
132
148
  ## `tray-cdk version`
133
149
 
134
150
  ```
@@ -1,7 +1,7 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export declare const titleCase: (value: string) => string;
3
3
  export declare const pascalCase: (value: string) => string;
4
- export default class ConnectorOperationAdd extends Command {
4
+ export default class AddOperation extends Command {
5
5
  static description: string;
6
6
  static args: {
7
7
  operationName: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
@@ -9,4 +9,4 @@ export default class ConnectorOperationAdd extends Command {
9
9
  };
10
10
  run(): Promise<void>;
11
11
  }
12
- //# sourceMappingURL=add.d.ts.map
12
+ //# sourceMappingURL=add-operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-operation.d.ts","sourceRoot":"","sources":["../src/add-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,aAAa,CAAC;AAc5C,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,MACQ,CAAC;AAEnD,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,MACd,CAAC;AAe9B,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAChD,MAAM,CAAC,WAAW,SAA2C;IAE7D,MAAM,CAAC,IAAI;;;MAYT;IAEI,GAAG;CAuDT"}
@@ -35,10 +35,10 @@ const getConnectorName = (currentDirectory) => {
35
35
  }
36
36
  return base;
37
37
  };
38
- class ConnectorOperationAdd extends core_1.Command {
38
+ class AddOperation extends core_1.Command {
39
39
  run() {
40
40
  return __awaiter(this, void 0, void 0, function* () {
41
- const { args } = yield this.parse(ConnectorOperationAdd);
41
+ const { args } = yield this.parse(AddOperation);
42
42
  const promptRes = yield inquirer_1.default.prompt([
43
43
  {
44
44
  name: 'operationName',
@@ -80,12 +80,12 @@ class ConnectorOperationAdd extends core_1.Command {
80
80
  operationNameCamelCase,
81
81
  connectorNamePascalCase,
82
82
  })();
83
- this.log(chalk_1.default.bold(chalk_1.default.green(`Success! Added operation: ${operationName}`)));
83
+ this.log(chalk_1.default.bold(chalk_1.default.green(`Success! Added operation: ${operationNameKebabCase}`)));
84
84
  });
85
85
  }
86
86
  }
87
- ConnectorOperationAdd.description = 'Add an operation to connector project';
88
- ConnectorOperationAdd.args = {
87
+ AddOperation.description = 'Add an operation to connector project';
88
+ AddOperation.args = {
89
89
  operationName: core_1.Args.string({
90
90
  name: 'Operation name',
91
91
  required: false,
@@ -98,4 +98,4 @@ ConnectorOperationAdd.args = {
98
98
  options: ['http', 'composite'],
99
99
  }),
100
100
  };
101
- exports.default = ConnectorOperationAdd;
101
+ exports.default = AddOperation;
Binary file
Binary file
@@ -1,11 +1,14 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export declare const titleCase: (value: string) => string;
3
3
  export declare const pascalCase: (value: string) => string;
4
- export default class ConnectorInit extends Command {
4
+ export default class Init extends Command {
5
5
  static description: string;
6
6
  static args: {
7
7
  connectorName: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
8
8
  };
9
+ static flags: {
10
+ install: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
+ };
9
12
  run(): Promise<void>;
10
13
  }
11
14
  //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AAgBnD,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,MACQ,CAAC;AAEnD,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,MACd,CAAC;AAE9B,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACxC,MAAM,CAAC,WAAW,SAAoC;IAEtD,MAAM,CAAC,IAAI;;MAMT;IAEF,MAAM,CAAC,KAAK;;MAKV;IAEI,GAAG;CA6CT"}
@@ -19,15 +19,16 @@ const chalk_1 = __importDefault(require("chalk"));
19
19
  const NodeFsGenerator_1 = require("@trayio/tray-generator/generator/NodeFsGenerator");
20
20
  const path_1 = require("path");
21
21
  const lodash_1 = require("lodash");
22
+ const child_process_1 = require("child_process");
22
23
  // TODO add to try-common in ts-modules
23
24
  const titleCase = (value) => (0, lodash_1.capitalize)((0, lodash_1.startCase)(value).replace(/_|-/g, ' '));
24
25
  exports.titleCase = titleCase;
25
26
  const pascalCase = (value) => (0, lodash_1.upperFirst)((0, lodash_1.camelCase)(value));
26
27
  exports.pascalCase = pascalCase;
27
- class ConnectorInit extends core_1.Command {
28
+ class Init extends core_1.Command {
28
29
  run() {
29
30
  return __awaiter(this, void 0, void 0, function* () {
30
- const { args } = yield this.parse(ConnectorInit);
31
+ const { args, flags } = yield this.parse(Init);
31
32
  const promptRes = yield inquirer_1.default.prompt([
32
33
  {
33
34
  name: 'connectorName',
@@ -51,15 +52,34 @@ class ConnectorInit extends core_1.Command {
51
52
  connectorNameCamelCase,
52
53
  })();
53
54
  this.log(chalk_1.default.bold(chalk_1.default.green(`Success! Added ${connectorNameKebabCase}`)));
55
+ if (flags.install) {
56
+ try {
57
+ this.log(chalk_1.default.bold(chalk_1.default.gray('Running npm install...')));
58
+ (0, child_process_1.execSync)(`cd ${connectorNameKebabCase} && npm install`, {
59
+ stdio: 'inherit',
60
+ });
61
+ }
62
+ catch (error) {
63
+ if (error instanceof Error) {
64
+ this.error(new Error(error.message));
65
+ }
66
+ }
67
+ }
54
68
  });
55
69
  }
56
70
  }
57
- ConnectorInit.description = 'Initialize a connector project';
58
- ConnectorInit.args = {
71
+ Init.description = 'Initialize a connector project';
72
+ Init.args = {
59
73
  connectorName: core_1.Args.string({
60
74
  name: 'Connector directory name',
61
75
  required: false,
62
76
  description: 'Connector directory name to generate template files',
63
77
  }),
64
78
  };
65
- exports.default = ConnectorInit;
79
+ Init.flags = {
80
+ install: core_1.Flags.boolean({
81
+ char: 'i',
82
+ description: 'Runs `npm install` after successful generation',
83
+ }),
84
+ };
85
+ exports.default = Init;
package/dist/test.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Test extends Command {
3
+ static description: string;
4
+ run(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKtC,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACxC,MAAM,CAAC,WAAW,SAAsC;IAElD,GAAG;CAeT"}
package/dist/test.js ADDED
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const core_1 = require("@oclif/core");
16
+ const chalk_1 = __importDefault(require("chalk"));
17
+ const child_process_1 = require("child_process");
18
+ class Test extends core_1.Command {
19
+ run() {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ try {
22
+ this.log(chalk_1.default.bold(chalk_1.default.gray('Running npm compile...')));
23
+ (0, child_process_1.execSync)('npm run compile', { stdio: 'inherit' });
24
+ this.log(chalk_1.default.bold(chalk_1.default.gray('Running npm test...')));
25
+ (0, child_process_1.execSync)('npm run test', { stdio: 'inherit' });
26
+ this.log(chalk_1.default.bold(chalk_1.default.green('Success')));
27
+ }
28
+ catch (error) {
29
+ if (error instanceof Error) {
30
+ this.error(new Error(error.message));
31
+ }
32
+ }
33
+ });
34
+ }
35
+ }
36
+ Test.description = 'Build and test connector project';
37
+ exports.default = Test;
@@ -1,6 +1,32 @@
1
1
  {
2
- "version": "0.0.8",
2
+ "version": "0.0.10",
3
3
  "commands": {
4
+ "add-operation": {
5
+ "id": "add-operation",
6
+ "description": "Add an operation to connector project",
7
+ "strict": true,
8
+ "pluginName": "@trayio/cdk-cli",
9
+ "pluginAlias": "@trayio/cdk-cli",
10
+ "pluginType": "core",
11
+ "aliases": [],
12
+ "flags": {},
13
+ "args": {
14
+ "operationName": {
15
+ "name": "operationName",
16
+ "description": "Operation name",
17
+ "required": false
18
+ },
19
+ "operationType": {
20
+ "name": "operationType",
21
+ "description": "Operation type",
22
+ "required": false,
23
+ "options": [
24
+ "http",
25
+ "composite"
26
+ ]
27
+ }
28
+ }
29
+ },
4
30
  ".": {
5
31
  "id": ".",
6
32
  "pluginName": "@trayio/cdk-cli",
@@ -10,15 +36,23 @@
10
36
  "flags": {},
11
37
  "args": {}
12
38
  },
13
- "connector:init": {
14
- "id": "connector:init",
39
+ "init": {
40
+ "id": "init",
15
41
  "description": "Initialize a connector project",
16
42
  "strict": true,
17
43
  "pluginName": "@trayio/cdk-cli",
18
44
  "pluginAlias": "@trayio/cdk-cli",
19
45
  "pluginType": "core",
20
46
  "aliases": [],
21
- "flags": {},
47
+ "flags": {
48
+ "install": {
49
+ "name": "install",
50
+ "type": "boolean",
51
+ "char": "i",
52
+ "description": "Runs `npm install` after successful generation",
53
+ "allowNo": false
54
+ }
55
+ },
22
56
  "args": {
23
57
  "connectorName": {
24
58
  "name": "connectorName",
@@ -27,31 +61,16 @@
27
61
  }
28
62
  }
29
63
  },
30
- "connector:operation:add": {
31
- "id": "connector:operation:add",
32
- "description": "Add an operation to connector project",
64
+ "test": {
65
+ "id": "test",
66
+ "description": "Build and test connector project",
33
67
  "strict": true,
34
68
  "pluginName": "@trayio/cdk-cli",
35
69
  "pluginAlias": "@trayio/cdk-cli",
36
70
  "pluginType": "core",
37
71
  "aliases": [],
38
72
  "flags": {},
39
- "args": {
40
- "operationName": {
41
- "name": "operationName",
42
- "description": "Operation name",
43
- "required": false
44
- },
45
- "operationType": {
46
- "name": "operationType",
47
- "description": "Operation type",
48
- "required": false,
49
- "options": [
50
- "http",
51
- "composite"
52
- ]
53
- }
54
- }
73
+ "args": {}
55
74
  }
56
75
  }
57
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/cdk-cli",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "A collection of CLI commands for connector development.",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/connector/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,aAAa,CAAC;AAc5C,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,MACQ,CAAC;AAEnD,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,MACd,CAAC;AAE9B,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IACjD,MAAM,CAAC,WAAW,SAAoC;IAEtD,MAAM,CAAC,IAAI;;MAMT;IAEI,GAAG;CAgCT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,aAAa,CAAC;AAc5C,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,MACQ,CAAC;AAEnD,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,MACd,CAAC;AAe9B,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,OAAO;IACzD,MAAM,CAAC,WAAW,SAA2C;IAE7D,MAAM,CAAC,IAAI;;;MAYT;IAEI,GAAG;CAqDT"}