Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged

retry #100

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 14 additions & 61 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,7 @@ jobs:
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-


- uses: pnpm/action-setup@v2
with:
Expand All @@ -99,7 +93,7 @@ jobs:
REDIS_SERVER_CONFIG: ${{ secrets.REDIS_SERVER_CONFIG }}

- name: Install example
run: pnpm install
run: pnpm add @upstash/redis@../../dist
working-directory: ./examples/nextjs

- name: Build example
Expand Down Expand Up @@ -137,13 +131,7 @@ jobs:
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-


- uses: pnpm/action-setup@v2
with:
Expand All @@ -161,7 +149,7 @@ jobs:
REDIS_SERVER_CONFIG: ${{ secrets.REDIS_SERVER_CONFIG }}

- name: Install example
run: pnpm install
run: pnpm add @upstash/redis@../../dist
working-directory: ./examples/nextjs_edge

- name: Build example
Expand Down Expand Up @@ -259,13 +247,7 @@ jobs:
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-


- uses: pnpm/action-setup@v2
with:
Expand All @@ -284,7 +266,7 @@ jobs:

- name: Install example
run: |
pnpm install
pnpm add @upstash/redis@../../dist
pnpm install -g miniflare @cloudflare/wrangler
working-directory: examples/cloudflare-worker

Expand Down Expand Up @@ -353,13 +335,7 @@ jobs:
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-


- uses: pnpm/action-setup@v2
with:
Expand All @@ -377,7 +353,7 @@ jobs:
REDIS_SERVER_CONFIG: ${{ secrets.REDIS_SERVER_CONFIG }}

- name: Install example
run: pnpm install
run: pnpm add @upstash/redis@../../dist
working-directory: examples/cloudflare-worker-wrangler2

- name: Add account ID
Expand Down Expand Up @@ -412,14 +388,7 @@ jobs:
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-


- uses: pnpm/action-setup@v2
with:
version: 6
Expand Down Expand Up @@ -460,14 +429,7 @@ jobs:
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-


- uses: pnpm/action-setup@v2
with:
version: 6
Expand All @@ -486,7 +448,7 @@ jobs:
- name: Install example
working-directory: ./examples/fastly
run: |
pnpm install
pnpm add @upstash/redis@../../dist
curl -L https://github.com/fastly/cli/releases/download/v1.7.0/fastly_v1.7.0_linux-amd64.tar.gz > fastly.tar.gz
tar -xf ./fastly.tar.gz

Expand Down Expand Up @@ -601,8 +563,7 @@ jobs:
REDIS_SERVER_CONFIG: ${{ secrets.REDIS_SERVER_CONFIG }}

- name: Install example
run: |
pnpm install
run: pnpm add @upstash/redis@../../dist
working-directory: examples/nodejs

- name: Run example
Expand All @@ -627,14 +588,7 @@ jobs:
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-


- uses: pnpm/action-setup@v2
with:
version: 6
Expand All @@ -651,8 +605,7 @@ jobs:
REDIS_SERVER_CONFIG: ${{ secrets.REDIS_SERVER_CONFIG }}

- name: Install example
run: |
pnpm install
run: pnpm add @upstash/redis@../../dist
working-directory: examples/nodejs-18

