Skip to content

Commit

Permalink
fix: deprecate --file and add release (#1639)
Browse files Browse the repository at this point in the history
* chore: deprecate -file flag in studio

Signed-off-by: Ashish Padhy <[email protected]>

* chore: update action-template

Signed-off-by: Ashish Padhy <[email protected]>

* chore: add changeset

Signed-off-by: Ashish Padhy <[email protected]>

---------

Signed-off-by: Ashish Padhy <[email protected]>
  • Loading branch information
Shurtu-gal authored Jan 21, 2025
1 parent 9f847e2 commit a37e124
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-pets-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@asyncapi/cli': minor
---

Deprecate the --file flag in `start studio` command
4 changes: 2 additions & 2 deletions action-template.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Generator, Validator, Converter and others - all in one for your AsyncAPI docs'
description: 'Use this action to generate docs or code from your AsyncAPI document. Use default templates or provide your custom ones.'
name: 'AsyncAPI CLI Action'
description: 'One stop solution for all your AsyncAPI Specification needs in github actions.'
inputs:
cli_version:
description: 'Version of AsyncAPI CLI to be used. This is only needed if you want to test with a specific version of AsyncAPI CLI. Default is latest which is also the recommended option.'
Expand Down
10 changes: 8 additions & 2 deletions src/commands/start/studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@ export default class StartStudio extends Command {

async run() {
const { args, flags } = await this.parse(StartStudio);
let filePath = args['spec-file'];

if (flags.file) {
this.warn('The file flag has been removed and is being replaced by the argument spec-file. Please pass the filename directly like `asyncapi start studio asyncapi.yml`');
}

let filePath = args['spec-file'] ?? flags.file;

const port = flags.port;
if (!filePath) {
try {
filePath = ((await load()).getFilePath());
this.log(`Loaded specification from: ${filePath}`);
} catch (error) {
filePath = '';
this.log('No file specified.');
this.error('No file specified.');
}
}
try {
Expand Down
1 change: 1 addition & 0 deletions src/core/flags/start/studio.flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Flags } from '@oclif/core';
export const studioFlags = () => {
return {
help: Flags.help({ char: 'h' }),
file: Flags.string({ char: 'f', description: 'path to the AsyncAPI file to link with Studio', deprecated: true }),
port: Flags.integer({ char: 'p', description: 'port in which to start Studio' }),
};
};
4 changes: 2 additions & 2 deletions src/core/models/Studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ export function start(filePath: string, port: number = DEFAULT_PORT): void {
if (filePath) {
console.log(`Watching changes on file ${filePath}`);
} else {
console.log(
'Hint : No file was provided, and we couldn\'t find a default file (like "asyncapi.yaml" or "asyncapi.json") in the current folder. Starting Studio with a blank workspace.'
console.warn(
'Warning: No file was provided, and we couldn\'t find a default file (like "asyncapi.yaml" or "asyncapi.json") in the current folder. Starting Studio with a blank workspace.'
);
}
open(url);
Expand Down

0 comments on commit a37e124

Please sign in to comment.