Skip to content

Commit

Permalink
added the reviewed changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gmin2 committed Jan 9, 2024
1 parent 85a867f commit 12bcdeb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 4 additions & 3 deletions scripts/add-new-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ async function addNewVersion(newVersion) {
fs.accessSync(newVersionDir);
console.error(`Directory ${newVersionDir} already exist and cannot be overwritten. Please create a different version.`);
return process.exit(1);
} catch (err) /* eslint-disable no-empty */ { }
} catch (err) {
console.error(`Error checking if directory ${newVersionDir} exist: ${err}`);
}

//Use the newest version as baseline for the new one
const latestVersion = (await execute('ls -d ./definitions/* | sort -V -r | head -1 | xargs -n 1 basename')).trim();
Expand All @@ -99,8 +101,7 @@ async function addNewVersion(newVersion) {
await execute(`cp -R ./examples/${latestExampleVersion} ${newExampleVersionDir}`);

// Replace $ref and $id paths such as `/3.0.0/` with new version (http://asyncapi.com/definitions/3.0.0/specificationExtension.json)
/* eslint-disable no-useless-escape */
await execute(`find ${newVersionDir} -name '*.json' -exec sed -i '' \"s+\/${latestVersion}\/+\/${newVersion}\/+g\" {} +`);
await execute(`find ${newVersionDir} -name '*.json' -exec sed -i '' "s+/${latestVersion}/+/${newVersion}/+g" {} +`);

// Replace .asyncapi version from old to new version
// Replace old version in title with new version
Expand Down
2 changes: 0 additions & 2 deletions tools/bundler/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const path = require('path');
const fs = require('fs');
const traverse = require('json-schema-traverse');
/* eslint-disable no-unused-vars */
const { url } = require('inspector');
const definitionsDirectory = path.resolve(__dirname, '../../definitions');
const bindingsDirectory = path.resolve(__dirname, '../../bindings');
const outputDirectory = path.resolve(__dirname, '../../schemas');
Expand Down

0 comments on commit 12bcdeb

Please sign in to comment.