Skip to content

Commit 993cd71

Browse files
committed
chore: add deps and rename project
1 parent 0fe53b1 commit 993cd71

File tree

15 files changed

+162
-30
lines changed

15 files changed

+162
-30
lines changed

.github/workflows/release.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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: Install bun
28+
run: npm install -g bun
29+
30+
- name: Install dependencies
31+
run: bun install
32+
33+
- name: Build
34+
run: bun run build
35+
36+
- name: Add npm token
37+
run: echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" > .npmrc
38+
39+
- name: Publish release candidate
40+
if: "github.event.release.prerelease"
41+
run: npm publish --access public --tag=canary --no-git-checks
42+
43+
- name: Publish
44+
if: "!github.event.release.prerelease"
45+
run: npm publish --access public --no-git-checks

.husky/commit-message

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
bun --no -- commitlint --edit ""

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
bun run fmt && bun run test
4+
bun run fmt && bun run test

.husky/pre-push

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
bun run build

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["biomejs.biome"]
3+
}

.vscode/settings.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"git.autofetch": true,
4+
"editor.codeActionsOnSave": {
5+
"source.fixAll": "explicit"
6+
},
7+
"[html]": {
8+
"editor.defaultFormatter": "biomejs.biome"
9+
},
10+
"[json]": {
11+
"editor.defaultFormatter": "biomejs.biome"
12+
},
13+
"[javascript]": {
14+
"editor.defaultFormatter": "biomejs.biome"
15+
},
16+
"[jsonc]": {
17+
"editor.defaultFormatter": "biomejs.biome"
18+
},
19+
"[typescript]": {
20+
"editor.defaultFormatter": "biomejs.biome"
21+
},
22+
"editor.defaultFormatter": "biomejs.biome"
23+
}

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Upstash SQS · ![license](https://img.shields.io/npm/l/%40upstash%2Fsqs) [![Tests](https://github.com/upstash/sqs/actions/workflows/tests.yaml/badge.svg)](https://github.com/upstash/sqs/actions/workflows/tests.yaml) ![npm (scoped)](https://img.shields.io/npm/v/@upstash/sqs) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@upstash/sqs) ![npm weekly download](https://img.shields.io/npm/dw/%40upstash%2Fsqs)
1+
# Upstash Queue · ![license](https://img.shields.io/npm/l/%40upstash%2Fqueue) [![Tests](https://github.com/upstash/queue/actions/workflows/tests.yaml/badge.svg)](https://github.com/upstash/queue/actions/workflows/tests.yaml) ![npm (scoped)](https://img.shields.io/npm/v/@upstash/queue) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@upstash/queue) ![npm weekly download](https://img.shields.io/npm/dw/%40upstash%2Fqueue)
22

33
> [!NOTE]> **This project is in the Experimental Stage.**
44
>
@@ -13,7 +13,7 @@ A simple, fast, robust stream based message queue for Node.js, backed by Upstash
1313

1414
```ts
1515
import { Redis } from "@upstash/redis";
16-
import { Queue } from "@upstash/sqs";
16+
import { Queue } from "@upstash/queue";
1717

1818
const queue = new Queue({ redis: new Redis() });
1919

@@ -25,11 +25,11 @@ expect(message1?.body).toEqual({ hello: "world1" });
2525

2626
## Introduction
2727

28-
`@upstash/sqs` is a Node.js library that provides a simple and efficient way to implement a message queue system using Redis streams. It offers features such as message sending, receiving, automatic message verification, and concurrency control. This library is particularly useful for building distributed systems and background job processing.
28+
`@upstash/queue` is a Node.js library that provides a simple and efficient way to implement a message queue system using Redis streams. It offers features such as message sending, receiving, automatic message verification, and concurrency control. This library is particularly useful for building distributed systems and background job processing.
2929

30-
## Why Upstash SQS?
30+
## Why Upstash Queue?
3131

32-
Upstash SQS brings the simplicity and performance of Redis streams to Node.js developers, making it easy to integrate a robust message queue system into their applications. Whether you're working on distributed systems, background job processing, or other asynchronous workflows, Upstash SQS provides essential features such as message sending, receiving, automatic verification, and concurrency control.
32+
Upstash queue brings the simplicity and performance of Redis streams to Node.js developers, making it easy to integrate a robust message queue system into their applications. Whether you're working on distributed systems, background job processing, or other asynchronous workflows, Upstash queue provides essential features such as message sending, receiving, automatic verification, and concurrency control.
3333

3434
**Key Features:**
3535

@@ -54,17 +54,17 @@ Upstash SQS brings the simplicity and performance of Redis streams to Node.js de
5454

5555
## Installation
5656

57-
To start using Upstash SQS, install the library via npm:
57+
To start using Upstash queue, install the library via npm:
5858

5959
```sh
60-
npm install @upstash/sqs
60+
npm install @upstash/queue
6161
```
6262

6363
## Getting Started
6464

6565
```typescript
6666
import Redis from "@upstash/redis";
67-
import { Queue } from "@upstash/sqs";
67+
import { Queue } from "@upstash/queue";
6868

6969
const redis = new Redis();
7070
const queue = new Queue({ redis });

biome.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"linter": {
55
"enabled": true,
66
"rules": {
7+
"nursery": {
8+
"useAwait": "error"
9+
},
710
"recommended": true,
811
"a11y": {
912
"noSvgWithoutTitle": "off"

bun.lockb

54.8 KB
Binary file not shown.

commitlint.config.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
2+
// ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
3+
// docs: Documentation only changes
4+
// feat: A new feature
5+
// fix: A bug fix
6+
// perf: A code change that improves performance
7+
// refactor: A code change that neither fixes a bug nor adds a feature
8+
// style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
9+
// test: Adding missing tests or correcting existing tests
10+
11+
module.exports = {
12+
extends: ["@commitlint/config-conventional"],
13+
rules: {
14+
"body-leading-blank": [1, "always"],
15+
"body-max-line-length": [2, "always", 100],
16+
"footer-leading-blank": [1, "always"],
17+
"footer-max-line-length": [2, "always", 100],
18+
"header-max-length": [2, "always", 100],
19+
"scope-case": [2, "always", "lower-case"],
20+
"subject-case": [
21+
2,
22+
"never",
23+
["sentence-case", "start-case", "pascal-case", "upper-case"],
24+
],
25+
"subject-empty": [2, "never"],
26+
"subject-full-stop": [2, "never", "."],
27+
"type-case": [2, "always", "lower-case"],
28+
"type-empty": [2, "never"],
29+
"type-enum": [
30+
2,
31+
"always",
32+
[
33+
"build",
34+
"chore",
35+
"ci",
36+
"docs",
37+
"feat",
38+
"fix",
39+
"perf",
40+
"refactor",
41+
"revert",
42+
"style",
43+
"test",
44+
"translation",
45+
"security",
46+
"changeset",
47+
],
48+
],
49+
},
50+
};

examples/nextjs14/app/page.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
"use client";
2-
import React, { useState, useEffect } from "react";
2+
import { useState } from "react";
33

4-
import { Queue } from "./../../../src";
4+
import { CSSTransition, TransitionGroup } from "react-transition-group";
55
import * as uuid from "uuid";
6-
import { Redis } from "@upstash/redis";
7-
import { TransitionGroup, CSSTransition } from "react-transition-group";
86

97
type MessageBody = {
108
content: string;
@@ -15,7 +13,7 @@ type MessageWithId = {
1513
body: MessageBody;
1614
};
1715

18-
const queueName = `sqs-${uuid.v4().substring(0, 18)}`;
16+
const queueName = `queue-${uuid.v4().substring(0, 18)}`;
1917

2018
export default function Home() {
2119
const [messageInput, setMessageInput] = useState<string>(
@@ -57,12 +55,12 @@ export default function Home() {
5755
<main>
5856
<header>
5957
<h1 className="text-4xl font-bold">
60-
Welcome to <span className="text-primary-500">@upstash/sqs</span>
58+
Welcome to <span className="text-primary-500">@upstash/queue</span>
6159
</h1>
6260

6361
<p className="mt-4">
64-
This is an example of how to use @upstash/sqs as a FIFO queue in your
65-
Next.js application.
62+
This is an example of how to use @upstash/queue as a FIFO queue in
63+
your Next.js application.
6664
</p>
6765

6866
<p className="mt-4">

package.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "@upstash/sqs",
2+
"name": "@upstash/queue",
33
"description": "A message queue based on Redis streams, without dependencies.",
44
"module": "./dist/index.mjs",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
7-
"version": "1.0.1",
7+
"version": "1.0.0",
88
"keywords": [
99
"redis",
1010
"stream",
@@ -15,14 +15,14 @@
1515
"author": "Oguzhan Olguncu <[email protected]>",
1616
"repository": {
1717
"type": "git",
18-
"url": "https://github.com/upstash/sqs"
18+
"url": "https://github.com/upstash/queue"
1919
},
2020
"license": "MIT",
2121
"files": [
2222
"dist"
2323
],
2424
"bugs": {
25-
"url": "https://github.com/upstash/sqs/issues"
25+
"url": "https://github.com/upstash/queue/issues"
2626
},
2727
"scripts": {
2828
"test": "bun test src --coverage --bail",
@@ -31,15 +31,17 @@
3131
"prepare": "husky install"
3232
},
3333
"dependencies": {
34-
"@types/uuid": "^9.0.8",
3534
"@upstash/redis": "1.28.0",
3635
"uuid": "^9.0.1"
3736
},
3837
"devDependencies": {
39-
"typescript": "^5.0.0",
40-
"@biomejs/biome": "^1.4.1",
38+
"@types/uuid": "^9.0.8",
39+
"typescript": "latest",
40+
"@biomejs/biome": "^1.5.3",
4141
"bun-types": "latest",
42-
"husky": "^8.0.3",
43-
"tsup": "latest"
42+
"husky": "^9.0.11",
43+
"tsup": "latest",
44+
"@commitlint/cli": "^18.6.0",
45+
"@commitlint/config-conventional": "^18.6.0"
4446
}
4547
}

src/queue.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ describe("Queue", () => {
308308

309309
test(
310310
"should poll until data arives",
311-
async () => {
311+
() => {
312312
const throwable = async () => {
313313
const fakeValue = randomValue();
314314
const producer = new Queue({ redis, queueName: "app-logs" });

src/queue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export class Queue {
253253
invariant(consumerGroupName, "Consumer group name cannot be empty when receiving a message");
254254
invariant(queueName, "Queue name cannot be empty when receving a message");
255255

256-
return redis.xreadgroup(consumerGroupName, consumerName, queueName, ">", {
256+
return await redis.xreadgroup(consumerGroupName, consumerName, queueName, ">", {
257257
count: 1,
258258
blockMS: blockTimeMs,
259259
});

src/utils.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, expect, test } from "bun:test";
22
import { parseXclaimAutoResponse, parseXreadGroupResponse } from "./utils";
33

44
describe("Response Parsers", () => {
5-
test("should parse XCLAIMAUTO response", async () => {
5+
test("should parse XCLAIMAUTO response", () => {
66
const input = ["0-0", [["1703754659687-0", ["messageBody", '{"hello":"world"}']]], []];
77

88
expect(parseXclaimAutoResponse(input)).toEqual({
@@ -11,7 +11,7 @@ describe("Response Parsers", () => {
1111
});
1212
});
1313

14-
test("should parse XREADGROUP response", async () => {
14+
test("should parse XREADGROUP response", () => {
1515
const input = [
1616
["UpstashMQ:1251e0e7", [["1703755686316-0", ["messageBody", '{"hello":"world"}']]]],
1717
];

0 commit comments

Comments
 (0)