Skip to content

Commit

Permalink
Merge pull request #45 from expressots/feature/update-doc-290
Browse files Browse the repository at this point in the history
Feature/update doc 290
  • Loading branch information
rsaz committed Mar 31, 2024
2 parents 8491480 + b6a3bac commit 933a5c4
Show file tree
Hide file tree
Showing 17 changed files with 507 additions and 699 deletions.
51 changes: 24 additions & 27 deletions docs/cli/generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,38 +45,25 @@ We provide two different structures to scaffold the resources:

Current available resources:

| Long form | short |
| ---------- | ----- |
| usecase | u |
| controller | c |
| dto | d |
| provider | p |
| service | s |
| entity | e |
| middleware | m |

## Usage Example

| Command | Expected result |
| -------------------------- | ---------------------------------------------------------------------------------------- |
| expressots g u user/find | Use case to be created in the folder `useCases` with this folder structure: user/find |
| expressots g c user/find | Controller to be created in the folder `useCases` inside of user/find |
| expressots g d user/find | DTO to be created in the folder `useCases` inside of user/find |
| expressots g p email/email | Provider to be created in the folder `providers` inside of user/find |
| expressots g s user/find | Service creates usecase, controller and DTO and add them in the desired folder user/find |
| expressots g e user | Entity to be created in the folder `entities` with this folder structure: user |
| expressots g m auth | Middleware to be created in the folder `middlewares` with this folder structure: auth |
| Long form | short | Command | Expected result |
| ---------- | ----- | -------------------------- | ---------------------------------------------------------------------------------------- |
| usecase | u | expressots g u user/find | Use case to be created in the folder `useCases` with this folder structure: user/find |
| controller | c | expressots g c user/find | Controller to be created in the folder `useCases` inside of user/find |
| dto | d | expressots g d user/find | DTO to be created in the folder `useCases` inside of user/find |
| provider | p | expressots g p email/email | Provider to be created in the folder `providers` inside of user/find |
| service | s | expressots g s user/find | Service creates usecase, controller and DTO and add them in the desired folder user/find |
| entity | e | expressots g e user | Entity to be created in the folder `entities` with this folder structure: user |
| middleware | mi | expressots g mi auth | Middleware to be created in the folder `middlewares` with this folder structure: auth |
| module | mo | expressots g mo user | Module to be created in the folder where `controllers` and `usecases` are located |

All resources can be created using the structure `folder/subfolder/resource`.

For services, you can take advantage of creating the use case, controller and DTO at once using the structure `entity_action` or `entity-action`. Example: `expressots g s user-create`.
## Scaffolding using hyphenated names

:::caution
The `expressots.config.ts` configuration file, located in the project root folder, determines where all resources will be created.
:::
For services, you can take advantage of creating the use case, controller and DTO at once using the structure `entity_action` or `entity-action`. Example: `expressots g s user-create`.

:::info
All usecases, controllers and DTOs are being inside of the `useCases` folder. However, this may change in the future.
The `expressots.config.ts` configuration file, located in the project root folder, determines where all resources will be created.
:::

## ExpressoTS Config File
Expand All @@ -91,7 +78,16 @@ import { ExpressoConfig, Pattern } from "@expressots/core";
const config: ExpressoConfig = {
sourceRoot: "src",
scaffoldPattern: Pattern.KEBAB_CASE,
opinionated: false,
opinionated: true,
scaffoldSchematics: {
entity: "entity",
provider: "provider",
module: "module",
controller: "controller",
dto: "dto",
middleware: "middleware",
usecase: "useCases",
},
};

export default config;
Expand All @@ -100,6 +96,7 @@ export default config;
- **sourceRoot**: the root folder that will be used by the CLI to create the resources. Default: `src`
- **scaffoldPattern**: the pattern that will be used to create the resources. Default: `Pattern.KEBAB_CASE`. Example: `user-create`
- **opinionated**: if true, the CLI will create the resources using the opinionated folder structure
- **scaffoldSchematics**: the folder convention names for each resource. Default: `useCases`, `entities`, `providers`, `middlewares`, `controllers`, `dtos`

## Recommendations

Expand Down
32 changes: 21 additions & 11 deletions docs/cli/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ First install the CLI globally using the command below:
npm install -g @expressots/cli
```

## Basic Usage
## Basic usage

```bash
expressots <command> [options]
Expand All @@ -37,9 +37,19 @@ expressots --help
Providers information about your Operational System, Project and CLI version:

```bash
expressots info
expressots info or i
```

### Resources list

List all available resources to scaffold:

```bash
expressots resources or r
```

![Resources](../overview/img/scaffold-resources.png)

## Create a Project

