aboutsummaryrefslogtreecommitdiffstats
path: root/src/packages/react
diff options
context:
space:
mode:
authorMatthew Strapp <matt@mattstrapp.net>2024-11-01 10:16:44 -0500
committerGitHub <noreply@github.com>2024-11-01 10:16:44 -0500
commit9c3cef2cda489501a177c34ebe47951321284463 (patch)
treea6b45cdef7acde058ee033c386b93fa819e15c36 /src/packages/react
parentbadge bleach (diff)
downloadlocusts-9c3cef2cda489501a177c34ebe47951321284463.tar
locusts-9c3cef2cda489501a177c34ebe47951321284463.tar.gz
locusts-9c3cef2cda489501a177c34ebe47951321284463.tar.bz2
locusts-9c3cef2cda489501a177c34ebe47951321284463.tar.lz
locusts-9c3cef2cda489501a177c34ebe47951321284463.tar.xz
locusts-9c3cef2cda489501a177c34ebe47951321284463.tar.zst
locusts-9c3cef2cda489501a177c34ebe47951321284463.zip
feat: Add React (#38)
* feat: Add React Closes #35 Signed-off-by: Matt Strapp <matt@mattstrapp.net> * lint Signed-off-by: Matt Strapp <matt@mattstrapp.net> * docs Signed-off-by: Matt Strapp <matt@mattstrapp.net> * lint Signed-off-by: Matt Strapp <matt@mattstrapp.net> * add keywords Signed-off-by: Matt Strapp <matt@mattstrapp.net> --------- Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to 'src/packages/react')
-rw-r--r--src/packages/react/.gitignore24
-rw-r--r--src/packages/react/README.md26
-rw-r--r--src/packages/react/eslint.config.mjs33
-rw-r--r--src/packages/react/package.json58
-rw-r--r--src/packages/react/src/components/Locusts.tsx5
-rw-r--r--src/packages/react/src/index.ts3
-rw-r--r--src/packages/react/src/vite-env.d.ts1
-rw-r--r--src/packages/react/tsconfig.json17
-rw-r--r--src/packages/react/vite.config.ts22
9 files changed, 189 insertions, 0 deletions
diff --git a/src/packages/react/.gitignore b/src/packages/react/.gitignore
new file mode 100644
index 0000000..a547bf3
--- /dev/null
+++ b/src/packages/react/.gitignore
@@ -0,0 +1,24 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+dist
+dist-ssr
+*.local
+
+# Editor directories and files
+.vscode/*
+!.vscode/extensions.json
+.idea
+.DS_Store
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/src/packages/react/README.md b/src/packages/react/README.md
new file mode 100644
index 0000000..39a04eb
--- /dev/null
+++ b/src/packages/react/README.md
@@ -0,0 +1,26 @@
+# @locusts/react
+
+[![CI](https://github.com/locusts-r-us/locusts/actions/workflows/node.yml/badge.svg)](https://github.com/locusts-r-us/locusts/actions/workflows/node.yml)
+[![NPM Version](https://img.shields.io/npm/v/%40locusts%2Freact?logo=react)](https://www.npmjs.com/package/@locusts/react)
+
+## Description
+
+@locusts/react is a member of a [series of components](https://github.com/locusts-r-us/locusts) that allows you to introduce locusts into your website.
+
+Why would you want to do that? I don't know.
+
+## Installation
+
+```bash
+npm install -D @locusts/react
+```
+
+## Usage
+
+```tsx
+import { Locusts } from "@locusts/react";
+
+export default function App() {
+ return <Locusts />;
+}
+```
diff --git a/src/packages/react/eslint.config.mjs b/src/packages/react/eslint.config.mjs
new file mode 100644
index 0000000..f49f020
--- /dev/null
+++ b/src/packages/react/eslint.config.mjs
@@ -0,0 +1,33 @@
+import library from "@repo/eslint-config/eslint.library.config.js";
+
+import globals from "globals";
+import react from "eslint-plugin-react";
+import reactHooks from "eslint-plugin-react-hooks";
+import reactRefresh from "eslint-plugin-react-refresh";
+import tseslint from "typescript-eslint";
+
+export default tseslint.config(
+ { ignores: ["dist"] },
+ {
+ extends: [...library],
+ files: ["**/*.{ts,tsx}"],
+ languageOptions: {
+ ecmaVersion: 2020,
+ globals: globals.browser,
+ },
+ plugins: {
+ "react-hooks": reactHooks,
+ "react-refresh": reactRefresh,
+ react,
+ },
+ rules: {
+ ...reactHooks.configs.recommended.rules,
+ "react-refresh/only-export-components": [
+ "warn",
+ { allowConstantExport: true },
+ ],
+ ...react.configs.recommended.rules,
+ ...react.configs["jsx-runtime"].rules,
+ },
+ },
+);
diff --git a/src/packages/react/package.json b/src/packages/react/package.json
new file mode 100644
index 0000000..3bab515
--- /dev/null
+++ b/src/packages/react/package.json
@@ -0,0 +1,58 @@
+{
+ "name": "@locusts/react",
+ "version": "0.0.0",
+ "description": "A React component that introduces locusts into your website.",
+ "author": "Matt Strapp <matt+locusts@mattstrapp.net> (https://mattstrapp.net)",
+ "bugs": "https://github.com/locusts-r-us/locusts/issues",
+ "license": "0BSD",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/locusts-r-us/locusts.git",
+ "directory": "packages/vue"
+ },
+ "files": [
+ "dist"
+ ],
+ "main": "./dist/locusts.umd.cjs",
+ "module": "./dist/locusts.js",
+ "type": "module",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.ts",
+ "import": "./dist/locusts.js",
+ "require": "./dist/locusts.umd.cjs"
+ }
+ },
+ "keywords": [
+ "react",
+ "component",
+ "why",
+ "joke"
+ ],
+ "types": "./dist/index.d.ts",
+ "scripts": {
+ "dev": "vite",
+ "build": "vite build && tsc --declaration --emitDeclarationOnly && publint",
+ "format": "prettier --write . && eslint --fix .",
+ "lint": "prettier --check . && eslint .",
+ "preview": "vite preview"
+ },
+ "peerDependencies": {
+ "react": ">=18.0.0"
+ },
+ "devDependencies": {
+ "@repo/eslint-config": "workspace:*",
+ "@repo/typescript-config": "workspace:*",
+ "@types/react": "^18.3.12",
+ "@types/react-dom": "^18.3.1",
+ "@vitejs/plugin-react-swc": "^3.5.0",
+ "eslint-plugin-react": "^7.37.2",
+ "eslint-plugin-react-hooks": "^5.0.0",
+ "eslint-plugin-react-refresh": "^0.4.14",
+ "globals": "^15.11.0",
+ "publint": "^0.2.0",
+ "typescript": "^5.6.2",
+ "typescript-eslint": "^8.11.0",
+ "vite": "^5.4.10"
+ }
+}
diff --git a/src/packages/react/src/components/Locusts.tsx b/src/packages/react/src/components/Locusts.tsx
new file mode 100644
index 0000000..37aff97
--- /dev/null
+++ b/src/packages/react/src/components/Locusts.tsx
@@ -0,0 +1,5 @@
+export const Locusts = () => {
+ return <></>;
+};
+
+export default Locusts;
diff --git a/src/packages/react/src/index.ts b/src/packages/react/src/index.ts
new file mode 100644
index 0000000..10e55c7
--- /dev/null
+++ b/src/packages/react/src/index.ts
@@ -0,0 +1,3 @@
+import Locusts from "./components/Locusts";
+
+export { Locusts };
diff --git a/src/packages/react/src/vite-env.d.ts b/src/packages/react/src/vite-env.d.ts
new file mode 100644
index 0000000..11f02fe
--- /dev/null
+++ b/src/packages/react/src/vite-env.d.ts
@@ -0,0 +1 @@
+/// <reference types="vite/client" />
diff --git a/src/packages/react/tsconfig.json b/src/packages/react/tsconfig.json
new file mode 100644
index 0000000..4928d20
--- /dev/null
+++ b/src/packages/react/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "extends": "@repo/typescript-config/base.json",
+ "compilerOptions": {
+ "allowImportingTsExtensions": true,
+ "outDir": "dist",
+ "declaration": true,
+ "declarationDir": "dist",
+ "emitDeclarationOnly": true,
+ "module": "ESNext",
+ "moduleResolution": "Bundler",
+ "skipLibCheck": true,
+ "jsx": "react-jsx",
+ "useDefineForClassFields": true
+ },
+ "exclude": ["node_modules", "dist"],
+ "include": ["src"]
+}
diff --git a/src/packages/react/vite.config.ts b/src/packages/react/vite.config.ts
new file mode 100644
index 0000000..d43457e
--- /dev/null
+++ b/src/packages/react/vite.config.ts
@@ -0,0 +1,22 @@
+import { defineConfig } from "vite";
+import react from "@vitejs/plugin-react-swc";
+
+// https://vite.dev/config/
+export default defineConfig({
+ plugins: [react()],
+ build: {
+ lib: {
+ entry: "src/index.ts",
+ name: "Locusts",
+ fileName: "locusts",
+ },
+ rollupOptions: {
+ external: ["react"],
+ output: {
+ globals: {
+ react: "React",
+ },
+ },
+ },
+ },
+});