@trayio/cdk-cli 0.0.9 → 0.0.11

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.9 linux-x64 node-v18.17.0
27
+ @trayio/cdk-cli/0.0.11 linux-x64 node-v18.17.0
28
28
  $ tray-cdk --help [COMMAND]
29
29
  USAGE
30
30
  $ tray-cdk COMMAND
@@ -40,6 +40,7 @@ USAGE
40
40
  * [`tray-cdk autocomplete [SHELL]`](#tray-cdk-autocomplete-shell)
41
41
  * [`tray-cdk help [COMMANDS]`](#tray-cdk-help-commands)
42
42
  * [`tray-cdk init [CONNECTORNAME]`](#tray-cdk-init-connectorname)
43
+ * [`tray-cdk test [OPERATIONNAME]`](#tray-cdk-test-operationname)
43
44
  * [`tray-cdk version`](#tray-cdk-version)
44
45
 
45
46
  ## `tray-cdk`
@@ -120,15 +121,33 @@ Initialize a connector project
120
121
 
121
122
  ```
122
123
  USAGE
123
- $ tray-cdk init [CONNECTORNAME]
124
+ $ tray-cdk init [CONNECTORNAME] [-i]
124
125
 
125
126
  ARGUMENTS
126
127
  CONNECTORNAME Connector directory name to generate template files
127
128
 
129
+ FLAGS
130
+ -i, --install Runs `npm install` after successful generation
131
+
128
132
  DESCRIPTION
129
133
  Initialize a connector project
130
134
  ```
131
135
 
136
+ ## `tray-cdk test [OPERATIONNAME]`
137
+
138
+ Build and test connector project or an operation
139
+
140
+ ```
141
+ USAGE
142
+ $ tray-cdk test [OPERATIONNAME]
143
+
144
+ ARGUMENTS
145
+ OPERATIONNAME Operation name to run the test against
146
+
147
+ DESCRIPTION
148
+ Build and test connector project or an operation
149
+ ```
150
+
132
151
  ## `tray-cdk version`
133
152
 
134
153
  ```
@@ -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>>;
@@ -1 +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,qBAAsB,SAAQ,OAAO;IACzD,MAAM,CAAC,WAAW,SAA2C;IAE7D,MAAM,CAAC,IAAI;;;MAYT;IAEI,GAAG;CAqDT"}
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
package/dist/init.d.ts CHANGED
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/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
+ {"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"}
package/dist/init.js CHANGED
@@ -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,9 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Test extends Command {
3
+ static description: string;
4
+ static args: {
5
+ operationName: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
6
+ };
7
+ run(): Promise<void>;
8
+ }
9
+ //# 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,EAAQ,MAAM,aAAa,CAAC;AAM5C,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACxC,MAAM,CAAC,WAAW,SAAsD;IAExE,MAAM,CAAC,IAAI;;MAMT;IAEI,GAAG;CA4BT"}
package/dist/test.js ADDED
@@ -0,0 +1,55 @@
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 lodash_1 = require("lodash");
18
+ const child_process_1 = require("child_process");
19
+ class Test extends core_1.Command {
20
+ run() {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ const { args } = yield this.parse(Test);
23
+ const operationNameKebabCase = (0, lodash_1.kebabCase)(args.operationName);
24
+ try {
25
+ this.log(chalk_1.default.bold(chalk_1.default.gray('Running npm compile...')));
26
+ (0, child_process_1.execSync)('npm run compile', { stdio: 'inherit' });
27
+ if (operationNameKebabCase) {
28
+ this.log(chalk_1.default.bold(chalk_1.default.gray(`Running test for ${operationNameKebabCase}...`)));
29
+ (0, child_process_1.execSync)(`npm run test ./src/${operationNameKebabCase}`, {
30
+ stdio: 'inherit',
31
+ });
32
+ }
33
+ else {
34
+ this.log(chalk_1.default.bold(chalk_1.default.gray('Running npm test...')));
35
+ (0, child_process_1.execSync)('npm run test', { stdio: 'inherit' });
36
+ }
37
+ this.log(chalk_1.default.bold(chalk_1.default.green('Success')));
38
+ }
39
+ catch (error) {
40
+ if (error instanceof Error) {
41
+ this.error(new Error(error.message));
42
+ }
43
+ }
44
+ });
45
+ }
46
+ }
47
+ Test.description = 'Build and test connector project or an operation';
48
+ Test.args = {
49
+ operationName: core_1.Args.string({
50
+ name: 'Operation name',
51
+ required: false,
52
+ description: 'Operation name to run the test against',
53
+ }),
54
+ };
55
+ exports.default = Test;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.9",
2
+ "version": "0.0.11",
3
3
  "commands": {
4
4
  "add-operation": {
5
5
  "id": "add-operation",
@@ -44,7 +44,15 @@
44
44
  "pluginAlias": "@trayio/cdk-cli",
45
45
  "pluginType": "core",
46
46
  "aliases": [],
47
- "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
+ },
48
56
  "args": {
49
57
  "connectorName": {
50
58
  "name": "connectorName",
@@ -52,6 +60,23 @@
52
60
  "required": false
53
61
  }
54
62
  }
63
+ },
64
+ "test": {
65
+ "id": "test",
66
+ "description": "Build and test connector project or an operation",
67
+ "strict": true,
68
+ "pluginName": "@trayio/cdk-cli",
69
+ "pluginAlias": "@trayio/cdk-cli",
70
+ "pluginType": "core",
71
+ "aliases": [],
72
+ "flags": {},
73
+ "args": {
74
+ "operationName": {
75
+ "name": "operationName",
76
+ "description": "Operation name to run the test against",
77
+ "required": false
78
+ }
79
+ }
55
80
  }
56
81
  }
57
82
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/cdk-cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "A collection of CLI commands for connector development.",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"