{"size": 1393, "ext": "js", "max_stars_repo_path": "generators/ide/jb-gen.js", "max_stars_repo_name": "lpmi-13/website", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "generators/ide/jb-gen.js", "max_issues_repo_name": "lpmi-13/website", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "generators/ide/jb-gen.js", "max_forks_repo_name": "lpmi-13/website", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.875, "max_line_length": 80, "alphanum_fraction": 0.6475233309}
//@ts-check
// run yarn generate:jb to regenerate JB docs after editing jb-product.md

import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";

const __dirname = path.dirname(fileURLToPath(import.meta.url));

/**
 * @type {Map<string, {[key: string]: string}>}
 */
const products = new Map();
products.set("intellij", {
  productTitle: "IntelliJ IDEA",
  productFullyQualifiedTitle: "IntelliJ IDEA Ultimate",
  productDocCode: "idea",
});
products.set("goland", {
  productTitle: "GoLand",
  productDocCode: "go",
});
products.set("phpstorm", {
  productTitle: "PhpStorm",
  productDocCode: "phpstorm",
});
products.set("pycharm", {
  productTitle: "PyCharm",
  productDocCode: "pycharm",
});

const keys = new Set();
keys.add("productId");
for (const parameters of products.values()) {
  for (const key in parameters) {
    keys.add(key);
  }
}

for (const [id, parameters] of products) {
  let content = fs.readFileSync(path.join(__dirname, "jb-product.md"), "utf-8");
  for (const key of keys) {
    const value =
      parameters[key] ||
      (key === "productId" && id) ||
      (key === "productFullyQualifiedTitle" && parameters["productTitle"]) ||
      "";
    content = content.replace(new RegExp(`__${key}__`, "gi"), value);
  }
  fs.writeFileSync(
    path.join(__dirname, `../../gitpod/docs/ides-and-editors/${id}.md`),
    content,
    "utf-8"
  );
}
