Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/upstash/react-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
chronark committed Oct 10, 2023
2 parents 5512ce9 + 5c5339e commit 1be17a0
Show file tree
Hide file tree
Showing 34 changed files with 371 additions and 200 deletions.
5 changes: 0 additions & 5 deletions .changeset/curvy-buckets-cheat.md

This file was deleted.

40 changes: 40 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://biomejs.dev/schemas/1.0.0/schema.json",
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"a11y": {
"noSvgWithoutTitle": "off",
"useButtonType": "warn"
},
"correctness": {
"noUnusedVariables": "warn"
},
"security": {
"recommended": true
},
"style": {
"useBlockStatements": "error",
"noNonNullAssertion": "off"
},
"performance": {
"recommended": true
},
"suspicious": {
"noArrayIndexKey": "off"
}
},
"ignore": ["node_modules", ".next", "dist", ".turbo"]
},
"formatter": {
"indentStyle": "space",
"indentSize": 2,
"enabled": true,
"lineWidth": 120,
"ignore": ["node_modules", ".next", "dist", ".turbo"]
}
}
6 changes: 5 additions & 1 deletion examples/nextjs13/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

.env*
.env*

# vscode

.vscode
4 changes: 0 additions & 4 deletions examples/nextjs13/.vscode/settings.json

This file was deleted.

31 changes: 31 additions & 0 deletions examples/nextjs13/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# nextjs13

## 0.1.25

### Patch Changes

- ff6d5ba: Bumped postcss version to get rid of dependabot warning
- Updated dependencies [ff6d5ba]
- @upstash/react-databrowser@0.0.7
- @upstash/react-cli@1.0.10

## 0.1.24

### Patch Changes

- Updated dependencies [3dcd8d7]
- @upstash/react-cli@1.0.9

## 0.1.23

### Patch Changes

- Updated dependencies [c51eb3a]
- @upstash/react-databrowser@0.0.6
- @upstash/react-cli@1.0.8

## 0.1.22

### Patch Changes

- Updated dependencies [3b2095b]
- @upstash/react-databrowser@0.0.5

