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

Build targeting Jest with relevant transforms #2698

Merged
merged 24 commits into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ dist
node_modules
es
lib
kbn-test
types
eui.d.ts
**/*.snap.js
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ tmp/
dist/
lib/
es/
kbn-test/
thompsongl marked this conversation as resolved.
Show resolved Hide resolved
.idea
.vscode/
.DS_Store
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-async-to-generator": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.1.0",
Expand Down
1 change: 1 addition & 0 deletions scripts/compile-clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ const rimraf = require('rimraf');
rimraf.sync('dist');
rimraf.sync('lib');
rimraf.sync('es');
rimraf.sync('kbn-test');
25 changes: 22 additions & 3 deletions scripts/compile-eui.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const chalk = require('chalk');
const shell = require('shelljs');
const path = require('path');
const glob = require('glob');
const fs = require('fs');
const dtsGenerator = require('dts-generator').default;

function compileLib() {
Expand All @@ -13,11 +14,12 @@ function compileLib() {
'lib/test'
);

console.log('Compiling src/ to es/ and lib/');
console.log('Compiling src/ to es/, lib/, and kbn-test/');

// Run all code (com|trans)pilation through babel (ESNext JS & TypeScript)

execSync(
'babel --quiet --out-dir=es --extensions .js,.ts,.tsx --ignore "**/webpack.config.js,**/*.test.js,**/*.d.ts" src',
'babel --quiet --out-dir=es --extensions .js,.ts,.tsx --ignore "**/webpack.config.js,**/*.test.js,**/*.test.ts,**/*.test.tsx,**/*.d.ts,**/*.testenv.js,**/*.testenv.tsx,**/*.testenv.ts" src',
{
env: {
...process.env,
Expand All @@ -26,15 +28,32 @@ function compileLib() {
},
}
);

execSync(
'babel --quiet --out-dir=lib --extensions .js,.ts,.tsx --ignore "**/webpack.config.js,**/*.test.js,**/*.test.ts,**/*.test.tsx,**/*.d.ts,**/*.testenv.js,**/*.testenv.tsx,**/*.testenv.ts" src',
{
env: {
...process.env,
NO_COREJS_POLYFILL: true,
},
}
);

execSync(
'babel --quiet --out-dir=lib --extensions .js,.ts,.tsx --ignore "**/webpack.config.js,**/*.test.js,**/*.d.ts" src',
'babel --quiet --out-dir=kbn-test --extensions .js,.ts,.tsx --plugins=@babel/plugin-transform-runtime,@babel/plugin-transform-async-to-generator,@babel/plugin-syntax-dynamic-import,dynamic-import-node --ignore "**/webpack.config.js,**/*.test.js,**/*.test.ts,**/*.test.tsx,**/*.d.ts" src',
{
env: {
...process.env,
NO_COREJS_POLYFILL: true,
},
}
);
glob('./kbn-test/**/index.testenv.js', undefined, (error, files) => {
files.forEach(file => {
const dir = path.dirname(file);
fs.renameSync(file, `${dir}/index.js`);
});
});

console.log(chalk.green('✔ Finished compiling src/'));

Expand Down
4 changes: 4 additions & 0 deletions src/components/icon/icon.testenv.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import React from 'react';
export const EuiIcon = ({ type }: { type: string }) => (
<div data-euiicon-type={type} />
);
2 changes: 2 additions & 0 deletions src/components/icon/index.testenv.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './icon';
export { EuiIcon } from './icon.testenv';
8 changes: 8 additions & 0 deletions src/index.testenv.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as Packages from '../packages';

export * from './components';
export * from './services';
export * from './test';
thompsongl marked this conversation as resolved.
Show resolved Hide resolved
export * from './utils';

export { Packages };
125 changes: 125 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,30 @@
source-map "^0.5.0"
trim-right "^1.0.1"

"@babel/generator@^7.7.4":
version "7.7.4"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.4.tgz#db651e2840ca9aa66f327dcec1dc5f5fa9611369"
integrity sha512-m5qo2WgdOJeyYngKImbkyQrnUN1mPceaG5BV+G0E3gWsa4l/jCSryWJdM2x8OuGAOyh+3d5pVYfZWCiNFtynxg==
dependencies:
"@babel/types" "^7.7.4"
jsesc "^2.5.1"
lodash "^4.17.13"
source-map "^0.5.0"

"@babel/helper-annotate-as-pure@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32"
integrity sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q==
dependencies:
"@babel/types" "^7.0.0"

