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

feat: add files to new repo #1

Merged
merged 1 commit into from
Aug 21, 2023
Merged
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
179 changes: 179 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
module.exports = {
extends: [
"eslint:recommended",
"plugin:import/recommended",
"plugin:prettier/recommended",
],
ignorePatterns: ["**/cdk.out/**", "**/dist/**"],
rules: {
"prettier/prettier": "error",
"import/extensions": 0,
"import/no-unresolved": 0,
"import/prefer-default-export": 0,
"import/no-duplicates": "error",
complexity: ["error", 8],
"max-lines": ["error", { max: 200, skipBlankLines: true }],
"max-depth": ["error", 3],
"max-params": ["error", 6],
eqeqeq: ["error", "smart"],
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: true,
optionalDependencies: false,
peerDependencies: false,
},
],
"no-shadow": [
"error",
{
hoist: "all",
},
],
"prefer-const": "error",
"import/order": [
"error",
{
groups: [
["external", "builtin"],
"unknown",
"internal",
["parent", "sibling", "index"],
],
alphabetize: {
order: "asc",
caseInsensitive: false,
},
"newlines-between": "always",
pathGroupsExcludedImportTypes: ["builtin"],
},
],
"sort-imports": [
"error",
{
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
},
],
"padding-line-between-statements": [
"error",
{
blankLine: "always",
prev: "*",
next: "return",
},
],
"prefer-arrow/prefer-arrow-functions": [
"error",
{
disallowPrototype: true,
singleReturnOnly: false,
classPropertiesAllowed: false,
},
],
"no-restricted-imports": [
"error",
{
paths: [
{
name: "aws-sdk",
message: "Please use aws-sdk/{module} import instead",
},
{
name: ".",
message: "Please use explicit import file",
},
],
},
],
curly: ["error", "all"],
},
root: true,
env: {
es6: true,
node: true,
browser: true,
},
plugins: ["prefer-arrow", "import"],
parserOptions: {
ecmaVersion: 9,
sourceType: "module",
project: ["./tsconfig.eslint.json"],
tsconfigRootDir: __dirname,
},
overrides: [
{
files: ["**/*.ts?(x)"],
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:prettier/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.eslint.json",
},
rules: {
"@typescript-eslint/prefer-optional-chain": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/strict-boolean-expressions": [
"error",
{
allowString: false,
allowNumber: false,
allowNullableObject: true,
},
],
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": "allow-with-description",
minimumDescriptionLength: 10,
},
],
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/explicit-member-accessibility": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/interface-name-prefix": 0,
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/ban-types": [
"error",
{
types: {
FC: "Use `const MyComponent = (props: Props): JSX.Element` instead",
SFC: "Use `const MyComponent = (props: Props): JSX.Element` instead",
FunctionComponent:
"Use `const MyComponent = (props: Props): JSX.Element` instead",
"React.FC":
"Use `const MyComponent = (props: Props): JSX.Element` instead",
"React.SFC":
"Use `const MyComponent = (props: Props): JSX.Element` instead",
"React.FunctionComponent":
"Use `const MyComponent = (props: Props): JSX.Element` instead",
},
extendDefaults: true,
},
],
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-unnecessary-type-arguments": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/restrict-template-expressions": [
"error",
{
allowNumber: true,
allowBoolean: true,
},
],
"@typescript-eslint/no-unsafe-enum-comparison": "warn",
},
},
],
};
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:wrench: Changes in this PR:

-

:books: Documentation

-

:construction: Remaining work:

-
28 changes: 28 additions & 0 deletions .github/workflows/push-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Merge into main

on:
push:
branches:
- main

permissions:
# write to contents and pull-requests required for release-please
contents: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release-please.outputs.releases_created }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release-please
with:
release-type: node
package-name: eventbridge-toolbox-schema-generator
token: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/release-published.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release Published

on:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
publish-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7.27.0
- uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org/'
cache: "pnpm"
- name: 💫 Install dependencies
run: pnpm install --frozen-lockfile
- name: 🏡 Build
run: pnpm run build
- name: 🚀 Publish eventbridge-toolbox
run: pnpm publish --access=public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Node modules
node_modules

# CDK Output
cdk.out

# Environment Variables
.env

# Built Files
dist
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
auto-install-peers=true

@aleios-cloud:registry=https://registry.npmjs.org
87 changes: 87 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# eventbridge-toolbox-schema-generator

Eventbridge Toolbox Schema Generator is cli tool that automates the initial creation of a schema registry in your documentation of your event-driven architecture.

This is designed to work with the [eventbridge-toolbox](https://github.com/aleios-cloud/eventbridge-toolbox) package.

## Eventbridge Contracts

Within event-driven architectures, events facilitate communication between loosely connected services in an application. EventBridge is AWS's tool for implementing asynchronous event-driven workflows.

Event emitters are responsible for broadcasting events to event channels, while event consumers are responsible for executing business logic whenever they encounter a relevant event.

EventBridge contracts ensure a stable and reliable interaction emitters and consumers. These contract acts as a guiding agreement which guarantees that emitters' published events will consistently trigger the corresponding business logic on the consumer side.

## Key Features

- Generate documentation skeletons for events
- Generate json schemas for events from contracts

## Getting Started

### Prerequisites

### Installation

With npm:

```
npm install --save-dev @aleios-cloud/eventbridge-toolbox-schema-generator
```

With yarn:

```
yarn add -D @aleios-cloud/eventbridge-toolbox-schema-generator
```

With pnpm:

```
pnpm add -D @aleios-cloud/eventbridge-toolbox-schema-generator
```

### Usage

You can create a documentation website based on [eventcatalog.dev](https://www.eventcatalog.dev/) and generate docs directly from your event contracts.

1. Set up an event catalog site and give it a name:

```
npx @eventcatalog/create-eventcatalog@latest <name your event catalog>
```

2. Edit `eventcatalog.config.js` with your details

3. Remove the example events from the `events` folder, as well as everything in the `services` and `domains` folders

4. Run `eventbridge-toolbox-schema-generator` with the following arguments:

- The path from the root to your event contracts
- The path from the root to the event catalog events folder

```
npx schema-generator <path from root to your event contracts> <path from root to event catalog events>
```

5. You can start a local development server by running:

```
npm run dev
```

6. You can find out more about how to deploy your documentation site in the [event catalog docs](https://www.eventcatalog.dev/docs/guides/deployment)

## Contributors

<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td valign="top"><a href="https://github.com/RyanT5"><img src="https://avatars.githubusercontent.com/u/22382958?v=4" width="100px;" alt="Ryan Schuller"/><br /><sub><b>Ryan Schuller</b></sub></a></td>
<td valign="top"><a href="https://github.com/lukey-aleios"><img src="https://avatars.githubusercontent.com/u/93375669?v=4" width="100px;" alt="Luke Yianni"/><br /><sub><b>Luke Yianni</b></sub></a></td>
<td valign="top"><a href="https://github.com/april-bates-aleios"><img src="https://avatars.githubusercontent.com/u/124585201?v=4" width="100px;" alt="April Bates"/><br /><sub><b>April Bates</b></sub></a></td>
</tr>
</tbody>
</table>
<!-- markdownlint-restore -->
Loading