- name: Run example
Expand Down
6 changes: 3 additions & 3 deletions cmd/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ await build({
"size-limit": [
{
path: "esm/platforms/nodejs.js",
limit: "5 KB",
limit: "6 KB",
},
{
path: "esm/platforms/fastly.js",
limit: "5 KB",
limit: "6 KB",
},
{
path: "esm/platforms/cloudflare.js",
limit: "5 KB",
limit: "6 KB",
},
{
path: "esm/platforms/node_with_fetch.js",
Expand Down
2 changes: 1 addition & 1 deletion examples/aws-lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "SAM CLI",
"license": "MIT",
"dependencies": {
"@upstash/redis": "../../dist"
"@upstash/redis": "latest"
},
"scripts": {
"test": "mocha tests/unit/"
Expand Down
26 changes: 26 additions & 0 deletions examples/cloudflare-worker-wrangler2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Cloudflare Worker Example

This example uses
[Wrangler 2](https://developers.cloudflare.com/workers/wrangler/) to create a
javascript worker.

## How to use

1. Clone and install the example

```bash
git clone https://github.com/upstash/upstash-redis.git
cd upstash-redis/examples/cloudflare-worker-wrangler2
npm install
```

2. Create a free Database on [upstash.com](https://console.upstash.com/redis)
3. Copy the `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` to
`wrangler.toml`
4. Start the development server

```bash
npm run dev
```

5. Open your browser at [localhost:8787](http://localhost:8787)
2 changes: 1 addition & 1 deletion examples/cloudflare-worker-wrangler2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"wrangler": "^2.0.7"
},
"dependencies": {
"@upstash/redis": "../../dist"
"@upstash/redis": "latest"
}
}
26 changes: 26 additions & 0 deletions examples/cloudflare-worker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Cloudflare Worker Example

This example uses
[Wrangler 1](https://developers.cloudflare.com/workers/wrangler/) to create a
typescript worker.

## How to use

1. Clone and install the example

```bash
git clone https://github.com/upstash/upstash-redis.git
cd upstash-redis/examples/cloudflare-worker
npm install
```

2. Create a free Database on [upstash.com](https://console.upstash.com/redis)
3. Copy the `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` to
`wrangler.toml`
4. Start the development server

```bash
npm run dev
```

5. Open your browser at [localhost:8787](http://localhost:8787)
2 changes: 1 addition & 1 deletion examples/cloudflare-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"typescript": "^4.6.3"
},
"dependencies": {
"@upstash/redis": "../../dist"
"@upstash/redis": "latest"
}
}
2 changes: 1 addition & 1 deletion examples/fastly/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@fastly/js-compute": "^0.2.1",
"@upstash/redis": "../../dist",
"@upstash/redis": "latest",
"flight-path": "^1.0.10"
},
"scripts": {
Expand Down
32 changes: 21 additions & 11 deletions examples/nextjs/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
# Next.js + Tailwind CSS Example

This example shows how to use [Tailwind CSS](https://tailwindcss.com/)
[(v3.0)](https://tailwindcss.com/blog/tailwindcss-v3) with Next.js. It follows
the steps outlined in the official
[Tailwind docs](https://tailwindcss.com/docs/guides/nextjs).
# Nextjs Example

## How to use

Execute
[`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app)
with [npm](https://docs.npmjs.com/cli/init) or
[Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
1. Clone and install the example

```bash
git clone https://github.com/upstash/upstash-redis.git
cd upstash-redis/examples/nextjs
npm install
```

2. Create a free Database on [upstash.com](https://console.upstash.com/redis)
3. Copy the `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` to `.env`

```
UPSTASH_REDIS_REST_URL=""
UPSTASH_REDIS_REST_TOKEN=""
```

4. Start the development server

```bash
yarn create next-app -e https://github.com/upstash/next-template your-app-name
npm run dev
```

5. Open your browser at [localhost:3000](http://localhost:3000)
2 changes: 1 addition & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
"@upstash/redis": "../../dist",
"@upstash/redis": "latest",
"next": "^12.1.6",
"react": "^18.1.0",
"react-dom": "^18.1.0"
Expand Down
32 changes: 21 additions & 11 deletions examples/nextjs_edge/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
# Next.js + Tailwind CSS Example

This example shows how to use [Tailwind CSS](https://tailwindcss.com/)
[(v3.0)](https://tailwindcss.com/blog/tailwindcss-v3) with Next.js. It follows
the steps outlined in the official
[Tailwind docs](https://tailwindcss.com/docs/guides/nextjs).
# Nextjs Example

## How to use

Execute
[`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app)
with [npm](https://docs.npmjs.com/cli/init) or
[Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
1. Clone and install the example

```bash
git clone https://github.com/upstash/upstash-redis.git
cd upstash-redis/examples/nextjs
npm install
```

2. Create a free Database on [upstash.com](https://console.upstash.com/redis)
3. Copy the `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` to `.env`

```
UPSTASH_REDIS_REST_URL=""
UPSTASH_REDIS_REST_TOKEN=""
```

4. Start the development server

```bash
yarn create next-app -e https://github.com/upstash/next-template your-app-name
npm run dev
```

5. Open your browser at [localhost:3000](http://localhost:3000)
2 changes: 1 addition & 1 deletion examples/nextjs_edge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
"@upstash/redis": "../../dist",
"@upstash/redis": "latest",
"next": "^12.1.6",
"react": "^18.1.0",
"react-dom": "^18.1.0"
Expand Down
22 changes: 22 additions & 0 deletions examples/nodejs-18/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Nodejs v18 Example

This example uses the now native fetch api, and does not require a polyfill.

## How to use

1. Clone and install the example

```bash
git clone https://github.com/upstash/upstash-redis.git
cd upstash-redis/examples/nodejs-18
npm install
```

2. Create a free Database on [upstash.com](https://console.upstash.com/redis)
3. Copy the `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN`

4. Run the script

```bash
UPSTASH_REDIS_REST_URL="" UPSTASH_REDIS_REST_TOKEN="" node ./index.js
```
Loading