Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

perf: oas-form bloat reduction and bundle overhauls #1179

Merged
merged 20 commits into from
Feb 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ab4705f
chore: removing core-js from oas-form
erunion Feb 16, 2021
a635a7d
refactor: removing unused validation and error handling
erunion Feb 17, 2021
ce8bb71
refactor: removing support for `dependencies` from oas-form
erunion Feb 17, 2021
89ab1b2
refactor: removing support for error handling from our custom SchemaF…
erunion Feb 17, 2021
f8c3d57
chore: removing the deprecated `autocomplete` prop
erunion Feb 17, 2021
75891a8
refactor: removing the unused withTheme export
erunion Feb 17, 2021
a2d6c47
refactor: removing support for `ui:order` and ordering object props
erunion Feb 17, 2021
c50b5d2
refactor: removing unused validation exports
erunion Feb 17, 2021
662ebbc
refactor: removing support for the omitExtraData and liveOmit props
erunion Feb 17, 2021
95ca4ba
refactor: removing support for additionalMetaSchemas for AJV
erunion Feb 17, 2021
d246292
refactor: removing lodash
erunion Feb 17, 2021
fefedd9
Merge branch 'next' into refactor/oas-form-validation
erunion Feb 17, 2021
75f9787
refactor: removing ajv
erunion Feb 17, 2021
719c43d
refactor: removing some unused errorSchema props
erunion Feb 17, 2021
cfa5cff
test: removing broken tests
erunion Feb 18, 2021
0149a22
perf: exclude `react-instantsearch-dom` from explorer bundles
erunion Feb 18, 2021
606a6f8
test: updating test snapshots
erunion Feb 18, 2021
0902174
style: cleaning up the explorer webpack config a bit
erunion Feb 18, 2021
1ac0d61
Merge branch 'next' into refactor/oas-form-validation
erunion Feb 18, 2021
feb94fa
Merge branch 'next' into refactor/oas-form-validation
erunion Feb 19, 2021
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
416 changes: 27 additions & 389 deletions package-lock.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

36 changes: 0 additions & 36 deletions packages/api-explorer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions packages/api-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"directory": "packages/api-explorer"
},
"scripts": {
"build": "webpack --config webpack.prod.js",
"build": "webpack --config webpack.config.js",
"lint": "eslint . --ext js --ext jsx",
"pretest": "npm run lint && npm run prettier",
"prettier": "prettier --list-different --write \"./**/**.{js,jsx}\"",
Expand Down Expand Up @@ -61,8 +61,7 @@
"react-dom": "^16.14.0",
"terser-webpack-plugin": "^4.1.0",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9",
"webpack-merge": "^5.1.3"
"webpack-cli": "^3.3.9"
},
"prettier": "@readme/eslint-config/prettier"
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ class MultiSchemaField extends Component {
const {
baseType,
disabled,
errorSchema,
formData,
idPrefix,
idSchema,
Expand Down Expand Up @@ -274,7 +273,6 @@ class MultiSchemaField extends Component {
<div className="form-group">
<SchemaField
disabled={disabled}
errorSchema={errorSchema}
formData={selectedValue}
idPrefix={idPrefix}
idSchema={idSchema}
Expand All @@ -292,7 +290,6 @@ class MultiSchemaField extends Component {
{option !== null && (
<SchemaField
disabled={disabled}
errorSchema={errorSchema}
formData={formData}
idPrefix={idPrefix}
idSchema={idSchema}
Expand Down
8 changes: 2 additions & 6 deletions packages/api-explorer/src/form-components/SchemaField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,18 @@ function getTypeLabel(schema) {
}

function CustomTemplateShell(props) {
const { classNames, help, errors, children } = props;
const { classNames, help, children } = props;

return (
<div className={`${classNames} param`}>
{children}
{errors && <div className="errors">{errors}</div>}
{help && <div className="help">{help}</div>}
</div>
);
}

function CustomTemplate(props) {
const { id, classNames, label, help, required, description, errors, children, schema, onKeyChange } = props;
const { id, classNames, label, help, required, description, children, schema, onKeyChange } = props;

const EditLabel = (
<input defaultValue={label} id={`${id}-key`} onBlur={event => onKeyChange(event.target.value)} type="text" />
Expand All @@ -92,7 +91,6 @@ function CustomTemplate(props) {
{description && <div className="description">{description}</div>}
</span>
{children && <div className="children">{children}</div>}
{errors && <div className="errors">{errors}</div>}
{help && <div className="help">{help}</div>}
</div>
);
Expand Down Expand Up @@ -172,7 +170,6 @@ CustomTemplate.propTypes = {
children: PropTypes.node.isRequired,
classNames: PropTypes.string.isRequired,
description: PropTypes.node.isRequired,
errors: PropTypes.node.isRequired,
help: PropTypes.node.isRequired,
id: PropTypes.node.isRequired,
label: PropTypes.string,
Expand All @@ -188,7 +185,6 @@ CustomTemplate.defaultProps = {
CustomTemplateShell.propTypes = {
children: PropTypes.node.isRequired,
classNames: PropTypes.string.isRequired,
errors: PropTypes.node.isRequired,
help: PropTypes.node.isRequired,
};

Expand Down
50 changes: 34 additions & 16 deletions packages/api-explorer/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');

module.exports = {
entry: ['whatwg-fetch', './src/index.jsx'],
externals: {
'@readme/markdown': '@readme/markdown',
'@readme/variable': '@readme/variable',
react: {
root: 'React',
commonjs: 'react',
commonjs2: 'react',
amd: 'react',
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom',
umd: 'react-dom',
externals: [
'@readme/markdown',
'@readme/variable',
{
react: {
root: 'React',
commonjs: 'react',
commonjs2: 'react',
amd: 'react',
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom',
umd: 'react-dom',
},
},
},

// `@readme/ui` loads this in for the search components but unfortunately we aren't able to exclude this from being
// compiled into our dist, despite not using that component. If we treat it as a Webpack external it will thankfully
// be ignored.
'react-instantsearch-dom',
],
module: {
rules: [
{
Expand All @@ -45,11 +54,20 @@ module.exports = {
},
],
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
libraryTarget: 'commonjs2',
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
],
resolve: {
extensions: ['.js', '.json', '.jsx'],
},
Expand Down
18 changes: 0 additions & 18 deletions packages/api-explorer/webpack.prod.js

This file was deleted.

23 changes: 0 additions & 23 deletions packages/oas-form/.babelrc

This file was deleted.

Loading