{"size": 1028, "ext": "js", "max_stars_repo_path": "scripts/gulp/manifest.js", "max_stars_repo_name": "LukeG294/BrainlyTools_Extension", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "scripts/gulp/manifest.js", "max_issues_repo_name": "LukeG294/BrainlyTools_Extension", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scripts/gulp/manifest.js", "max_forks_repo_name": "LukeG294/BrainlyTools_Extension", "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": 21.8723404255, "max_line_length": 45, "alphanum_fraction": 0.5690661479}
import { src, dest } from "gulp";
import gulpChange from "gulp-change";
import mergeDeep from "merge-deep";

const manifest = {
  dev: {
    version: process.env.npm_package_version,
    background: {
      scripts: [
        "background/livereload.js",
        "background/background.js",
      ],
    },
    permissions: [
      "webRequest",
      "webRequestBlocking",
      "*://browser.sentry-cdn.com/*",
      "*://*.yandex.ru/*",
      "*://*.google-analytics.com/*",
      "*://*.datadome.co/*",
      "*://*.googletagmanager.com/*",
    ],
  },

  production: {
    version: process.env.npm_package_version,
  },
};

export default () => {
  const manifestData =
    process.env.NODE_ENV === "production" //
      ? manifest.production
      : manifest.dev;

  return src("./manifest.json")
    .pipe(
      gulpChange(content => {
        let data = JSON.parse(content);
        data = mergeDeep(data, manifestData);

        return JSON.stringify(data);
      }),
    )
    .pipe(dest(process.env.BUILD_FOLDER));
};
