function updateVersions(oldVersion, newVersion) {
	echo("Updating ESLint versions list in docs package");

	const filePath = path.join(
		__dirname,
		"docs",
		"src",
		"_data",
		"versions.json",
	);
	const data = require(filePath);
	const { items } = data;

	const isOldVersionPrerelease = isPreRelease(oldVersion);
	const isNewVersionPrerelease = isPreRelease(newVersion);

	if (isOldVersionPrerelease) {
		if (isNewVersionPrerelease) {
			// prerelease -> prerelease. Just update the version.
			items.find(item => item.branch === "next").version = newVersion;
		} else {
			// prerelease -> release. First, update the item for the previous latest version
			const latestVersionItem = items.find(
				item => item.branch === "latest",
			);
			const latestVersion = latestVersionItem.version;
			const versionBranch = `v${latestVersion.slice(0, latestVersion.indexOf("."))}.x`; // "v8.x", "v9.x", "v10.x" ...

			latestVersionItem.branch = versionBranch;
			latestVersionItem.path = `/docs/${versionBranch}/`;

			// Then, replace the item for the prerelease with a new item for the new latest version
			items.splice(
				items.findIndex(item => item.branch === "next"),
				1,
				{
					version: newVersion,
					branch: "latest",
					path: "/docs/latest/",
				},
			);
		}
	} else {
		if (isNewVersionPrerelease) {
			// release -> prerelease. Insert an item for the prerelease.
			items.splice(1, 0, {
				version: newVersion,
				branch: "next",
				path: "/docs/next/",
			});
		} else {
			// release -> release. Just update the version.
			items.find(item => item.branch === "latest").version = newVersion;
		}
	}

	fs.writeFileSync(filePath, `${JSON.stringify(data, null, 4)}\n`);
}
Updates docs/src/_data/versions.json
@param {string} oldVersion Current version.
@param {string} newVersion New version to be released.
@returns {void}