Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating dependencies #1

Merged
merged 11 commits into from
Sep 23, 2024
Merged
8 changes: 4 additions & 4 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ ignorePatterns:
- dist

extends:
- plugin:@foxglove/base
- plugin:@foxglove/jest
- plugin:@lichtblick/base
- plugin:@lichtblick/jest

overrides:
- files: ["*.ts", "*.tsx"]
extends:
- plugin:@foxglove/typescript
- plugin:@lichtblick/typescript
parserOptions:
project: ./tsconfig.json
rules:
"@foxglove/no-boolean-parameters": off
"@lichtblick/no-boolean-parameters": off
1 change: 1 addition & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ printWidth: 100
trailingComma: "all"
tabWidth: 2
semi: true
endOfLine: "auto"
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# @foxglove/cdr
# @lichtblick/cdr

> _Common Data Representation serialization and deserialization library_

[![npm version](https://img.shields.io/npm/v/@foxglove/cdr.svg?style=flat)](https://www.npmjs.com/package/@foxglove/cdr)
[![npm version](https://img.shields.io/npm/v/@lichtblick/cdr.svg?style=flat)](https://www.npmjs.com/package/@lichtblick/cdr)

## Introduction

Expand All @@ -15,7 +15,7 @@ CDR is found in OMG DDS (Data Distributed Service) implementations such as the R
## Usage

```Typescript
import { CdrReader, CdrSizeCalculator, CdrWriter } from "@foxglove/cdr";
import { CdrReader, CdrSizeCalculator, CdrWriter } from "@lichtblick/cdr";

const calc = new CdrSizeCalculator();
calc.int8();
Expand Down Expand Up @@ -67,14 +67,10 @@ console.log(reader.sequenceLength());

## License

@foxglove/cdr is licensed under the [MIT License](https://opensource.org/licenses/MIT).
@lichtblick/cdr is licensed under the [MIT License](https://opensource.org/licenses/MIT).

## Releasing

1. Run `yarn version --[major|minor|patch]` to bump version
2. Run `git push && git push --tags` to push new tag
3. GitHub Actions will take care of the rest

## Stay in touch

Join our [Slack channel](https://foxglove.dev/slack) to ask questions, share feedback, and stay up to date on what our team is working on.
3. GitHub Actions will take care of the rest
39 changes: 21 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@foxglove/cdr",
"name": "@lichtblick/cdr",
"version": "3.3.0",
"description": "Common Data Representation serialization and deserialization library",
"license": "MIT",
Expand All @@ -15,13 +15,13 @@
],
"repository": {
"type": "git",
"url": "https://github.com/foxglove/cdr.git"
"url": "https://github.com/lichtblick/cdr.git"
},
"author": {
"name": "Foxglove Technologies",
"email": "[email protected]"
"name": "Lichtblick",
"email": "[email protected]"
},
"homepage": "https://github.com/foxglove/cdr",
"homepage": "https://github.com/lichtblick/cdr",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"files": [
Expand All @@ -41,21 +41,24 @@
"node": ">= 14"
},
"devDependencies": {
"@foxglove/eslint-plugin": "0.17.0",
"@types/jest": "27.0.1",
"@typescript-eslint/eslint-plugin": "4.31.1",
"@typescript-eslint/parser": "4.31.1",
"eslint": "7.32.0",
"@lichtblick/eslint-plugin": "^1.0.0",
"@types/jest": "29.5.12",
"@typescript-eslint/eslint-plugin": "v6",
"@typescript-eslint/parser": "v6",
"acorn": "^8.12.1",
"eslint": "8.50.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-es": "4.1.0",
"eslint-plugin-filenames": "1.3.2",
"eslint-plugin-import": "2.24.2",
"eslint-plugin-jest": "24.4.0",
"eslint-plugin-prettier": "4.0.0",
"jest": "27.2.0",
"prettier": "2.4.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jest": "27.6.3",
"eslint-plugin-prettier": "5.1.3",
"espree": "^9.1.0",
"jest": "29.7.0",
"prettier": "3.3.2",
"rimraf": "3.0.2",
"ts-jest": "27.0.5",
"typescript": "4.4.3"
}
"ts-jest": "^29.2.5",
"typescript": "5.3.3"
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
22 changes: 14 additions & 8 deletions src/CdrReader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,15 @@ describe("CdrReader", () => {
it.each([
["float32Array", "float32", [-3.835, 0, Math.PI], 6],
["float64Array", "float64", [-3.835, 0, Math.PI], 15],
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
["float64Array", "float64", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -0.123456789121212121212], 15],
])("reads float %s", (getter: string, setter: string, expected: number[], numDigits: number) => {
const writer = new CdrWriter();
writeArray(writer, setter as Setter, expected);

const reader = new CdrReader(writer.data);
const array = reader[getter as ArrayGetter](reader.sequenceLength());
expect(array).toBeDefined();
ctw-joao-luis marked this conversation as resolved.
Show resolved Hide resolved
expectToBeCloseToArray(Array.from(array.values()), expected, numDigits);
});

Expand Down Expand Up @@ -231,12 +233,12 @@ describe("CdrReader", () => {
const buffer = new Uint8Array(Buffer.from("00030000017f080064000000400000000", "hex"));
const reader = new CdrReader(buffer);
expect(reader.emHeader()).toMatchInlineSnapshot(`
Object {
"id": 100,
"mustUnderstand": true,
"objectSize": 64,
}
`);
{
"id": 100,
"mustUnderstand": true,
"objectSize": 64,
}
`);
});

it("takes a length when reading a string and doesn't read the sequence length again", () => {
Expand All @@ -263,7 +265,9 @@ Object {
writer.emHeader(false, 100, 4);

const reader = new CdrReader(writer.data);
expect(() => reader.sentinelHeader()).toThrowError(/Expected sentinel_pid/i);
expect(() => {
reader.sentinelHeader();
}).toThrow(/Expected sentinel_pid/i);
});

it.each([[1], [2], [4], [8], [0x7fffffff]])(
Expand Down Expand Up @@ -350,5 +354,7 @@ function writeBigArray(writer: CdrWriter, setter: "int64" | "uint64", array: big

function expectToBeCloseToArray(actual: number[], expected: number[], numDigits: number): void {
expect(actual.length).toBe(expected.length);
actual.forEach((x, i) => expect(x).toBeCloseTo(expected[i]!, numDigits));
actual.forEach((x, i) => {
expect(x).toBeCloseTo(expected[i]!, numDigits);
});
}
Loading
Loading