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

fix: dist build #433

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
- name: Install
run: yarn install --frozen-lockfile --production

- name: Patch
run: yarn patch

- name: Build
env:
NODE_ENV: production
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- name: Install
run: yarn install --immutable --immutable-cache --check-cache

- name: Patch
run: yarn patch

- name: Test
run: yarn test:ci

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- name: Install dependencies
run: yarn install --frozen-lockfile --production

- name: Patch
run: yarn patch

- name: Build
run: yarn build

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ docker run -it -v $(pwd):/usr/local/src/ -w /usr/local/src/ -p 3000:3000 node:la
yarn install
```

- Patch the package

Stitches package needs to be patched after the upgrade to TypeScript version 5. You can run this script after installing the dependencies to apply the patch:

```sh
yarn patch
```

- Run the Storybook

```sh
Expand Down
1 change: 1 addition & 0 deletions components/Alert/Alert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const AlertForStory = modifyVariantsForStory<AlertVariants, AlertProps>(BaseAler

const Component: Meta<typeof AlertForStory> = {
title: 'Components/Alert',
// @ts-expect-error
component: Alert,
};

Expand Down
2 changes: 2 additions & 0 deletions components/Navigation/NavigationItem.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import { Badge } from '../Badge';

const Component: Meta<typeof NavigationDrawer> = {
title: 'Components/NavigationItem',
// @ts-expect-error
component: NavigationItem,
argTypes: {
// @ts-expect-error
as: {
options: ['a', 'button'],
},
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"deploy-storybook": "storybook-to-ghpages",
"test": "jest --watch",
"test:ci": "jest --ci --silent",
"patch": "patch-package",
"prepare": "husky install",
"pre-commit": "lint-staged"
},
Expand Down Expand Up @@ -113,6 +114,7 @@
"lint-staged": "13.1.0",
"lodash.merge": "^4.6.2",
"np": "^8.0.4",
"patch-package": "^8.0.0",
"prettier": "^2.1.2",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
39 changes: 39 additions & 0 deletions patches/@stitches+react+1.2.8.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/node_modules/@stitches/react/types/css-util.d.ts b/node_modules/@stitches/react/types/css-util.d.ts
index 1668fc2ab56c421894c547b2e5a988166cd90e5f..cfdad3f208ef7f57c89de7fb94cdaecbd7378c63 100644
--- a/node_modules/@stitches/react/types/css-util.d.ts
+++ b/node_modules/@stitches/react/types/css-util.d.ts
@@ -117,3 +117,11 @@ export type $$ScaleValue = typeof $$ScaleValue
export declare const $$ThemeValue: unique symbol

export type $$ThemeValue = typeof $$ThemeValue
+
+// https://github.com/microsoft/TypeScript/issues/37888#issuecomment-846638356
+export type WithPropertyValue<T> = {
+ readonly [K in $$PropertyValue]: T
+}
+export type WithScaleValue<T> = {
+ readonly [K in $$ScaleValue]: T;
+}
\ No newline at end of file
diff --git a/node_modules/@stitches/react/types/index.d.ts b/node_modules/@stitches/react/types/index.d.ts
index 8dbcc9cad3f6c556a3f370065dd95300a02dd973..dafadd22e8b6285aadee2630936a7918c9c5b02b 100644
--- a/node_modules/@stitches/react/types/index.d.ts
+++ b/node_modules/@stitches/react/types/index.d.ts
@@ -35,7 +35,7 @@ export type ComponentProps<Component> = Component extends ((...args: any[]) => a
/** Returns a type that expects a value to be a kind of CSS property value. */
export type PropertyValue<Property extends keyof CSSUtil.CSSProperties, Config = null> = (
Config extends null
- ? { readonly [K in CSSUtil.$$PropertyValue]: Property }
+ ? CSSUtil.WithPropertyValue<Property>
: Config extends { [K: string]: any }
? CSSUtil.CSS<
Config['media'],
@@ -49,7 +49,7 @@ export type PropertyValue<Property extends keyof CSSUtil.CSSProperties, Config =
/** Returns a type that expects a value to be a kind of theme scale value. */
export type ScaleValue<Scale, Config = null> = (
Config extends null
- ? { readonly [K in CSSUtil.$$ScaleValue]: Scale }
+ ? CSSUtil.WithScaleValue<Scale>
: Config extends { [K: string]: any }
? Scale extends keyof Config['theme']
? `$${string & keyof Config['theme'][Scale]}`
3 changes: 2 additions & 1 deletion stitches.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const colors: Record<string, Property.Color> = {
divider: 'hsl(207, 10%, 82%)',
};

const stitches = (createStitches as any)({
const stitches = createStitches({
theme: {
colors: {
...colors,
Expand Down Expand Up @@ -270,6 +270,7 @@ export type CSS<T = typeof stitches.config> = StitchesCSS<T>;

export const { styled, css, createTheme, getCssText, globalCss, keyframes, config } = stitches;

// @ts-expect-error
export const utils = config.utils;

export const darkTheme = (primary: PrimaryColor) => {
Expand Down
Loading