@agility/plenum-ui 2.0.0-rc14 → 2.0.0-rc15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +20 -15
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/types/stories/index.d.ts +2 -2
- package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +14 -9
- package/dist/types/stories/organisms/DropdownComponent/index.d.ts +2 -2
- package/dist/types/stories/organisms/index.d.ts +2 -2
- package/package.json +2 -12
- package/stories/index.ts +0 -2
- package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +13 -16
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +16 -14
- package/stories/organisms/DropdownComponent/index.ts +2 -2
- package/stories/organisms/index.ts +1 -2
- package/.yarnrc.yml +0 -1
- package/scripts/build.sh +0 -53
- package/scripts/resolve-files.js +0 -32
- package/scripts/rewrite-imports.js +0 -24
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAvatarProps, IBadgeProps, IButtonProps, ICapsuleProps, IDynamicIconProps, IIconWithShadowProps, ILoaderProps, IRadialProgressProps, UnifiedIconName, IconName, FAIconName, BTNActionType, Avatar, Badge, Button, Capsule, DynamicIcon, IconWithShadow, Loader, RadialProgress, isFAIcon, isHeroIcon, isTablerIcon, isUnifiedIconName } from "./atoms";
|
|
2
2
|
import { ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, ITextareaProps, IToggleSwitchProps, AcceptedInputTypes, Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, Textarea, ToggleSwitch, TextInput, ITextInputProps, ISimpleSelectOptions } from "./molecules";
|
|
3
|
-
import { IAnimatedLabelInputProps, AnimatedLabelTextArea, IAnimatedLabelTextAreaProps, IButtonDropdownProps,
|
|
4
|
-
export type { IAvatarProps, IBadgeProps, IButtonProps, ICapsuleProps, ITextInputSelectProps, IDynamicIconProps, IIconWithShadowProps, ILoaderProps, IRadialProgressProps, ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, ITextareaProps, IToggleSwitchProps, AcceptedInputTypes, IAnimatedLabelInputProps, IAnimatedLabelTextAreaProps, IButtonDropdownProps,
|
|
3
|
+
import { IAnimatedLabelInputProps, AnimatedLabelTextArea, IAnimatedLabelTextAreaProps, IButtonDropdownProps, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, AnimatedLabelInput, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, TextInputSelect, ITextInputSelectProps } from "./organisms";
|
|
4
|
+
export type { IAvatarProps, IBadgeProps, IButtonProps, ICapsuleProps, ITextInputSelectProps, IDynamicIconProps, IIconWithShadowProps, ILoaderProps, IRadialProgressProps, ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, ITextareaProps, IToggleSwitchProps, AcceptedInputTypes, IAnimatedLabelInputProps, IAnimatedLabelTextAreaProps, IButtonDropdownProps, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, UnifiedIconName, IconName, FAIconName, BTNActionType, ITextInputProps, ISimpleSelectOptions };
|
|
5
5
|
export { Avatar, Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, Textarea, ToggleSwitch, AnimatedLabelInput, AnimatedLabelTextArea, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, Badge, Button, Capsule, DynamicIcon, IconWithShadow, Loader, RadialProgress, isFAIcon, isHeroIcon, isTablerIcon, isUnifiedIconName, TextInput, TextInputSelect };
|
|
@@ -10,19 +10,17 @@ export interface IItemProp extends HTMLAttributes<HTMLButtonElement> {
|
|
|
10
10
|
isEmphasized?: boolean;
|
|
11
11
|
key: React.Key;
|
|
12
12
|
}
|
|
13
|
-
export interface IDropdownClassnames {
|
|
14
|
-
groupClassname?: ClassNameWithAutocomplete;
|
|
15
|
-
itemsClassname?: ClassNameWithAutocomplete;
|
|
16
|
-
itemClassname?: ClassNameWithAutocomplete;
|
|
17
|
-
activeItemClassname?: ClassNameWithAutocomplete;
|
|
18
|
-
buttonClassname?: ClassNameWithAutocomplete;
|
|
19
|
-
}
|
|
20
13
|
export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
21
14
|
items: IItemProp[][];
|
|
22
15
|
label: string;
|
|
23
16
|
CustomDropdownTrigger?: React.ReactNode;
|
|
24
17
|
id: string;
|
|
25
|
-
|
|
18
|
+
groupClassname?: ClassNameWithAutocomplete;
|
|
19
|
+
itemsClassname?: ClassNameWithAutocomplete;
|
|
20
|
+
itemClassname?: ClassNameWithAutocomplete;
|
|
21
|
+
activeItemClassname?: ClassNameWithAutocomplete;
|
|
22
|
+
buttonClassname?: ClassNameWithAutocomplete;
|
|
23
|
+
iconClassname?: ClassNameWithAutocomplete;
|
|
26
24
|
placement?: Placement;
|
|
27
25
|
offsetOptions?: Partial<{
|
|
28
26
|
mainAxis: number;
|
|
@@ -30,7 +28,14 @@ export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
30
28
|
alignmentAxis: number | null;
|
|
31
29
|
}>;
|
|
32
30
|
}
|
|
33
|
-
export declare const defaultClassNames:
|
|
31
|
+
export declare const defaultClassNames: {
|
|
32
|
+
groupClassname: string;
|
|
33
|
+
itemsClassname: string;
|
|
34
|
+
itemClassname: string;
|
|
35
|
+
activeItemClassname: string;
|
|
36
|
+
buttonClassname: string;
|
|
37
|
+
iconClassname: string;
|
|
38
|
+
};
|
|
34
39
|
/** Comment */
|
|
35
40
|
declare const Dropdown: React.FC<IDropdownProps>;
|
|
36
41
|
export default Dropdown;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Dropdown, { IItemProp,
|
|
2
|
-
export type { IItemProp,
|
|
1
|
+
import Dropdown, { IItemProp, IDropdownProps, defaultClassNames } from "./DropdownComponent";
|
|
2
|
+
export type { IItemProp, IDropdownProps };
|
|
3
3
|
export { defaultClassNames };
|
|
4
4
|
export default Dropdown;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import AnimatedLabelInput, { IAnimatedLabelInputProps } from "./AnimatedLabelInput";
|
|
2
2
|
import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea";
|
|
3
3
|
import ButtonDropdown, { IButtonDropdownProps } from "./ButtonDropdown";
|
|
4
|
-
import Dropdown, {
|
|
4
|
+
import Dropdown, { IDropdownProps, IItemProp } from "./DropdownComponent";
|
|
5
5
|
import EmptySectionPlaceholder, { IEmptySectionPlaceholderProps } from "./EmptySectionPlaceholder";
|
|
6
6
|
import FormInputWithAddons, { IFormInputWithAddonsProps } from "./FormInputWithAddons";
|
|
7
7
|
import TextInputSelect, { ITextInputSelectProps } from "./TextInputSelect";
|
|
8
|
-
export type { IAnimatedLabelInputProps, IAnimatedLabelTextAreaProps, IButtonDropdownProps,
|
|
8
|
+
export type { IAnimatedLabelInputProps, IAnimatedLabelTextAreaProps, IButtonDropdownProps, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, ITextInputSelectProps };
|
|
9
9
|
export { AnimatedLabelInput, AnimatedLabelTextArea, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, TextInputSelect };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agility/plenum-ui",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -19,12 +19,10 @@
|
|
|
19
19
|
"dev": "yarn storybook",
|
|
20
20
|
"build:tw": "tailwindcss -o ./dist/tailwind.css",
|
|
21
21
|
"build:tsc": "yarn node build.js",
|
|
22
|
-
"Xbuild:rollup": "rollup -c",
|
|
23
22
|
"prepare": "yarn build",
|
|
24
23
|
"build": "yarn clean && npm-run-all -s \"build:*\" ",
|
|
25
24
|
"clean": "rimraf dist",
|
|
26
|
-
"create-component": "node scripts/create-component.js"
|
|
27
|
-
"buildsh": "./scripts/build.sh --external:react --external:react-dom"
|
|
25
|
+
"create-component": "node scripts/create-component.js"
|
|
28
26
|
},
|
|
29
27
|
"devDependencies": {
|
|
30
28
|
"@floating-ui/react": "^0.25.0",
|
|
@@ -32,9 +30,6 @@
|
|
|
32
30
|
"@headlessui/tailwindcss": "^0.1.2",
|
|
33
31
|
"@heroicons/react": "^1.0.5",
|
|
34
32
|
"@next/font": "^13.4.12",
|
|
35
|
-
"@rollup/plugin-commonjs": "^21.0.1",
|
|
36
|
-
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
37
|
-
"@rollup/plugin-typescript": "^11.1.2",
|
|
38
33
|
"@storybook/addon-designs": "^7.0.1",
|
|
39
34
|
"@storybook/addon-essentials": "^7.1.1",
|
|
40
35
|
"@storybook/addon-interactions": "^7.1.1",
|
|
@@ -67,11 +62,6 @@
|
|
|
67
62
|
"react-dom": "18.2.0",
|
|
68
63
|
"react-icons": "^4.10.1",
|
|
69
64
|
"rimraf": "^5.0.1",
|
|
70
|
-
"rollup": "3.28.0",
|
|
71
|
-
"rollup-plugin-dts": "^5.3.1",
|
|
72
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
73
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
74
|
-
"rollup-plugin-typescript2": "^0.35.0",
|
|
75
65
|
"storybook": "^7.1.1",
|
|
76
66
|
"tailwindcss": "^3.2.4",
|
|
77
67
|
"typescript": "^5.1.6"
|
package/stories/index.ts
CHANGED
|
@@ -56,7 +56,6 @@ import {
|
|
|
56
56
|
AnimatedLabelTextArea,
|
|
57
57
|
IAnimatedLabelTextAreaProps,
|
|
58
58
|
IButtonDropdownProps,
|
|
59
|
-
IDropdownClassnames,
|
|
60
59
|
IDropdownProps,
|
|
61
60
|
IEmptySectionPlaceholderProps,
|
|
62
61
|
IItemProp,
|
|
@@ -93,7 +92,6 @@ export type {
|
|
|
93
92
|
IAnimatedLabelInputProps,
|
|
94
93
|
IAnimatedLabelTextAreaProps,
|
|
95
94
|
IButtonDropdownProps,
|
|
96
|
-
IDropdownClassnames,
|
|
97
95
|
IDropdownProps,
|
|
98
96
|
IEmptySectionPlaceholderProps,
|
|
99
97
|
IItemProp,
|
|
@@ -16,21 +16,7 @@ export interface IButtonDropdownProps {
|
|
|
16
16
|
* Primary UI component for user interaction
|
|
17
17
|
*/
|
|
18
18
|
const ButtonDropdown: FC<IButtonDropdownProps> = ({ button, dropDown, placement, offsetOptions }) => {
|
|
19
|
-
|
|
20
|
-
...defaultClassNames,
|
|
21
|
-
groupClassname: cn(
|
|
22
|
-
"flex items-center justify-center rounded-l-none border !border-l-0 rounded-r px-2 transition-all hover:!border-l-0",
|
|
23
|
-
button.actionType === "primary"
|
|
24
|
-
? "border-purple-600 bg-purple-600 !text-white hover:border-purple-700 hover:bg-purple-700 active:!border-purple-800 active:!bg-purple-800 fill-white"
|
|
25
|
-
: "",
|
|
26
|
-
button.actionType === "secondary"
|
|
27
|
-
? "border-purple-50 bg-purple-50 !text-purple-700 hover:border-purple-100 hover:bg-purple-100 active:!border-purple-300 active:!bg-purple-300 fill-purple-700"
|
|
28
|
-
: "",
|
|
29
|
-
button.actionType === "alternative"
|
|
30
|
-
? "border-gray-300 bg-white !text-gray-700 fill-gray-700 hover:border-gray-300 hover:bg-gray-50 active:bg-gray-100"
|
|
31
|
-
: ""
|
|
32
|
-
)
|
|
33
|
-
}
|
|
19
|
+
|
|
34
20
|
return (
|
|
35
21
|
<div className="flex items-stretch focus-within:ring-purple-600 focus-within:ring-2 focus-within:ring-offset-white focus-within:ring-offset-2 rounded-[3px]">
|
|
36
22
|
<Button
|
|
@@ -65,7 +51,18 @@ const ButtonDropdown: FC<IButtonDropdownProps> = ({ button, dropDown, placement,
|
|
|
65
51
|
}}
|
|
66
52
|
/>
|
|
67
53
|
),
|
|
68
|
-
|
|
54
|
+
groupClassname: cn(
|
|
55
|
+
"flex items-center justify-center rounded-l-none border !border-l-0 rounded-r px-2 transition-all hover:!border-l-0",
|
|
56
|
+
button.actionType === "primary"
|
|
57
|
+
? "border-purple-600 bg-purple-600 !text-white hover:border-purple-700 hover:bg-purple-700 active:!border-purple-800 active:!bg-purple-800 fill-white"
|
|
58
|
+
: "",
|
|
59
|
+
button.actionType === "secondary"
|
|
60
|
+
? "border-purple-50 bg-purple-50 !text-purple-700 hover:border-purple-100 hover:bg-purple-100 active:!border-purple-300 active:!bg-purple-300 fill-purple-700"
|
|
61
|
+
: "",
|
|
62
|
+
button.actionType === "alternative"
|
|
63
|
+
? "border-gray-300 bg-white !text-gray-700 fill-gray-700 hover:border-gray-300 hover:bg-gray-50 active:bg-gray-100"
|
|
64
|
+
: ""
|
|
65
|
+
),
|
|
69
66
|
offsetOptions: offsetOptions ?? {
|
|
70
67
|
crossAxis: 0,
|
|
71
68
|
mainAxis: 5, //up/down
|
|
@@ -28,19 +28,17 @@ export interface IItemProp extends HTMLAttributes<HTMLButtonElement> {
|
|
|
28
28
|
isEmphasized?: boolean
|
|
29
29
|
key: React.Key
|
|
30
30
|
}
|
|
31
|
-
export interface IDropdownClassnames {
|
|
32
|
-
groupClassname?: ClassNameWithAutocomplete
|
|
33
|
-
itemsClassname?: ClassNameWithAutocomplete
|
|
34
|
-
itemClassname?: ClassNameWithAutocomplete
|
|
35
|
-
activeItemClassname?: ClassNameWithAutocomplete
|
|
36
|
-
buttonClassname?: ClassNameWithAutocomplete
|
|
37
|
-
}
|
|
38
31
|
export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
39
32
|
items: IItemProp[][]
|
|
40
33
|
label: string
|
|
41
34
|
CustomDropdownTrigger?: React.ReactNode
|
|
42
35
|
id: string
|
|
43
|
-
|
|
36
|
+
groupClassname?: ClassNameWithAutocomplete
|
|
37
|
+
itemsClassname?: ClassNameWithAutocomplete
|
|
38
|
+
itemClassname?: ClassNameWithAutocomplete
|
|
39
|
+
activeItemClassname?: ClassNameWithAutocomplete
|
|
40
|
+
buttonClassname?: ClassNameWithAutocomplete
|
|
41
|
+
iconClassname?: ClassNameWithAutocomplete
|
|
44
42
|
placement?: Placement
|
|
45
43
|
offsetOptions?: Partial<{
|
|
46
44
|
mainAxis: number
|
|
@@ -48,7 +46,7 @@ export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
48
46
|
alignmentAxis: number | null
|
|
49
47
|
}>
|
|
50
48
|
}
|
|
51
|
-
export const defaultClassNames
|
|
49
|
+
export const defaultClassNames = {
|
|
52
50
|
groupClassname: "flex inline-block text-left",
|
|
53
51
|
itemsClassname:
|
|
54
52
|
"mt-2 origin-bottom-right rounded bg-white shadow-lg z-20 divide-y divide-gray-100 border border-gray-300 ",
|
|
@@ -56,7 +54,8 @@ export const defaultClassNames: IDropdownClassnames = {
|
|
|
56
54
|
"group flex font-muli cursor-pointer items-center px-4 py-2 text-sm transition-all hover:bg-gray-100 hover:text-gray-900 justify-between gap-4 ",
|
|
57
55
|
activeItemClassname: "block px-4 py-2 text-sm text-gray-700 bg-gray-100 hover:bg-gray-200 hover:text-gray-900",
|
|
58
56
|
buttonClassname:
|
|
59
|
-
"py-[2px] z-20 flex items-center rounded outline-purple-500 transition-all text-gray-400 hover:text-gray-600 "
|
|
57
|
+
"py-[2px] z-20 flex items-center rounded outline-purple-500 transition-all text-gray-400 hover:text-gray-600 ",
|
|
58
|
+
iconClassname: "ml-1 h-5 w-6"
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
/** Comment */
|
|
@@ -64,7 +63,12 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
64
63
|
items,
|
|
65
64
|
id,
|
|
66
65
|
label,
|
|
67
|
-
|
|
66
|
+
groupClassname = defaultClassNames.groupClassname,
|
|
67
|
+
itemsClassname = defaultClassNames.itemsClassname,
|
|
68
|
+
itemClassname = defaultClassNames.itemClassname,
|
|
69
|
+
activeItemClassname = defaultClassNames.activeItemClassname,
|
|
70
|
+
buttonClassname = defaultClassNames.buttonClassname,
|
|
71
|
+
iconClassname = defaultClassNames.iconClassname,
|
|
68
72
|
CustomDropdownTrigger,
|
|
69
73
|
placement = "bottom-start",
|
|
70
74
|
offsetOptions,
|
|
@@ -104,8 +108,6 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
104
108
|
}
|
|
105
109
|
})
|
|
106
110
|
|
|
107
|
-
const { groupClassname, buttonClassname, itemsClassname, itemClassname, activeItemClassname } = classNames
|
|
108
|
-
|
|
109
111
|
return (
|
|
110
112
|
<div
|
|
111
113
|
{...{
|
|
@@ -132,7 +134,7 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
132
134
|
) : (
|
|
133
135
|
<>
|
|
134
136
|
<span className="pl-1">{label}</span>
|
|
135
|
-
<DynamicIcon icon="ChevronDownIcon" className=
|
|
137
|
+
<DynamicIcon icon="ChevronDownIcon" className={iconClassname} />
|
|
136
138
|
</>
|
|
137
139
|
)}
|
|
138
140
|
</button>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Dropdown, { IItemProp,
|
|
2
|
-
export type { IItemProp,
|
|
1
|
+
import Dropdown, { IItemProp, IDropdownProps, defaultClassNames } from "./DropdownComponent"
|
|
2
|
+
export type { IItemProp, IDropdownProps }
|
|
3
3
|
export { defaultClassNames }
|
|
4
4
|
export default Dropdown
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AnimatedLabelInput, { IAnimatedLabelInputProps } from "./AnimatedLabelInput"
|
|
2
2
|
import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea"
|
|
3
3
|
import ButtonDropdown, { IButtonDropdownProps } from "./ButtonDropdown"
|
|
4
|
-
import Dropdown, {
|
|
4
|
+
import Dropdown, { IDropdownProps, IItemProp } from "./DropdownComponent"
|
|
5
5
|
import EmptySectionPlaceholder, { IEmptySectionPlaceholderProps } from "./EmptySectionPlaceholder"
|
|
6
6
|
import FormInputWithAddons, { IFormInputWithAddonsProps } from "./FormInputWithAddons"
|
|
7
7
|
import TextInputSelect, { ITextInputSelectProps } from "./TextInputSelect"
|
|
@@ -10,7 +10,6 @@ export type {
|
|
|
10
10
|
IAnimatedLabelInputProps,
|
|
11
11
|
IAnimatedLabelTextAreaProps,
|
|
12
12
|
IButtonDropdownProps,
|
|
13
|
-
IDropdownClassnames,
|
|
14
13
|
IDropdownProps,
|
|
15
14
|
IEmptySectionPlaceholderProps,
|
|
16
15
|
IItemProp,
|
package/.yarnrc.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
nodeLinker: node-modules
|
package/scripts/build.sh
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -e
|
|
3
|
-
|
|
4
|
-
SCRIPT_DIR=$(cd ${0%/*} && pwd -P)
|
|
5
|
-
|
|
6
|
-
# Known variables
|
|
7
|
-
SRC='./stories'
|
|
8
|
-
DST='./dist'
|
|
9
|
-
name="plenum-ui"
|
|
10
|
-
input="./${SRC}/index.ts"
|
|
11
|
-
|
|
12
|
-
# Find executables
|
|
13
|
-
esbuild=$(yarn bin esbuild)
|
|
14
|
-
tsc=$(yarn bin tsc)
|
|
15
|
-
resolver="${SCRIPT_DIR}/resolve-files.js"
|
|
16
|
-
rewriteImports="${SCRIPT_DIR}/rewrite-imports.js"
|
|
17
|
-
|
|
18
|
-
# Setup shared options for esbuild
|
|
19
|
-
sharedOptions=()
|
|
20
|
-
sharedOptions+=("--platform=browser")
|
|
21
|
-
sharedOptions+=("--target=es2019")
|
|
22
|
-
|
|
23
|
-
# Generate actual builds
|
|
24
|
-
# ESM
|
|
25
|
-
resolverOptions=()
|
|
26
|
-
resolverOptions+=($SRC)
|
|
27
|
-
resolverOptions+=('/**/*.{ts,tsx}')
|
|
28
|
-
resolverOptions+=('--ignore=.test.,__mocks__')
|
|
29
|
-
INPUT_FILES=$($resolver ${resolverOptions[@]})
|
|
30
|
-
|
|
31
|
-
NODE_ENV=production $esbuild $INPUT_FILES --format=esm --outdir=$DST --outbase=$SRC --minify --pure:React.createElement --define:process.env.TEST_BYPASS_TRACKED_POINTER="false" --define:__DEV__="false" ${sharedOptions[@]} &
|
|
32
|
-
NODE_ENV=production $esbuild $input --format=esm --outfile=$DST/$name.esm.js --outbase=$SRC --minify --pure:React.createElement --define:process.env.TEST_BYPASS_TRACKED_POINTER="false" --define:__DEV__="false" ${sharedOptions[@]} &
|
|
33
|
-
|
|
34
|
-
# Common JS
|
|
35
|
-
NODE_ENV=production $esbuild $input --format=cjs --outfile=$DST/$name.prod.cjs --minify --bundle --pure:React.createElement --define:process.env.TEST_BYPASS_TRACKED_POINTER="false" --define:__DEV__="false" ${sharedOptions[@]} $@ &
|
|
36
|
-
NODE_ENV=development $esbuild $input --format=cjs --outfile=$DST/$name.dev.cjs --bundle --pure:React.createElement --define:process.env.TEST_BYPASS_TRACKED_POINTER="false" --define:__DEV__="true" ${sharedOptions[@]} $@ &
|
|
37
|
-
|
|
38
|
-
# Generate types
|
|
39
|
-
tsc --emitDeclarationOnly --project tsconfig.lib.json --outDir $DST &
|
|
40
|
-
|
|
41
|
-
# Copy build files over
|
|
42
|
-
cp -rf ./build/ $DST
|
|
43
|
-
|
|
44
|
-
# Wait for all the scripts to finish
|
|
45
|
-
wait
|
|
46
|
-
|
|
47
|
-
# Rewrite ESM imports 😤
|
|
48
|
-
$rewriteImports "$DST" '/**/*.js'
|
|
49
|
-
$rewriteImports "$DST" '/**/*.d.ts'
|
|
50
|
-
|
|
51
|
-
# Remove test related files
|
|
52
|
-
rm -rf `$resolver "$DST" '/**/*.{test,__mocks__,}.*'`
|
|
53
|
-
rm -rf `$resolver "$DST" '/**/test-utils/*'`
|
package/scripts/resolve-files.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
let fastGlob = require('fast-glob')
|
|
3
|
-
|
|
4
|
-
let parts = process.argv.slice(2)
|
|
5
|
-
let [args, flags] = parts.reduce(
|
|
6
|
-
([args, flags], part) => {
|
|
7
|
-
if (part.startsWith('--')) {
|
|
8
|
-
flags[part.slice(2, part.indexOf('='))] = part.slice(part.indexOf('=') + 1)
|
|
9
|
-
} else {
|
|
10
|
-
args.push(part)
|
|
11
|
-
}
|
|
12
|
-
return [args, flags]
|
|
13
|
-
},
|
|
14
|
-
[[], {}]
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
flags.ignore = flags.ignore ?? ''
|
|
18
|
-
flags.ignore = flags.ignore.split(',').filter(Boolean)
|
|
19
|
-
|
|
20
|
-
console.log(
|
|
21
|
-
fastGlob
|
|
22
|
-
.sync(args.join(''))
|
|
23
|
-
.filter((file) => {
|
|
24
|
-
for (let ignore of flags.ignore) {
|
|
25
|
-
if (file.includes(ignore)) {
|
|
26
|
-
return false
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return true
|
|
30
|
-
})
|
|
31
|
-
.join('\n')
|
|
32
|
-
)
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
let fs = require('fs')
|
|
4
|
-
let path = require('path')
|
|
5
|
-
let fastGlob = require('fast-glob')
|
|
6
|
-
|
|
7
|
-
console.time('Rewrote imports in')
|
|
8
|
-
fastGlob.sync([process.argv.slice(2).join('')]).forEach((file) => {
|
|
9
|
-
file = path.resolve(process.cwd(), file)
|
|
10
|
-
let content = fs.readFileSync(file, 'utf8')
|
|
11
|
-
let result = content.replace(/(import|export)([^"']*?)(["'])\.(.*?)\3/g, (full, a, b, _, d) => {
|
|
12
|
-
// For idempotency reasons, if `.js` already exists, then we can skip this. This allows us to
|
|
13
|
-
// run this script over and over again without adding .js files every time.
|
|
14
|
-
if (d.endsWith('.js')) {
|
|
15
|
-
return full
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return `${a}${b}'.${d}.js'`
|
|
19
|
-
})
|
|
20
|
-
if (result !== content) {
|
|
21
|
-
fs.writeFileSync(file, result, 'utf8')
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
console.timeEnd('Rewrote imports in')
|