aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/examples/with-create-react-app/packages/ui
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-create-react-app/packages/ui
parentfc8c5fdce62fb229202659408798a7b6c98f6e8b (diff)
downloadHydroRoll-8b2c4a38a461ff5ecc95972291bc711e2c5dec9a.tar.gz
HydroRoll-8b2c4a38a461ff5ecc95972291bc711e2c5dec9a.zip
Diffstat (limited to 'examples/with-create-react-app/packages/ui')
-rw-r--r--examples/with-create-react-app/packages/ui/.eslintrc.js1
-rw-r--r--examples/with-create-react-app/packages/ui/package.json25
-rw-r--r--examples/with-create-react-app/packages/ui/src/Link.tsx20
-rw-r--r--examples/with-create-react-app/packages/ui/src/index.tsx4
-rw-r--r--examples/with-create-react-app/packages/ui/tsconfig.json5
5 files changed, 55 insertions, 0 deletions
diff --git a/examples/with-create-react-app/packages/ui/.eslintrc.js b/examples/with-create-react-app/packages/ui/.eslintrc.js
new file mode 100644
index 0000000..3f6c1e9
--- /dev/null
+++ b/examples/with-create-react-app/packages/ui/.eslintrc.js
@@ -0,0 +1 @@
+module.exports = require("../eslint-config-custom");
diff --git a/examples/with-create-react-app/packages/ui/package.json b/examples/with-create-react-app/packages/ui/package.json
new file mode 100644
index 0000000..e9aedab
--- /dev/null
+++ b/examples/with-create-react-app/packages/ui/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "ui",
+ "version": "0.0.0",
+ "private": true,
+ "license": "MIT",
+ "sideEffects": false,
+ "main": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "scripts": {
+ "build": "tsup src/index.tsx --format cjs --dts --external react",
+ "clean": "rm -rf dist",
+ "dev": "tsup src/index.tsx --format cjs --watch --dts --external react",
+ "lint": "eslint \"src/**/*.ts*\""
+ },
+ "devDependencies": {
+ "@types/react": "^17.0.13",
+ "@types/react-dom": "^17.0.8",
+ "eslint": "^8.4.1",
+ "eslint-config-custom": "workspace:*",
+ "react": "^17.0.2",
+ "tsconfig": "workspace:*",
+ "tsup": "^5.10.1",
+ "typescript": "^4.5.3"
+ }
+}
diff --git a/examples/with-create-react-app/packages/ui/src/Link.tsx b/examples/with-create-react-app/packages/ui/src/Link.tsx
new file mode 100644
index 0000000..416bac8
--- /dev/null
+++ b/examples/with-create-react-app/packages/ui/src/Link.tsx
@@ -0,0 +1,20 @@
+import * as React from "react";
+
+interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
+ children: React.ReactNode;
+ href: string;
+}
+
+export const Link = (props: LinkProps) => {
+ const { children, href, ...rest } = props;
+
+ if (rest.target === "_blank") {
+ rest.rel = "noopener noreferrer";
+ }
+
+ return (
+ <a href={href} {...rest}>
+ {children}
+ </a>
+ );
+};
diff --git a/examples/with-create-react-app/packages/ui/src/index.tsx b/examples/with-create-react-app/packages/ui/src/index.tsx
new file mode 100644
index 0000000..c7aa624
--- /dev/null
+++ b/examples/with-create-react-app/packages/ui/src/index.tsx
@@ -0,0 +1,4 @@
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+import * as React from "react";
+
+export * from "./Link";
diff --git a/examples/with-create-react-app/packages/ui/tsconfig.json b/examples/with-create-react-app/packages/ui/tsconfig.json
new file mode 100644
index 0000000..ad010d9
--- /dev/null
+++ b/examples/with-create-react-app/packages/ui/tsconfig.json
@@ -0,0 +1,5 @@
+{
+ "extends": "tsconfig/react-library.json",
+ "include": ["."],
+ "exclude": ["dist", "node_modules"]
+}