-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Split components into seperate packages (#411)
- Loading branch information
Showing
22 changed files
with
525 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,31 +229,31 @@ Example webhook definition | |
## Download webhook definitions and webhook payloads schema | ||
|
||
You can download the latest `index.json` and `schema.json` files from | ||
[unpkg](https://unpkg.com/browse/@octokit/[email protected]/) | ||
[unpkg](https://unpkg.com/) | ||
|
||
- [`index.json`](https://unpkg.com/@octokit/webhooks-definitions/index.json) | ||
- [`schema.json`](https://unpkg.com/@octokit/webhooks-definitions/schema.json) | ||
- [`index.json`](https://unpkg.com/@octokit/webhooks-examples/index.json) | ||
- [`schema.json`](https://unpkg.com/@octokit/webhooks-schemas/schema.json) | ||
|
||
## Usage as Node module | ||
|
||
To get an array of all webhook definition objects, require the `index.json` file | ||
To get an array of all webhook definition objects, require the `@octokit/webhooks-examples` package. | ||
|
||
```js | ||
// Use Node.js require: | ||
const WEBHOOKS = require("@octokit/webhooks-definitions/index.json"); | ||
const WEBHOOKS = require("@octokit/webhooks-examples/index.json"); | ||
|
||
// Or ESM/TypeScript import: | ||
import WEBHOOKS from "@octokit/webhooks-definitions/index.json"; | ||
import WEBHOOKS from "@octokit/webhooks-examples/index.json"; | ||
``` | ||
|
||
To get the JSON schema for webhook payloads, require the `schema.json` file | ||
To get the JSON schema for webhook payloads, require the `@octokit/webhooks-schemas` package. | ||
|
||
```js | ||
// Use Node.js require: | ||
const SCHEMA = require("@octokit/webhooks-definitions/schema.json"); | ||
const SCHEMA = require("@octokit/webhooks-schemas"); | ||
|
||
// Or ESM/TypeScript import: | ||
import SCHEMA from "@octokit/webhooks-definitions/schema.json"; | ||
import SCHEMA from "@octokit/webhooks-schemas"; | ||
``` | ||
|
||
### Usage with `ajv` in `strict` mode | ||
|
@@ -267,8 +267,8 @@ the custom keyword `tsAdditionalProperties`. | |
Here is an example of how you can set this up: | ||
|
||
```ts | ||
import type { WebhookEvent } from "@octokit/webhooks-definitions/schema"; | ||
import * as githubWebhookSchema from "@octokit/webhooks-definitions/schema.json"; | ||
import type { WebhookEvent } from "@octokit/webhooks-types"; | ||
import * as githubWebhookSchema from "@octokit/webhooks-schemas"; | ||
import Ajv from "ajv"; | ||
import addFormats from "ajv-formats"; | ||
|
||
|
@@ -286,10 +286,7 @@ This package ships with types for the webhook events generated from the | |
respective json schemas, which you can use like so: | ||
|
||
```typescript | ||
import { | ||
WebhookEvent, | ||
IssuesOpenedEvent, | ||
} from "@octokit/webhooks-definitions/schema"; | ||
import { WebhookEvent, IssuesOpenedEvent } from "@octokit/webhooks-types"; | ||
|
||
const handleWebhookEvent = (event: WebhookEvent) => { | ||
if ("action" in event && event.action === "completed") { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.