Skip to content

Commit

Permalink
Merge branch 'master' into KhudaDad414-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
KhudaDad414 authored Apr 18, 2024
2 parents 1c7e9f8 + 37b6cfb commit 8db5325
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
16 changes: 12 additions & 4 deletions examples/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { Optimizer } = require('../lib/Optimizer')
const fs = require('fs')
const path = require('path')

// read input.yaml file synconously and store it as an string
const input = require('fs').readFileSync('./examples/input.yaml', 'utf8')
// Construct absolute paths to input and output files
const inputFilePath = path.join(__dirname, 'input.yaml')
const outputFilePath = path.join(__dirname, 'output.yaml')

// Read input.yaml file synchronously and store it as a string
const input = fs.readFileSync(inputFilePath, 'utf8')
const optimizer = new Optimizer(input)

optimizer.getReport().then((report) => {
console.log(report)
const optimizedDocument = optimizer.getOptimizedDocument({
Expand All @@ -18,6 +25,7 @@ optimizer.getReport().then((report) => {
schema: false,
},
})
//store optimizedDocument as to output.yaml
require('fs').writeFileSync('./examples/output.yaml', optimizedDocument)

// Store optimizedDocument to output.yaml
fs.writeFileSync(outputFilePath, optimizedDocument)
})
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@asyncapi/optimizer",
"version": "1.0.0",
"version": "1.0.1",
"description": "This library will optimize the AsyncAPI specification file.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down

0 comments on commit 8db5325

Please sign in to comment.