2022-05-04 17:25:28 +03:00
|
|
|
const fs = require("fs");
|
|
|
|
const path = require("path");
|
|
|
|
|
|
|
|
const nodeModulesDirectory = path.join(
|
|
|
|
__dirname,
|
|
|
|
"..",
|
|
|
|
"..",
|
|
|
|
"..",
|
|
|
|
"node_modules"
|
|
|
|
);
|
2022-03-12 10:45:25 +03:00
|
|
|
/**
|
2022-05-04 17:25:28 +03:00
|
|
|
*
|
|
|
|
* @param {string} s
|
2022-03-12 10:45:25 +03:00
|
|
|
*/
|
|
|
|
function copy(s) {
|
2022-05-04 17:25:28 +03:00
|
|
|
console.log(`es/preset-env: Copying ${s}`);
|
2022-03-12 10:45:25 +03:00
|
|
|
|
2022-05-04 17:25:28 +03:00
|
|
|
const targetPath = path.join(__dirname, "..", "data", s);
|
|
|
|
const targetDir = path.dirname(targetPath);
|
2022-03-12 10:45:25 +03:00
|
|
|
|
|
|
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
|
|
|
2022-05-04 17:25:28 +03:00
|
|
|
fs.copyFileSync(path.join(nodeModulesDirectory, s), targetPath);
|
2022-03-12 10:45:25 +03:00
|
|
|
}
|
|
|
|
|
2022-05-04 17:25:28 +03:00
|
|
|
copy("@babel/compat-data/data/plugins.json");
|
|
|
|
copy("@babel/compat-data/data/plugin-bugfixes.json");
|
|
|
|
copy("core-js-compat/data.json");
|
|
|
|
copy("core-js-compat/entries.json");
|
|
|
|
copy("core-js-compat/modules-by-versions.json");
|