Skip to content

Commit

Permalink
refactor: pnpm and tsup (#285)
Browse files Browse the repository at this point in the history
* refactor: use pnpm and tsup

* build: remove react from external rollup options

* build: add workaround

* ci: update pnpm
  • Loading branch information
jonambas authored Jun 5, 2024
1 parent 4644129 commit dc93da2
Show file tree
Hide file tree
Showing 31 changed files with 6,473 additions and 9,491 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build:packages
- uses: pnpm/action-setup@v4
with:
version: 9.2
- run: pnpm i
- run: pnpm build:packages
7 changes: 5 additions & 2 deletions .github/workflows/libra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build:libra
- uses: pnpm/action-setup@v4
with:
version: 9.2
- run: pnpm i
- run: pnpm build:libra
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
dist
.turbo
*.tsbuildinfo
styles
styles
.DS_Store
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# TODO figure out why Libra's Vite can't find deps of deps
public-hoist-pattern[]=*
59 changes: 0 additions & 59 deletions build/makeRollupConfig.mjs

This file was deleted.

12 changes: 6 additions & 6 deletions libra.config.js → libra.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ export default defineConfig({
title: 'Sweatpants',
port: 8080,
inspect: true,
layout: './libra/DefaultLayout.tsx',
layout: './libra/default-layout.tsx',
outDir: 'dist',
viteConfig: () => {
return {
resolve: {
alias: {
'@styles/css': resolve(__dirname, './styles/css')
}
'@styles/css': resolve(__dirname, './styles/css'),
},
},
optimizeDeps: {
exclude: ['@styles/css']
}
exclude: ['@styles/css'],
},
};
}
},
});
8 changes: 1 addition & 7 deletions libra/components/Card.libra.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
Button,
ButtonGroup,
Card,
Stack,
Text,
} from '../../packages/react/src';
import { Button, ButtonGroup, Card, Stack, Text } from '../../packages/react/src';
import { css } from '@styles/css';

directory('Card', () => {
Expand Down
8 changes: 1 addition & 7 deletions libra/components/Dialog.libra.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
Button,
Dialog,
Stack,
DateField,
Select,
} from '../../packages/react/src';
import { Button, Dialog, Stack, DateField, Select } from '../../packages/react/src';

directory('Dialog', () => {
add('Default', () => {
Expand Down
4 changes: 2 additions & 2 deletions libra/components/Icons.libra.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@styles/css';
import * as icons from '../../packages/react/src/icons/icons';
import * as icons from '@sweatpants/react/';
import { ElementType } from 'react';
import { Stack, Text } from '../../packages/react/src';

Expand All @@ -10,7 +10,7 @@ directory('Icons', () => {
className={css({
display: 'grid',
gridTemplateColumns: 'repeat(5, 1fr)',
gridGap: '8'
gridGap: '8',
})}
>
{Object.keys(icons).map((name) => {
Expand Down
2 changes: 1 addition & 1 deletion libra/components/Select.libra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ directory('Select', () => {
position: 'relative',
display: 'flex',
flexDirection: 'column',
gap: '0.5rem'
gap: '0.5rem',
}}
>
<Select
Expand Down
2 changes: 1 addition & 1 deletion libra/components/Stack.libra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Item = () => (
className={css({
height: '2rem',
width: '10rem',
bg: 'blue4'
bg: 'blue4',
})}
/>
);
Expand Down
6 changes: 3 additions & 3 deletions libra/components/TextField.libra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ directory('TextField', () => {
display: 'flex',
flexDir: 'column',
gap: '4',
alignItems: 'flex-start'
alignItems: 'flex-start',
})}
>
<TextField
Expand All @@ -36,7 +36,7 @@ directory('TextField', () => {
display: 'flex',
flexDir: 'column',
gap: '4',
alignItems: 'flex-start'
alignItems: 'flex-start',
})}
>
<TextField id="test2" label="Label" hasError />
Expand All @@ -51,7 +51,7 @@ directory('TextField', () => {
display: 'flex',
flexDir: 'column',
gap: '4',
alignItems: 'flex-start'
alignItems: 'flex-start',
})}
>
<TextField id="test2" size="sm" label="Label" prefix={'$'} />
Expand Down
4 changes: 2 additions & 2 deletions libra/DefaultLayout.tsx → libra/default-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import {
ColorSchemeProvider,
Link,
Stack,
Text
Text,
} from '../packages/react/src';
import type { LibraLayout } from '@sweatpants/libra';

const styles = css({
p: '8',
bg: 'baseBg',
minH: '100vh'
minH: '100vh',
});

const Layout: LibraLayout = ({ children, scheme }) => {
Expand Down
Loading

0 comments on commit dc93da2

Please sign in to comment.