Skip to content

Commit

Permalink
add prettier, formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-schabel committed Jan 19, 2024
1 parent 9e5ca29 commit 846635c
Show file tree
Hide file tree
Showing 178 changed files with 6,857 additions and 6,957 deletions.
18 changes: 10 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"semi": false,
"singleQuote": true
}
103 changes: 51 additions & 52 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "bun",
"request": "launch",
"name": "Debug Bun",

// The path to a JavaScript or TypeScript file to run.
"program": "${file}",

// The arguments to pass to the program, if any.
"args": [],

// The working directory of the program.
"cwd": "${workspaceFolder}",

// The environment variables to pass to the program.
"env": {},

// If the environment variables should not be inherited from the parent process.
"strictEnv": false,

// If the program should be run in watch mode.
// This is equivalent to passing `--watch` to the `bun` executable.
// You can also set this to "hot" to enable hot reloading using `--hot`.
"watchMode": false,

// If the debugger should stop on the first line of the program.
"stopOnEntry": false,

// If the debugger should be disabled. (for example, breakpoints will not be hit)
"noDebug": false,

// The path to the `bun` executable, defaults to your `PATH` environment variable.
"runtime": "bun",

// The arguments to pass to the `bun` executable, if any.
// Unlike `args`, these are passed to the executable itself, not the program.
"runtimeArgs": [],
},
{
"type": "bun",
"request": "attach",
"name": "Attach to Bun",

// The URL of the WebSocket inspector to attach to.
// This value can be retrieved by using `bun --inspect`.
"url": "ws://localhost:6499/",
}
]
}

"version": "0.2.0",
"configurations": [
{
"type": "bun",
"request": "launch",
"name": "Debug Bun",

// The path to a JavaScript or TypeScript file to run.
"program": "${file}",

// The arguments to pass to the program, if any.
"args": [],

// The working directory of the program.
"cwd": "${workspaceFolder}",

// The environment variables to pass to the program.
"env": {},

// If the environment variables should not be inherited from the parent process.
"strictEnv": false,

// If the program should be run in watch mode.
// This is equivalent to passing `--watch` to the `bun` executable.
// You can also set this to "hot" to enable hot reloading using `--hot`.
"watchMode": false,

// If the debugger should stop on the first line of the program.
"stopOnEntry": false,

// If the debugger should be disabled. (for example, breakpoints will not be hit)
"noDebug": false,

// The path to the `bun` executable, defaults to your `PATH` environment variable.
"runtime": "bun",

// The arguments to pass to the `bun` executable, if any.
// Unlike `args`, these are passed to the executable itself, not the program.
"runtimeArgs": []
},
{
"type": "bun",
"request": "attach",
"name": "Attach to Bun",

// The URL of the WebSocket inspector to attach to.
// This value can be retrieved by using `bun --inspect`.
"url": "ws://localhost:6499/"
}
]
}
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
17 changes: 16 additions & 1 deletion CREATING_A_MODULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,64 @@ Certainly! Let's create a README document to guide users through the process of
# Creating a Module in BNK (Bun Nookit)

## Overview

This guide provides step-by-step instructions on how to create a new module for the BNK framework. Whether you're adding functionality like OAuth integration or something entirely different, these guidelines will help align the module with BNK's design philosophy and standards to ensure consistency.

## Prerequisites

- Familiarity with TypeScript and BNK's core concepts.
- Understanding of the problem domain the module will address.

## Step 1: Research and Requirements Gathering

Before coding, understand the scope and requirements of the module. For instance, if you're building an OAuth module, research the OAuth 2.0 protocol, and identify the primary use cases you want to support.

## Step 2: Designing the Module

### 2.1 Define the API

Design a clear and intuitive API for the module. Consider the functions and interfaces users will interact with.

### 2.2 Plan the Architecture

Ensure the module aligns with BNK's architecture. Use factory functions, avoid global state, and adhere to strong typing.

### 2.3 Security and Performance

Plan for security and performance from the start. This is especially important for modules handling sensitive data or requiring high efficiency.

## Step 3: Implementation

### 3.1 Setup

Set up the basic structure of the module. Create a new directory and files as needed within the BNK project structure.

### 3.2 Core Functionality

Develop the core functionality of the module. Keep functions short and focused, and use descriptive names.

### 3.3 Integration

Ensure that the module integrates seamlessly with other BNK components.

### 3.4 Error Handling

Implement robust error handling to make the module resilient and reliable.

## Step 4: Testing

Write comprehensive tests for the module. Cover unit testing for individual functions and integration testing for the module as a whole.

## Step 5: Documentation

Document the module thoroughly. Include a usage guide, example implementations, and a detailed API reference.

## Step 6: Community Feedback and Iteration

Release a beta version of the module and encourage feedback from the BNK community. Iterate based on the feedback received.

## Best Practices

