Skip to content

Commit c10c035

Browse files
authored
Drop microbundle for tsup (#3580)
* chore(dev-deps): remove vercel/node * chore(dev-deps): drop microbundle, use tsup * ci: perf, do not run prisma when not needed * fix: tailwind class order * fix: tailwind class order
1 parent 3895849 commit c10c035

File tree

14 files changed

+101
-1594
lines changed

14 files changed

+101
-1594
lines changed

.github/workflows/ci-monorepo-integrity.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535

3636
- name: 📥 Monorepo install
3737
uses: ./.github/actions/yarn-nm-install
38+
with:
39+
skip-prisma-postinstall-generate: true
3840

3941
- name: 👬🏽 Check for duplicate dependencies in lock file
4042
run: yarn dedupe --check

apps/nextjs-app/src/components/banner/Banner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const Banner: FC<Props> = () => {
2424
<div className="order-3 mt-2 w-full shrink-0 sm:order-2 sm:mt-0 sm:w-auto">
2525
<a
2626
href="@/components/banner/Banner#"
27-
className="flex items-center justify-center rounded-md border border-transparent bg-white py-2 px-4 text-sm font-medium text-indigo-600 shadow-sm hover:bg-indigo-50"
27+
className="flex items-center justify-center rounded-md border border-transparent bg-white px-4 py-2 text-sm font-medium text-indigo-600 shadow-sm hover:bg-indigo-50"
2828
>
2929
Learn more
3030
</a>

apps/nextjs-app/src/components/banner/__tests__/__snapshots__/Banner.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ exports[`should match snapshot 1`] = `
4747
className="order-3 mt-2 w-full shrink-0 sm:order-2 sm:mt-0 sm:w-auto"
4848
>
4949
<a
50-
className="flex items-center justify-center rounded-md border border-transparent bg-white py-2 px-4 text-sm font-medium text-indigo-600 shadow-sm hover:bg-indigo-50"
50+
className="flex items-center justify-center rounded-md border border-transparent bg-white px-4 py-2 text-sm font-medium text-indigo-600 shadow-sm hover:bg-indigo-50"
5151
href="@/components/banner/Banner#"
5252
>
5353
Learn more

apps/nextjs-app/src/features/auth/components/LoginForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const LoginForm: FC<Props> = (_props) => {
9191
type="submit"
9292
disabled={isSubmitting}
9393
className={clsx(
94-
'inline-flex justify-center rounded-md border border-transparent py-2 px-4 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2',
94+
'inline-flex justify-center rounded-md border border-transparent px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2',
9595
isSubmitting ? 'bg-indigo-100' : 'bg-indigo-600'
9696
)}
9797
>

apps/nextjs-app/src/features/demo/components/PoemCard.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@ export const PoemCard: FC<Props> = (props) => {
1818
const image = img ?? defaultImg;
1919
return (
2020
<div className="max-w-sm overflow-hidden rounded shadow-lg">
21-
<div className="aspect-w-16 aspect-h-9 h-56 lg:aspect-none">
21+
<div className="aspect-h-9 aspect-w-16 h-56 lg:aspect-none">
2222
<img
2323
className="h-full w-full object-cover object-center lg:h-full lg:w-full"
2424
src={image ?? ''}
2525
alt={title}
2626
/>
2727
</div>
28-
<article className="prose py-4 px-6">
28+
<article className="prose px-6 py-4">
2929
<div className="mb-2 text-xl font-bold">{title}</div>
3030
<p className="text-indigo-600">By {author}</p>
31-
<p className="text-base text-gray-700 line-clamp-4">{content}</p>
31+
<p className="line-clamp-4 text-base text-gray-700">{content}</p>
3232
</article>
33-
<div className="px-6 pt-4 pb-2">
33+
<div className="px-6 pb-2 pt-4">
3434
{keywords.map((keyword) => {
3535
return (
3636
<span
3737
key={keyword}
38-
className="mr-2 mb-2 inline-block rounded-full bg-gray-200 py-1 px-3 text-sm font-semibold text-gray-700"
38+
className="mb-2 mr-2 inline-block rounded-full bg-gray-200 px-3 py-1 text-sm font-semibold text-gray-700"
3939
>
4040
#{keyword}
4141
</span>

apps/nextjs-app/src/features/home/blocks/cta/CtaBlock.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type Props = {
66
export const CtaBlock: FC<Props> = () => {
77
return (
88
<div className="bg-gray-50">
9-
<div className="mx-auto max-w-7xl py-12 px-4 sm:px-6 lg:flex lg:items-center lg:justify-between lg:py-16 lg:px-8">
9+
<div className="mx-auto max-w-7xl px-4 py-12 sm:px-6 lg:flex lg:items-center lg:justify-between lg:px-8 lg:py-16">
1010
<h2 className="text-3xl font-extrabold tracking-tight text-gray-900 sm:text-4xl">
1111
<span className="block">Ready to dive in?</span>
1212
<span className="block text-indigo-600">
@@ -17,15 +17,15 @@ export const CtaBlock: FC<Props> = () => {
1717
<div className="inline-flex rounded-md shadow">
1818
<a
1919
href="#"
20-
className="inline-flex items-center justify-center rounded-md border border-transparent bg-indigo-600 py-3 px-5 text-base font-medium text-white hover:bg-indigo-700"
20+
className="inline-flex items-center justify-center rounded-md border border-transparent bg-indigo-600 px-5 py-3 text-base font-medium text-white hover:bg-indigo-700"
2121
>
2222
Get started
2323
</a>
2424
</div>
2525
<div className="ml-3 inline-flex rounded-md shadow">
2626
<a
2727
href="#"
28-
className="inline-flex items-center justify-center rounded-md border border-transparent bg-white py-3 px-5 text-base font-medium text-indigo-600 hover:bg-indigo-50"
28+
className="inline-flex items-center justify-center rounded-md border border-transparent bg-white px-5 py-3 text-base font-medium text-indigo-600 hover:bg-indigo-50"
2929
>
3030
Learn more
3131
</a>

apps/nextjs-app/src/features/home/blocks/features/FeaturesBlock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const FeaturesBlock: FC<Props> = () => {
7777
{feature.name}
7878
</p>
7979
</dt>
80-
<dd className="mt-2 ml-16 text-base text-gray-500">
80+
<dd className="ml-16 mt-2 text-base text-gray-500">
8181
{feature.description}
8282
</dd>
8383
</div>

apps/nextjs-app/src/features/home/blocks/hero/HeroBlock.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const HeroBlock: FC<Props> = () => {
1111

1212
return (
1313
<section className="body-font text-gray-600">
14-
<div className="container mx-auto flex flex-col items-center py-24 px-5 md:flex-row">
14+
<div className="container mx-auto flex flex-col items-center px-5 py-24 md:flex-row">
1515
<div className="mb-16 flex flex-col items-center text-center md:mb-0 md:w-1/2 md:items-start md:pr-16 md:text-left lg:grow lg:pr-24">
1616
<h1 className="title-font mb-4 text-3xl font-medium text-gray-900 sm:text-4xl">
1717
Before they sold out&nbsp;
@@ -25,10 +25,10 @@ export const HeroBlock: FC<Props> = () => {
2525
hexagon try-hard chambray.
2626
</p>
2727
<div className="flex justify-center">
28-
<button className="inline-flex rounded border-0 bg-indigo-500 py-2 px-6 text-lg text-white hover:bg-indigo-600 focus:outline-none">
28+
<button className="inline-flex rounded border-0 bg-indigo-500 px-6 py-2 text-lg text-white hover:bg-indigo-600 focus:outline-none">
2929
Button
3030
</button>
31-
<button className="ml-4 inline-flex rounded border-0 bg-gray-100 py-2 px-6 text-lg text-gray-700 hover:bg-gray-200 focus:outline-none">
31+
<button className="ml-4 inline-flex rounded border-0 bg-gray-100 px-6 py-2 text-lg text-gray-700 hover:bg-gray-200 focus:outline-none">
3232
Button
3333
</button>
3434
</div>

apps/nextjs-app/src/features/system/pages/ErrorPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const ErrorPage: FC<Props> = (props) => {
2424
Something went wrong. Please try again later.
2525
</p>
2626
</div>
27-
<div className="absolute right-0 bottom-0 m-5 rounded-lg border-2 border-solid border-indigo-400 p-5 text-left text-sm text-gray-700">
27+
<div className="absolute bottom-0 right-0 m-5 rounded-lg border-2 border-solid border-indigo-400 p-5 text-left text-sm text-gray-700">
2828
<p data-testid="error-status-code">Code: {statusCode}</p>
2929
<p>Message: {message}</p>
3030
<p>Error id: {errorId}</p>

apps/remix-app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"@remix-run/react": "1.14.3",
4242
"@remix-run/serve": "1.14.3",
4343
"@remix-run/vercel": "1.14.3",
44-
"@vercel/node": "2.10.2",
4544
"@your-org/common-i18n": "workspace:^",
4645
"@your-org/core-lib": "workspace:^",
4746
"@your-org/ui-lib": "workspace:^",

packages/core-lib/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818
"directory": "packages/core-lib"
1919
},
2020
"scripts": {
21-
"build": "rimraf ./dist && cross-env NODE_ENV=production microbundle --tsconfig ./tsconfig.build.json --jsx React.createElement --jsxFragment React.Fragment -f cjs,es --no-compress",
22-
"build-react17jsx": "microbundle --tsconfig ./tsconfig.build.json --jsx jsx --jsxImportSource react --globals react/jsx-runtime=jsx --compress",
21+
"build": "tsup",
2322
"clean": "rimraf ./dist ./coverage ./tsconfig.tsbuildinfo",
24-
"dev": "microbundle watch",
23+
"dev": "tsup --watch",
2524
"fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs --fix",
2625
"lint": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs --cache --cache-location ../../.cache/eslint/core-lib.eslintcache",
2726
"test": "run-s test-unit",
@@ -49,13 +48,13 @@
4948
"eslint": "8.37.0",
5049
"jest": "29.5.0",
5150
"jest-environment-jsdom": "29.5.0",
52-
"microbundle": "0.15.1",
5351
"npm-run-all": "4.1.5",
5452
"prettier": "2.8.7",
5553
"react": "18.2.0",
5654
"react-dom": "18.2.0",
5755
"rimraf": "4.4.1",
5856
"ts-jest": "29.0.5",
57+
"tsup": "6.7.0",
5958
"typescript": "5.0.2",
6059
"vite": "4.2.1",
6160
"vite-tsconfig-paths": "4.0.7",

packages/core-lib/tsconfig.build.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
"$schema": "https://json.schemastore.org/tsconfig",
33
"extends": "./tsconfig.json",
44
"compilerOptions": {
5-
"rootDir": "./src",
65
"target": "esnext",
76
"module": "esnext",
87
"jsx": "react-jsx",
9-
"jsxFactory": "",
10-
"jsxFragmentFactory": ""
8+
"incremental": false // dts with tsup requires rootDir if incremental (which does not work well aliases)
119
},
12-
"exclude": ["dist", "**/__tests__/*"]
10+
"exclude": [
11+
"**/*.stories.tsx",
12+
"**/*.stories.ts",
13+
"**/*.stories.mdx",
14+
".storybook/**"
15+
]
1316
}

packages/core-lib/tsup.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { defineConfig } from 'tsup';
2+
3+
export default defineConfig((options) => ({
4+
entry: ['src/index.ts'],
5+
splitting: true,
6+
treeshake: true,
7+
clean: true,
8+
dts: true,
9+
format: ['esm'],
10+
platform: 'browser',
11+
target: ['es2017', 'chrome70', 'edge18', 'firefox70', 'node14'],
12+
tsconfig: new URL('./tsconfig.build.json', import.meta.url).pathname,
13+
sourcemap: !options.watch,
14+
minify: !options.watch,
15+
}));

0 commit comments

Comments
 (0)