@devkong/cli 0.0.3 → 0.0.5
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
|
@@ -66759,13 +66759,13 @@ function generateShortId() {
|
|
|
66759
66759
|
uuidHash.push(uuidToJavaHashCode(guid()) & 2147483647);
|
|
66760
66760
|
return sqids.encode(uuidHash);
|
|
66761
66761
|
}
|
|
66762
|
-
async function spawnCommand(commandText, logger = null) {
|
|
66762
|
+
async function spawnCommand(commandText, logger = null, shell = false) {
|
|
66763
66763
|
return new Promise((resolve2, reject) => {
|
|
66764
66764
|
const commandWithArgs = commandText.split(" ").filter((s) => s);
|
|
66765
66765
|
logger.debug(commandText);
|
|
66766
66766
|
const command = commandWithArgs.shift();
|
|
66767
66767
|
const commandArgs = commandWithArgs;
|
|
66768
|
-
const child = (0, import_child_process.spawn)(command, commandArgs, { stdio: ["pipe", "pipe", "pipe"] });
|
|
66768
|
+
const child = (0, import_child_process.spawn)(command, commandArgs, { shell, stdio: ["pipe", "pipe", "pipe"] });
|
|
66769
66769
|
let stdout = "";
|
|
66770
66770
|
let stderr = "";
|
|
66771
66771
|
child.stdout.on("data", (data) => {
|
|
@@ -69401,17 +69401,17 @@ var InstallCommand = class {
|
|
|
69401
69401
|
constructor(verbose) {
|
|
69402
69402
|
this.verbose = verbose;
|
|
69403
69403
|
}
|
|
69404
|
-
async execute(
|
|
69404
|
+
async execute(workspaceDirectory) {
|
|
69405
69405
|
await new Listr([
|
|
69406
69406
|
{
|
|
69407
69407
|
title: "Installing dependencies with pip",
|
|
69408
69408
|
task: async (_2, task) => {
|
|
69409
69409
|
const scriptPath = this.scriptPath();
|
|
69410
|
-
|
|
69411
|
-
task.output = `${scriptPath} ${extensionPath}`;
|
|
69410
|
+
task.output = `${scriptPath} ${workspaceDirectory}`;
|
|
69412
69411
|
await spawnCommand(
|
|
69413
|
-
`${scriptPath} ${
|
|
69414
|
-
new ListrTaskLogger(task, this.verbose ? 3 /* DEBUG */ : 0 /* INFO */)
|
|
69412
|
+
`${scriptPath} ${workspaceDirectory}`,
|
|
69413
|
+
new ListrTaskLogger(task, this.verbose ? 3 /* DEBUG */ : 0 /* INFO */),
|
|
69414
|
+
true
|
|
69415
69415
|
);
|
|
69416
69416
|
},
|
|
69417
69417
|
rendererOptions: {
|
|
@@ -69437,14 +69437,14 @@ var GenerateCommand = class {
|
|
|
69437
69437
|
}
|
|
69438
69438
|
async execute(extensionName, sdk, presetVersion) {
|
|
69439
69439
|
const id = generateShortId();
|
|
69440
|
-
await (0, import_create_nx_workspace.createWorkspace)(`@devkong/cli-nx@${presetVersion}`, {
|
|
69440
|
+
const workspace = await (0, import_create_nx_workspace.createWorkspace)(`@devkong/cli-nx@${presetVersion}`, {
|
|
69441
69441
|
name: extensionName,
|
|
69442
69442
|
id,
|
|
69443
69443
|
platform: sdk,
|
|
69444
69444
|
nxCloud: "skip",
|
|
69445
69445
|
packageManager: "npm"
|
|
69446
69446
|
});
|
|
69447
|
-
await new InstallCommand(this.verbose).execute(
|
|
69447
|
+
await new InstallCommand(this.verbose).execute(workspace.directory);
|
|
69448
69448
|
}
|
|
69449
69449
|
};
|
|
69450
69450
|
|
|
@@ -69700,7 +69700,7 @@ var ListExtensionSnapshotCommand = class {
|
|
|
69700
69700
|
} else {
|
|
69701
69701
|
const result = [];
|
|
69702
69702
|
for (const ver of versions) {
|
|
69703
|
-
result.push(`${ver.version}, ${ver.created}, ${ver.createdBy}`);
|
|
69703
|
+
result.push(`${ver.version}, ${ver.created}, ${ver.createdBy}, ${ver.notes}`);
|
|
69704
69704
|
}
|
|
69705
69705
|
task.output = result.join("\n");
|
|
69706
69706
|
}
|
|
@@ -69744,7 +69744,7 @@ var PublishCommand = class {
|
|
|
69744
69744
|
get wslPrefix() {
|
|
69745
69745
|
return this.isWin ? "wsl" : "";
|
|
69746
69746
|
}
|
|
69747
|
-
async execute(repoName) {
|
|
69747
|
+
async execute(repoName, notes) {
|
|
69748
69748
|
const defaultRendererOptions = {
|
|
69749
69749
|
bottomBar: this.verbose ? Infinity : true,
|
|
69750
69750
|
persistentOutput: true
|
|
@@ -69800,11 +69800,7 @@ var PublishCommand = class {
|
|
|
69800
69800
|
title: "Generate schema",
|
|
69801
69801
|
task: async (ctx, task) => {
|
|
69802
69802
|
const logger = new ListrTaskLogger(task, this.verbose ? 3 /* DEBUG */ : 0 /* INFO */);
|
|
69803
|
-
|
|
69804
|
-
ctx.schemaText = await spawnCommand(this.getSchemaCmdText("python3"), logger);
|
|
69805
|
-
} catch {
|
|
69806
|
-
ctx.schemaText = await spawnCommand(this.getSchemaCmdText("python"), logger);
|
|
69807
|
-
}
|
|
69803
|
+
ctx.schemaText = await spawnCommand(this.getSchemaCmdText(), logger);
|
|
69808
69804
|
},
|
|
69809
69805
|
rendererOptions: defaultRendererOptions
|
|
69810
69806
|
},
|
|
@@ -69824,7 +69820,7 @@ var PublishCommand = class {
|
|
|
69824
69820
|
outputSchema: jsonSchemas.output,
|
|
69825
69821
|
metadata: kongJson,
|
|
69826
69822
|
version: Number(ctx.publishDetails.imageVersion),
|
|
69827
|
-
notes
|
|
69823
|
+
notes,
|
|
69828
69824
|
created: utcNow(DEFAULT_TIMEZONE),
|
|
69829
69825
|
createdBy: kongJson.ownership.at(0)
|
|
69830
69826
|
};
|
|
@@ -69860,7 +69856,11 @@ var PublishCommand = class {
|
|
|
69860
69856
|
dockerLoginCmdText(username, password, registry3) {
|
|
69861
69857
|
return `${this.wslPrefix} /bin/bash -c 'echo ${password} |docker login -u ${username} --password-stdin ${registry3}'`;
|
|
69862
69858
|
}
|
|
69863
|
-
getSchemaCmdText(
|
|
69859
|
+
getSchemaCmdText() {
|
|
69860
|
+
let engine = ".\\.venv\\Scripts\\python.exe";
|
|
69861
|
+
if (process.platform !== "win32") {
|
|
69862
|
+
engine = "./.venv/bin/python";
|
|
69863
|
+
}
|
|
69864
69864
|
const mainPyPath = resolveProjectPath("src/main.py");
|
|
69865
69865
|
return `${engine} ${mainPyPath} --schema`;
|
|
69866
69866
|
}
|
|
@@ -69971,18 +69971,21 @@ async function main() {
|
|
|
69971
69971
|
});
|
|
69972
69972
|
const installCommand = new Command("install").description("Setup virtual environment and install dependencies").addOption(new Option("--verbose", "Show full logs during command execution")).action(async (options) => {
|
|
69973
69973
|
try {
|
|
69974
|
-
|
|
69974
|
+
const kongJsonPath = resolveProjectPath("kong.json");
|
|
69975
|
+
const projectRoot = import_path5.default.dirname(kongJsonPath);
|
|
69976
|
+
await new InstallCommand(options.verbose).execute(projectRoot);
|
|
69975
69977
|
} catch (ex) {
|
|
69976
69978
|
printError("install command failed", ex);
|
|
69977
69979
|
}
|
|
69978
69980
|
});
|
|
69979
69981
|
const publishVersionCommand = new Command("publish-version").description(
|
|
69980
69982
|
"Build and automatically tag the current code with an incremented version, ready for selection in extension aliases"
|
|
69981
|
-
).addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).addOption(new Option("--verbose", "Show full logs during command execution")).action(async (options) => {
|
|
69983
|
+
).addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).addOption(new Option("--verbose", "Show full logs during command execution")).addOption(new Option("--notes [text]", "Optional version notes").default("")).action(async (options) => {
|
|
69982
69984
|
try {
|
|
69983
69985
|
const kongJson = getKongJson();
|
|
69984
69986
|
await new PublishCommand(getProfile(options.profile), options.verbose).execute(
|
|
69985
|
-
kongJson.name
|
|
69987
|
+
kongJson.name,
|
|
69988
|
+
options.notes
|
|
69986
69989
|
);
|
|
69987
69990
|
} catch (ex) {
|
|
69988
69991
|
printError("publish-version command failed", ex);
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ export declare class PublishCommand {
|
|
|
6
6
|
private managementClient;
|
|
7
7
|
private get wslPrefix();
|
|
8
8
|
constructor(profile: Profile, verbose?: boolean);
|
|
9
|
-
execute(repoName: string): Promise<void>;
|
|
9
|
+
execute(repoName: string, notes: string): Promise<void>;
|
|
10
10
|
private resolveRegistryUrl;
|
|
11
11
|
private dockerBuildCmdText;
|
|
12
12
|
private dockerPushCmdText;
|
|
@@ -8,5 +8,5 @@ export declare function env(key: string): string;
|
|
|
8
8
|
export declare function optionalEnv(key: string): string;
|
|
9
9
|
export declare function resolveProjectPath(fileName: string): string;
|
|
10
10
|
export declare function generateShortId(): string;
|
|
11
|
-
export declare function spawnCommand(commandText: string, logger?: ILogger): Promise<string>;
|
|
11
|
+
export declare function spawnCommand(commandText: string, logger?: ILogger, shell?: boolean): Promise<string>;
|
|
12
12
|
export declare function printError(message: string, error: unknown): void;
|