## 0.1.21

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions examples/nextjs13/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nextjs13",
"version": "0.1.21",
"version": "0.1.25",
"private": true,
"scripts": {
"dev": "next dev",
Expand All @@ -25,7 +25,7 @@
},
"devDependencies": {
"autoprefixer": "^10.4.14",
"postcss": "^8.4.22",
"postcss": "^8.4.31",
"tailwindcss": "^3.3.1"
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"build": "turbo run build",
"dev": "turbo run dev --parallel",
"test": "turbo run test",
"fmt": "pnpm rome check . --apply-suggested && pnpm rome format . --write",
"fmt": "pnpm biome format . --write && pnpm biome check . --apply-unsafe ",
"prepare": "husky install",
"bump-versions": "pnpm changeset version && pnpm install"
},
Expand All @@ -16,8 +16,8 @@
"lint-staged": "^13.0.3",
"prettier": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.5.5",
"rome": "^11.0.0",
"turbo": "^1.9.3"
"turbo": "^1.9.3",
"@biomejs/biome": "^1.2.2"
},
"lint-staged": {
"**/*.{js,ts,tsx}": [
Expand Down
18 changes: 18 additions & 0 deletions packages/react-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# @upstash/react-cli

## 1.0.10

### Patch Changes

- ff6d5ba: Bumped postcss version to get rid of dependabot warning

## 1.0.9

### Patch Changes

- 3dcd8d7: Add Vite to enable standalone mode in the CLI

## 1.0.8

### Patch Changes

- c51eb3a: Applied formatter and linter

## 1.0.7

### Patch Changes
Expand Down
12 changes: 12 additions & 0 deletions packages/react-cli/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CLI Playground</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/playground.tsx"></script>
</body>
</html>
11 changes: 7 additions & 4 deletions packages/react-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@upstash/react-cli",
"version": "1.0.7",
"version": "1.0.10",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"license": "MIT",
Expand All @@ -17,19 +17,22 @@
],
"author": "Andreas Thomas <[email protected]>",
"scripts": {
"build": "tsup"
"build": "tsup",
"dev": "vite"
},
"devDependencies": {
"@types/node": "^18.15.11",
"@types/react": "^18.0.37",
"@types/react-dom": "^18.0.11",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.22",
"postcss": "^8.4.31",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tailwindcss": "^3.3.1",
"tsup": "^6.7.0",
"typescript": "^5.0.4"
"typescript": "^5.0.4",
"@vitejs/plugin-react": "^4.1.0",
"vite": "^4.4.10"
},
"peerDependencies": {
"react": "^18.2.0",
Expand Down
36 changes: 36 additions & 0 deletions packages/react-cli/src/playground.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { RedisCli } from "./redis-cli";
import "./cli.css";

ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<main
style={{
height: "100vh",
width: "100vw",
display: "flex",
alignItems: "center",
justifyContent: "center",
flexDirection: "column",
background: "rgb(250,250,250)",
}}
>
<div
style={{
height: "100%",
width: "100%",
maxHeight: "32rem",
maxWidth: "48rem",
borderRadius: "0.5rem",
overflow: "hidden",
}}
>
<RedisCli
token={process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN!}
url={process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_URL!}
/>
</div>
</main>
</React.StrictMode>,
);
14 changes: 10 additions & 4 deletions packages/react-cli/src/redis-cli.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const RedisCli: React.FC<CliProps> = (props) => {
const [stdin, setStdin] = useState("");

const specialCommands: Record<string, Command> = {
clear: (ctx) => {
clear: (_ctx) => {
setResults([]);
setHistoryIndex(null);
setStdin("");
Expand Down Expand Up @@ -158,9 +158,13 @@ export const RedisCli: React.FC<CliProps> = (props) => {
* the input should be updated to the command that they are currently on
*/
useEffect(() => {
if (historyIndex === null) return;
if (historyIndex === null) {
return;
}
const cmd = history[historyIndex];
if (!cmd) return;
if (!cmd) {
return;
}
setStdin(cmd);
}, [historyIndex, history]);

Expand All @@ -173,7 +177,9 @@ export const RedisCli: React.FC<CliProps> = (props) => {
*/
const onEnter = async () => {
try {
if (loading) return;
if (loading) {
return;
}
setLoading(true);

const command = stdin.trim();
Expand Down
2 changes: 1 addition & 1 deletion packages/react-cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/* Language and Environment */
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
"jsx": "react", /* Specify what JSX code is generated. */
"jsx": "react-jsx", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
Expand Down
12 changes: 12 additions & 0 deletions packages/react-cli/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";

export default ({ mode }: { mode: string }) => {
const env = loadEnv(mode, process.cwd(), "");
return defineConfig({
define: {
"process.env": env,
},
plugins: [react()],
});
};
18 changes: 18 additions & 0 deletions packages/react-databrowser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# @upstash/react-databrowser

## 0.0.7

### Patch Changes

- ff6d5ba: Bumped postcss version to get rid of dependabot warning

## 0.0.6

### Patch Changes

- c51eb3a: Applied formatter and linter

## 0.0.5

### Patch Changes

- 3b2095b: update publishConfig

## 0.0.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react-databrowser/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"components": "@/components",
"utils": "@/lib/utils"
}
}
}
6 changes: 3 additions & 3 deletions packages/react-databrowser/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@upstash/react-databrowser",
"version": "0.0.4",
"version": "0.0.7",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"license": "MIT",
"private": false,
"publishConfig": {
"access": "public"
},
},
"bugs": {
"url": "https://github.com/upstash/react-ui/issues"
},
Expand All @@ -29,7 +29,7 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"lucide-react": "^0.279.0",
"postcss": "^8.4.22",
"postcss": "^8.4.31",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tailwind-merge": "^1.14.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { Loader2 } from "lucide-react";
import { FormEvent, useState } from "react";

const expUnit = ["Second(s)", "Minute(s)", "Hour(s)", "Day(s)", "Week(s)", "Month(s)", "Year(s)"] as const;
export type ExpUnitUnion = typeof expUnit[number];
export type ExpUnitUnion = (typeof expUnit)[number];

type Props = {
onNewDataAdd: (dataKey?: [string, RedisDataTypeUnion]) => void;
Expand All @@ -52,7 +52,9 @@ export function AddDataDialog({ onNewDataAdd }: Props) {
const expUnit = formData.get("exp-unit") as ExpUnitUnion;
const ttl = convertToSeconds(expUnit, exp);
const ok = await addData.mutateAsync([key, value, ttl]);
if (!(key && value)) throw new Error("Missing key or value data");
if (!(key && value)) {
throw new Error("Missing key or value data");
}

if (ok) {
toast({
Expand Down
Loading

1 comment on commit 1be17a0

@vercel
Copy link

@vercel vercel bot commented on 1be17a0 Oct 10, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

react-ui – ./

upstash-react-cli.vercel.app
react-ui-git-main-upstash.vercel.app
react-ui-upstash.vercel.app

Please sign in to comment.