@trayio/cdk-cli 0.0.7 → 0.0.9
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 +33 -33
- package/dist/{connector/operation/add.d.ts → add-operation.d.ts} +1 -1
- package/dist/add-operation.d.ts.map +1 -0
- package/dist/{connector/operation/add.js → add-operation.js} +29 -12
- package/dist/composite-operation-template.zip +0 -0
- package/dist/connector-template.zip +0 -0
- package/dist/http-operation-template.zip +0 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/{connector/init.js → init.js} +9 -5
- package/oclif.manifest.json +29 -29
- package/package.json +1 -1
- package/dist/connector/connector-template.zip +0 -0
- package/dist/connector/init.d.ts.map +0 -1
- package/dist/connector/operation/add.d.ts.map +0 -1
- package/dist/connector/operation/composite-operation-template.zip +0 -0
- package/dist/connector/operation/http-operation-template.zip +0 -0
- /package/dist/{connector/init.d.ts → init.d.ts} +0 -0
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.
|
|
27
|
+
@trayio/cdk-cli/0.0.9 linux-x64 node-v18.17.0
|
|
28
28
|
$ tray-cdk --help [COMMAND]
|
|
29
29
|
USAGE
|
|
30
30
|
$ tray-cdk COMMAND
|
|
@@ -36,10 +36,10 @@ 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
43
|
* [`tray-cdk version`](#tray-cdk-version)
|
|
44
44
|
|
|
45
45
|
## `tray-cdk`
|
|
@@ -49,6 +49,22 @@ USAGE
|
|
|
49
49
|
$ tray-cdk
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
## `tray-cdk add-operation [OPERATIONNAME] [OPERATIONTYPE]`
|
|
53
|
+
|
|
54
|
+
Add an operation to connector project
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
USAGE
|
|
58
|
+
$ tray-cdk add-operation [OPERATIONNAME] [OPERATIONTYPE]
|
|
59
|
+
|
|
60
|
+
ARGUMENTS
|
|
61
|
+
OPERATIONNAME Operation name
|
|
62
|
+
OPERATIONTYPE (http|composite) Operation type
|
|
63
|
+
|
|
64
|
+
DESCRIPTION
|
|
65
|
+
Add an operation to connector project
|
|
66
|
+
```
|
|
67
|
+
|
|
52
68
|
## `tray-cdk autocomplete [SHELL]`
|
|
53
69
|
|
|
54
70
|
display autocomplete installation instructions
|
|
@@ -78,57 +94,41 @@ EXAMPLES
|
|
|
78
94
|
|
|
79
95
|
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v2.1.9/src/commands/autocomplete/index.ts)_
|
|
80
96
|
|
|
81
|
-
## `tray-cdk
|
|
97
|
+
## `tray-cdk help [COMMANDS]`
|
|
82
98
|
|
|
83
|
-
|
|
99
|
+
Display help for tray-cdk.
|
|
84
100
|
|
|
85
101
|
```
|
|
86
102
|
USAGE
|
|
87
|
-
$ tray-cdk
|
|
103
|
+
$ tray-cdk help [COMMANDS] [-n]
|
|
88
104
|
|
|
89
105
|
ARGUMENTS
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
DESCRIPTION
|
|
93
|
-
Initialize a connector project
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## `tray-cdk connector operation add [OPERATIONNAME] [OPERATIONTYPE]`
|
|
97
|
-
|
|
98
|
-
Add an operation to connector project
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
USAGE
|
|
102
|
-
$ tray-cdk connector operation add [OPERATIONNAME] [OPERATIONTYPE]
|
|
106
|
+
COMMANDS Command to show help for.
|
|
103
107
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
OPERATIONTYPE (http|composite) Operation type
|
|
108
|
+
FLAGS
|
|
109
|
+
-n, --nested-commands Include all nested commands in the output.
|
|
107
110
|
|
|
108
111
|
DESCRIPTION
|
|
109
|
-
|
|
112
|
+
Display help for tray-cdk.
|
|
110
113
|
```
|
|
111
114
|
|
|
112
|
-
|
|
115
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.9/src/commands/help.ts)_
|
|
113
116
|
|
|
114
|
-
|
|
117
|
+
## `tray-cdk init [CONNECTORNAME]`
|
|
118
|
+
|
|
119
|
+
Initialize a connector project
|
|
115
120
|
|
|
116
121
|
```
|
|
117
122
|
USAGE
|
|
118
|
-
$ tray-cdk
|
|
123
|
+
$ tray-cdk init [CONNECTORNAME]
|
|
119
124
|
|
|
120
125
|
ARGUMENTS
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
FLAGS
|
|
124
|
-
-n, --nested-commands Include all nested commands in the output.
|
|
126
|
+
CONNECTORNAME Connector directory name to generate template files
|
|
125
127
|
|
|
126
128
|
DESCRIPTION
|
|
127
|
-
|
|
129
|
+
Initialize a connector project
|
|
128
130
|
```
|
|
129
131
|
|
|
130
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.9/src/commands/help.ts)_
|
|
131
|
-
|
|
132
132
|
## `tray-cdk version`
|
|
133
133
|
|
|
134
134
|
```
|
|
@@ -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,qBAAsB,SAAQ,OAAO;IACzD,MAAM,CAAC,WAAW,SAA2C;IAE7D,MAAM,CAAC,IAAI;;;MAYT;IAEI,GAAG;CAqDT"}
|
|
@@ -17,13 +17,24 @@ const core_1 = require("@oclif/core");
|
|
|
17
17
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
18
18
|
const chalk_1 = __importDefault(require("chalk"));
|
|
19
19
|
const NodeFsGenerator_1 = require("@trayio/tray-generator/generator/NodeFsGenerator");
|
|
20
|
-
const path_1 = require("path");
|
|
20
|
+
const path_1 = __importDefault(require("path"));
|
|
21
21
|
const lodash_1 = require("lodash");
|
|
22
22
|
// TODO add to try-common in ts-modules
|
|
23
23
|
const titleCase = (value) => (0, lodash_1.capitalize)((0, lodash_1.startCase)(value).replace(/_|-/g, ' '));
|
|
24
24
|
exports.titleCase = titleCase;
|
|
25
25
|
const pascalCase = (value) => (0, lodash_1.upperFirst)((0, lodash_1.camelCase)(value));
|
|
26
26
|
exports.pascalCase = pascalCase;
|
|
27
|
+
const isInSrcFolder = (currentDirectory) => {
|
|
28
|
+
const { base } = path_1.default.parse(currentDirectory);
|
|
29
|
+
return base === 'src';
|
|
30
|
+
};
|
|
31
|
+
const getConnectorName = (currentDirectory) => {
|
|
32
|
+
const { base } = path_1.default.parse(currentDirectory);
|
|
33
|
+
if (base === 'src') {
|
|
34
|
+
return path_1.default.basename(path_1.default.dirname(currentDirectory));
|
|
35
|
+
}
|
|
36
|
+
return base;
|
|
37
|
+
};
|
|
27
38
|
class ConnectorOperationAdd extends core_1.Command {
|
|
28
39
|
run() {
|
|
29
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -34,7 +45,7 @@ class ConnectorOperationAdd extends core_1.Command {
|
|
|
34
45
|
message: 'Operation name',
|
|
35
46
|
type: 'input',
|
|
36
47
|
when: !args.operationName,
|
|
37
|
-
default: '
|
|
48
|
+
default: 'my-operation',
|
|
38
49
|
},
|
|
39
50
|
{
|
|
40
51
|
name: 'operationType',
|
|
@@ -48,20 +59,26 @@ class ConnectorOperationAdd extends core_1.Command {
|
|
|
48
59
|
default: 'http',
|
|
49
60
|
},
|
|
50
61
|
]);
|
|
51
|
-
const operationName =
|
|
52
|
-
const
|
|
53
|
-
const
|
|
62
|
+
const operationName = args.operationName || promptRes.operationName;
|
|
63
|
+
const operationNameKebabCase = (0, lodash_1.kebabCase)(operationName);
|
|
64
|
+
const operationNamePascalCase = (0, exports.pascalCase)(operationName);
|
|
65
|
+
const operationNameCamelCase = (0, lodash_1.camelCase)(operationName);
|
|
66
|
+
const currentDirectory = process.cwd();
|
|
67
|
+
const connectorNamePascalCase = (0, exports.pascalCase)(getConnectorName(currentDirectory));
|
|
54
68
|
const operationType = args.operationType || promptRes.operationType;
|
|
55
69
|
const rootDir = __dirname;
|
|
56
70
|
const templatePath = operationType === 'http'
|
|
57
|
-
?
|
|
58
|
-
:
|
|
71
|
+
? path_1.default.join(rootDir, 'http-operation-template.zip')
|
|
72
|
+
: path_1.default.join(rootDir, 'composite-operation-template.zip');
|
|
59
73
|
const generator = new NodeFsGenerator_1.NodeFsGenerator();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
74
|
+
const targetPath = isInSrcFolder(currentDirectory)
|
|
75
|
+
? currentDirectory
|
|
76
|
+
: path_1.default.join(currentDirectory, 'src');
|
|
77
|
+
yield generator.generate(templatePath, targetPath, {
|
|
78
|
+
operationNameKebabCase,
|
|
79
|
+
operationNamePascalCase,
|
|
80
|
+
operationNameCamelCase,
|
|
81
|
+
connectorNamePascalCase,
|
|
65
82
|
})();
|
|
66
83
|
this.log(chalk_1.default.bold(chalk_1.default.green(`Success! Added operation: ${operationName}`)));
|
|
67
84
|
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +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"}
|
|
@@ -37,16 +37,20 @@ class ConnectorInit extends core_1.Command {
|
|
|
37
37
|
default: 'my-connector',
|
|
38
38
|
},
|
|
39
39
|
]);
|
|
40
|
-
const
|
|
41
|
-
const
|
|
40
|
+
const connectorNameKebabCase = (0, lodash_1.kebabCase)(args.connectorName || promptRes.connectorName);
|
|
41
|
+
const connectorNameTitleCase = (0, exports.titleCase)(connectorNameKebabCase);
|
|
42
|
+
const connectorNamePascalCase = (0, exports.pascalCase)(connectorNameKebabCase);
|
|
43
|
+
const connectorNameCamelCase = (0, lodash_1.camelCase)(connectorNameKebabCase);
|
|
42
44
|
const rootDir = __dirname;
|
|
43
45
|
const templatePath = (0, path_1.join)(rootDir, 'connector-template.zip');
|
|
44
46
|
const generator = new NodeFsGenerator_1.NodeFsGenerator();
|
|
45
47
|
yield generator.generate(templatePath, process.cwd(), {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
connectorNameKebabCase,
|
|
49
|
+
connectorNameTitleCase,
|
|
50
|
+
connectorNamePascalCase,
|
|
51
|
+
connectorNameCamelCase,
|
|
48
52
|
})();
|
|
49
|
-
this.log(chalk_1.default.bold(chalk_1.default.green(`Success! Added ${
|
|
53
|
+
this.log(chalk_1.default.bold(chalk_1.default.green(`Success! Added ${connectorNameKebabCase}`)));
|
|
50
54
|
});
|
|
51
55
|
}
|
|
52
56
|
}
|
package/oclif.manifest.json
CHANGED
|
@@ -1,34 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.9",
|
|
3
3
|
"commands": {
|
|
4
|
-
"
|
|
5
|
-
"id": "
|
|
6
|
-
"pluginName": "@trayio/cdk-cli",
|
|
7
|
-
"pluginAlias": "@trayio/cdk-cli",
|
|
8
|
-
"pluginType": "core",
|
|
9
|
-
"aliases": [],
|
|
10
|
-
"flags": {},
|
|
11
|
-
"args": {}
|
|
12
|
-
},
|
|
13
|
-
"connector:init": {
|
|
14
|
-
"id": "connector:init",
|
|
15
|
-
"description": "Initialize a connector project",
|
|
16
|
-
"strict": true,
|
|
17
|
-
"pluginName": "@trayio/cdk-cli",
|
|
18
|
-
"pluginAlias": "@trayio/cdk-cli",
|
|
19
|
-
"pluginType": "core",
|
|
20
|
-
"aliases": [],
|
|
21
|
-
"flags": {},
|
|
22
|
-
"args": {
|
|
23
|
-
"connectorName": {
|
|
24
|
-
"name": "connectorName",
|
|
25
|
-
"description": "Connector directory name to generate template files",
|
|
26
|
-
"required": false
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"connector:operation:add": {
|
|
31
|
-
"id": "connector:operation:add",
|
|
4
|
+
"add-operation": {
|
|
5
|
+
"id": "add-operation",
|
|
32
6
|
"description": "Add an operation to connector project",
|
|
33
7
|
"strict": true,
|
|
34
8
|
"pluginName": "@trayio/cdk-cli",
|
|
@@ -52,6 +26,32 @@
|
|
|
52
26
|
]
|
|
53
27
|
}
|
|
54
28
|
}
|
|
29
|
+
},
|
|
30
|
+
".": {
|
|
31
|
+
"id": ".",
|
|
32
|
+
"pluginName": "@trayio/cdk-cli",
|
|
33
|
+
"pluginAlias": "@trayio/cdk-cli",
|
|
34
|
+
"pluginType": "core",
|
|
35
|
+
"aliases": [],
|
|
36
|
+
"flags": {},
|
|
37
|
+
"args": {}
|
|
38
|
+
},
|
|
39
|
+
"init": {
|
|
40
|
+
"id": "init",
|
|
41
|
+
"description": "Initialize a connector project",
|
|
42
|
+
"strict": true,
|
|
43
|
+
"pluginName": "@trayio/cdk-cli",
|
|
44
|
+
"pluginAlias": "@trayio/cdk-cli",
|
|
45
|
+
"pluginType": "core",
|
|
46
|
+
"aliases": [],
|
|
47
|
+
"flags": {},
|
|
48
|
+
"args": {
|
|
49
|
+
"connectorName": {
|
|
50
|
+
"name": "connectorName",
|
|
51
|
+
"description": "Connector directory name to generate template files",
|
|
52
|
+
"required": false
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -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;CAyBT"}
|
|
@@ -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;CA6CT"}
|
|
Binary file
|
|
Binary file
|
|
File without changes
|