Skip to content

Commit 1d93182

Browse files
committed
build: expose build artifacts for various usecases
Refs #1542
1 parent 7db8f7a commit 1d93182

20 files changed

+5301
-1478
lines changed

.babelrc

+84-30
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,86 @@
11
{
2-
"presets": [
3-
[
4-
"@babel/preset-env",
5-
{
6-
"targets": {
7-
"browsers": [
8-
/* benefit of C/S/FF/Edge only? */
9-
"> 1%",
10-
"last 2 versions",
11-
"Firefox ESR",
12-
"not dead"
13-
],
14-
"node": "8"
15-
},
16-
"useBuiltIns": "entry",
17-
"corejs": "2"
18-
}
19-
]
20-
],
21-
"plugins": [
22-
[
23-
"@babel/plugin-transform-runtime",
24-
{
25-
"corejs": 2
26-
}
27-
],
28-
"@babel/plugin-proposal-object-rest-spread",
29-
"@babel/plugin-transform-async-to-generator",
30-
"@babel/plugin-transform-destructuring"
31-
]
2+
"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": true,
14+
"ignoreBrowserslistConfig": true
15+
}
16+
]
17+
],
18+
"plugins": [
19+
["@babel/plugin-transform-modules-commonjs", {
20+
"loose": true
21+
}],
22+
"@babel/proposal-class-properties",
23+
"@babel/proposal-object-rest-spread",
24+
"add-module-exports"
25+
]
26+
},
27+
"es": {
28+
"presets": [
29+
[
30+
"@babel/preset-env",
31+
{
32+
"debug": false,
33+
"modules": false,
34+
"forceAllTransforms": true,
35+
"ignoreBrowserslistConfig": true
36+
}
37+
]
38+
],
39+
"plugins": [
40+
"@babel/proposal-class-properties",
41+
"@babel/proposal-object-rest-spread",
42+
"lodash"
43+
]
44+
},
45+
"node": {
46+
"presets": [
47+
[
48+
"@babel/preset-env",
49+
{
50+
"debug": false,
51+
"targets": {
52+
"node": "8"
53+
},
54+
"useBuiltIns": "entry",
55+
"corejs": 3,
56+
"ignoreBrowserslistConfig": true
57+
}
58+
]
59+
],
60+
"plugins": [
61+
"@babel/proposal-class-properties",
62+
"@babel/proposal-object-rest-spread",
63+
"@babel/plugin-transform-runtime"
64+
]
65+
},
66+
"browser": {
67+
"presets": [
68+
[
69+
"@babel/preset-env",
70+
{
71+
"debug": false
72+
}
73+
]
74+
],
75+
"plugins": [
76+
[
77+
"@babel/plugin-transform-runtime",
78+
{ "corejs": 2 }
79+
],
80+
"@babel/proposal-class-properties",
81+
"@babel/proposal-object-rest-spread",
82+
"lodash"
83+
]
84+
}
85+
}
3286
}

.browserslistrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
> 1%
2+
last 2 versions
3+
Firefox ESR
4+
not dead

.github/workflows/nodejs.yml

-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ jobs:
3939
run: npm run security-audit
4040
- name: Build swagger-js
4141
run: npm run build
42-
- name: Check bundlesize
43-
run: npm run build:bundlesize
4442

4543
release:
4644
if: contains(github.ref, 'master')

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ env.properties
1515
local.yaml
1616
.deps.json
1717
/.karma
18+
/lib
19+
/es
1820
diagrams/
1921
notes/
2022
.DS_Store
2123
.deps_check
2224
test/specmap/data/private
2325
test/webpack-bundle/.tmp
24-
browser
25-
26+
/swagger-client-*.*.*.tgz
2627
jest-stare
2728

2829
# Automated releases

bundlesize.config.json

-9
This file was deleted.

config/jest/jest.bundle-browser.config.js renamed to config/jest/jest.artifact-commonjs.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ const path = require('path');
33
module.exports = {
44
rootDir: path.join(__dirname, '..', '..'),
55
testEnvironment: 'node',
6-
testMatch: ['**/test/webpack-bundle/browser.js'],
6+
testMatch: ['**/test/build-artifacts/commonjs.js'],
77
};

config/jest/jest.bundle-node.config.js renamed to config/jest/jest.artifact-es.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ const path = require('path');
33
module.exports = {
44
rootDir: path.join(__dirname, '..', '..'),
55
testEnvironment: 'node',
6-
testMatch: ['**/test/webpack-bundle/node.js'],
6+
testMatch: ['**/test/build-artifacts/es.js'],
77
};
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+
};

config/jest/jest.unit.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ module.exports = {
1010
'<rootDir>/test/data/',
1111
'<rootDir>/test/jest.setup.js',
1212
'<rootDir>/test/specmap/data/',
13-
'<rootDir>/test/webpack-bundle/',
13+
'<rootDir>/test/build-artifacts/',
1414
],
1515
};

config/webpack/_config-builder.js

-84
This file was deleted.

0 commit comments

Comments
 (0)