"@babel/helper-annotate-as-pure@^7.7.4":
version "7.7.4"
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.7.4.tgz#bb3faf1e74b74bd547e867e48f551fa6b098b6ce"
integrity sha512-2BQmQgECKzYKFPpiycoF9tlb5HA4lrVyAmLLVK177EcQAqjVLciUb2/R+n1boQ9y5ENV3uz2ZqiNw7QMBBw1Og==
dependencies:
"@babel/types" "^7.7.4"

"@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.1.0.tgz#6b69628dfe4087798e0c4ed98e3d4a6b2fbd2f5f"
Expand Down Expand Up @@ -215,13 +232,29 @@
"@babel/template" "^7.1.0"
"@babel/types" "^7.0.0"

"@babel/helper-function-name@^7.7.4":
version "7.7.4"
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz#ab6e041e7135d436d8f0a3eca15de5b67a341a2e"
integrity sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ==
dependencies:
"@babel/helper-get-function-arity" "^7.7.4"
"@babel/template" "^7.7.4"
"@babel/types" "^7.7.4"

"@babel/helper-get-function-arity@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3"
integrity sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==
dependencies:
"@babel/types" "^7.0.0"

"@babel/helper-get-function-arity@^7.7.4":
version "7.7.4"
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz#cb46348d2f8808e632f0ab048172130e636005f0"
integrity sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA==
dependencies:
"@babel/types" "^7.7.4"

"@babel/helper-hoist-variables@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.0.0.tgz#46adc4c5e758645ae7a45deb92bab0918c23bb88"
Expand All @@ -243,6 +276,13 @@
dependencies:
"@babel/types" "^7.0.0"

"@babel/helper-module-imports@^7.7.4":
version "7.7.4"
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.7.4.tgz#e5a92529f8888bf319a6376abfbd1cebc491ad91"
integrity sha512-dGcrX6K9l8258WFjyDLJwuVKxR4XZfU0/vTUgOQYWEnRD8mgr+p4d6fCUMq/ys0h4CCt/S5JhbvtyErjWouAUQ==
dependencies:
"@babel/types" "^7.7.4"

"@babel/helper-module-transforms@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.1.0.tgz#470d4f9676d9fad50b324cdcce5fbabbc3da5787"
Expand Down Expand Up @@ -285,6 +325,17 @@
"@babel/traverse" "^7.1.0"
"@babel/types" "^7.0.0"

"@babel/helper-remap-async-to-generator@^7.7.4":
version "7.7.4"
resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.7.4.tgz#c68c2407350d9af0e061ed6726afb4fff16d0234"
integrity sha512-Sk4xmtVdM9sA/jCI80f+KS+Md+ZHIpjuqmYPk1M7F/upHou5e4ReYmExAiu6PVe65BhJPZA2CY9x9k4BqE5klw==
dependencies:
"@babel/helper-annotate-as-pure" "^7.7.4"
"@babel/helper-wrap-function" "^7.7.4"
"@babel/template" "^7.7.4"
"@babel/traverse" "^7.7.4"
"@babel/types" "^7.7.4"

"@babel/helper-replace-supers@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.1.0.tgz#5fc31de522ec0ef0899dc9b3e7cf6a5dd655f362"
Expand Down Expand Up @@ -324,6 +375,13 @@
dependencies:
"@babel/types" "^7.4.4"

"@babel/helper-split-export-declaration@^7.7.4":
version "7.7.4"
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz#57292af60443c4a3622cf74040ddc28e68336fd8"
integrity sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug==
dependencies:
"@babel/types" "^7.7.4"

"@babel/helper-wrap-function@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.1.0.tgz#8cf54e9190706067f016af8f75cb3df829cc8c66"
Expand All @@ -334,6 +392,16 @@
"@babel/traverse" "^7.1.0"
"@babel/types" "^7.0.0"

"@babel/helper-wrap-function@^7.7.4":
version "7.7.4"
resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.7.4.tgz#37ab7fed5150e22d9d7266e830072c0cdd8baace"
integrity sha512-VsfzZt6wmsocOaVU0OokwrIytHND55yvyT4BPB9AIIgwr8+x7617hetdJTsuGwygN5RC6mxA9EJztTjuwm2ofg==
dependencies:
"@babel/helper-function-name" "^7.7.4"
"@babel/template" "^7.7.4"
"@babel/traverse" "^7.7.4"
"@babel/types" "^7.7.4"

