Skip to content

Commit d7fcd3a

Browse files
authored
chore: convert from monorepo (#19)
1 parent 422a6de commit d7fcd3a

32 files changed

+171
-301
lines changed

.coderabbit.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
2-
language: "en-US"
2+
language: 'en-US'
33
early_access: false
44
reviews:
5-
profile: "assertive"
5+
profile: 'assertive'
66
request_changes_workflow: false
77
high_level_summary: true
88
poem: false
@@ -13,4 +13,4 @@ reviews:
1313
enabled: true
1414
drafts: false
1515
chat:
16-
auto_reply: true
16+
auto_reply: true

.devcontainer/docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ services:
3030
volumes:
3131
- redis-data:/data
3232
healthcheck:
33-
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
33+
test: ['CMD-SHELL', 'redis-cli ping | grep PONG']
3434
interval: 5s
3535
timeout: 5s
3636
retries: 5
@@ -45,4 +45,4 @@ services:
4545
ports:
4646
- 5540:5540
4747
volumes:
48-
- redis-insight:/data
48+
- redis-insight:/data

.github/workflows/build-and-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Check out repository code
1919
uses: actions/checkout@v5
2020

21-
- name: Install system dependencies
21+
- name: Install system dependencies
2222
run: |
2323
apt-get update
2424
apt-get install -y unzip
@@ -35,4 +35,4 @@ jobs:
3535
- name: Test
3636
env:
3737
REDIS_URL: redis://redis:6379
38-
run: bun run test
38+
run: bun run test

.github/workflows/publish-package.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Check out repository code
2323
uses: actions/checkout@v5
2424

25-
- name: Install system dependencies
25+
- name: Install system dependencies
2626
run: |
2727
apt-get update
2828
apt-get install -y unzip
@@ -41,15 +41,12 @@ jobs:
4141
REDIS_URL: redis://redis:6379
4242
run: bun run test
4343

44-
- name: Copy extra files
45-
run: cp ./README.md ./LICENSE ./packages/cache
46-
4744
- name: Publish package to NPM
4845
env:
4946
NPM_CONFIG_TOKEN: ${{ secrets.NPM_CONFIG_TOKEN }}
50-
run: cd ./packages/cache && bun publish --tolerate-republish --access public
47+
run: bun publish --tolerate-republish --access public
5148

5249
- name: Publish package to GitHub
5350
env:
5451
NPM_CONFIG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55-
run: cd ./packages/cache && bun publish --tolerate-republish --access public --registry https://npm.pkg.github.com
52+
run: bun publish --tolerate-republish --access public --registry https://npm.pkg.github.com
File renamed without changes.

.oxfmtrc.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"insertFinalNewline": true,
1010
"jsxSingleQuote": true,
1111
"trailingComma": "all",
12-
"ignorePatterns": [
12+
"ignorePatterns": [
1313
"**/dist/*",
1414
"**/.next/*",
1515
"**/.turbo/*",
@@ -21,5 +21,5 @@
2121
"apps/next/src/app/(payload)/*",
2222
"apps/start/.wrangler/*",
2323
"apps/start/src/routeTree.gen.ts"
24-
],
25-
}
24+
]
25+
}

.oxlintrc.json

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"$schema": "./node_modules/oxlint/configuration_schema.json",
3-
"plugins": [
4-
"typescript",
5-
"react"
6-
],
3+
"plugins": ["typescript", "react"],
74
"categories": {
85
"correctness": "warn",
96
"pedantic": "warn",
@@ -105,9 +102,7 @@
105102
],
106103
"overrides": [
107104
{
108-
"files": [
109-
"**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"
110-
],
105+
"files": ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
111106
"rules": {
112107
"for-direction": "error",
113108
"no-async-promise-executor": "error",
@@ -165,9 +160,7 @@
165160
}
166161
},
167162
{
168-
"files": [
169-
"**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"
170-
],
163+
"files": ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
171164
"env": {
172165
"browser": true,
173166
"commonjs": true,
@@ -176,12 +169,7 @@
176169
}
177170
},
178171
{
179-
"files": [
180-
"**/*.ts",
181-
"**/*.tsx",
182-
"**/*.mts",
183-
"**/*.cts"
184-
],
172+
"files": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
185173
"rules": {
186174
"no-class-assign": "off",
187175
"no-const-assign": "off",
@@ -202,4 +190,4 @@
202190
}
203191
}
204192
]
205-
}
193+
}

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
"vitest.explorer",
99
"zenstack.zenstack-v3"
1010
]
11-
}
11+
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
"typescript.experimental.useTsgo": true,
55
"[javascript][javascriptreact][typescript][typescriptreact][json][jsonc]": {
66
"editor.defaultFormatter": "oxc.oxc-vscode"
7-
},
7+
}
88
}

