From 8b2c4a38a461ff5ecc95972291bc711e2c5dec9a Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Fri, 28 Apr 2023 01:47:57 +0800 Subject: --- examples/with-tailwind/apps/web/.eslintrc.js | 4 ++ examples/with-tailwind/apps/web/.gitignore | 34 +++++++++++++++ examples/with-tailwind/apps/web/README.md | 30 ++++++++++++++ examples/with-tailwind/apps/web/next-env.d.ts | 5 +++ examples/with-tailwind/apps/web/next.config.js | 3 ++ examples/with-tailwind/apps/web/package.json | 29 +++++++++++++ examples/with-tailwind/apps/web/postcss.config.js | 9 ++++ examples/with-tailwind/apps/web/src/pages/_app.tsx | 9 ++++ .../with-tailwind/apps/web/src/pages/_document.tsx | 32 +++++++++++++++ .../with-tailwind/apps/web/src/pages/index.tsx | 48 ++++++++++++++++++++++ .../with-tailwind/apps/web/src/styles/globals.css | 3 ++ examples/with-tailwind/apps/web/tailwind.config.js | 7 ++++ examples/with-tailwind/apps/web/tsconfig.json | 5 +++ 13 files changed, 218 insertions(+) create mode 100644 examples/with-tailwind/apps/web/.eslintrc.js create mode 100644 examples/with-tailwind/apps/web/.gitignore create mode 100644 examples/with-tailwind/apps/web/README.md create mode 100644 examples/with-tailwind/apps/web/next-env.d.ts create mode 100644 examples/with-tailwind/apps/web/next.config.js create mode 100644 examples/with-tailwind/apps/web/package.json create mode 100644 examples/with-tailwind/apps/web/postcss.config.js create mode 100644 examples/with-tailwind/apps/web/src/pages/_app.tsx create mode 100644 examples/with-tailwind/apps/web/src/pages/_document.tsx create mode 100644 examples/with-tailwind/apps/web/src/pages/index.tsx create mode 100644 examples/with-tailwind/apps/web/src/styles/globals.css create mode 100644 examples/with-tailwind/apps/web/tailwind.config.js create mode 100644 examples/with-tailwind/apps/web/tsconfig.json (limited to 'examples/with-tailwind/apps/web') diff --git a/examples/with-tailwind/apps/web/.eslintrc.js b/examples/with-tailwind/apps/web/.eslintrc.js new file mode 100644 index 0000000..c8df607 --- /dev/null +++ b/examples/with-tailwind/apps/web/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: ["custom"], +}; diff --git a/examples/with-tailwind/apps/web/.gitignore b/examples/with-tailwind/apps/web/.gitignore new file mode 100644 index 0000000..1437c53 --- /dev/null +++ b/examples/with-tailwind/apps/web/.gitignore @@ -0,0 +1,34 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env.local +.env.development.local +.env.test.local +.env.production.local + +# vercel +.vercel diff --git a/examples/with-tailwind/apps/web/README.md b/examples/with-tailwind/apps/web/README.md new file mode 100644 index 0000000..4fae62a --- /dev/null +++ b/examples/with-tailwind/apps/web/README.md @@ -0,0 +1,30 @@ +## Getting Started + +First, run the development server: + +```bash +yarn dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. + +[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`. + +The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn/foundations/about-nextjs) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/examples/with-tailwind/apps/web/next-env.d.ts b/examples/with-tailwind/apps/web/next-env.d.ts new file mode 100644 index 0000000..4f11a03 --- /dev/null +++ b/examples/with-tailwind/apps/web/next-env.d.ts @@ -0,0 +1,5 @@ +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/examples/with-tailwind/apps/web/next.config.js b/examples/with-tailwind/apps/web/next.config.js new file mode 100644 index 0000000..da1bb77 --- /dev/null +++ b/examples/with-tailwind/apps/web/next.config.js @@ -0,0 +1,3 @@ +module.exports = { + reactStrictMode: true, +}; diff --git a/examples/with-tailwind/apps/web/package.json b/examples/with-tailwind/apps/web/package.json new file mode 100644 index 0000000..17834e5 --- /dev/null +++ b/examples/with-tailwind/apps/web/package.json @@ -0,0 +1,29 @@ +{ + "name": "web", + "version": "1.0.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint" + }, + "dependencies": { + "next": "latest", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "ui": "workspace:*" + }, + "devDependencies": { + "@types/node": "^18.11.17", + "@types/react": "^18.0.26", + "@types/react-dom": "^18.0.9", + "autoprefixer": "^10.4.13", + "eslint-config-custom": "workspace:*", + "postcss": "^8.4.20", + "tailwind-config": "workspace:*", + "tailwindcss": "^3.2.4", + "tsconfig": "workspace:*", + "typescript": "^4.9.4" + } +} diff --git a/examples/with-tailwind/apps/web/postcss.config.js b/examples/with-tailwind/apps/web/postcss.config.js new file mode 100644 index 0000000..07aa434 --- /dev/null +++ b/examples/with-tailwind/apps/web/postcss.config.js @@ -0,0 +1,9 @@ +// If you want to use other PostCSS plugins, see the following: +// https://tailwindcss.com/docs/using-with-preprocessors + +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/examples/with-tailwind/apps/web/src/pages/_app.tsx b/examples/with-tailwind/apps/web/src/pages/_app.tsx new file mode 100644 index 0000000..cab70f5 --- /dev/null +++ b/examples/with-tailwind/apps/web/src/pages/_app.tsx @@ -0,0 +1,9 @@ +import "../styles/globals.css"; +// include styles from the ui package +import "ui/styles.css"; + +import type { AppProps } from "next/app"; + +export default function MyApp({ Component, pageProps }: AppProps) { + return ; +} diff --git a/examples/with-tailwind/apps/web/src/pages/_document.tsx b/examples/with-tailwind/apps/web/src/pages/_document.tsx new file mode 100644 index 0000000..a091efe --- /dev/null +++ b/examples/with-tailwind/apps/web/src/pages/_document.tsx @@ -0,0 +1,32 @@ +import Document, { + DocumentContext, + DocumentInitialProps, + Html, + Head, + Main, + NextScript, +} from "next/document"; + +class MyDocument extends Document { + static async getInitialProps( + ctx: DocumentContext + ): Promise { + const initialProps = await Document.getInitialProps(ctx); + + return initialProps; + } + + render() { + return ( + + + +
+ + + + ); + } +} + +export default MyDocument; diff --git a/examples/with-tailwind/apps/web/src/pages/index.tsx b/examples/with-tailwind/apps/web/src/pages/index.tsx new file mode 100644 index 0000000..27f57cb --- /dev/null +++ b/examples/with-tailwind/apps/web/src/pages/index.tsx @@ -0,0 +1,48 @@ +import Head from "next/head"; +import { Button, Card } from "ui"; + +const CARD_CONTENT = [ + { + title: "Caching Tasks", + href: "https://turbo.build/repo/docs/core-concepts/caching", + cta: "Read More", + }, + { + title: "Running Tasks", + href: "https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks", + cta: "Read More", + }, + { + title: "Configuration Options", + href: "https://turbo.build/repo/docs/reference/configuration", + cta: "Read More", + }, +]; + +export default function Home() { + return ( +
+ + Web - Turborepo Example + + +
+

+ Web + + Turborepo Example + +

+
+
+ +
+ {CARD_CONTENT.map((card) => ( + + ))} +
+
+
+ ); +} diff --git a/examples/with-tailwind/apps/web/src/styles/globals.css b/examples/with-tailwind/apps/web/src/styles/globals.css new file mode 100644 index 0000000..b5c61c9 --- /dev/null +++ b/examples/with-tailwind/apps/web/src/styles/globals.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/examples/with-tailwind/apps/web/tailwind.config.js b/examples/with-tailwind/apps/web/tailwind.config.js new file mode 100644 index 0000000..cc78ae3 --- /dev/null +++ b/examples/with-tailwind/apps/web/tailwind.config.js @@ -0,0 +1,7 @@ +// tailwind config is required for editor support + +const sharedConfig = require("tailwind-config/tailwind.config.js"); + +module.exports = { + presets: [sharedConfig], +}; diff --git a/examples/with-tailwind/apps/web/tsconfig.json b/examples/with-tailwind/apps/web/tsconfig.json new file mode 100644 index 0000000..a355365 --- /dev/null +++ b/examples/with-tailwind/apps/web/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "tsconfig/nextjs.json", + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] +} -- cgit v1.2.3-70-g09d2