Skip to content

Commit 2556895

Browse files
committed
initialize repo
0 parents  commit 2556895

File tree

18 files changed

+1064
-0
lines changed

18 files changed

+1064
-0
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
UPSTASH_REDIS_REST_URL=
2+
UPSTASH_REDIS_REST_TOKEN=

.github/workflows/release.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repo
14+
uses: actions/checkout@v3
15+
16+
- name: Set env
17+
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v2
21+
with:
22+
node-version: 18
23+
24+
- name: Set package version
25+
run: echo $(jq --arg v "${{ env.VERSION }}" '(.version) = $v' package.json) > package.json
26+
27+
- name: Setup Bun
28+
uses: oven-sh/setup-bun@v1
29+
with:
30+
bun-version: latest
31+
32+
- name: Install dependencies
33+
run: bun install
34+
35+
- name: Build
36+
run: bun run build
37+
38+
- name: Add npm token
39+
run: echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" > .npmrc
40+
41+
- name: Publish release candidate
42+
if: "github.event.release.prerelease"
43+
run: npm publish --access public --tag=canary
44+
45+
- name: Publish
46+
if: "!github.event.release.prerelease"
47+
run: npm publish --access public

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.env
2+
3+
# dependencies
4+
**node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
.idea
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
.pnpm-debug.log*
28+
29+
# local env files
30+
.env*.local
31+
32+
# vercel
33+
.vercel
34+
35+
# typescript
36+
*.tsbuildinfo
37+
next-env.d.ts
38+
39+
.turbo
40+
dist

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bun run lint-staged

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# React Redis ClI for Upstash Redis
2+
3+
`@upstash/react-redis-cli` is a React component that provides a CLI interface to interact with Upstash Redis.
4+
5+
<img src="public%2Fredis-cli.png" width="640px" />
6+
7+
### Install
8+
9+
Install the component via npm:
10+
11+
```bash
12+
$ npm install @upstash/react-redis-cli
13+
```
14+
15+
### Usage
16+
17+
Here's a basic example of how to use the component:
18+
19+
```tsx
20+
import { RedisCli } from "@upstash/react-redis-cli"
21+
22+
import "@upstash/react-redis-cli/dist/index.css"
23+
24+
export default function Page() {
25+
return (
26+
<main style={mainStyle}>
27+
<RedisCli url={UPSTASH_REDIS_REST_URL} token={UPSTASH_REDIS_REST_TOKEN} />
28+
</main>
29+
)
30+
}
31+
32+
const mainStyle = {
33+
width: "100vw",
34+
maxWidth: "900px",
35+
height: "500px",
36+
margin: "0 auto",
37+
}
38+
```

bun.lockb

147 KB
Binary file not shown.

eslint.config.mjs

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import path from "node:path"
2+
import { fileURLToPath } from "node:url"
3+
import { FlatCompat } from "@eslint/eslintrc"
4+
import js from "@eslint/js"
5+
import typescriptEslint from "@typescript-eslint/eslint-plugin"
6+
import unicorn from "eslint-plugin-unicorn"
7+
8+
const __filename = fileURLToPath(import.meta.url)
9+
const __dirname = path.dirname(__filename)
10+
const compat = new FlatCompat({
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all,
14+
})
15+
16+
export default [
17+
{
18+
ignores: ["**/*.config.*", "**/examples", "**/dist"],
19+
},
20+
...compat.extends(
21+
"eslint:recommended",
22+
"plugin:unicorn/recommended",
23+
"plugin:@typescript-eslint/recommended"
24+
),
25+
{
26+
plugins: {
27+
"@typescript-eslint": typescriptEslint,
28+
unicorn,
29+
},
30+
31+
languageOptions: {
32+
globals: {},
33+
ecmaVersion: 5,
34+
sourceType: "script",
35+
36+
parserOptions: {
37+
project: "./tsconfig.json",
38+
},
39+
},
40+
41+
rules: {
42+
"no-console": [
43+
"error",
44+
{
45+
allow: ["warn", "error"],
46+
},
47+
],
48+
49+
"@typescript-eslint/no-magic-numbers": "off",
50+
"@typescript-eslint/unbound-method": "off",
51+
"@typescript-eslint/prefer-as-const": "error",
52+
"@typescript-eslint/consistent-type-imports": "error",
53+
"@typescript-eslint/no-explicit-any": "off",
54+
"@typescript-eslint/restrict-template-expressions": "off",
55+
56+
"@typescript-eslint/no-unused-vars": [
57+
"error",
58+
{
59+
varsIgnorePattern: "^_",
60+
argsIgnorePattern: "^_",
61+
},
62+
],
63+
64+
"@typescript-eslint/prefer-ts-expect-error": "off",
65+
66+
"@typescript-eslint/no-misused-promises": [
67+
"error",
68+
{
69+
checksVoidReturn: false,
70+
},
71+
],
72+
73+
"unicorn/prevent-abbreviations": "off",
74+
75+
"no-implicit-coercion": [
76+
"error",
77+
{
78+
boolean: true,
79+
},
80+
],
81+
82+
"no-extra-boolean-cast": [
83+
"error",
84+
{
85+
enforceForLogicalOperands: true,
86+
},
87+
],
88+
89+
"no-unneeded-ternary": [
90+
"error",
91+
{
92+
defaultAssignment: true,
93+
},
94+
],
95+
96+
"unicorn/no-array-reduce": ["off"],
97+
"unicorn/no-nested-ternary": "off",
98+
"unicorn/no-null": "off",
99+
"unicorn/filename-case": "off",
100+
},
101+
},
102+
]

