forked from upstash/ratelimit-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: dynamic boundaries (upstash#6)
* test: dynamic boundaries * feat: global sliding window * fix: delete line * ci: load secrets in env * docs: add global ratelimit * test: do not sanitize * test: wait for requests in global tests * test: boundaries * test: boundaries * style: fmt * style: fmt * style: fmt * style: fmt * style: fmt * style: fmt * style: fmt * test: testcases
- Loading branch information
Showing
15 changed files
with
3,747 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
dist | ||
.mf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Miniflare Example Project | ||
|
||
This is an example [Cloudflare Workers](https://workers.cloudflare.com/) project | ||
that uses [Miniflare](https://github.com/cloudflare/miniflare) for local | ||
development, [TypeScript](https://www.typescriptlang.org/), | ||
[esbuild](https://github.com/evanw/esbuild) for bundling, and | ||
[Jest](https://jestjs.io/) for testing, with | ||
[Miniflare's custom Jest environment](https://v2.miniflare.dev/jest.html). | ||
|
||
```shell | ||
# Install dependencies | ||
$ npm install | ||
# Start local development server with live reload | ||
$ npm run dev | ||
# Run tests | ||
$ npm test | ||
# Run type checking | ||
$ npm run types:check | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface Bindings { | ||
UPSTASH_REDIS_REST_URL: string; | ||
UPSTASH_REDIS_REST_TOKEN: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import path from "path"; | ||
import { fileURLToPath } from "url"; | ||
import { build } from "esbuild"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
try { | ||
await build({ | ||
bundle: true, | ||
sourcemap: true, | ||
format: "esm", | ||
target: "esnext", | ||
entryPoints: [path.join(__dirname, "src", "index.ts")], | ||
outdir: path.join(__dirname, "dist"), | ||
outExtension: { ".js": ".mjs" }, | ||
}); | ||
} catch { | ||
process.exitCode = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "miniflare-typescript-esbuild-jest", | ||
"version": "1.0.0", | ||
"description": "Example project using Miniflare, TypeScript, esbuild and Jest", | ||
"type": "module", | ||
"module": "./dist/index.mjs", | ||
"scripts": { | ||
"build": "node build.js", | ||
"dev": "miniflare --live-reload --debug", | ||
"types:check": "tsc && tsc -p test/tsconfig.json" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@cloudflare/workers-types": "^3.1.1", | ||
"esbuild": "^0.13.13", | ||
"miniflare": "^2.0.0", | ||
"typescript": "^4.4.4" | ||
}, | ||
"dependencies": { | ||
"@upstash/ratelimit": "../../dist", | ||
"@upstash/redis": "^1.3.4" | ||
} | ||
} |
Oops, something went wrong.