Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: download compat-table when build-data is run #10873

Merged
merged 2 commits into from Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/babel-preset-env/.gitignore
Expand Up @@ -8,3 +8,4 @@ test/tmp
.nyc_output
tmp
babel-preset-env-*.tgz
/build
1 change: 1 addition & 0 deletions packages/babel-preset-env/.npmignore
Expand Up @@ -15,3 +15,4 @@ babel-preset-env-*.tgz
flow-typed
.github
.idea
/build
4 changes: 2 additions & 2 deletions packages/babel-preset-env/CONTRIBUTING.md
Expand Up @@ -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)

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.

Expand Down
3 changes: 1 addition & 2 deletions packages/babel-preset-env/package.json
Expand Up @@ -11,7 +11,7 @@
"repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-env",
"main": "lib/index.js",
"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": {
"@babel/helper-module-imports": "^7.7.4",
Expand Down Expand Up @@ -76,7 +76,6 @@
"@babel/helper-plugin-test-runner": "^7.7.4",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"caniuse-db": "1.0.30000969",
"compat-table": "kangax/compat-table#4195aca631ad904cb0efeb62a9c2d8c8511706f8",
"electron-to-chromium": "1.3.113"
}
}
4 changes: 2 additions & 2 deletions packages/babel-preset-env/scripts/build-data.js
Expand Up @@ -46,7 +46,7 @@ const renameTests = (tests, getName, category) =>
// environments (node4 and chrome45), as well as familial relationships (edge
// and ie11) can be handled properly.

const envs = require("compat-table/environments");
const envs = require("../build/compat-table/environments");

const byTestSuite = suite => browser => {
return Array.isArray(browser.test_suites)
Expand All @@ -56,7 +56,7 @@ const byTestSuite = suite => browser => {

const compatSources = ["es5", "es6", "es2016plus", "esnext"].reduce(
(result, source) => {
const data = require(`compat-table/data-${source}`);
const data = require(`../build/compat-table/data-${source}`);
data.browsers = pickBy(envs, byTestSuite(source));
result.push(data);
return result;
Expand Down
8 changes: 8 additions & 0 deletions packages/babel-preset-env/scripts/download-compat-table.sh
@@ -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