There are two options to create a new project, interactively or silently (passing the options as arguments).
Expand All @@ -61,9 +71,9 @@ expressots new <project-name>
expressots new <project-name> -p <package-manager> -t <template> -d <directory>
```

- **package-manager**: `npm`, `yarn` or `pnpm`
- **template**: `opinionated` or `non-opinionated`
- **directory**: `./my-project`
- **package-manager**: `npm`, `yarn` or `pnpm`
- **template**: `opinionated` or `non-opinionated`
- **directory**: `./my-project`

The flag `-d` is optional and is used to specify the directory where the project will be created. If not specified, the project will be created in the current directory.

Expand All @@ -73,9 +83,9 @@ The flag `-d` is optional and is used to specify the directory where the project

ExpressoTS is an MIT-licensed open source project. It's an independent project with ongoing development made possible thanks to your support. If you'd like to help, please consider:

- Become a **[sponsor on GitHub](https://github.com/sponsors/expressots)**
- Follow the **[organization](https://github.com/expressots)** on GitHub and Star ⭐ the project
- Subscribe to the Twitch channel: **[Richard Zampieri](https://www.twitch.tv/richardzampieri)**
- Join our **[Discord](https://discord.com/invite/PyPJfGK)**
- Contribute submitting **[issues and pull requests](https://github.com/expressots/expressots/issues/new/choose)**
- Share the project with your friends and colleagues
- Become a **[sponsor on GitHub](https://github.com/sponsors/expressots)**
- Follow the **[organization](https://github.com/expressots)** on GitHub and Star ⭐ the project
- Subscribe to the Twitch channel: **[Richard Zampieri](https://www.twitch.tv/richardzampieri)**
- Join our **[Discord](https://discord.com/invite/PyPJfGK)**
- Contribute submitting **[issues and pull requests](https://github.com/expressots/expressots/issues/new/choose)**
- Share the project with your friends and colleagues
42 changes: 22 additions & 20 deletions docs/codebyexample/app-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,48 @@ The application container is a dependency injection container. See [Application
const appContainer = new AppContainer();

export const container: Container = appContainer.create([
// Add your modules here
AppModule,
// Add your modules here
AppModule,
]);
```

## Creating AppContainer

The `AppContainer` class takes one optional parameter:

- `defaultScope` is the default binding scope. Use `BindingScopeEnum` to set the default scope (Request, Singleton, Transient).
- `skipBaseClassChecks` is a boolean value that indicates if the container should skip the base class checks. This is useful when you are using abstract classes as binding identifiers or you are extending classes from third-party libraries. Set this value to `true` to skip the base class checks.
- `defaultScope` is the default binding scope. Use `BindingScopeEnum` to set the default scope (Request, Singleton, Transient).
- `skipBaseClassChecks` is a boolean value that indicates if the container should skip the base class checks. This is useful when you are using abstract classes as binding identifiers or you are extending classes from third-party libraries. Set this value to `true` to skip the base class checks.
- `autoBindInjectable` is a boolean value that indicates if the container should automatically bind injectable classes. Set this value to `true` to automatically bind injectable classes.

:::info
The default scope is `BindingScopeEnum.Request` and `skipBaseClassChecks` is `false`.
:::

```typescript
const appContainer = new AppContainer({
defaultScope: BindingScopeEnum.Request,
skipBaseClassChecks: true,
defaultScope: BindingScopeEnum.Request,
skipBaseClassChecks: true,
autoBindInjectable: false,
});
```

The `AppContainer` instance returns an instance of `AppContainer` that gives you access to the following methods:

- `create()` creates the application container.
- `Container` is the dependency injection container instance.
- `getBindingDictionary()` returns the binding dictionary map of classes injected in the dependency injection system.
- `getContainerOptions()` returns the container options.
- `create()` creates the application container.
- `Container` is the dependency injection container instance.
- `getBindingDictionary()` returns the binding dictionary map of classes injected in the dependency injection system.
- `getContainerOptions()` returns the container options.

### Method Create

The `create` method takes one mandatory parameter (array of modules);

```typescript
export const container: Container = appContainer.create([
// Add your modules here
AppModule,
UserModule,
ProductModule,
// Add your modules here
AppModule,
UserModule,
ProductModule,
]);
```

