chore: download compat-table when build-data is run (#10873)
This commit is contained in:
parent
c35ba3d3ab
commit
ff8a295ea7
1
packages/babel-preset-env/.gitignore
vendored
1
packages/babel-preset-env/.gitignore
vendored
@ -8,3 +8,4 @@ test/tmp
|
|||||||
.nyc_output
|
.nyc_output
|
||||||
tmp
|
tmp
|
||||||
babel-preset-env-*.tgz
|
babel-preset-env-*.tgz
|
||||||
|
/build
|
||||||
|
|||||||
@ -15,3 +15,4 @@ babel-preset-env-*.tgz
|
|||||||
flow-typed
|
flow-typed
|
||||||
.github
|
.github
|
||||||
.idea
|
.idea
|
||||||
|
/build
|
||||||
|
|||||||
@ -63,9 +63,9 @@ If you want to mark a new proposal as shipped, add it to [this list](https://git
|
|||||||
|
|
||||||
### Update [`plugins.json`](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugins.json)
|
### Update [`plugins.json`](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugins.json)
|
||||||
|
|
||||||
Until `compat-table` is a standalone npm module for data we are using the git url
|
Until `compat-table` is a standalone npm module for data we are using the git commit in `scripts/download-compat-table.sh`
|
||||||
|
|
||||||
`"compat-table": "kangax/compat-table#[latest-commit-hash]"`,
|
`COMPAT_TABLE_COMMIT=[latest-commit-hash]`,
|
||||||
|
|
||||||
So we update and then run `npm run build-data`. If there are no changes, then `plugins.json` will be the same.
|
So we update and then run `npm run build-data`. If there are no changes, then `plugins.json` will be the same.
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-env",
|
"repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-env",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build-data": "node ./scripts/build-data.js; node ./scripts/build-modules-support.js"
|
"build-data": "./scripts/download-compat-table.sh; node ./scripts/build-data.js; node ./scripts/build-modules-support.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/helper-module-imports": "^7.7.4",
|
"@babel/helper-module-imports": "^7.7.4",
|
||||||
@ -76,7 +76,6 @@
|
|||||||
"@babel/helper-plugin-test-runner": "^7.7.4",
|
"@babel/helper-plugin-test-runner": "^7.7.4",
|
||||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||||
"caniuse-db": "1.0.30000969",
|
"caniuse-db": "1.0.30000969",
|
||||||
"compat-table": "kangax/compat-table#4195aca631ad904cb0efeb62a9c2d8c8511706f8",
|
|
||||||
"electron-to-chromium": "1.3.113"
|
"electron-to-chromium": "1.3.113"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,7 @@ const renameTests = (tests, getName, category) =>
|
|||||||
// environments (node4 and chrome45), as well as familial relationships (edge
|
// environments (node4 and chrome45), as well as familial relationships (edge
|
||||||
// and ie11) can be handled properly.
|
// and ie11) can be handled properly.
|
||||||
|
|
||||||
const envs = require("compat-table/environments");
|
const envs = require("../build/compat-table/environments");
|
||||||
|
|
||||||
const byTestSuite = suite => browser => {
|
const byTestSuite = suite => browser => {
|
||||||
return Array.isArray(browser.test_suites)
|
return Array.isArray(browser.test_suites)
|
||||||
@ -56,7 +56,7 @@ const byTestSuite = suite => browser => {
|
|||||||
|
|
||||||
const compatSources = ["es5", "es6", "es2016plus", "esnext"].reduce(
|
const compatSources = ["es5", "es6", "es2016plus", "esnext"].reduce(
|
||||||
(result, source) => {
|
(result, source) => {
|
||||||
const data = require(`compat-table/data-${source}`);
|
const data = require(`../build/compat-table/data-${source}`);
|
||||||
data.browsers = pickBy(envs, byTestSuite(source));
|
data.browsers = pickBy(envs, byTestSuite(source));
|
||||||
result.push(data);
|
result.push(data);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
8
packages/babel-preset-env/scripts/download-compat-table.sh
Executable file
8
packages/babel-preset-env/scripts/download-compat-table.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
COMPAT_TABLE_COMMIT=4195aca631ad904cb0efeb62a9c2d8c8511706f8
|
||||||
|
rm -rf build/compat-table
|
||||||
|
mkdir -p build
|
||||||
|
git clone --branch=gh-pages --single-branch --shallow-since=2019-11-14 https://github.com/kangax/compat-table.git build/compat-table
|
||||||
|
cd build/compat-table && git checkout -qf $COMPAT_TABLE_COMMIT
|
||||||
Loading…
x
Reference in New Issue
Block a user