"@babel/helpers@^7.1.2":
version "7.1.2"
resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.1.2.tgz#ab752e8c35ef7d39987df4e8586c63b8846234b5"
Expand Down Expand Up @@ -399,6 +467,11 @@
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.0.tgz#3e05d0647432a8326cb28d0de03895ae5a57f39b"
integrity sha512-+o2q111WEx4srBs7L9eJmcwi655eD8sXniLqMB93TBK9GrNzGrxDWSjiqz2hLU0Ha8MTXFIP0yd9fNdP+m43ZQ==

"@babel/parser@^7.7.4":
version "7.7.5"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71"
integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig==

"@babel/plugin-proposal-async-generator-functions@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.1.0.tgz#41c1a702e10081456e23a7b74d891922dd1bb6ce"
Expand Down Expand Up @@ -525,6 +598,15 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/helper-remap-async-to-generator" "^7.1.0"

"@babel/plugin-transform-async-to-generator@^7.7.4":
version "7.7.4"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.7.4.tgz#694cbeae6d613a34ef0292713fa42fb45c4470ba"
integrity sha512-zpUTZphp5nHokuy8yLlyafxCJ0rSlFoSHypTUWgpdwoDXWQcseaect7cJ8Ppk6nunOM6+5rPMkod4OYKPR5MUg==
dependencies:
"@babel/helper-module-imports" "^7.7.4"
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/helper-remap-async-to-generator" "^7.7.4"

"@babel/plugin-transform-block-scoped-functions@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.0.0.tgz#482b3f75103927e37288b3b67b65f848e2aa0d07"
Expand Down Expand Up @@ -710,6 +792,16 @@
dependencies:
regenerator-transform "^0.13.3"

"@babel/plugin-transform-runtime@^7.7.6":
version "7.7.6"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.7.6.tgz#4f2b548c88922fb98ec1c242afd4733ee3e12f61"
integrity sha512-tajQY+YmXR7JjTwRvwL4HePqoL3DYxpYXIHKVvrOIvJmeHe2y1w4tz5qz9ObUDC9m76rCzIMPyn4eERuwA4a4A==
dependencies:
"@babel/helper-module-imports" "^7.7.4"
"@babel/helper-plugin-utils" "^7.0.0"
resolve "^1.8.1"
semver "^5.5.1"

"@babel/plugin-transform-shorthand-properties@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.0.0.tgz#85f8af592dcc07647541a0350e8c95c7bf419d15"
Expand Down Expand Up @@ -902,6 +994,15 @@
"@babel/parser" "^7.6.0"
"@babel/types" "^7.6.0"

"@babel/template@^7.7.4":
version "7.7.4"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.7.4.tgz#428a7d9eecffe27deac0a98e23bf8e3675d2a77b"
integrity sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw==
dependencies:
"@babel/code-frame" "^7.0.0"
"@babel/parser" "^7.7.4"
"@babel/types" "^7.7.4"

"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.5", "@babel/traverse@^7.2.2":
version "7.2.3"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.2.3.tgz#7ff50cefa9c7c0bd2d81231fdac122f3957748d8"
Expand Down Expand Up @@ -962,6 +1063,21 @@
globals "^11.1.0"
lodash "^4.17.13"

"@babel/traverse@^7.7.4":
version "7.7.4"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.7.4.tgz#9c1e7c60fb679fe4fcfaa42500833333c2058558"
integrity sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw==
dependencies:
"@babel/code-frame" "^7.5.5"
"@babel/generator" "^7.7.4"
"@babel/helper-function-name" "^7.7.4"
"@babel/helper-split-export-declaration" "^7.7.4"
"@babel/parser" "^7.7.4"
"@babel/types" "^7.7.4"
debug "^4.1.0"
globals "^11.1.0"
lodash "^4.17.13"

"@babel/types@^7.0.0", "@babel/types@^7.1.2", "@babel/types@^7.1.3":
version "7.1.3"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.1.3.tgz#3a767004567060c2f40fca49a304712c525ee37d"
Expand Down Expand Up @@ -998,6 +1114,15 @@
lodash "^4.17.13"
to-fast-properties "^2.0.0"

"@babel/types@^7.7.4":
version "7.7.4"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.7.4.tgz#516570d539e44ddf308c07569c258ff94fde9193"
integrity sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA==
dependencies:
esutils "^2.0.2"
lodash "^4.17.13"
to-fast-properties "^2.0.0"

"@elastic/charts@^13.0.0":
version "13.0.0"
resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-13.0.0.tgz#eefd1a003c18c558465fa5d1dce28c137d1f50b4"
Expand Down