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

chore: only run biome on changed files #8

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/validate-biome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- uses: biomejs/setup-biome@v2

- name: Run Biome
run: biome ci
run: biome ci --changed --no-errors-on-unmatched --files-ignore-unknown=true
17 changes: 9 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Topsort.js
# @topsort/sdk

This repository holds the official Topsort.js client library. This project is built with [TypeScript][typescript] and uses [Bun][bun] for package management and testing.
This repository holds the official Topsort javascript client library. This project is built with [TypeScript][typescript] and uses [Bun][bun] for package management and testing.

[typescript]: https://www.typescriptlang.org
[bun]: https://bun.sh/
Expand Down Expand Up @@ -37,9 +37,9 @@ are more sensitive, emailed to <[email protected]>.

## Local Installation

To install Topsort.js as a contributor, you need to have Bun installed on your machine. Follow the instructions on the [Bun website](https://bun.sh/) to install it.
To modify or interact with the source code, you need to install Bun (the runtime). Follow the instructions on the [Bun website](https://bun.sh/) to install it.

You will also need [typos](https://github.com/crate-ci/typos) for validating documentation and [actionlint](https://github.com/rhysd/actionlint) for validating actions. Install it through your package manager of choice (on MacOS: `brew install typos-cli actionlint`).
You will additionally need [typos](https://github.com/crate-ci/typos) for validating documentation and [actionlint](https://github.com/rhysd/actionlint) for validating actions. Install it through your package manager of choice (on MacOS: `brew install typos-cli actionlint`).

Clone the repository and install the dependencies:

Expand All @@ -60,18 +60,18 @@ bun run build
bun link
```

This will register a local `topsort.js` to be used on the secondary project.
This will set up a local `@topsort/sdk` library to be used on another local project.

On the secondary project, if using bun, run:

```bash
bun link topsort.js
bun link @topsort/sdk
```

Or add it in dependencies in the package.json file:

```bash
"topsort.js": "link:topsort.js"
"@topsort/sdk": "link:@topsort/sdk"
```

## Building the SDK
Expand All @@ -82,7 +82,7 @@ To build the SDK, run the following command:
bun run build
```

This command cleans the `dist` directory and compiles the Typescript files into Javascript back to it
This command compiles Typescript into Javascript, suitable for use in more runtimes and browsers.

## Tests

Expand All @@ -109,6 +109,7 @@ bun run format:fix
```

## Submitting Contributions

### Commit Messages

We do conventional commits, so it will fail on checker with capital case after commit prefix. Refer to [Conventional Commits spec](https://www.conventionalcommits.org/en/v1.0.0/) or to [Amannn's Github Action for Semantic Pull Request](https://github.com/amannn/action-semantic-pull-request) for details.
Expand Down
57 changes: 30 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Topsort.js
# Topsort SDK

This repository holds the official Topsort.js client library. This project is built with [TypeScript][typescript] and uses [Bun][bun] for package management and testing.
This repository holds the official Topsort javascript client library. This project is built with [TypeScript][typescript] and uses [Bun][bun] for package management and testing.

[typescript]: https://www.typescriptlang.org
[bun]: https://bun.sh/
Expand All @@ -16,23 +16,24 @@ This repository holds the official Topsort.js client library. This project is bu

## Installation

With npm:
Using npm:
```sh
npm install @topsort/topsort.js --save
npm install @topsort/sdk --save
```
With yarn:

Using yarn:
```sh
yarn add @topsort/topsort.js --save
yarn add @topsort/sdk --save
```

## Usage

### Auctions

To create an auction, use the createAuction function. Here is an example:
To create an auction, use the `createAuction` function. Example:

```js
import { createAuction, type TopsortAuction } from '@topsort/topsort.js';
import { type TopsortAuction, createAuction } from "@topsort/sdk";

const auctionDetails: TopsortAuction = {
auctions: [
Expand All @@ -55,12 +56,13 @@ const auctionDetails: TopsortAuction = {

const config = {
// generate your api key in the auction manager - it should look some thing like this
// note: this is an invalid key and won't work, you need to replace it with your own
apiKey: "TSE_4S6o1g1CB5tyRENfhDMAn6viR7A5cy3j1JAR",
};

createAuction(config, auctionDetails)
.then(result => console.log(result))
.catch(error => console.error(error));
.then((result) => console.log(result))
.catch((error) => console.error(error));
```

#### Parameters
Expand Down Expand Up @@ -111,31 +113,31 @@ createAuction(config, auctionDetails)
To report an event, use the reportEvent function. Here is an example:

```js
import { reportEvent, type TopsortEvent } from 'topsort.js';
import { type TopsortEvent, reportEvent } from "@topsort/sdk";

const event: TopsortEvent = {
impressions: [
{
resolvedBidId:
"ChAGaP5D2ex-UKEEBCOHwvDjEhABkF4FDAx0S5mMD2cOG0w9GhABkEnL2CB6qKIoqeItVgA_InsKd2h0dHBzOi8vd3d3LndlYmEuYmUvZnIvcHJvbW8uaHRtbD91dG1fc291cmNlPW15c2hvcGkmdXRtX21lZGl1bT1iYW5uZXJfMTI4MHg0MDAmdXRtX2NvbnRlbnQ9ZGlzcGxheSZ1dG1fY2FtcGFpZ249c29sZGVuEAU",
id: "1720706109.713344-53B92988-7A49-4679-B18E-465943B46149",
occurredAt: "2024-07-11T13:55:09Z",
opaqueUserId: "38e0a5ff-9f8a-4e80-8969-e5e3f01348e8",
placement: {
path: "/categories/sports",
}
impressions: [
{
resolvedBidId:
"ChAGaP5D2ex-UKEEBCOHwvDjEhABkF4FDAx0S5mMD2cOG0w9GhABkEnL2CB6qKIoqeItVgA_InsKd2h0dHBzOi8vd3d3LndlYmEuYmUvZnIvcHJvbW8uaHRtbD91dG1fc291cmNlPW15c2hvcGkmdXRtX21lZGl1bT1iYW5uZXJfMTI4MHg0MDAmdXRtX2NvbnRlbnQ9ZGlzcGxheSZ1dG1fY2FtcGFpZ249c29sZGVuEAU",
id: "1720706109.713344-53B92988-7A49-4679-B18E-465943B46149",
occurredAt: "2024-07-11T13:55:09Z",
opaqueUserId: "38e0a5ff-9f8a-4e80-8969-e5e3f01348e8",
placement: {
path: "/categories/sports",
},
],
};

},
],
};

const config = {
// generate your api key in the auction manager - it should look some thing like this
apiKey: "TSE_4S6o1g1CB5tyRENfhDMAn6viR7A5cy3j1JAR",
};

reportEvent(config, event)
.then(result => console.log(result))
.catch(error => console.error(error));
.then((result) => console.log(result))
.catch((error) => console.error(error));
```

#### Parameters
Expand Down Expand Up @@ -172,4 +174,5 @@ We aim to cover the entire Topsort API, and contributions are always welcome. Th
Your help in enhancing the project is highly appreciated. Whether it’s reporting a bug, suggesting a new feature, or submitting a pull request, every bit of input helps us improve. Thank you for your support and happy coding!

## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "topsort.js",
"name": "@topsort/sdk",
"version": "0.1.0",
"description": "",
"packageManager": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class APIClient {
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"X-UA": `topsort.js ${version}`,
"X-UA": `@topsort/sdk ${version}`,
Authorization: `Bearer ${config.apiKey}`,
},
body: JSON.stringify(body),
Expand Down