- **Follow BNK's Coding Style**: Adhere to the principles outlined in BNK's coding guidelines, such as using `const`, writing pure functions, and avoiding premature optimization.
- **Use Descriptive Names**: Choose clear and descriptive names for functions, variables, and modules.
- **Write Efficient Code**: Focus on practicality and optimization where necessary. Prioritize clarity and simplicity.

52 changes: 28 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@

**Bun Nookit (BNK)** is a comprehensive toolkit for software development, leveraging the power of Bun and TypeScript. With zero third-party dependencies, strong TypeScript inferencing, and a focus on Web API standards, BNK offers a modular, type-safe, and efficient way to build robust applications.


![GitHub License](https://img.shields.io/github/license/nookit-dev/bnkit)

![npm](https://img.shields.io/npm/v/bnkit?logo=npm) ![GitHub release (with filter)](https://img.shields.io/github/v/release/nookit-dev/bnkit) ![Stars](https://img.shields.io/github/stars/nookit-dev/bnkit)
![npm bundle size](https://img.shields.io/bundlephobia/min/bnkit) ![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/bnkit)
![npm](https://img.shields.io/npm/v/bnkit?logo=npm) ![GitHub release (with filter)](https://img.shields.io/github/v/release/nookit-dev/bnkit) ![Stars](https://img.shields.io/github/stars/nookit-dev/bnkit)
![npm bundle size](https://img.shields.io/bundlephobia/min/bnkit) ![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/bnkit)

![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/bun_nook_kit). ![Discord](https://img.shields.io/discord/1164699087543746560)'
![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/bun_nook_kit). ![Discord](https://img.shields.io/discord/1164699087543746560)'

## BNK Server Quickstart

## BNK Server Quickstart
```bash
bash <(curl -fsSL https://raw.githubusercontent.com/nookit-dev/bnkit/main/scripts/quickstart.sh)
```
Expand All @@ -22,48 +21,52 @@ Visit `http://localhost:3000` in your browser and you should see Hello world and
`http://localhost:3000/json` for the json

---
###

###

# [📋 Documentation](https://nookit.dev/readme)

#### [🧩 Modules Docs](https://nookit.dev/modules)

#### [🖥️ BNK CLI Docs](https://nookit.dev/bnk-cli/bnk-cli-readme)
#### [🔌 Plugin Docs](https://nookit.dev/plugins/BNK+Plugins)

###
#### [🔌 Plugin Docs](https://nookit.dev/plugins/BNK+Plugins)

###

## Bun Nookit Package Installation

Install in your project:
Install in your project:
`bun add bnkit`

Plugin install example:
Plugin install example:
`bun add @bnk/react`

Use any an all Bun Nookit modules - server example with json response (similar to starter project)

`index.ts`

```typescript
import { jsonRes, serverFactory } from "bnkit/server";
import { middleware, RoutesWithMiddleware } from "./middlewares";
import { jsonRes, serverFactory } from 'bnkit/server'
import { middleware, RoutesWithMiddleware } from './middlewares'

const routes = {
"/": {
'/': {
// parse from request if neeeded
get: (request) => new Response("Hello World!")
get: (request) => new Response('Hello World!'),
},
'/json': {
get: (request) =>
bnk.server.jsonRes({
message: 'Hello JSON Response!',
}),
},
"/json": {
get: request => bnk.server.jsonRes({
message: "Hello JSON Response!"
})
}
} satisfies RoutesWithMiddleware

const { start, routes } = bnk.server.serverFactory({
routes,
middleware
});

middleware,
})

// start on default port 3000
start()
Expand All @@ -76,7 +79,6 @@ Join our [Discord Server]("https://discord.gg/rQyWN7V6") https://discord.gg/rQyW
## Key Highlights

- **Zero Third Paty Dependencies** - BNK uses nothin' but Bun

- **Unit Tested** - To ensure BNK is reliable, changeable, and upgradeable.

- **TypeSafe with Strong TypeScript type Inferencing** - Strong types tell you where things are incorrect, strong type inferrence allows you to utilize the advantages of strong types and not having to deal with too much TypeScript.
Expand Down Expand Up @@ -138,6 +140,7 @@ Close To Final For V1:
### Better handling for Server Sent Events in Server, Fetcher, etc

## Screenshots

(if you made it this far)

Create typesafe server routes and middleware!
Expand All @@ -146,8 +149,8 @@ Create typesafe server routes and middleware!

<img width="582" alt="Xnapper-2023-11-14-19 47 14" src="https://github.com/nookit-dev/bnkit/assets/18100375/78afc0e7-46c0-4269-8072-e8622f111b08">


### Sponsors

None! Be the first to sponsor BNK :)

## License
Expand All @@ -157,4 +160,5 @@ Bun Nookit is licensed under the MIT License. Enjoy the freedom to use, modify,
Jumpstart your journey to revolutionary software development with Bun Nookit!

Contribute to the docs:

### [Docs Repo](https://github.com/nookit-dev/bnkit-docs)
Loading

0 comments on commit 846635c

Please sign in to comment.