Expand All @@ -59,9 +61,9 @@ export const container: Container = appContainer.create([

ExpressoTS is an MIT-licensed open source project. It's an independent project with ongoing development made possible thanks to your support. If you'd like to help, please consider:

- Become a **[sponsor on GitHub](https://github.com/sponsors/expressots)**
- Follow the **[organization](https://github.com/expressots)** on GitHub and Star ⭐ the project
- Subscribe to the Twitch channel: **[Richard Zampieri](https://www.twitch.tv/richardzampieri)**
- Join our **[Discord](https://discord.com/invite/PyPJfGK)**
- Contribute submitting **[issues and pull requests](https://github.com/expressots/expressots/issues/new/choose)**
- Share the project with your friends and colleagues
- Become a **[sponsor on GitHub](https://github.com/sponsors/expressots)**
- Follow the **[organization](https://github.com/expressots)** on GitHub and Star ⭐ the project
- Subscribe to the Twitch channel: **[Richard Zampieri](https://www.twitch.tv/richardzampieri)**
- Join our **[Discord](https://discord.com/invite/PyPJfGK)**
- Contribute submitting **[issues and pull requests](https://github.com/expressots/expressots/issues/new/choose)**
- Share the project with your friends and colleagues
74 changes: 34 additions & 40 deletions docs/hello.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,54 @@
sidebar_position: 0
---

# Hello, Dev
# Welcome to ExpressoTS

ExpressoTS strives to abstract away the complexities of software development to make it eaiser for you to build your next project. We want to make you more productive and help you focus on what matters the most, your business logic.
ExpressoTS is designed to simplify the software development process, enabling developers to concentrate on the core business logic by abstracting technical complexities. Our goal is to enhance your productivity through a framework that not only accelerates development but also offers comprehensive documentation and a superior developer experience, minimizing the necessity for boilerplate code.

If you think about it, every programming language feature or framework is built to accelerate the development process, but most fail to deliver good documentation, good developer experience, or to reduce the amount of boilerplate code you have to write. We want to change that.
Our commitment is twofold: to simplify your development work and to enhance your productivity. As we embark on this journey, we invite you to join our community-driven project. Your insights, feedback, and contributions are invaluable in creating an optimal developer experience for everyone.

> This is our commitment: to make your life easier, and to make you more productive.
We appreciate your support in this endeavor. Let's code efficiently together. 🐎

As a community-driven project, we want you to be part of this journey with us. Your feedback, ideas, and contributions will help us build a better developer experience for everyone.
## Navigating the Documentation

Thanks for joining us in this challenge. Happy coding! 🐎
This documentation is organized into distinct sections, each focusing on a specific aspect of ExpressoTS. Utilize the sidebar on the left to navigate through the content:

---

## How to Read this Documentation

The documentation is divided into several sections, each one covering a different topic. You can navigate through the documentation using the sidebar on the left side of the page.
- **Overview**: Provides general information about ExpressoTS, including project resources, concepts, objectives, and initial setup instructions.
- **Code By Example**: Offers practical examples to demonstrate the application of ExpressoTS resources.
- **CLI**: Details the command-line interface, including usage instructions.
- **Providers**: Describes the available providers and their utilization.
- **Tutorial**: A comprehensive, step-by-step guide to accomplishing specific tasks within ExpressoTS.
- **Roadmap**: Outlines the future direction and planned features of ExpressoTS.
- **Governance**: Explains the governance model of ExpressoTS and outlines how to contribute to the project.

- **Overview**: General information about the project resources, concepts, its goals, and how to get started.
- **Code By Example**: A collection of examples that demonstrate how to use the project resources in a more practical way.
- **CLI**: Information about the command-line interface and how to use it.
- **Providers**: Information about the providers and how to use them.
- **Tutorial**: A step-by-step guide explaining how to perform a specific task.
- **Roadmap**: A list of features that are planned for future releases.
- **Governance**: Information about the project governance and how to contribute.

---
## Understanding Alert Types

## Alert Types
Throughout this documentation, various formats are used to draw attention to different types of information:

- **[links](./overview/intro.md)**: Bold text denotes a link to other pages of the documentation or external locations.
- `code`: Emphasized code snippets and commands, or key technical terms.
- Alerts: Are used to highlight important information.
- **Links**: Bold text indicates hyperlinks to other documentation pages or external resources.
- **Code**: Code snippets, commands, and key technical terms are highlighted.
- **Alerts**: Specific alerts are employed to emphasize crucial information, utilizing the following markers:

:::note ( note ) Used to express general information
:::
:::tip ( tip ) This is a tip
:::
:::info ( info ) Extra information that is not vital
:::
:::caution ( caution ) Used to indicate spoilers
:::
:::warning ( warning ) Used to indicate when something could go wrong
:::
:::note Conveys general information or reminders.
:::
:::tip Provides helpful suggestions or best practices.
:::
:::info Offers additional, non-critical information.
:::
:::caution Alerts to potential spoilers or sensitive content.
:::
:::warning Signals potential issues or risks that could impact development.
:::

---

## Support the Project

ExpressoTS is an MIT-licensed open source project. It's an independent project with ongoing development made possible thanks to your support. If you'd like to help, please consider:

- Become a **[sponsor on GitHub](https://github.com/sponsors/expressots)**
- Follow the **[organization](https://github.com/expressots)** on GitHub and Star ⭐ the project
- Subscribe to the Twitch channel: **[Richard Zampieri](https://www.twitch.tv/richardzampieri)**
- Join our **[Discord](https://discord.com/invite/PyPJfGK)**
- Contribute submitting **[issues and pull requests](https://github.com/expressots/expressots/issues/new/choose)**
- Share the project with your friends and colleagues
- Become a **[sponsor on GitHub](https://github.com/sponsors/expressots)**
- Follow the **[organization](https://github.com/expressots)** on GitHub and Star ⭐ the project
- Subscribe to the Twitch channel: **[Richard Zampieri](https://www.twitch.tv/richardzampieri)**
- Join our **[Discord](https://discord.com/invite/PyPJfGK)**
- Contribute submitting **[issues and pull requests](https://github.com/expressots/expressots/issues/new/choose)**
- Share the project with your friends and colleagues
Loading

0 comments on commit 933a5c4

Please sign in to comment.