Skip to content

Commit

Permalink
chore: first draft
Browse files Browse the repository at this point in the history
  • Loading branch information
cadgerfeast committed Nov 11, 2023
0 parents commit de3961e
Show file tree
Hide file tree
Showing 122 changed files with 23,127 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Checks

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
checks:
runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, 'chore: release')"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
- name: Setup
uses: actions/setup-node@v3
with:
node-version: '18.14.2'
cache: 'npm'
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Test
run: npm run test
- name: Lint
run: npm run lint
31 changes: 31 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Docs

on:
push:
branches:
- main

jobs:
docs:
runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, 'chore: release')"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
- name: Setup
uses: actions/setup-node@v3
with:
node-version: '18.14.2'
cache: 'npm'
- name: Install
run: npm ci
- name: Build
run: npm run build -- --projects docs
- name: Deploy
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GH_TOKEN }}
publish_dir: ./docs/.vitepress/dist
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18.13.0'
registry-url: 'https://registry.npmjs.org'
- name: Setup Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Github Action"
- name: Setup NPM
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Version
run: npm run version
- name: Changelog
run: |
npm run changelog
git commit -a -m "chore: changelog"
git push --force
- name: Publish
run: npm run publish
- name: Release
run: npm run release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
/.npmrc
34 changes: 34 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Contributing

## Commits

Commit names should follow the [Conventional Commit](https://www.conventionalcommits.org/) convention.

Here are the supported types:

- `feat`: *New features*
- `fix`: *Changes that fixes a known bug or regression*
- `test`: *Changes that adds/updates/removes tests*
- `docs`: *Changes that affect internal or public documentation*
- `ci`: *Changes that affect the continuous integration system*
- `refactor`: *Changes that changes source or test files, without adding new feature nor fixing a bug*
- `style`: *Changes that only affect code clarity*
- `build`: *Changes that affect the build system*
- `perf`: *Changes that improves overall performance*
- `revert`: *Reverts previous changes*
- `chore`: *Other changes that doesn't affect source or test files*

## Issues

### When you find a new issue

- Open a [new issue](https://github.com/genesys/mollitia/issues/new).
Be sure to include a title and a clear description.
A code sample to reproduce the issue would be even better!

### When you fix an issue

- [Create an issue](#when-you-find-a-new-issue) if your fix solves an issue that has not yet been reported.
- Create a pull request referencing the issue that should be solved.
- Linting and Unit-Tests should be passing.
- If needed, documentation should be updated.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Genesys

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Mollitia

<p align="center"><br/><img width="200" src="https://genesys.github.io/mollitia/favicon.svg" alt="Mollitia Icon"/><br/><br/></p>

> JavaScript Resilience Library
`Mollitia` is a JavaScript Resilience library that works on Node and on browsers.

Its purpose is to help organize **asynchronous operations** under a highly customizable circuit that helps manage error use cases.

When everything is falling apart, it stops the classic flow and uses modules to manage failures.

## 📄 Documentation

Please check out the official documentation to get started using **Mollitia**, visit [genesys.github.io/mollitia](https://genesys.github.io/mollitia).

## 👏 Contributing

Please checkout the [Contributing Guide](./CONTRIBUTING.md) before creating any issue/pull-requests.
8 changes: 8 additions & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Helpers
import type { UserConfig } from '@commitlint/types';

module.exports = {
extends: [
'@commitlint/config-conventional'
]
} as UserConfig;
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.vitepress/cache
/.vitepress/dist
/node_modules
98 changes: 98 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// Helpers
import { withMermaid } from 'vitepress-plugin-mermaid';

export default withMermaid({
title: 'Mollitia',
cleanUrls: true,
srcDir: './src',
head: [
['link', { rel: 'icon', href: '/favicon.svg'}],
],
themeConfig: {
logo: '/favicon.svg',
nav: [
{
text: 'Guide',
link: '/guide/what-is-mollitia',
activeMatch: '/guide/'
},
{
text: 'Links',
items: [
{
text: 'Contributing',
link: 'https://github.com/genesys/mollitia/blob/main/CONTRIBUTING.md'
},
{
text: 'Changelog',
link: 'https://github.com/genesys/mollitia/blob/main/CHANGELOG.md'
}
]
}
],
socialLinks: [
{ icon: 'github', link: 'https://github.com/genesys/mollitia' }
],
sidebar: {
'/guide/': [
{
text: 'Introduction',
collapsed: false,
items: [
{ text: 'What is Mollitia?', link: '/guide/what-is-mollitia' },
{ text: 'Design', link: '/guide/design' },
{ text: 'Getting Started', link: '/guide/getting-started' }
]
},
{
text: 'API',
collapsed: false,
items: [
{ text: 'Circuit', link: '/guide/api/circuit' },
{
text: 'Modules',
collapsed: false,
items: [
{ text: 'Fallback', link: '/guide/api/modules/fallback' },
{ text: 'Timeout', link: '/guide/api/modules/timeout' },
{ text: 'Retry', link: '/guide/api/modules/retry' },
{ text: 'Cache', link: '/guide/api/modules/cache' },
{ text: 'Ratelimit', link: '/guide/api/modules/ratelimit' },
{ text: 'Bulkhead', link: '/guide/api/modules/bulkhead' },
{
text: 'Circuit Breaker',
collapsed: false,
items: [
{ text: 'Sliding Count', link: '/guide/api/modules/breaker/sliding-count' },
{ text: 'Sliding Time', link: '/guide/api/modules/breaker/sliding-time' }
]
}
]
}
]
},
{
text: 'Customization',
collapsed: false,
items: [
{
text: 'Modules',
link: '/guide/customization/modules'
},
{
text: 'Addons',
link: '/guide/customization/addons',
collapsed: false,
items: [
{ text: 'Prometheus', link: '/guide/customization/addons/prometheus' }
]
}
]
}
]
},
search: {
provider: 'local'
}
}
});
18 changes: 18 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "docs",
"private": true,
"type": "module",
"scripts": {
"dev": "vitepress dev",
"build": "vitepress build",
"preview": "vitepress preview"
},
"devDependencies": {
"mermaid": "^10.6.1",
"mollitia": "*",
"sass": "^1.69.5",
"vitepress": "^1.0.0-rc.25",
"vitepress-plugin-mermaid": "^2.0.15",
"vue": "^3.3.8"
}
}
47 changes: 47 additions & 0 deletions docs/src/components/form/number.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<script lang="ts" setup>
// Props
const props = withDefaults(defineProps<{
modelValue?: number;
step?: number;
label?: string;
}>(), {
modelValue: 0,
step: 1
});
// Emits
defineEmits(['update:modelValue']);
</script>

<template>
<div class="number">
<label>
<span class="label" v-if="props.label">{{ props.label }}</span>
<input type="number" :value="props.modelValue" :step="props.step" @input="$emit('update:modelValue', +($event.target as HTMLInputElement).value)"/>
</label>
</div>
</template>

<style lang="scss" scoped>
div.number {
> label {
> span.label {
margin-right: 5px;
}
> input {
font-size: inherit;
padding: 0 5px;
background-color: var(--vp-c-gray-soft);
color: var(--vp-c-neutral);
border-radius: 8px;
width: 50px;
border: 1px solid transparent;
&:hover {
border-color: var(--vp-c-brand-1);
}
&:focus-visible {
border-color: var(--vp-c-brand-1);
}
}
}
}
</style>
Loading

0 comments on commit de3961e

Please sign in to comment.