Skip to content

Commit 2eaa6c1

Browse files
authored
feat(build): es2015 bundle artifact (#6291)
* es2015 bundle with dependencies via npm script build:es:bundle * es2015 bundle without dependencies via npm script build:es:bundle * jest dependency for test:artifact * migrate babel.config.json to babel.config.js and maintain env support for commonjs and es2015 * remove polyfill * fix es syntax: replace module.exports with export * fix es syntax: remove .jsx extension inside import
1 parent d9f5691 commit 2eaa6c1

22 files changed

+10973
-6709
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ env:
33
browser: true
44
node: true
55
es6: true
6+
jest: true
67
parserOptions:
78
ecmaFeatures:
89
jsx: true

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ selenium-debug.log
1111
chromedriver.log
1212
test/e2e/db.json
1313
docs/_book
14-
dist/log*
1514

15+
# dist
1616
flavors/**/dist/*
17+
/lib
18+
/es
19+
dist/log*
1720

1821
# Cypress
1922
test/e2e-cypress/screenshots

.mocharc.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
recursive: true
22
require: ['esm','@babel/register','source-map-support', 'test/mocha/setup.js']
3-
# spec: 'test/mocha/**/*.{js,jsx}'

babel.config.json renamed to babel.config.js

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,58 @@
1-
{
1+
module.exports = {
22
"env": {
3+
"commonjs": {
4+
"presets": [
5+
[
6+
"@babel/preset-env",
7+
{
8+
"debug": false,
9+
"modules": "commonjs",
10+
"targets": {
11+
"node": "8"
12+
},
13+
"forceAllTransforms": false,
14+
"ignoreBrowserslistConfig": true
15+
}
16+
],
17+
"@babel/preset-react",
18+
],
19+
"plugins": [
20+
[
21+
"@babel/plugin-transform-modules-commonjs",
22+
{
23+
"loose": true
24+
}
25+
],
26+
"@babel/proposal-class-properties",
27+
"@babel/proposal-object-rest-spread",
28+
"@babel/plugin-proposal-optional-chaining",
29+
]
30+
},
31+
"es": {
32+
"presets": [
33+
[
34+
"@babel/preset-env",
35+
{
36+
"debug": false,
37+
"modules": false
38+
}
39+
],
40+
"@babel/preset-react",
41+
],
42+
"plugins": [
43+
[
44+
"@babel/plugin-transform-runtime",
45+
{
46+
"absoluteRuntime": false,
47+
"corejs": 2,
48+
"version": "^7.10.4"
49+
}
50+
],
51+
"@babel/proposal-class-properties",
52+
"@babel/proposal-object-rest-spread",
53+
"@babel/plugin-proposal-optional-chaining",
54+
]
55+
},
356
"development": {
457
"presets": [
558
[

config/.eslintrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"rules": {
3+
"import/no-unresolved": 0,
4+
"import/extensions": 0,
5+
"quotes": ["error", "single"],
6+
"semi": ["error", "always"]
7+
}
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
rootDir: path.join(__dirname, '..', '..'),
5+
testEnvironment: 'jsdom',
6+
testMatch: ['**/test/build-artifacts/es-bundle-core.js'],
7+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
rootDir: path.join(__dirname, '..', '..'),
5+
testEnvironment: 'jsdom',
6+
testMatch: ['**/test/build-artifacts/es-bundle.js'],
7+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
rootDir: path.join(__dirname, '..', '..'),
5+
testEnvironment: 'jsdom',
6+
testMatch: ['**/test/build-artifacts/umd.js'],
7+
};

0 commit comments

Comments
 (0)