Skip to content

Commit

Permalink
Added first set of base classes. Configured docs and its publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed Feb 10, 2024
1 parent fa44090 commit 7430e3c
Show file tree
Hide file tree
Showing 33 changed files with 1,188 additions and 184 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: npm run lint

- name: Build
run: npm run build:ts
run: npm run build

- name: Test
run: npm run test
66 changes: 66 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Deploy VitePress site to Pages

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
# - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm # or pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: npm ci # or pnpm install / yarn install / bun install
- name: Build with VitePress
run: |
npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
touch docs/.vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

![](./docs/logo.png)

# Emmett - a Node.js Event Store
# Emmett - vent Sourcing development made simple

Nowadays, storage is cheap, but the information is priceless.

Event Sourcing, contrary to the standard approach, keeps all the facts that happened in our system. To do that, it needs an event store: a database designed for its needs.

**This project aims to deliver an opinionated event store based on my experience working on [Marten](martendb.io/) and [EventStoreDB](https://developers.eventstore.com/).**
This project aims to experiment with an opinionated Event Sourcing framework based on my experience working on [Marten](martendb.io/) and [EventStoreDB](https://developers.eventstore.com/).

Check my inspirations and what I'm up to in [Reference materials](./ReferenceMaterials.md).
**Take your event-driven applications back to the future!**

## FAQ

Expand Down
1 change: 1 addition & 0 deletions ReferenceMaterials.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ I put here links that either are useful or may be useful for my implementation.
## NPM Packaging

- [Orhun Özer - How to bundle a tree-shakable typescript library with tsup and publish with npm](https://dev.to/orabazu/how-to-bundle-a-tree-shakable-typescript-library-with-tsup-and-publish-with-npm-3c46)
- [Andrea Stagi - Publish to NPM using GitHub Actions](https://dev.to/astagi/publish-to-npm-using-github-actions-23fn)
- [Colin Diesh - You may not need a bundler for your NPM library](https://cmdcolin.github.io/posts/2022-05-27-youmaynotneedabundler)

## Frontend
Expand Down
8 changes: 4 additions & 4 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ export default defineConfig({
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'Examples', link: '/markdown-examples' },
{ text: 'Getting Started', link: '/getting-started' },
],

sidebar: [
{
text: 'Examples',
items: [
{ text: 'Markdown Examples', link: '/markdown-examples' },
{ text: 'Runtime API Examples', link: '/api-examples' },
{ text: 'Getting Started', link: '/getting-started' },
{ text: 'API Examples', link: '/api-examples' },
],
},
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' },
{ icon: 'github', link: 'https://github.com/event-driven-io/emmett' },
],
},
});
8 changes: 8 additions & 0 deletions docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--vp-c-brand: #2b0f54;
--vp-c-brand-light: #ab1f65;
--vp-c-brand-dark: #2b0f54;
--vp-home-hero-name-color: var(--vp-c-brand);
--vp-button-brand-bg: var(--vp-c-brand);
--vp-button-brand-border: #c9b8a9;
--vp-button-brand-hover-border: var(--vp-button-brand-border);
--vp-button-brand-hover-bg: var(--vp-c-brand-light);
6 changes: 6 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import DefaultTheme from 'vitepress/theme';
import './custom.css';

export default {
...DefaultTheme,
};
5 changes: 5 additions & 0 deletions docs/api-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
outline: deep
---

# API docs
55 changes: 0 additions & 55 deletions docs/api-examples.md

This file was deleted.

11 changes: 11 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**Event Sourcing keeps all the facts that happened in our system, and that's powerful!** Facts are stored as events that can be used to make decisions, fine-tune read models, integrate our systems, and enhance our analytics and tracking. All in one package, wash and go!

Yet, some say that's complex and complicated; Emmett aims to prove that it doesn't have to be like that. We cut the boilerplate and layered madness, letting you focus on delivery. We're opinionated but focus on composition, not magic. Let me show you how.

## Events

Events are the centrepiece of event-sourced systems. They represent both critical points of the business process but are also used as the state. That enables you to reflect your business into the code better, getting the synergy. Let's model a simple business process: a shopping cart. You can open it, add or remove the product from it and confirm or cancel.

We could define it as follows:

<<< @/snippets/shoppingCart.ts#getting-started-events
24 changes: 12 additions & 12 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ layout: home

hero:
name: 'Emmett'
text: 'Event Sourcing made simple'
tagline: My great project tagline
text: 'Event Sourcing development made simple'
tagline: Take your event-driven applications back to the future!
actions:
- theme: brand
text: Markdown Examples
link: /markdown-examples
text: Getting Started
link: /getting-started
- theme: alt
text: API Examples
link: /api-examples
text: API Docs
link: /api-docs

features:
- title: Feature A
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature B
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature C
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: DevExperience as prime goal
details: Reduce the boilerplate, and focus on delivery with accessible tooling
- title: Gain insights from your data
details: Unleash the power of your data with Event Sourcing capabilities
- title: All patterns in one place
details: Use Decider, Workflow and other event-driven best practices seamlessly
---
85 changes: 0 additions & 85 deletions docs/markdown-examples.md

This file was deleted.

48 changes: 48 additions & 0 deletions docs/snippets/shoppingCart.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// #region getting-started-events
export type ShoppingCartEvent =
| {
type: 'ShoppingCartOpened';
data: {
shoppingCartId: string;
clientId: string;
openedAt: string;
};
}
| {
type: 'ProductItemAddedToShoppingCart';
data: {
shoppingCartId: string;
productItem: PricedProductItem;
};
}
| {
type: 'ProductItemRemovedFromShoppingCart';
data: {
shoppingCartId: string;
productItem: PricedProductItem;
};
}
| {
type: 'ShoppingCartConfirmed';
data: {
shoppingCartId: string;
confirmedAt: string;
};
}
| {
type: 'ShoppingCartCanceled';
data: {
shoppingCartId: string;
canceledAt: string;
};
};

export interface ProductItem {
productId: string;
quantity: number;
}

export type PricedProductItem = ProductItem & {
price: number;
};
// #endregion getting-started-events
Loading

0 comments on commit 7430e3c

Please sign in to comment.