@trayio/cdk-cli 0.0.6 → 0.0.8
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 +1 -1
- package/dist/connector/connector-template.zip +0 -0
- package/dist/connector/init.d.ts.map +1 -1
- package/dist/connector/init.js +9 -5
- package/dist/connector/operation/add.d.ts.map +1 -1
- package/dist/connector/operation/add.js +29 -12
- package/dist/connector/operation/composite-operation-template.zip +0 -0
- package/dist/connector/operation/http-operation-template.zip +0 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
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.8 linux-x64 node-v18.16.1
|
|
28
28
|
$ tray-cdk --help [COMMAND]
|
|
29
29
|
USAGE
|
|
30
30
|
$ tray-cdk COMMAND
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"}
|
package/dist/connector/init.js
CHANGED
|
@@ -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
|
}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"}
|
|
@@ -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
|
package/oclif.manifest.json
CHANGED