@devkong/cli 0.0.67-alpha.19 → 0.0.67-alpha.20
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/index.js
CHANGED
|
@@ -60828,7 +60828,7 @@ function getProfile(name) {
|
|
|
60828
60828
|
function printProfile(name) {
|
|
60829
60829
|
const profileData = getProfile(name);
|
|
60830
60830
|
console.info(
|
|
60831
|
-
`
|
|
60831
|
+
`profile=${name}, baseUrl=${profileData.kongBaseUrl}, username=${profileData.userName}`
|
|
60832
60832
|
);
|
|
60833
60833
|
}
|
|
60834
60834
|
|
|
@@ -61072,8 +61072,9 @@ function getKongJson() {
|
|
|
61072
61072
|
|
|
61073
61073
|
// packages/kong-cli/src/commands/generateCommand.ts
|
|
61074
61074
|
var GenerateCommand = class {
|
|
61075
|
-
async execute(extensionName, sdk, presetVersion) {
|
|
61075
|
+
async execute(extensionName, sdk, presetVersion, template2) {
|
|
61076
61076
|
const id = generateShortId();
|
|
61077
|
+
const variant = sdk === "python" ? template2 ?? await this.promptTemplate() : "basic";
|
|
61077
61078
|
validateKongJson({
|
|
61078
61079
|
id,
|
|
61079
61080
|
sdk,
|
|
@@ -61085,12 +61086,31 @@ var GenerateCommand = class {
|
|
|
61085
61086
|
name: extensionName,
|
|
61086
61087
|
id,
|
|
61087
61088
|
platform: sdk,
|
|
61089
|
+
// Passed through to the preset generator. Not named `template` on purpose:
|
|
61090
|
+
// create-nx-workspace reserves that option for cloning a GitHub workspace.
|
|
61091
|
+
variant,
|
|
61088
61092
|
nxCloud: "skip",
|
|
61089
61093
|
packageManager: "npm",
|
|
61090
61094
|
trustThirdPartyPreset: true,
|
|
61091
61095
|
analytics: false
|
|
61092
61096
|
});
|
|
61093
61097
|
}
|
|
61098
|
+
async promptTemplate() {
|
|
61099
|
+
const { template: template2 } = await dist_default14.prompt({
|
|
61100
|
+
type: "select",
|
|
61101
|
+
name: "template",
|
|
61102
|
+
message: "which template would you like to use?",
|
|
61103
|
+
default: "basic",
|
|
61104
|
+
choices: [
|
|
61105
|
+
{ name: "basic - a single operation", value: "basic" },
|
|
61106
|
+
{
|
|
61107
|
+
name: "advanced - multiple operations with a secret example",
|
|
61108
|
+
value: "advanced"
|
|
61109
|
+
}
|
|
61110
|
+
]
|
|
61111
|
+
});
|
|
61112
|
+
return template2;
|
|
61113
|
+
}
|
|
61094
61114
|
};
|
|
61095
61115
|
|
|
61096
61116
|
// node_modules/listr2/node_modules/eventemitter3/index.mjs
|
|
@@ -63402,8 +63422,7 @@ var PublishVersionCommand = class {
|
|
|
63402
63422
|
});
|
|
63403
63423
|
await this.managementClient.createExtensionSnapshot(kongJson.id, snapshot);
|
|
63404
63424
|
task.output = [
|
|
63405
|
-
`the version ${publishDetails.imageVersion} has been successfully published
|
|
63406
|
-
joinUrlAndPath(this.profile.kongBaseUrl, "/extensions/aliases")
|
|
63425
|
+
`the version ${publishDetails.imageVersion} has been successfully published!`
|
|
63407
63426
|
].join("\n");
|
|
63408
63427
|
},
|
|
63409
63428
|
rendererOptions: this.defaultRendererOptions
|
|
@@ -63675,10 +63694,15 @@ import_dotenv_expand.default.expand(import_dotenv.default.config({ path: import_
|
|
|
63675
63694
|
async function main() {
|
|
63676
63695
|
const generateCommand = new Command("generate").description("Generate new extension").argument("name", "Extension name").addOption(
|
|
63677
63696
|
new Option("--sdk <name>", "Target sdk platform for extension").choices(["python", "kotlin"]).default("python")
|
|
63697
|
+
).addOption(
|
|
63698
|
+
new Option("--template <name>", "Starter template to scaffold (python only)").choices([
|
|
63699
|
+
"basic",
|
|
63700
|
+
"advanced"
|
|
63701
|
+
])
|
|
63678
63702
|
).addOption(new Option("--verbose", "Show full logs during command execution")).action(async (name, options) => {
|
|
63679
63703
|
try {
|
|
63680
63704
|
const presetVersion = getPresetVersion();
|
|
63681
|
-
await new GenerateCommand().execute(name, options.sdk, presetVersion);
|
|
63705
|
+
await new GenerateCommand().execute(name, options.sdk, presetVersion, options.template);
|
|
63682
63706
|
} catch (ex) {
|
|
63683
63707
|
printError("generate command failed", ex);
|
|
63684
63708
|
}
|
package/package.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AppExtension } from "@kong/contract";
|
|
2
|
+
export type ExtensionTemplate = "basic" | "advanced";
|
|
2
3
|
export declare class GenerateCommand {
|
|
3
|
-
execute(extensionName: AppExtension["name"], sdk: "kotlin" | "python", presetVersion: string): Promise<void>;
|
|
4
|
+
execute(extensionName: AppExtension["name"], sdk: "kotlin" | "python", presetVersion: string, template?: ExtensionTemplate): Promise<void>;
|
|
5
|
+
private promptTemplate;
|
|
4
6
|
}
|