README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
ZenStack Cache
44
</h1>
55

6-
Reduce response times and database load with query-level caching integrated with the ZenStack ORM.
6+
Reduce response times and database load with query-level caching integrated with the ZenStack ORM.
7+
78
</div>
89

910
<div align="center">
@@ -19,7 +20,7 @@
1920
<a href="https://discord.gg/2PaRSu7X">
2021
<img alt="Join the ZenStack Cache channel" src="https://img.shields.io/discord/1035538056146595961">
2122
</a>
22-
<a href="https://github.com/visualbravo/zenstack-cache/blob/76a2de03245c26841b04525dd8b424a8799d654c/LICENSE">
23+
<a href="https://github.com/visualbravo/zenstack-cache/blob/dev/LICENSE">
2324
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-green">
2425
</a>
2526

@@ -29,17 +30,18 @@
2930
</div>
3031

3132
## Features
32-
* 🌐 **Redis Cache:** A central cache to scale across different systems.
33-
* 🖥️ **Memory Cache:** A simple cache when scale is not a concern.
34-
* 🛟 **Type-safety:** The caching options appear in the intellisense for all read queries.
35-
* 🏷️ **Tag-based Invalidation:** Easily invalidate multiple related cache entries.
33+
34+
- 🌐 **Redis Cache:** A central cache to scale across different systems.
35+
- 🖥️ **Memory Cache:** A simple cache when scale is not a concern.
36+
- 🛟 **Type-safety:** The caching options appear in the intellisense for all read queries.
37+
- 🏷️ **Tag-based Invalidation:** Easily invalidate multiple related cache entries.
3638

3739
## Requirements
3840

39-
* ZenStack (version >= `3.3.0`)
40-
* Node.js (version >= `20.0.0`)
41-
* Redis (version >= `7.0.0`)
42-
* ℹ️ Only if you intend to use the `RedisCacheProvider`
41+
- ZenStack (version >= `3.3.0`)
42+
- Node.js (version >= `20.0.0`)
43+
- Redis (version >= `7.0.0`)
44+
- ℹ️ Only if you intend to use the `RedisCacheProvider`
4345

4446
## Installation
4547

@@ -115,21 +117,22 @@ After performing a query, you can check where the result came from.
115117
const publishedPostsStatus = client.$cache.status // 'hit' | 'miss' | 'stale'
116118
```
117119

118-
* `hit` - a cache entry in the `ttl` window was found, and the database was not queried.
119-
* `miss` - a cache entry was not found, and the database was queried.
120-
* `stale` - a cache entry in the `swr` window was found, and the database was queried in the background to revalidate it.
120+
- `hit` - a cache entry in the `ttl` window was found, and the database was not queried.
121+
- `miss` - a cache entry was not found, and the database was queried.
122+
- `stale` - a cache entry in the `swr` window was found, and the database was queried in the background to revalidate it.
121123

122124
## Revalidation
123125

124126
If the result was stale, you can choose to await its revalidation.
127+
125128
```typescript
126129
const revalidatedPublishedPosts = await client.$cache.revalidation as Post[]
127130
```
128131

129132
## Cache Options
130133

131-
* `ttl` reduces response times and database load by serving cached results.
132-
* `swr` reduces response times by serving cached results, but does not reduce database load because it performs a revalidation in the background after each request.
134+
- `ttl` reduces response times and database load by serving cached results.
135+
- `swr` reduces response times by serving cached results, but does not reduce database load because it performs a revalidation in the background after each request.
133136

134137
> [!NOTE]
135138
> The total TTL of a cache entry is equal to its `ttl` + `swr`. The `ttl` window comes first, followed by the `swr` window. You can combine the two options to best suit the needs of your application.

0 commit comments

Comments
 (0)