Skip to content

Commit

Permalink
monorepo tools first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoobes committed Aug 29, 2023
0 parents commit bcac9e4
Show file tree
Hide file tree
Showing 42 changed files with 6,974 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.yarn/*
.yarn/releases/*
!.yarn/patches
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
# Swap the comments on the following lines if you don't wish to use zero-installs
# Documentation here: https://yarnpkg.com/features/zero-installs
!.yarn/cache
#.pnp.*
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarnPath: .yarn/releases/yarn-3.6.3.cjs
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# tools
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "tools",
"packageManager": "[email protected]",
"private": true,
"workspaces": [
"packages/*"
]
}
2 changes: 2 additions & 0 deletions packages/builder/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist/*
1 change: 1 addition & 0 deletions packages/builder/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./test
34 changes: 34 additions & 0 deletions packages/builder/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Contributing to sern-handler/option

Thank you for your interest in contributing! We appreciate your help in making this project better.

To contribute, please follow these guidelines:

## Bug Reports and Feature Requests

If you encounter a bug or have a feature request, please submit an issue on the [GitHub repository](https://github.com/sern-handler/option/issues). Before submitting an issue, please search existing issues to avoid duplicates.

When submitting an issue, please provide as much detail as possible, including steps to reproduce, expected behavior, and screenshots if applicable.

## Pull Requests

We welcome pull requests for bug fixes, improvements, and new features. To submit a pull request, please follow these steps:

1. Fork the repository and create your branch from `main`.
2. Make your changes and ensure that the code follows the project's coding style and conventions.
3. Write clear and concise commit messages.
4. Test your changes thoroughly.
5. Document any necessary changes in the project's documentation.
6. Submit the pull request, providing a detailed description of the changes made.

## Coding Style and Conventions

Please adhere to the coding style and conventions used in the project. If there are specific guidelines or linting rules, they will be mentioned in the project's documentation or configuration files.

## License

By contributing to [Project Name], you agree that your contributions will be licensed under the [project's license](./LICENSE).

---

Thank you for considering contributing! We appreciate your support and look forward to your contributions.
21 changes: 21 additions & 0 deletions packages/builder/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 sern

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.
66 changes: 66 additions & 0 deletions packages/builder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

# @sern/builder

`@sern/builder` is a TypeScript library that provides a type-safe and declarative builder to create data for the Discord API. At the moment it only creates `options for chat input command.` PRs are welcome!

## Installation

You can install `@sern/builder` using npm or yarn:

```bash
npm install @sern/builder
```
or

```bash
yarn add @sern/builder
```

## Features
- Small size: `<= 2kb`
- Type-safe builder: Create data for the Discord API with full type checking.
- Declarative and minimal syntax: Build data using a clean and intuitive syntax.
- Supports all option types: String, number, attachment, integer, user, channel, and mentionable and subcommands
- Validates data: checks names and description based on Discord Api regexes
- 'Bottom up Builders': Each function is composable and individual,
- Traditional builders contain an intermediary invalid state, while pure functions yield 'valid state'
- This allows more flexible structures and substructures while being `declarative` and `less noisy`

## Usage

Here's an example of how to use `@sern/builder` to create a subcommandgroup structure for the Discord API:

```javascript
import { str, name, description, NoValidator, Flags, subcommandgroup, subcommand, length, _ } from '@sern/builder';

const tree = subcommandgroup(
name('group'),
description('bunch of subcommands'),
[
subcommand(
name("first"),
description("second"),
[
str(
name("choose"),
description("pick one of the following"),
length(_, 10),
Flags.Required | Flags.Autocomplete),
]
)]
)
```

## Contributing

Contributions to `@sern/builder` are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the [GitHub repository](https://github.com/sern-handler/option).

Before contributing, please make sure to read the [Contributing Guidelines](CONTRIBUTING.md).

## License

This project is licensed under the [MIT License](LICENSE).

---

Thank you for using `@sern/builder`! If you have any questions or need further assistance, please feel free to reach out.
Loading

0 comments on commit bcac9e4

Please sign in to comment.