@devkong/cli 0.0.3 → 0.0.4

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
@@ -66765,7 +66765,7 @@ async function spawnCommand(commandText, logger = null) {
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: true, stdio: ["pipe", "pipe", "pipe"] });
66769
66769
  let stdout = "";
66770
66770
  let stderr = "";
66771
66771
  child.stdout.on("data", (data) => {
@@ -69401,16 +69401,15 @@ var InstallCommand = class {
69401
69401
  constructor(verbose) {
69402
69402
  this.verbose = verbose;
69403
69403
  }
69404
- async execute(extensionName) {
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
- const extensionPath = import_path3.default.join(process.cwd(), extensionName);
69411
- task.output = `${scriptPath} ${extensionPath}`;
69410
+ task.output = `${scriptPath} ${workspaceDirectory}`;
69412
69411
  await spawnCommand(
69413
- `${scriptPath} ${extensionPath}`,
69412
+ `${scriptPath} ${workspaceDirectory}`,
69414
69413
  new ListrTaskLogger(task, this.verbose ? 3 /* DEBUG */ : 0 /* INFO */)
69415
69414
  );
69416
69415
  },
@@ -69437,14 +69436,14 @@ var GenerateCommand = class {
69437
69436
  }
69438
69437
  async execute(extensionName, sdk, presetVersion) {
69439
69438
  const id = generateShortId();
69440
- await (0, import_create_nx_workspace.createWorkspace)(`@devkong/cli-nx@${presetVersion}`, {
69439
+ const workspace = await (0, import_create_nx_workspace.createWorkspace)(`@devkong/cli-nx@${presetVersion}`, {
69441
69440
  name: extensionName,
69442
69441
  id,
69443
69442
  platform: sdk,
69444
69443
  nxCloud: "skip",
69445
69444
  packageManager: "npm"
69446
69445
  });
69447
- await new InstallCommand(this.verbose).execute(extensionName);
69446
+ await new InstallCommand(this.verbose).execute(workspace.directory);
69448
69447
  }
69449
69448
  };
69450
69449
 
@@ -69700,7 +69699,7 @@ var ListExtensionSnapshotCommand = class {
69700
69699
  } else {
69701
69700
  const result = [];
69702
69701
  for (const ver of versions) {
69703
- result.push(`${ver.version}, ${ver.created}, ${ver.createdBy}`);
69702
+ result.push(`${ver.version}, ${ver.created}, ${ver.createdBy}, ${ver.notes}`);
69704
69703
  }
69705
69704
  task.output = result.join("\n");
69706
69705
  }
@@ -69744,7 +69743,7 @@ var PublishCommand = class {
69744
69743
  get wslPrefix() {
69745
69744
  return this.isWin ? "wsl" : "";
69746
69745
  }
69747
- async execute(repoName) {
69746
+ async execute(repoName, notes) {
69748
69747
  const defaultRendererOptions = {
69749
69748
  bottomBar: this.verbose ? Infinity : true,
69750
69749
  persistentOutput: true
@@ -69800,11 +69799,7 @@ var PublishCommand = class {
69800
69799
  title: "Generate schema",
69801
69800
  task: async (ctx, task) => {
69802
69801
  const logger = new ListrTaskLogger(task, this.verbose ? 3 /* DEBUG */ : 0 /* INFO */);
69803
- try {
69804
- ctx.schemaText = await spawnCommand(this.getSchemaCmdText("python3"), logger);
69805
- } catch {
69806
- ctx.schemaText = await spawnCommand(this.getSchemaCmdText("python"), logger);
69807
- }
69802
+ ctx.schemaText = await spawnCommand(this.getSchemaCmdText(), logger);
69808
69803
  },
69809
69804
  rendererOptions: defaultRendererOptions
69810
69805
  },
@@ -69824,7 +69819,7 @@ var PublishCommand = class {
69824
69819
  outputSchema: jsonSchemas.output,
69825
69820
  metadata: kongJson,
69826
69821
  version: Number(ctx.publishDetails.imageVersion),
69827
- notes: "",
69822
+ notes,
69828
69823
  created: utcNow(DEFAULT_TIMEZONE),
69829
69824
  createdBy: kongJson.ownership.at(0)
69830
69825
  };
@@ -69860,7 +69855,11 @@ var PublishCommand = class {
69860
69855
  dockerLoginCmdText(username, password, registry3) {
69861
69856
  return `${this.wslPrefix} /bin/bash -c 'echo ${password} |docker login -u ${username} --password-stdin ${registry3}'`;
69862
69857
  }
69863
- getSchemaCmdText(engine) {
69858
+ getSchemaCmdText() {
69859
+ let engine = ".\\.venv\\Scripts\\python.exe";
69860
+ if (process.platform !== "win32") {
69861
+ engine = "./.venv/bin/python";
69862
+ }
69864
69863
  const mainPyPath = resolveProjectPath("src/main.py");
69865
69864
  return `${engine} ${mainPyPath} --schema`;
69866
69865
  }
@@ -69971,18 +69970,21 @@ async function main() {
69971
69970
  });
69972
69971
  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
69972
  try {
69974
- await new InstallCommand(options.verbose).execute();
69973
+ const kongJsonPath = resolveProjectPath("kong.json");
69974
+ const projectRoot = import_path5.default.dirname(kongJsonPath);
69975
+ await new InstallCommand(options.verbose).execute(projectRoot);
69975
69976
  } catch (ex) {
69976
69977
  printError("install command failed", ex);
69977
69978
  }
69978
69979
  });
69979
69980
  const publishVersionCommand = new Command("publish-version").description(
69980
69981
  "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) => {
69982
+ ).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
69983
  try {
69983
69984
  const kongJson = getKongJson();
69984
69985
  await new PublishCommand(getProfile(options.profile), options.verbose).execute(
69985
- kongJson.name
69986
+ kongJson.name,
69987
+ options.notes
69986
69988
  );
69987
69989
  } catch (ex) {
69988
69990
  printError("publish-version command failed", ex);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devkong/cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "type": "commonjs",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
@@ -1,6 +1,6 @@
1
1
  export declare class InstallCommand {
2
2
  private verbose;
3
3
  constructor(verbose: boolean);
4
- execute(extensionName?: string): Promise<void>;
4
+ execute(workspaceDirectory: string): Promise<void>;
5
5
  private scriptPath;
6
6
  }
@@ -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;