Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(type-safe-api): remove wrapper scripts for websocket docs projects #861

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions packages/pdk/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions packages/type-safe-api/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ const generateAsyncApiSpec = (openApiSpec: any): any => {
};
};

void (async () => {
export default async (argv: string[]) => {
const args = parse<Arguments>({
specPath: { type: String, alias: "s" },
outputPath: { type: String, alias: "o" },
});
}, { argv });

const openApiSpec = (await SwaggerParser.bundle(args.specPath)) as any;

Expand All @@ -138,4 +138,4 @@ void (async () => {
writeFile(args.outputPath, JSON.stringify(asyncApiSpec, null, 2), {
readonly: true,
});
})();
};
3 changes: 3 additions & 0 deletions packages/type-safe-api/scripts/type-safe-api/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { parse } from "ts-command-line-args";
import generateMockData from "./custom/mock-data/generate-mock-data";
import parseOpenapiSpec from "./parser/parse-openapi-spec";
import generate from "./generators/generate-next";
import generateAsyncapiSpec from "./custom/generate-asyncapi-spec/generate-asyncapi-spec";
import * as path from "path";

interface SubCommandArgs {
Expand All @@ -21,6 +22,8 @@ void (async () => {
return await generateMockData(argv);
case "parse-openapi-spec":
return await parseOpenapiSpec(argv);
case "generate-asyncapi-spec":
return await generateAsyncapiSpec(argv);
case "generate":
return await generate(argv, path.resolve(__dirname));
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,10 @@ export enum TypeSafeApiScript {
GENERATE = "type-safe-api.generate",
GENERATE_NEXT = "type-safe-api generate",
GENERATE_MOCK_DATA = "type-safe-api generate-mock-data",
GENERATE_HTML_REDOC_DOCS = "type-safe-api.generate-html-redoc-docs",
GENERATE_ASYNCAPI_HTML_DOCS = "type-safe-api.generate-asyncapi-html-docs",
GENERATE_ASYNCAPI_MARKDOWN_DOCS = "type-safe-api.generate-asyncapi-markdown-docs",
CLEAN_OPENAPI_GENERATED_CODE = "type-safe-api.clean-openapi-generated-code",
COPY_GRADLE_WRAPPER = "type-safe-api.copy-gradle-wrapper",
COPY_ASYNC_SMITHY_TRANSFORMER = "type-safe-api.copy-async-smithy-transformer",
GENERATE_ASYNCAPI_SPEC = "type-safe-api.generate-asyncapi-spec",
GENERATE_ASYNCAPI_SPEC = "type-safe-api generate-asyncapi-spec",
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ SPDX-License-Identifier: Apache-2.0 */
import { Project, ProjectOptions, Task } from "projen";
import { GeneratedAsyncApiHtmlDocumentationOptions } from "../../types";
import { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment";
import {
buildTypeSafeApiExecCommand,
TypeSafeApiScript,
} from "../components/utils";

export interface GeneratedAsyncApiHtmlDocumentationProjectOptions
extends ProjectOptions,
Expand All @@ -26,11 +22,9 @@ export class GeneratedAsyncApiHtmlDocumentationProject extends Project {

this.generateTask = this.addTask("generate");
this.generateTask.exec(
buildTypeSafeApiExecCommand(
TypeSafeApiScript.GENERATE_ASYNCAPI_HTML_DOCS,
`--spec-path ${options.specPath} --output-path .`
)
`npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "${options.specPath}" @asyncapi/html-template@2.3.2 --param singleFile=true --param outFilename=index.html --force-write`
);

this.compileTask.spawn(this.generateTask);

if (!options.commitGeneratedCode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ SPDX-License-Identifier: Apache-2.0 */
import { Project, ProjectOptions, Task } from "projen";
import { GeneratedAsyncApiMarkdownDocumentationOptions } from "../../types";
import { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment";
import {
buildTypeSafeApiExecCommand,
TypeSafeApiScript,
} from "../components/utils";

export interface GeneratedAsyncApiMarkdownDocumentationProjectOptions
extends ProjectOptions,
Expand All @@ -26,10 +22,7 @@ export class GeneratedAsyncApiMarkdownDocumentationProject extends Project {

this.generateTask = this.addTask("generate");
this.generateTask.exec(
buildTypeSafeApiExecCommand(
TypeSafeApiScript.GENERATE_ASYNCAPI_MARKDOWN_DOCS,
`--spec-path ${options.specPath} --output-path .`
)
`npx --yes @asyncapi/cli@1.7.3 generate fromTemplate "${options.specPath}" @asyncapi/markdown-template@1.5.0 --param outFilename=index.md --force-write`
);
this.compileTask.spawn(this.generateTask);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class TypeSafeWebSocketApiModelProject extends TypeSafeApiModelProjectBas
this.generateTask.exec(
buildTypeSafeApiExecCommand(
TypeSafeApiScript.GENERATE_ASYNCAPI_SPEC,
`--spec-path ${this.parsedSpecFile} --output-path ${this.asyncApiSpecFile}`
`--specPath ${this.parsedSpecFile} --outputPath ${this.asyncApiSpecFile}`
)
);

Expand Down
Loading
Loading