Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace parcel with tsup. Better types, better tsconfig. Move to ESM. #6467

Merged
merged 5 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
9 changes: 0 additions & 9 deletions packages/components/.parcelrc

This file was deleted.

1 change: 1 addition & 0 deletions packages/components/news/6467.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace `parcel` with `tsup`. Better types, better tsconfig. Move to ESM. @sneridagh
31 changes: 12 additions & 19 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,20 @@
"bugs": {
"url": "https://github.com/plone/components/issues"
},
"type": "module",
"files": [
"dist",
"src",
"README.md"
],
"source": "./src/index.ts",
"main": "./dist/main.js",
"module": "./dist/module.mjs",
"types": "./dist/index.d.ts",
"main": "./dist/index.js",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"import": "./dist/module.mjs",
"require": "./dist/main.js"
"import": "./dist/index.js",
"default": "./dist/index.cjs"
},
"./dist/*.css": "./dist/*.css",
"./src/*": "./src/*"
"./dist/*.css": "./dist/*.css"
},
"homepage": "https://plone.org",
"keywords": [
Expand All @@ -45,12 +42,13 @@
"quanta"
],
"scripts": {
"build": "parcel build && pnpm build:css",
"build:force": "parcel build --no-cache && pnpm build:css",
"build": "tsup && pnpm build:css",
"build:force": "tsup && pnpm build:css",
"build:css": "pnpm build:basic && pnpm build:quanta",
"build:basic": "lightningcss --browserslist --bundle --sourcemap src/styles/basic/main.css -o basic.css && mv basic.css* dist/.",
"build:quanta": "lightningcss --browserslist --bundle --sourcemap src/styles/quanta/main.css -o quanta.css && mv quanta.css* dist/.",
"check-ts": "tsc --project tsconfig.json",
"check:exports": "attw --pack .",
"check:ts": "tsc --project tsconfig.json",
"test": "vitest --passWithNoTests",
"coverage": "vitest run --coverage --no-threads",
"lint": "pnpm eslint && pnpm prettier && pnpm stylelint && pnpm check-ts",
Expand All @@ -77,12 +75,7 @@
"not dead"
],
"devDependencies": {
"@parcel/config-default": "^2.12.0",
"@parcel/core": "^2.12.0",
"@parcel/packager-ts": "^2.12.0",
"@parcel/transformer-js": "^2.12.0",
"@parcel/transformer-react-refresh-wrap": "^2.12.0",
"@parcel/transformer-typescript-types": "^2.12.0",
"@arethetypeswrong/cli": "^0.16.4",
"@plone/types": "workspace: *",
"@react-types/shared": "^3.22.0",
"@storybook/addon-essentials": "^8.0.4",
Expand All @@ -107,9 +100,9 @@
"jsdom": "^22.1.0",
"lightningcss": "^1.24.0",
"lightningcss-cli": "^1.24.0",
"parcel": "^2.12.0",
"release-it": "17.1.1",
"storybook": "^8.0.4",
"tsup": "^8.3.5",
"typescript": "^5.6.3",
"vite": "^5.4.8",
"vitest": "^2.1.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from 'react';
import { Toolbar as RACToolbar, ToolbarProps } from 'react-aria-components';
import {
Toolbar as RACToolbar,
type ToolbarProps,
} from 'react-aria-components';

export function BlockToolbar(props: ToolbarProps) {
return <RACToolbar {...props} className="blocks-toolbar" />;
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { forwardRef, ForwardedRef } from 'react';
import { Button as RACButton, ButtonProps } from 'react-aria-components';
import React, { forwardRef, type ForwardedRef } from 'react';
import { Button as RACButton, type ButtonProps } from 'react-aria-components';

export const Button = forwardRef(function _Button(
props: ButtonProps,
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/components/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
Calendar as RACCalendar,
CalendarCell,
CalendarGrid,
CalendarProps as RACCalendarProps,
DateValue,
type CalendarProps as RACCalendarProps,
type DateValue,
Heading,
Text,
} from 'react-aria-components';
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {
Checkbox as RACCheckbox,
CheckboxProps as RACCheckboxProps,
type CheckboxProps as RACCheckboxProps,
} from 'react-aria-components';

interface CheckboxProps extends RACCheckboxProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import {
CheckboxGroup as RACCheckboxGroup,
CheckboxGroupProps as RACCheckboxGroupProps,
type CheckboxGroupProps as RACCheckboxGroupProps,
FieldError,
Text,
ValidationResult,
type ValidationResult,
} from 'react-aria-components';

export interface CheckboxGroupProps
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/ColorArea/ColorArea.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import {
ColorArea as RACColorArea,
ColorAreaProps,
type ColorAreaProps,
ColorThumb,
} from 'react-aria-components';

Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/components/ColorField/ColorField.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from 'react';
import {
ColorField as RACColorField,
ColorFieldProps as RACColorFieldProps,
type ColorFieldProps as RACColorFieldProps,
FieldError,
Input,
Label,
Text,
ValidationResult,
type ValidationResult,
} from 'react-aria-components';

export interface ColorFieldProps extends RACColorFieldProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import {
Button,
ColorPicker as RACColorPicker,
ColorPickerProps as RACColorPickerProps,
type ColorPickerProps as RACColorPickerProps,
Dialog,
DialogTrigger,
Popover,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import {
ColorSlider as RACColorSlider,
ColorSliderProps as RACColorSliderProps,
type ColorSliderProps as RACColorSliderProps,
ColorThumb,
Label,
SliderOutput,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import {
ColorSwatch as RACColorSwatch,
ColorSwatchProps,
type ColorSwatchProps,
} from 'react-aria-components';

export function ColorSwatch(props: ColorSwatchProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as React from 'react';
import {
ColorSwatchPicker as AriaColorSwatchPicker,
ColorSwatchPickerItem as AriaColorSwatchPickerItem,
ColorSwatchPickerItemProps,
ColorSwatchPickerProps,
type ColorSwatchPickerItemProps,
type ColorSwatchPickerProps,
} from 'react-aria-components';

import { ColorSwatch } from '../ColorSwatch/ColorSwatch';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import {
ColorThumb,
ColorWheel as AriaColorWheel,
ColorWheelProps as AriaColorWheelProps,
type ColorWheelProps as AriaColorWheelProps,
ColorWheelTrack,
} from 'react-aria-components';

Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/components/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import React from 'react';
import {
Button,
ComboBox as RACComboBox,
ComboBoxProps as RACComboBoxProps,
type ComboBoxProps as RACComboBoxProps,
FieldError,
Input,
Label,
ListBox,
ListBoxItem,
ListBoxItemProps,
type ListBoxItemProps,
Popover,
Text,
ValidationResult,
type ValidationResult,
} from 'react-aria-components';

export interface ComboBoxProps<T extends object>
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/components/DateField/DateField.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import {
DateField as RACDateField,
DateFieldProps as RACDateFieldProps,
type DateFieldProps as RACDateFieldProps,
DateInput,
DateSegment,
DateValue,
type DateValue,
FieldError,
Label,
Text,
ValidationResult,
type ValidationResult,
} from 'react-aria-components';

export interface DateFieldProps<T extends DateValue>
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/components/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import {
CalendarGrid,
DateInput,
DatePicker as RACDatePicker,
DatePickerProps as RACDatePickerProps,
type DatePickerProps as RACDatePickerProps,
DateSegment,
DateValue,
type DateValue,
Dialog,
FieldError,
Group,
Heading,
Label,
Popover,
Text,
ValidationResult,
type ValidationResult,
} from 'react-aria-components';

export interface DatePickerProps<T extends DateValue>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
CalendarGrid,
DateInput,
DateRangePicker as RACDateRangePicker,
DateRangePickerProps as RACDateRangePickerProps,
type DateRangePickerProps as RACDateRangePickerProps,
DateSegment,
DateValue,
type DateValue,
Dialog,
FieldError,
Group,
Expand All @@ -16,7 +16,7 @@ import {
Popover,
RangeCalendar,
Text,
ValidationResult,
type ValidationResult,
} from 'react-aria-components';

export interface DateRangePickerProps<T extends DateValue>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Dialog as RACDialog, DialogProps } from 'react-aria-components';
import { Dialog as RACDialog, type DialogProps } from 'react-aria-components';

export function Dialog(props: DialogProps) {
return <RACDialog {...props} />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import {
UNSTABLE_Disclosure as RACDisclosure,
DisclosureProps,
type DisclosureProps,
} from 'react-aria-components';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import {
UNSTABLE_DisclosureGroup as RACDisclosureGroup,
DisclosureGroupProps,
type DisclosureGroupProps,
} from 'react-aria-components';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/Form/Form.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Form as RACForm, FormProps } from 'react-aria-components';
import { Form as RACForm, type FormProps } from 'react-aria-components';

export function Form(props: FormProps) {
return <RACForm {...props} />;
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/components/GridList/GridList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
Button,
GridList as RACGridList,
GridListItem as RACGridListItem,
GridListItemProps,
GridListProps,
type GridListItemProps,
type GridListProps,
} from 'react-aria-components';

import { Checkbox } from '../Checkbox/Checkbox';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactElement } from 'react';
import React, { type ReactElement } from 'react';
import type {
AriaLabelingProps,
DOMProps,
Expand All @@ -7,7 +7,7 @@ import type {
} from '@react-types/shared';
import {
baseStyleProps,
StyleHandlers,
type StyleHandlers,
useSlotProps,
useStyleProps,
} from '@react-spectrum/utils';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/components/ListBox/ListBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import {
ListBox as RACListBox,
ListBoxItem as RACListBoxItem,
ListBoxItemProps,
ListBoxProps,
type ListBoxItemProps,
type ListBoxProps,
} from 'react-aria-components';

export function ListBox<T extends object>({
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React from 'react';
import {
Menu as RACMenu,
MenuItem as RACMenuItem,
MenuItemProps,
MenuProps,
type MenuItemProps,
type MenuProps,
MenuTrigger,
MenuTriggerProps,
type MenuTriggerProps,
Popover,
PressEvent,
type PressEvent,
} from 'react-aria-components';

import { Button } from '../Button/Button';
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/Meter/Meter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import {
Label,
Meter as RACMeter,
MeterProps as RACMeterProps,
type MeterProps as RACMeterProps,
} from 'react-aria-components';

export interface MeterProps extends RACMeterProps {
Expand Down
5 changes: 4 additions & 1 deletion packages/components/src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from 'react';
import { Modal as RACModal, ModalOverlayProps } from 'react-aria-components';
import {
Modal as RACModal,
type ModalOverlayProps,
} from 'react-aria-components';

export function Modal(props: ModalOverlayProps) {
return <RACModal {...props} />;
Expand Down
Loading
Loading