kami-redis 2.0.3 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -5
- package/dist/index.d.ts +2365 -0
- package/dist/index.js +1 -5
- package/package.json +7 -2
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.github/workflows/main.yml +0 -17
- package/.github/workflows/publish.yml +0 -32
- package/.vscode/settings.json +0 -51
- package/CHANGELOG.md +0 -25
- package/bun.lock +0 -1237
- package/dist/index.js.map +0 -1
- package/eslint.config.js +0 -28
- package/src/index.ts +0 -75
- package/src/utils/clean-up.ts +0 -3
- package/src/utils/format-value.ts +0 -16
- package/src/utils/get-value.ts +0 -18
- package/src/utils/graceful-exit.ts +0 -24
- package/src/utils/is-redis-url.ts +0 -23
- package/src/utils/prompt-for-key.ts +0 -30
- package/src/utils/view-key.ts +0 -95
- package/tsconfig.json +0 -27
- package/tsup.config.ts +0 -11
package/dist/index.js
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
Usage
|
|
4
|
-
kami-redis <url>
|
|
5
|
-
`,{importMeta:import.meta}),[l]=p.input;l||(console.log(p.help),process.exit(1));m(l)||(console.log(p.help),console.log(w.red("Provided URL is not a valid Redis URL")),process.exit(1));var e=P({url:l});async function E(){try{for(i(),await e.connect();;){let t=await d();t||(console.log("No keys in Redis!"),await e.quit(),process.exit(0));let r=await y(t);if(r==="quit")await s(0);else{if(r==="deleted")continue;if(r==="back")continue}}}catch(t){console.error(w.red("Unexpected error:"),t);try{await e.quit()}catch{process.exit(1)}}}E();export{e as client};
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
2
|
+
import K from"meow";import h from"picocolors";import{createClient as E}from"redis";function p(e){try{let r=new URL(e);return(r.protocol==="redis:"||r.protocol==="rediss:")&&!!r.hostname&&(!r.port||!Number.isNaN(Number(r.port)))}catch{return!1}}import b from"inquirer";async function m(e=0){try{if(process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}try{process.stdin.pause()}catch{await t.quit()}}catch{}finally{console.clear(),process.exit(e)}}async function u(){let e=await t.keys("*");if(e.length===0)return null;try{let{selectedKey:r}=await b.prompt({type:"list",name:"selectedKey",message:"Select a key to view its value:",choices:e,pageSize:20,theme:{icon:{cursor:">"},prefix:"0_0"}});return r}catch{await m(0)}}import R from"boxen";import{highlight as q}from"cli-highlight";import N from"readline";import S from"picocolors";function f(e){if(typeof e=="object"&&e!==null)return JSON.stringify(e,null,2);if(typeof e=="string")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return String(e)}async function d(e,r){switch(r){case"string":return t.get(e);case"hash":return t.hGetAll(e);case"list":return t.lRange(e,0,-1);case"set":return t.sMembers(e);case"zset":return t.zRangeWithScores(e,0,-1);default:return"(unsupported type)"}}var y=!1;function T(){!y&&process.stdin.isTTY&&(N.emitKeypressEvents(process.stdin),y=!0)}async function g(e){let r=await t.type(e),w=await d(e,r);return console.clear(),console.log(R(q(f(w),{language:"json",ignoreIllegals:!0}),{borderColor:"cyan",padding:1,title:e,borderStyle:"round"})),console.log(S.dim("d: delete | c: copy | \u2190: back | ctrl+c: quit")),T(),new Promise(s=>{let n=!1,i=()=>{if(!n){if(n=!0,process.stdin.removeListener("keypress",l),process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause()}},l=async(M,o)=>{if(!(!o||n)){if(o.ctrl&&o.name==="c"){i(),console.clear(),s("quit");return}if(o.name==="d"){i();try{await t.del(e)}catch{}console.clear(),s("deleted");return}if(o.name==="c"){try{console.log("Copied to clipboard!")}catch(x){console.log("Error copying:",x)}i(),console.clear(),s("back");return}o.name==="left"&&(i(),console.clear(),s("back"))}};process.stdin.isTTY&&process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("keypress",l)})}var c=K("Usage: kami-redis <url>",{importMeta:import.meta}),[a]=c.input;a||(console.log(c.help),process.exit(1));p(a)||(console.log(c.help),console.log(h.red("Invalid Redis URL")),process.exit(1));var t=E({url:a});async function I(){try{for(console.clear(),await t.connect();;){let e=await u();e||(console.log("No keys in Redis"),await t.quit(),process.exit(0)),await g(e)==="quit"&&(await t.quit(),process.exit(0))}}catch(e){console.error(h.red("Error:"),e);try{await t.quit()}catch{}process.exit(1)}}process.on("SIGINT",async()=>{try{await t.quit()}catch{}process.exit(0)});I();export{t as client};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kami-redis",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"description": "Browse, inspect, copy, and delete Redis keys from your CLI",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -10,9 +10,14 @@
|
|
|
10
10
|
"bin": {
|
|
11
11
|
"kami-redis": "dist/index.js"
|
|
12
12
|
},
|
|
13
|
+
"files": [
|
|
14
|
+
"/dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"package.json"
|
|
17
|
+
],
|
|
13
18
|
"scripts": {
|
|
14
19
|
"dev": "bun run --watch src/index.ts",
|
|
15
|
-
"build": "tsup
|
|
20
|
+
"build": "tsup",
|
|
16
21
|
"lint": "eslint",
|
|
17
22
|
"lint:fix": "eslint --fix",
|
|
18
23
|
"release": "bun run build && changeset publish",
|
package/.changeset/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Changesets
|
|
2
|
-
|
|
3
|
-
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
|
4
|
-
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
|
5
|
-
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
|
6
|
-
|
|
7
|
-
We have a quick list of common questions to get you started engaging with this project in
|
|
8
|
-
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
package/.changeset/config.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
|
4
|
-
"commit": false,
|
|
5
|
-
"fixed": [],
|
|
6
|
-
"linked": [],
|
|
7
|
-
"access": "public",
|
|
8
|
-
"baseBranch": "main",
|
|
9
|
-
"updateInternalDependencies": "patch",
|
|
10
|
-
"ignore": []
|
|
11
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches:
|
|
5
|
-
- "**"
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
build:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v3
|
|
12
|
-
- uses: oven-sh/setup-bun@v2
|
|
13
|
-
with:
|
|
14
|
-
bun-version: latest
|
|
15
|
-
|
|
16
|
-
- run: bun install
|
|
17
|
-
- run: bun run lint && bun run build
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
name: Publish
|
|
2
|
-
on:
|
|
3
|
-
workflow_run:
|
|
4
|
-
workflows: [CI]
|
|
5
|
-
branches: [main]
|
|
6
|
-
types: [completed]
|
|
7
|
-
|
|
8
|
-
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
9
|
-
|
|
10
|
-
permissions:
|
|
11
|
-
contents: write
|
|
12
|
-
pull-requests: write
|
|
13
|
-
|
|
14
|
-
jobs:
|
|
15
|
-
publish:
|
|
16
|
-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
17
|
-
runs-on: ubuntu-latest
|
|
18
|
-
steps:
|
|
19
|
-
- uses: actions/checkout@v3
|
|
20
|
-
- uses: oven-sh/setup-bun@v2
|
|
21
|
-
with:
|
|
22
|
-
bun-version: latest
|
|
23
|
-
|
|
24
|
-
- run: bun install
|
|
25
|
-
- name: Create Release Pull Request or Publish
|
|
26
|
-
id: changesets
|
|
27
|
-
uses: changesets/action@v1
|
|
28
|
-
with:
|
|
29
|
-
publish: bun run release
|
|
30
|
-
env:
|
|
31
|
-
GITHUB_TOKEN: ${{ secrets.GHUB_TOKEN }}
|
|
32
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.vscode/settings.json
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Disable the default formatter, use eslint instead
|
|
3
|
-
"prettier.enable": false,
|
|
4
|
-
"editor.formatOnSave": false,
|
|
5
|
-
|
|
6
|
-
// Auto fix
|
|
7
|
-
"editor.codeActionsOnSave": {
|
|
8
|
-
"source.fixAll.eslint": "explicit",
|
|
9
|
-
"source.organizeImports": "never"
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
13
|
-
"eslint.rules.customizations": [
|
|
14
|
-
{ "rule": "style/*", "severity": "off", "fixable": true },
|
|
15
|
-
{ "rule": "format/*", "severity": "off", "fixable": true },
|
|
16
|
-
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
17
|
-
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
|
18
|
-
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
|
19
|
-
{ "rule": "*-order", "severity": "off", "fixable": true },
|
|
20
|
-
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
|
21
|
-
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
|
22
|
-
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
|
23
|
-
{ "rule": "*semi", "severity": "off", "fixable": true }
|
|
24
|
-
],
|
|
25
|
-
|
|
26
|
-
// Enable eslint for all supported languages
|
|
27
|
-
"eslint.validate": [
|
|
28
|
-
"javascript",
|
|
29
|
-
"javascriptreact",
|
|
30
|
-
"typescript",
|
|
31
|
-
"typescriptreact",
|
|
32
|
-
"vue",
|
|
33
|
-
"html",
|
|
34
|
-
"markdown",
|
|
35
|
-
"json",
|
|
36
|
-
"json5",
|
|
37
|
-
"jsonc",
|
|
38
|
-
"yaml",
|
|
39
|
-
"toml",
|
|
40
|
-
"xml",
|
|
41
|
-
"gql",
|
|
42
|
-
"graphql",
|
|
43
|
-
"astro",
|
|
44
|
-
"svelte",
|
|
45
|
-
"css",
|
|
46
|
-
"less",
|
|
47
|
-
"scss",
|
|
48
|
-
"pcss",
|
|
49
|
-
"postcss"
|
|
50
|
-
]
|
|
51
|
-
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# kami-redis
|
|
2
|
-
|
|
3
|
-
## 2.0.3
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- 3c47730: fixed
|
|
8
|
-
|
|
9
|
-
## 2.0.2
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- c9fe624: added shebang
|
|
14
|
-
|
|
15
|
-
## 2.0.1
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- b2e2ed5: added bin (forgot to add bin)
|
|
20
|
-
|
|
21
|
-
## 2.0.0
|
|
22
|
-
|
|
23
|
-
### Major Changes
|
|
24
|
-
|
|
25
|
-
- e7c8743: initial update
|