aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/examples/with-tailwind/packages
diff options
context:
space:
mode:
author简律纯 <hsiangnianian@outlook.com>2023-04-28 01:47:57 +0800
committer简律纯 <hsiangnianian@outlook.com>2023-04-28 01:47:57 +0800
commit8b2c4a38a461ff5ecc95972291bc711e2c5dec9a (patch)
tree29f552e3df949073e21bf5c76d7abc3044830ec6 /examples/with-tailwind/packages
parentfc8c5fdce62fb229202659408798a7b6c98f6e8b (diff)
downloadHydroRoll-8b2c4a38a461ff5ecc95972291bc711e2c5dec9a.tar.gz
HydroRoll-8b2c4a38a461ff5ecc95972291bc711e2c5dec9a.zip
Diffstat (limited to 'examples/with-tailwind/packages')
-rw-r--r--examples/with-tailwind/packages/eslint-config-custom/index.js11
-rw-r--r--examples/with-tailwind/packages/eslint-config-custom/package.json15
-rw-r--r--examples/with-tailwind/packages/tailwind-config/package.json9
-rw-r--r--examples/with-tailwind/packages/tailwind-config/tailwind.config.js19
-rw-r--r--examples/with-tailwind/packages/tsconfig/base.json20
-rw-r--r--examples/with-tailwind/packages/tsconfig/nextjs.json22
-rw-r--r--examples/with-tailwind/packages/tsconfig/package.json9
-rw-r--r--examples/with-tailwind/packages/tsconfig/react-library.json11
-rw-r--r--examples/with-tailwind/packages/ui/package.json32
-rw-r--r--examples/with-tailwind/packages/ui/postcss.config.js9
-rw-r--r--examples/with-tailwind/packages/ui/src/Button.tsx16
-rw-r--r--examples/with-tailwind/packages/ui/src/Card.tsx27
-rw-r--r--examples/with-tailwind/packages/ui/src/index.tsx6
-rw-r--r--examples/with-tailwind/packages/ui/src/styles.css3
-rw-r--r--examples/with-tailwind/packages/ui/tailwind.config.js7
-rw-r--r--examples/with-tailwind/packages/ui/tsconfig.json5
-rw-r--r--examples/with-tailwind/packages/ui/tsup.config.ts13
17 files changed, 234 insertions, 0 deletions
diff --git a/examples/with-tailwind/packages/eslint-config-custom/index.js b/examples/with-tailwind/packages/eslint-config-custom/index.js
new file mode 100644
index 0000000..c9523f1
--- /dev/null
+++ b/examples/with-tailwind/packages/eslint-config-custom/index.js
@@ -0,0 +1,11 @@
+module.exports = {
+ extends: ["next", "turbo", "prettier"],
+ rules: {
+ "@next/next/no-html-link-for-pages": "off",
+ },
+ parserOptions: {
+ babelOptions: {
+ presets: [require.resolve("next/babel")],
+ },
+ },
+};
diff --git a/examples/with-tailwind/packages/eslint-config-custom/package.json b/examples/with-tailwind/packages/eslint-config-custom/package.json
new file mode 100644
index 0000000..a423424
--- /dev/null
+++ b/examples/with-tailwind/packages/eslint-config-custom/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "eslint-config-custom",
+ "version": "0.0.0",
+ "main": "index.js",
+ "license": "MIT",
+ "dependencies": {
+ "eslint-config-next": "latest",
+ "eslint-config-prettier": "^8.3.0",
+ "eslint-plugin-react": "7.28.0",
+ "eslint-config-turbo": "latest"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/examples/with-tailwind/packages/tailwind-config/package.json b/examples/with-tailwind/packages/tailwind-config/package.json
new file mode 100644
index 0000000..fbf983c
--- /dev/null
+++ b/examples/with-tailwind/packages/tailwind-config/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "tailwind-config",
+ "version": "0.0.0",
+ "private": true,
+ "main": "index.js",
+ "devDependencies": {
+ "tailwindcss": "^3.2.4"
+ }
+}
diff --git a/examples/with-tailwind/packages/tailwind-config/tailwind.config.js b/examples/with-tailwind/packages/tailwind-config/tailwind.config.js
new file mode 100644
index 0000000..c0f237b
--- /dev/null
+++ b/examples/with-tailwind/packages/tailwind-config/tailwind.config.js
@@ -0,0 +1,19 @@
+const colors = require("tailwindcss/colors");
+
+module.exports = {
+ content: [
+ // app content
+ `src/**/*.{js,ts,jsx,tsx}`,
+ // include packages if not transpiling
+ // "../../packages/**/*.{js,ts,jsx,tsx}",
+ ],
+ theme: {
+ extend: {
+ colors: {
+ brandblue: colors.blue[500],
+ brandred: colors.red[500],
+ },
+ },
+ },
+ plugins: [],
+};
diff --git a/examples/with-tailwind/packages/tsconfig/base.json b/examples/with-tailwind/packages/tsconfig/base.json
new file mode 100644
index 0000000..d72a9f3
--- /dev/null
+++ b/examples/with-tailwind/packages/tsconfig/base.json
@@ -0,0 +1,20 @@
+{
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "display": "Default",
+ "compilerOptions": {
+ "composite": false,
+ "declaration": true,
+ "declarationMap": true,
+ "esModuleInterop": true,
+ "forceConsistentCasingInFileNames": true,
+ "inlineSources": false,
+ "isolatedModules": true,
+ "moduleResolution": "node",
+ "noUnusedLocals": false,
+ "noUnusedParameters": false,
+ "preserveWatchOutput": true,
+ "skipLibCheck": true,
+ "strict": true
+ },
+ "exclude": ["node_modules"]
+}
diff --git a/examples/with-tailwind/packages/tsconfig/nextjs.json b/examples/with-tailwind/packages/tsconfig/nextjs.json
new file mode 100644
index 0000000..91cd404
--- /dev/null
+++ b/examples/with-tailwind/packages/tsconfig/nextjs.json
@@ -0,0 +1,22 @@
+{
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "display": "Next.js",
+ "extends": "./base.json",
+ "compilerOptions": {
+ "target": "es5",
+ "lib": ["dom", "dom.iterable", "esnext"],
+ "allowJs": true,
+ "skipLibCheck": true,
+ "strict": false,
+ "forceConsistentCasingInFileNames": true,
+ "noEmit": true,
+ "incremental": true,
+ "esModuleInterop": true,
+ "module": "esnext",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "jsx": "preserve"
+ },
+ "include": ["src", "next-env.d.ts"],
+ "exclude": ["node_modules"]
+}
diff --git a/examples/with-tailwind/packages/tsconfig/package.json b/examples/with-tailwind/packages/tsconfig/package.json
new file mode 100644
index 0000000..6efb83e
--- /dev/null
+++ b/examples/with-tailwind/packages/tsconfig/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "tsconfig",
+ "version": "0.0.0",
+ "private": true,
+ "license": "MIT",
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/examples/with-tailwind/packages/tsconfig/react-library.json b/examples/with-tailwind/packages/tsconfig/react-library.json
new file mode 100644
index 0000000..6d6a7fe
--- /dev/null
+++ b/examples/with-tailwind/packages/tsconfig/react-library.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "display": "React Library",
+ "extends": "./base.json",
+ "compilerOptions": {
+ "lib": ["ES2015"],
+ "module": "ESNext",
+ "target": "ES6",
+ "jsx": "react-jsx"
+ }
+}
diff --git a/examples/with-tailwind/packages/ui/package.json b/examples/with-tailwind/packages/ui/package.json
new file mode 100644
index 0000000..be2c395
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/package.json
@@ -0,0 +1,32 @@
+{
+ "name": "ui",
+ "version": "0.0.0",
+ "sideEffects": [
+ "**/*.css"
+ ],
+ "types": "./dist/index.d.ts",
+ "exports": {
+ ".": "./dist",
+ "./styles.css": "./dist/index.css"
+ },
+ "license": "MIT",
+ "scripts": {
+ "build": "tsup",
+ "dev": "tsup --watch",
+ "check-types": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^18.2.0"
+ },
+ "devDependencies": {
+ "@types/react": "^18.0.26",
+ "eslint": "^7.32.0",
+ "eslint-config-custom": "workspace:*",
+ "postcss": "^8.4.20",
+ "react": "^18.2.0",
+ "tailwind-config": "workspace:*",
+ "tsconfig": "workspace:*",
+ "tsup": "^6.1.3",
+ "typescript": "^4.9.4"
+ }
+}
diff --git a/examples/with-tailwind/packages/ui/postcss.config.js b/examples/with-tailwind/packages/ui/postcss.config.js
new file mode 100644
index 0000000..07aa434
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/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/packages/ui/src/Button.tsx b/examples/with-tailwind/packages/ui/src/Button.tsx
new file mode 100644
index 0000000..495d02a
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/src/Button.tsx
@@ -0,0 +1,16 @@
+import * as React from "react";
+
+export const Button = () => {
+ return (
+ <div className="rounded-md ">
+ <a href="https://turbo.build/repo/docs">
+ <div className="ui-flex ui-w-full ui-items-center ui-justify-center ui-rounded-md ui-border ui-border-transparent ui-px-8 ui-py-3 ui-text-base ui-font-medium ui-no-underline ui-bg-white ui-text-black hover:ui-bg-gray-300 md:ui-py-3 md:ui-px-10 md:ui-text-lg md:ui-leading-6">
+ Read the docs
+ <span className="ui-ml-2 ui-bg-gradient-to-r ui-from-brandred ui-to-brandblue ui-bg-clip-text ui-text-transparent">
+ →
+ </span>
+ </div>
+ </a>
+ </div>
+ );
+};
diff --git a/examples/with-tailwind/packages/ui/src/Card.tsx b/examples/with-tailwind/packages/ui/src/Card.tsx
new file mode 100644
index 0000000..6083de2
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/src/Card.tsx
@@ -0,0 +1,27 @@
+import * as React from "react";
+
+export const Card = ({
+ title,
+ cta,
+ href,
+}: {
+ title: string;
+ cta: string;
+ href: string;
+}) => {
+ return (
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ href={href}
+ className="ui-group ui-mt-4 ui-rounded-lg ui-border ui-border-transparent ui-overflow-hidden ui-bg-origin-border ui-bg-gradient-to-r ui-from-brandred ui-to-brandblue ui-text-[#6b7280]"
+ >
+ <div className="ui-p-4 ui-bg-zinc-900 ui-h-full">
+ <p className="ui-inline-block ui-text-xl ui-text-white">{title}</p>
+ <div className="ui-text-xs ui-mt-4 group-hover:ui-underline">
+ {cta} →
+ </div>
+ </div>
+ </a>
+ );
+};
diff --git a/examples/with-tailwind/packages/ui/src/index.tsx b/examples/with-tailwind/packages/ui/src/index.tsx
new file mode 100644
index 0000000..8af7073
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/src/index.tsx
@@ -0,0 +1,6 @@
+// styles
+import "./styles.css";
+
+// components
+export * from "./Button";
+export * from "./Card";
diff --git a/examples/with-tailwind/packages/ui/src/styles.css b/examples/with-tailwind/packages/ui/src/styles.css
new file mode 100644
index 0000000..b5c61c9
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/src/styles.css
@@ -0,0 +1,3 @@
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
diff --git a/examples/with-tailwind/packages/ui/tailwind.config.js b/examples/with-tailwind/packages/ui/tailwind.config.js
new file mode 100644
index 0000000..23887e6
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/tailwind.config.js
@@ -0,0 +1,7 @@
+const sharedConfig = require("tailwind-config/tailwind.config.js");
+
+module.exports = {
+ // prefix ui lib classes to avoid conflicting with the app
+ prefix: "ui-",
+ presets: [sharedConfig],
+};
diff --git a/examples/with-tailwind/packages/ui/tsconfig.json b/examples/with-tailwind/packages/ui/tsconfig.json
new file mode 100644
index 0000000..cd6c94d
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/tsconfig.json
@@ -0,0 +1,5 @@
+{
+ "extends": "tsconfig/react-library.json",
+ "include": ["."],
+ "exclude": ["dist", "build", "node_modules"]
+}
diff --git a/examples/with-tailwind/packages/ui/tsup.config.ts b/examples/with-tailwind/packages/ui/tsup.config.ts
new file mode 100644
index 0000000..7b2189a
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/tsup.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig, Options } from "tsup";
+
+export default defineConfig((options: Options) => ({
+ treeshake: true,
+ splitting: true,
+ entry: ["src/**/*.tsx"],
+ format: ["esm"],
+ dts: true,
+ minify: true,
+ clean: true,
+ external: ["react"],
+ ...options,
+}));