Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Commit

Permalink
feat: build the library with both es5 and es6 as a target
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardo-forina authored and wtrocki committed Jul 21, 2021
1 parent 27b02f3 commit 1dcdad5
Show file tree
Hide file tree
Showing 52 changed files with 89 additions and 64 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,6 @@ dist

# Custom
reproductions
.idea/
.idea/

/dist
2 changes: 1 addition & 1 deletion __tests__/AutoField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
RadioField,
SelectField,
TextField,
} from 'uniforms-patternfly';
} from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/AutoFields.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { AutoFields } from 'uniforms-patternfly';
import { AutoFields } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/AutoForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { AutoForm } from 'uniforms-patternfly';
import { AutoForm } from '../src';

import createSchema from './_createSchema';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/BaseForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { BaseForm } from 'uniforms-patternfly';
import { BaseForm } from '../src';

import createSchema from './_createSchema';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/BoolField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { BoolField } from 'uniforms-patternfly';
import { BoolField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/DateField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
import { DateField } from 'uniforms-patternfly';
import { DateField } from '../src';
import createContext from './_createContext';
import mount from './_mount';

Expand Down
2 changes: 1 addition & 1 deletion __tests__/ErrorField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { ErrorField } from 'uniforms-patternfly';
import { ErrorField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/ErrorsField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { ErrorsField } from 'uniforms-patternfly';
import { ErrorsField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/HiddenField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { HiddenField } from 'uniforms-patternfly';
import { HiddenField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/ListAddField.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import merge from 'lodash/merge';
import { Button } from '@patternfly/react-core';
import { ListAddField } from 'uniforms-patternfly';
import { ListAddField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/ListDelField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { merge } from 'lodash';
import { ListDelField } from 'uniforms-patternfly';
import { ListDelField } from '../src';
import { Button } from '@patternfly/react-core';

import createContext from './_createContext';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/ListField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { ListField } from 'uniforms-patternfly';
import { ListField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/ListItemField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { AutoField, ListItemField } from 'uniforms-patternfly';
import { AutoField, ListItemField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/LongTextField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { LongTextField } from 'uniforms-patternfly';
import { LongTextField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/NestField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Card } from '@patternfly/react-core';
import { AutoField, NestField } from 'uniforms-patternfly';
import { AutoField, NestField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/NumField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { NumField } from 'uniforms-patternfly';
import { NumField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/QuickForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { QuickForm } from 'uniforms-patternfly';
import { QuickForm } from '../src';

import createSchema from './_createSchema';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/RadioField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { RadioField } from 'uniforms-patternfly';
import { RadioField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/SelectField.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Select, Radio } from '@patternfly/react-core';
import { act } from '@testing-library/react';
import { SelectField } from 'uniforms-patternfly';
import { SelectField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/SubmitField.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Button } from '@patternfly/react-core';

import { SubmitField } from 'uniforms-patternfly';
import { SubmitField } from '../src';
import createContext from './_createContext';
import mount from './_mount';

Expand Down
2 changes: 1 addition & 1 deletion __tests__/TextField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { TextField } from 'uniforms-patternfly';
import { TextField } from '../src';

import createContext from './_createContext';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/ValidatedForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { ValidatedForm } from 'uniforms-patternfly';
import { ValidatedForm } from '../src';

import createSchema from './_createSchema';
import mount from './_mount';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as unstyled from 'uniforms-patternfly';
import * as unstyled from '../src';

it('exports everything', () => {
expect(unstyled).toEqual({
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
"repository": "[email protected]:aerogear/uniforms-patternfly.git",
"author": "Gianluca <[email protected]>",
"license": "Apache-2.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "dist/es5/index.js",
"module": "dist/es6/index.js",
"scripts": {
"build": "tsc --build --incremental",
"buildProd": "tsc --build",
"build": "tsc --build --incremental tsconfig.build.json",
"buildProd": "tsc --build tsconfig.build.json",
"watch": "tsc --watch --incremental",
"clean": "rimraf dist coverage tsconfig.tsbuildinfo",
"clean": "tsc --build --clean tsconfig.build.json && rimraf dist coverage",
"coverage": "jest --runInBand --coverage",
"lint": "eslint --ext js,ts,tsx src",
"reset": "rimraf tsconfig.tsbuildinfo dist node_modules",
"reset": "rimraf dist node_modules",
"release:validate": "./scripts/validateRelease.sh TAG=1.2.3",
"release:publish": "./scripts/publishRelease.sh",
"test": "jest --runInBand"
Expand Down
2 changes: 1 addition & 1 deletion src/AutoField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import invariant from 'invariant';
import { createAutoField } from 'uniforms/es5';
import { createAutoField } from 'uniforms';

import BoolField from './BoolField';
import DateField from './DateField';
Expand Down
2 changes: 1 addition & 1 deletion src/AutoFields.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComponentType, createElement } from 'react';
import { useForm } from 'uniforms/es5';
import { useForm } from 'uniforms';

import AutoField from './AutoField';

Expand Down
2 changes: 1 addition & 1 deletion src/AutoForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AutoForm } from 'uniforms/es5';
import { AutoForm } from 'uniforms';

import ValidatedQuickForm from './ValidatedQuickForm';

Expand Down
2 changes: 1 addition & 1 deletion src/BaseForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Form } from '@patternfly/react-core';
import { BaseForm, context } from 'uniforms/es5';
import { BaseForm, context } from 'uniforms';

function Patternfly(parent: any): any {
class _ extends parent {
Expand Down
2 changes: 1 addition & 1 deletion src/BoolField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Switch,
SwitchProps,
} from '@patternfly/react-core';
import { connectField, FieldProps } from 'uniforms/es5';
import { connectField, FieldProps } from 'uniforms';

import wrapField from './wrapField';

Expand Down
2 changes: 1 addition & 1 deletion src/DateField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useCallback, useMemo } from 'react';
import { connectField, FieldProps } from 'uniforms/es5';
import { connectField, FieldProps } from 'uniforms';
import {
DatePicker,
Flex,
Expand Down
2 changes: 1 addition & 1 deletion src/ErrorField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { HTMLProps } from 'react';
import { connectField, filterDOMProps } from 'uniforms/es5';
import { connectField, filterDOMProps } from 'uniforms';

export type ErrorFieldProps = {
error?: any;
Expand Down
2 changes: 1 addition & 1 deletion src/ErrorsField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { HTMLProps } from 'react';
import { useForm, filterDOMProps } from 'uniforms/es5';
import { useForm, filterDOMProps } from 'uniforms';

export type ErrorsFieldProps = HTMLProps<HTMLDivElement>;

Expand Down
2 changes: 1 addition & 1 deletion src/HiddenField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { HTMLProps, Ref, useEffect } from 'react';
import { useField, filterDOMProps } from 'uniforms/es5';
import { useField, filterDOMProps } from 'uniforms';

export type HiddenFieldProps = {
inputRef?: Ref<HTMLInputElement>;
Expand Down
2 changes: 1 addition & 1 deletion src/ListAddField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
filterDOMProps,
joinName,
useField,
} from 'uniforms/es5';
} from 'uniforms';

export type ListAddFieldProps = FieldProps<
unknown,
Expand Down
2 changes: 1 addition & 1 deletion src/ListDelField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
filterDOMProps,
joinName,
useField,
} from 'uniforms/es5';
} from 'uniforms';

export type ListDelFieldProps = FieldProps<
unknown,
Expand Down
2 changes: 1 addition & 1 deletion src/ListField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, {
} from 'react';
import { Split, SplitItem, Tooltip } from '@patternfly/react-core';
import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons';
import { connectField, filterDOMProps, HTMLFieldProps } from 'uniforms/es5';
import { connectField, filterDOMProps, HTMLFieldProps } from 'uniforms';

import ListItemField from './ListItemField';
import ListAddField from './ListAddField';
Expand Down
2 changes: 1 addition & 1 deletion src/ListItemField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { ReactNode } from 'react';
import { connectField } from 'uniforms/es5';
import { connectField } from 'uniforms';

import AutoField from './AutoField';
import ListDelField from './ListDelField';
Expand Down
2 changes: 1 addition & 1 deletion src/LongTextField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { TextArea } from '@patternfly/react-core';
import { connectField, filterDOMProps, HTMLFieldProps } from 'uniforms/es5';
import { connectField, filterDOMProps, HTMLFieldProps } from 'uniforms';

export type LongTextFieldProps = HTMLFieldProps<
string,
Expand Down
2 changes: 1 addition & 1 deletion src/NestField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { connectField, filterDOMProps, HTMLFieldProps } from 'uniforms/es5';
import { connectField, filterDOMProps, HTMLFieldProps } from 'uniforms';
import { Card, CardBody } from '@patternfly/react-core';

import AutoField from './AutoField';
Expand Down
2 changes: 1 addition & 1 deletion src/NumField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Ref } from 'react';
import { TextInput, TextInputProps } from '@patternfly/react-core';
import { connectField } from 'uniforms/es5';
import { connectField } from 'uniforms';

import wrapField from './wrapField';

Expand Down
2 changes: 1 addition & 1 deletion src/QuickForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QuickForm } from 'uniforms/es5';
import { QuickForm } from 'uniforms';

import AutoField from './AutoField';
import BaseForm from './BaseForm';
Expand Down
2 changes: 1 addition & 1 deletion src/RadioField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Radio as RadioField, RadioProps } from '@patternfly/react-core';
import { connectField, filterDOMProps, HTMLFieldProps } from 'uniforms/es5';
import { connectField, filterDOMProps, HTMLFieldProps } from 'uniforms';

import wrapField from './wrapField';

Expand Down
2 changes: 1 addition & 1 deletion src/SelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
SelectVariant,
SelectOptionObject,
} from '@patternfly/react-core';
import { connectField, FieldProps, filterDOMProps } from 'uniforms/es5';
import { connectField, FieldProps, filterDOMProps } from 'uniforms';

import wrapField from './wrapField';

Expand Down
2 changes: 1 addition & 1 deletion src/SubmitField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Button } from '@patternfly/react-core';
import { filterDOMProps, HTMLFieldProps, useForm } from 'uniforms/es5';
import { filterDOMProps, HTMLFieldProps, useForm } from 'uniforms';

export type SubmitFieldProps = HTMLFieldProps<
number | string | undefined,
Expand Down
2 changes: 1 addition & 1 deletion src/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
TextInputProps,
TimePicker,
} from '@patternfly/react-core';
import { connectField, filterDOMProps } from 'uniforms/es5';
import { connectField, filterDOMProps } from 'uniforms';

import wrapField from './wrapField';

Expand Down
2 changes: 1 addition & 1 deletion src/ValidatedForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ValidatedForm } from 'uniforms/es5';
import { ValidatedForm } from 'uniforms';

import BaseForm from './BaseForm';

Expand Down
2 changes: 1 addition & 1 deletion src/wrapField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { FormGroup, FormGroupProps } from '@patternfly/react-core';
import { filterDOMProps } from 'uniforms/es5';
import { filterDOMProps } from 'uniforms';

declare module 'uniforms' {
interface FilterDOMProps {
Expand Down
7 changes: 7 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "tsconfig.es5.json" },
{ "path": "tsconfig.es6.json" },
]
}
9 changes: 9 additions & 0 deletions tsconfig.es5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"baseUrl": "src",
"outDir": "dist/es5",
"rootDir": "src",
"target": "es5",
}
}
Loading

0 comments on commit 1dcdad5

Please sign in to comment.