index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>CLI Playground</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="/src/playground.tsx"></script>
11+
</body>
12+
</html>

package.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "@upstash/react-redis-cli",
3+
"version": "0.0.0",
4+
"main": "./dist/index.js",
5+
"types": "./dist/index.d.ts",
6+
"license": "MIT",
7+
"private": false,
8+
"publishConfig": {
9+
"access": "public"
10+
},
11+
"bugs": {
12+
"url": "https://github.com/upstash/react-redis-cli/issues"
13+
},
14+
"homepage": "https://github.com/upstash/react-redis-cli",
15+
"files": [
16+
"./dist/**"
17+
],
18+
"scripts": {
19+
"build": "tsup",
20+
"dev": "vite",
21+
"lint": "tsc && eslint",
22+
"fmt": "prettier --write .",
23+
"prepare": "husky"
24+
},
25+
"lint-staged": {
26+
"**/*.{js,ts,tsx}": [
27+
"prettier --write",
28+
"eslint --fix"
29+
]
30+
},
31+
"devDependencies": {
32+
"@ianvs/prettier-plugin-sort-imports": "^4.4.0",
33+
"@types/node": "^18.15.11",
34+
"@types/react": "^18.0.37",
35+
"@types/react-dom": "^18.0.11",
36+
"@typescript-eslint/eslint-plugin": "8.4.0",
37+
"@typescript-eslint/parser": "8.4.0",
38+
"@vitejs/plugin-react": "^4.1.0",
39+
"autoprefixer": "^10.4.14",
40+
"eslint": "9.10.0",
41+
"eslint-plugin-unicorn": "55.0.0",
42+
"husky": "^9.1.6",
43+
"lint-staged": "^15.2.10",
44+
"postcss": "^8.4.31",
45+
"prettier": "^3.0.3",
46+
"prettier-plugin-tailwindcss": "^0.5.5",
47+
"react": "^18.2.0",
48+
"react-dom": "^18.2.0",
49+
"tsup": "^6.7.0",
50+
"typescript": "^5.0.4",
51+
"vite": "^4.4.10"
52+
},
53+
"peerDependencies": {
54+
"react": "^18.2.0 || ^19",
55+
"react-dom": "^18.2.0 || ^19"
56+
},
57+
"dependencies": {
58+
"@radix-ui/react-scroll-area": "^1.0.3"
59+
}
60+
}

prettier.config.mjs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* @type {import('prettier').Config & import('prettier-plugin-tailwindcss').options &
3+
* import("@ianvs/prettier-plugin-sort-imports").PluginConfig}
4+
*/
5+
const config = {
6+
endOfLine: "lf",
7+
semi: false,
8+
singleQuote: false,
9+
tabWidth: 2,
10+
trailingComma: "es5",
11+
printWidth: 100,
12+
arrowParens: "always",
13+
importOrder: [
14+
"^(react/(.*)$)|^(react$)",
15+
"^(next/(.*)$)|^(next$)",
16+
"<THIRD_PARTY_MODULES>",
17+
"",
18+
"^types$",
19+
"^@/types/(.*)$",
20+
"^@/config/(.*)$",
21+
"^@/lib/(.*)$",
22+
"^@/hooks/(.*)$",
23+
"^@/components/ui/(.*)$",
24+
"^@/components/(.*)$",
25+
"^@/services/(.*)$",
26+
"^@/constants/(.*)$",
27+
"^@/registry/(.*)$",
28+
"^@/styles/(.*)$",
29+
"^@/app/(.*)$",
30+
"",
31+
"^[./]",
32+
],
33+
// importOrderSeparation: false,
34+
// importOrderSortSpecifiers: true,
35+
// importOrderBuiltinModulesToTop: true,
36+
importOrderParserPlugins: ["typescript", "jsx", "decorators-legacy"],
37+
// importOrderMergeDuplicateImports: true,
38+
// importOrderCombineTypeAndValueImports: true,
39+
plugins: ["@ianvs/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"],
40+
}
41+
42+
export default config

0 commit comments

Comments
 (0)