-
Notifications
You must be signed in to change notification settings - Fork 0
Setup esbuild build script #8
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bdf5f8e
chore: eslint ignore .coverage λλ ν 리 μΆκ° λ° νμ
μν¬νΈ μΌκ΄μ± κ·μΉ μΆκ°
toothlessdev 951fa57
refactor: λ°°λ΄ νμΌ λΆλ¦¬
toothlessdev db68d71
build: tsconfig μΌκ΄μ±μ λ§κ² μμ (node20+ μ κΈ°μ€)
toothlessdev f4fddf0
feature: κΈ°λ³Έ cli ꡬ쑰 μ€μ
toothlessdev 68ebc84
build: esbuild λ° λΉλ μ€ν¬λ¦½νΈ μ€μ
toothlessdev 88234ec
build: lint fix script λ° task μΆκ°
toothlessdev 42d85a0
refactor: type import κ·μΉ ν΅μΌν
toothlessdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { Command } from "commander"; | ||
|
|
||
| export function createCLI() { | ||
| const program = new Command(); | ||
|
|
||
| program | ||
| .name("patchlogr") | ||
| .version("0.0.0") | ||
| .description("PatchlogrCLI : changelogs from openapi specs"); | ||
|
|
||
| program | ||
| .command("help") | ||
| .description("Display help information about patchlogr commands"); | ||
|
|
||
| program | ||
| .command("canonicalize") | ||
| .argument("<api-docs>", "Path to the OpenAPI specification file") | ||
| .option("--canonicalize", "Canonicalize the OpenAPI specification") | ||
toothlessdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .option( | ||
| "--skipValidation", | ||
| "Skip validation of the OpenAPI specification", | ||
| ) | ||
| .option( | ||
| "-o, --output <file>", | ||
| "Write result to file instead of stdout (default: stdout)", | ||
| ) | ||
| .action(async (apiDocs, options) => { | ||
| try { | ||
| console.log("[patchlogr] Processing:", apiDocs, options); | ||
| } catch (error) { | ||
| console.error("[patchlogr] Error:", (error as Error).message); | ||
toothlessdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| process.exitCode = 1; | ||
| } | ||
| }); | ||
|
|
||
| return program; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { preprocessOASDocument } from "@patchlogr/oas"; | ||
| import { type OASStageOptions } from "@patchlogr/oas"; | ||
|
|
||
| export type RunCanonicalizeOptions = OASStageOptions; | ||
|
|
||
| export async function runCanonicalize( | ||
| apiDocs: any, | ||
| options: RunCanonicalizeOptions, | ||
| ) { | ||
| preprocessOASDocument(apiDocs, { ...options }); | ||
| } | ||
toothlessdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { createCLI } from "./cli"; | ||
|
|
||
| const program = createCLI(); | ||
|
|
||
| program.parseAsync(process.argv).catch((error) => { | ||
| console.error("[patchlogr] Error:", error); | ||
| process.exitCode = 1; | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { build } from "esbuild"; | ||
| import pkg from "./package.json" with { type: "json" }; | ||
|
|
||
| await build({ | ||
| entryPoints: ["src/index.ts"], | ||
| outdir: "dist", | ||
| bundle: true, | ||
| platform: "node", | ||
| target: ["node18", "node20", "node24"], | ||
| format: "esm", | ||
| sourcemap: true, | ||
| external: [ | ||
| ...Object.keys(pkg.dependencies || {}), | ||
| ...Object.keys(pkg.peerDependencies || {}), | ||
| ], | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/patchlogr-oas/src/__tests__/preprocessOASDocument.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/patchlogr-oas/src/canonicalize/__tests__/v3/canonicalizeOASV3.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,2 @@ | ||
| import { OpenAPI } from "openapi-types"; | ||
| import { PipelineExecutor } from "./pipeline/PipelineExecutor"; | ||
| import { OASValidationStage } from "./pipeline/OASValidationStage"; | ||
| import { OASCanonicalizeStage } from "./pipeline/OASCanonicalizeStage"; | ||
| import { OASBundleStage } from "./pipeline/OASBundleStage"; | ||
| import { OASStageContext, OASStageOptions } from "./pipeline/OASStageContext"; | ||
| import { OASDereferenceStage } from "./pipeline/OASDereferenceStage"; | ||
|
|
||
| export function preprocessOASDocument( | ||
| doc: OpenAPI.Document, | ||
| options: OASStageOptions = {}, | ||
| ) { | ||
| const pipelineExecutor = new PipelineExecutor<OASStageContext>(); | ||
|
|
||
| pipelineExecutor.add(new OASBundleStage()); | ||
| pipelineExecutor.add(new OASValidationStage()); | ||
| pipelineExecutor.add(new OASDereferenceStage()); | ||
| pipelineExecutor.add(new OASCanonicalizeStage()); | ||
|
|
||
| return pipelineExecutor.run({ | ||
| source: doc, | ||
| options, | ||
| }); | ||
| } | ||
| export { type OASStageOptions } from "./pipeline/OASStageContext"; | ||
| export { preprocessOASDocument } from "./preprocessOASDocument"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/patchlogr-oas/src/pipeline/__tests__/OASBundleStage.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/patchlogr-oas/src/pipeline/__tests__/OASDereferenceStage.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/patchlogr-oas/src/pipeline/__tests__/OASValidationStage.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packages/patchlogr-oas/src/pipeline/__tests__/PipelineExecutor.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import type { OpenAPI } from "openapi-types"; | ||
| import { OASBundleStage } from "./pipeline/OASBundleStage"; | ||
| import { OASCanonicalizeStage } from "./pipeline/OASCanonicalizeStage"; | ||
| import { OASDereferenceStage } from "./pipeline/OASDereferenceStage"; | ||
| import type { | ||
| OASStageOptions, | ||
| OASStageContext, | ||
| } from "./pipeline/OASStageContext"; | ||
| import { OASValidationStage } from "./pipeline/OASValidationStage"; | ||
| import { PipelineExecutor } from "./pipeline/PipelineExecutor"; | ||
|
|
||
| export function preprocessOASDocument( | ||
| doc: OpenAPI.Document, | ||
toothlessdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| options: OASStageOptions = {}, | ||
| ) { | ||
| const pipelineExecutor = new PipelineExecutor<OASStageContext>(); | ||
|
|
||
| pipelineExecutor.add(new OASBundleStage()); | ||
| pipelineExecutor.add(new OASValidationStage()); | ||
| pipelineExecutor.add(new OASDereferenceStage()); | ||
| pipelineExecutor.add(new OASCanonicalizeStage()); | ||
|
|
||
| return pipelineExecutor.run({ | ||
| source: doc, | ||
| options, | ||
| }); | ||
| } | ||
2 changes: 1 addition & 1 deletion
2
packages/patchlogr-oas/src/utils/__tests__/toCanonicalSchema.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.