forked from babel/babel
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build-bugfixes-targets.js
46 lines (37 loc) · 1.24 KB
/
build-bugfixes-targets.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"use strict";
// NOTE: This script must be run _after_ build-data.js
const path = require("path");
const {
generateData,
environments,
writeFile,
defineLegacyPluginAliases,
} = require("./utils-build-data");
const pluginBugfixes = require("./data/plugin-bugfixes");
const pluginFeatures = require("./data/plugin-features");
const { data: dataWithBugfixes, overlapping } = generateData(
environments,
Object.assign({}, pluginBugfixes, pluginFeatures)
);
const dataWithoutBugfixes = require("../data/plugins.json");
for (const [key, support] of Object.entries(dataWithBugfixes)) {
const originalSupport = dataWithoutBugfixes[key];
if (
originalSupport &&
Object.keys(support).length === Object.keys(originalSupport).length &&
Object.keys(support).every(env => support[env] === originalSupport[env])
) {
// The data with and without bugfixes is the same; we can avoid saving it twice.
delete dataWithBugfixes[key];
}
}
for (const [filename, data] of [
["plugin-bugfixes", dataWithBugfixes],
["overlapping-plugins", overlapping],
]) {
const dataPath = path.join(__dirname, `../data/${filename}.json`);
if (!writeFile(defineLegacyPluginAliases(data), dataPath, filename)) {
process.exitCode = 1;
break;
}
}