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

Update kitchen-sink with App Router. #4840

Merged
merged 11 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 2 additions & 2 deletions examples/kitchen-sink/apps/storefront/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"clean": "rm -rf .next",
"dev": "next dev -p 3002",
"lint": "next lint",
"start": "next start "
"start": "next start"
},
"dependencies": {
"logger": "workspace:*",
"next": "latest",
"next": "^13.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ui": "workspace:*"
Expand Down
13 changes: 13 additions & 0 deletions examples/kitchen-sink/apps/storefront/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import "./styles.css";

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { log } from "logger";
import Head from "next/head";
import { CounterButton, NewTabLink } from "ui";

export const metadata = {
title: "Store | Kitchen Sink",
};

export default function Store() {
log("Hey! This is Home.");
return (
<div className="container">
<Head>
<title>Store | Kitchen Sink</title>
</Head>
<h1 className="title">
Store <br />
<span>Kitchen Sink</span>
Expand Down
55 changes: 55 additions & 0 deletions examples/kitchen-sink/apps/storefront/src/app/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
html {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif;
-webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-tap-highlight-color: transparent;
line-height: 1.5;
tab-size: 4;
}

body {
margin: 0;
}

.container {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1.5rem;
max-width: 100%;
margin: 0 auto;
padding: 0 16px;
text-align: center;
}

.title {
font-size: 3rem;
font-weight: 700;
margin: 0;
}

.title span {
display: inline-block;
background-image: linear-gradient(to right, #3b82f6, #ef4444);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}

.description {
color: #9ca3af;
font-weight: 500;
}

.description a {
color: #3b82f6;
text-decoration: none;
}

.description a:hover {
text-decoration: underline;
}
6 changes: 0 additions & 6 deletions examples/kitchen-sink/apps/storefront/src/pages/_app.tsx

This file was deleted.

10 changes: 7 additions & 3 deletions examples/kitchen-sink/apps/storefront/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
"exclude": ["node_modules"],
"extends": "tsconfig/nextjs.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
"outDir": "dist",
"plugins": [
{
"name": "next"
}
]
},
"include": ["src", "next-env.d.ts"]
"include": ["src", "next-env.d.ts", ".next/types/**/*.ts"]
}
12 changes: 6 additions & 6 deletions examples/kitchen-sink/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"private": true,
"scripts": {
"build": "turbo run build",
"clean": "turbo run clean",
"dev": "turbo run dev --no-cache --continue",
"build": "turbo build",
"clean": "turbo clean",
"dev": "turbo dev --no-cache --continue",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"lint": "turbo run lint",
"test": "turbo run test"
"lint": "turbo lint",
"test": "turbo test"
},
"devDependencies": {
"prettier": "^2.7.1",
"turbo": "latest"
"turbo": "^1.9.3"
},
"packageManager": "pnpm@7.15.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"main": "index.js",
"dependencies": {
"eslint-config-turbo": "latest"
"eslint-config-turbo": "^1.9.3"
},
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"license": "MIT",
"main": "index.js",
"dependencies": {
"eslint-config-next": "latest",
"eslint-config-next": "^13.4.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "7.28.0",
"eslint-config-turbo": "latest"
"eslint-config-turbo": "^1.9.3"
},
"publishConfig": {
"access": "public"
Expand Down
1 change: 1 addition & 0 deletions examples/kitchen-sink/packages/tsconfig/nextjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"display": "Next.js",
"extends": "./base.json",
"compilerOptions": {
"plugins": [{ "name": "next" }],
"allowJs": true,
"declaration": false,
"declarationMap": false,
Expand Down
4 changes: 2 additions & 2 deletions examples/kitchen-sink/packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"dist/**"
],
"scripts": {
"build": "tsup src/index.tsx --format esm,cjs --dts --external react",
"build": "tsup",
"clean": "rm -rf dist",
"dev": "tsup src/index.tsx --format esm,cjs --watch --dts --external react",
"dev": "tsup --watch",
"lint": "eslint \"src/**/*.ts*\"",
"test": "jest"
},
Expand Down
14 changes: 14 additions & 0 deletions examples/kitchen-sink/packages/ui/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig, Options } from "tsup";

export default defineConfig((options: Options) => ({
entry: {
".": "src/index.tsx",
},
banner: {
js: "'use client'",
},
Comment on lines +4 to +6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but it's a little confusing as it's now dictating the type of components we can put in this package. And it makes the decision between bundling / using an internal package more nuanced. Not a change request, just a comment!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's definitely weird but I poked around the ecosystem and it doesn't look like there is an idiomatic way that people handle this yet. It's also notable that it's generally an okay approach as we're all learning how to migrate together. 😬

format: ["cjs", "esm"],
external: ["react"],
dts: true,
...options,
}));
Loading