Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
assignees: [ "leonardocustodio" ]
reviewers: [ "leonardocustodio" ]
labels: [ "dependencies" ]
groups:
node:
patterns:
- "*"

- package-ecosystem: github-actions
directory: '/'
labels: [ "dependencies" ]
assignees: ["leonardocustodio" ]
reviewers: ["leonardocustodio" ]
schedule:
interval: weekly
groups:
gh-actions:
patterns:
- "*"
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build and Test

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Build packages
run: bun run build

- name: Run tests
run: bun run test
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Code Analysis

on:
push:
branches: [main]
pull_request:
paths-ignore:
- '**.md'

jobs:
lint:
name: ESLint & Prettier
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Check formatting
run: bun run format:check

- name: Run linter
run: bun run lint

- name: Type check
run: bun run check-types
28 changes: 1 addition & 27 deletions apps/playground/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1 @@
## Getting Started

First, run the development server:

```bash
pnpm dev
```

Open [http://localhost:3001](http://localhost:3001) with your browser to see the result.

You can start editing the page by modifying `app.vue`. The page auto-updates as you edit the file.

To create [API routes](https://nuxt.com/docs/guide/directory-structure/server), add an `api/` or a `routes` directory to the `server/` directory and create `your-file.ts` which will contain your api logic. Like `server/api/hello.ts` would map to [http://localhost:3001/api/hello](http://localhost:3001/api/hello).

> See the guide for more details -> [directory-structure/server](https://nuxt.com/docs/guide/directory-structure/server)

## Learn More

To learn more about Next.js, take a look at the following resources:

- [NuxtJs Official documentation](https://nuxt.com/docs/getting-started/introduction) - learn about Nuxt to create production-grade full-stack web apps and websites features and API.

## Deploy on Vercel

You can easily deploy your Nuxt app by using the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme).

Check out our [Nuxt deployment documentation](https://vercel.com/docs/frameworks/nuxt) for more details.
## playground
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev",
"test": "turbo run test",
"lint": "turbo run lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"format:check": "prettier --check \"**/*.{ts,tsx,md}\"",
"check-types": "turbo run check-types"
},
"devDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion packages/uniform-resources/src/fountain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ export class FountainDecoder {
}

// Validate consistency
if (part.seqLen !== this.seqLen || part.messageLen !== this.messageLen || part.checksum !== this.checksum) {
if (
part.seqLen !== this.seqLen ||
part.messageLen !== this.messageLen ||
part.checksum !== this.checksum
) {
throw new Error("Inconsistent part metadata");
}

Expand Down
12 changes: 9 additions & 3 deletions packages/uniform-resources/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,10 @@ function uint32ToBytes(value: number): Uint8Array {
* Encode data as bytewords with the specified style.
* Includes CRC32 checksum.
*/
export function encodeBytewords(data: Uint8Array, style: BytewordsStyle = BytewordsStyle.Minimal): string {
export function encodeBytewords(
data: Uint8Array,
style: BytewordsStyle = BytewordsStyle.Minimal,
): string {
// Append CRC32 checksum
const checksum = crc32(data);
const checksumBytes = uint32ToBytes(checksum);
Expand Down Expand Up @@ -718,7 +721,10 @@ export function encodeBytewords(data: Uint8Array, style: BytewordsStyle = Bytewo
* Decode bytewords string back to data.
* Validates and removes CRC32 checksum.
*/
export function decodeBytewords(encoded: string, style: BytewordsStyle = BytewordsStyle.Minimal): Uint8Array {
export function decodeBytewords(
encoded: string,
style: BytewordsStyle = BytewordsStyle.Minimal,
): Uint8Array {
const lowercased = encoded.toLowerCase();
let bytes: number[];

Expand Down Expand Up @@ -788,7 +794,7 @@ export function decodeBytewords(encoded: string, style: BytewordsStyle = Bytewor

if (expectedChecksum !== actualChecksum) {
throw new Error(
`Bytewords checksum mismatch: expected ${expectedChecksum.toString(16)}, got ${actualChecksum.toString(16)}`
`Bytewords checksum mismatch: expected ${expectedChecksum.toString(16)}, got ${actualChecksum.toString(16)}`,
);
}

Expand Down
12 changes: 8 additions & 4 deletions packages/uniform-resources/tests/uniform-resources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,13 +585,13 @@ describe("CRC32 tests", () => {
// "123456789" has CRC32 = 0xCBF43926 (IEEE polynomial)
const data = new TextEncoder().encode("123456789");
const checksum = crc32(data);
expect(checksum).toBe(0xCBF43926);
expect(checksum).toBe(0xcbf43926);
});

it("calculates CRC32 for single byte", () => {
const data = new Uint8Array([0x00]);
const checksum = crc32(data);
expect(checksum).toBe(0xD202EF8D);
expect(checksum).toBe(0xd202ef8d);
});
});

Expand All @@ -606,7 +606,9 @@ describe("Bytewords identifier tests", () => {

it("throws for non-4-byte data", () => {
const data = new Uint8Array([0, 1, 2]);
expect(() => encodeBytewordsIdentifier(data)).toThrow("Identifier data must be exactly 4 bytes");
expect(() => encodeBytewordsIdentifier(data)).toThrow(
"Identifier data must be exactly 4 bytes",
);
});
});

Expand All @@ -621,7 +623,9 @@ describe("Bytemoji identifier tests", () => {

it("throws for non-4-byte data", () => {
const data = new Uint8Array([0, 1, 2]);
expect(() => encodeBytemojisIdentifier(data)).toThrow("Identifier data must be exactly 4 bytes");
expect(() => encodeBytemojisIdentifier(data)).toThrow(
"Identifier data must be exactly 4 bytes",
);
});

it("contains 256 unique bytemojis", () => {
Expand Down
3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": [".nuxt/**", ".output/**", "dist/**"]
},
"test": {
"dependsOn": ["build"]
},
"lint": {
"dependsOn": ["^lint"]
},
Expand Down
Loading