Skip to content

Commit

Permalink
[Doc] Improved English verbiage & adding consistent styling (#24)
Browse files Browse the repository at this point in the history
* docs: improving language & styles

* docs: updated verbiage & styles of CLI docs

* [Docs] Improving English verbiage & styles in overview pages
  • Loading branch information
michaeljolley authored Sep 2, 2023
1 parent c755c17 commit 0ffca52
Show file tree
Hide file tree
Showing 14 changed files with 95 additions and 94 deletions.
30 changes: 15 additions & 15 deletions docs/cli/generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ sidebar_position: 2

# Generate

In order to provide a better developer experience, the ExpressoTS CLI provides a set of commands to help you to scaffold the application resources such as use cases, controllers, dto's, providers and services.
In order to provide a better developer experience, the ExpressoTS CLI provides a set of commands to help you scaffold the application resources such as use cases, controllers, DTO's, providers and services.

This command allows developers to stay ahead of the curve by generating the boilerplate code for the application, so they can focus on the business logic.

## Command syntax
## Command Syntax

Generate command can be expressed as followed:
The generate command can be executed as follows:

```bash
expressots generate <resource> <structure>
Expand All @@ -22,7 +22,7 @@ Or in its short form:
expressots g <resource> <structure>
```

### Command structure
### Command Structure

We provide two different structures to scaffold the resources:

Expand All @@ -35,13 +35,13 @@ We provide two different structures to scaffold the resources:
If you add `/` at the end of the structure, the CLI will create the resource inside of the folder. Example: `expressots generate service user/create/`
Structure: `user/create/` and the file: `create.[resource].ts`

### Resource root folder
### Resource Root Folder

- The root folder for all resources is the `src` folder. This can be changed in the `expressots.config.ts` file.
- In the opinionated mode, the root folder is the `src` folder and the resources scaffolded with `service, usecase, dto, controller` are created inside of the `useCases` folder.
- Entities are created inside of the `entities` folder, and providers inside of the `providers` folder.

## Resource types
## Resource Types

Current available resources:

Expand All @@ -53,29 +53,29 @@ Current available resources:
| provider | p |
| service | s |

## Example of usage
## 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 s user/find | Service creates usecase, controller and DTO and add them in the desired folder user/find |

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

For services you can also 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`.
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`.

:::caution
What determine where the resources will be created is the `expressots.config.ts` configuration file located in the project root folder.
The `expressots.config.ts` configuration file, located in the project root folder, determines where all resources will be created.
:::

:::info
All usecases, controllers and dtos are being created inside of the `useCases` folder. This is not set on the stone, it might change in the future.
All usecases, controllers and DTOs are being inside of the `useCases` folder. However, this may change in the future.
:::

## ExpressoTS config file
## ExpressoTS Config File

The configuration file is located in the root folder of the project and it's called `expressots.config.ts`. This file is used to configure the CLI and the project.

Expand All @@ -97,13 +97,13 @@ export default config;
- **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

## Recommendation
## Recommendations

Try to use as many different forms of creating resources as possible. This will help you to understand how the CLI works and how to use it in your favor. As well as, it will help us to improve the CLI and make it more robust.
Try to use as many different forms of creating resources as possible. This will help you to understand how the CLI works and how to use it in your favor. It also helps us improve the CLI to make it more robust.

---

## Support the project
## 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:

Expand Down
10 changes: 5 additions & 5 deletions docs/cli/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar_position: 1
The ExpressoTS CLI is a command-line interface tool that helps you to `create` ExpressoTS projects and `scaffold` the application resources such as use cases, controllers, dto's, providers and services.

:::info
We use in this tutorial the `npm` package manager, but you can use your favorite package manager such as `yarn` or `pnpm`.
We use the `npm` package manager in this tutorial, but you can use your favorite package manager, such as `yarn` or `pnpm`.
:::

## Installation
Expand All @@ -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 @@ -40,7 +40,7 @@ Providers information about your Operational System, Project and CLI version:
expressots info
```

## Create a project
## Create a Project

There are two options to create a new project, interactively or silently (passing the options as arguments).
Here is the complete command syntax:
Expand All @@ -65,11 +65,11 @@ expressots new <project-name> -p <package-manager> -t <template> -d <directory>
- **template**: `opinionated` or `non-opinionated`
- **directory**: `./my-project`

The flag `-d` is optional and it's used to specify the directory where the project will be created. If not specified, the project will be created in the current directory.
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.

---

## Support the project
## 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:

Expand Down
4 changes: 2 additions & 2 deletions docs/governance.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ We are moving the project board and roadmap from Jira to GitHub Projects. This w

Meet the team of regular contributors: **[Team](https://expresso-ts.com/team)**

## Want to help?
## Want to Help?

**[Fix a bug or submit a proposal](https://github.com/expressots/expressots/issues/new/choose)**

---

## Support the project
## 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:

Expand Down
22 changes: 11 additions & 11 deletions docs/overview/app-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ sidebar_position: 3

# App Container

The ExpressoTS uses **[InversifyJS](https://inversify.io/)** as its ioC (Inversion of Control) container. It is a powerful tool for managing dependency injection. It is a type-aware container that can be used to manage the instantiation and resolution of objects, as well as the management of their life cycles.
The ExpressoTS uses **[InversifyJS](https://inversify.io/)** as its IoC (Inversion of Control) container. InversifyJS is a powerful tool for managing dependency injection. It is a type-aware container that can be used to manage the instantiation and resolution of objects, as well as the management of their life cycles.

The container provides a central location for managing dependencies and creating objects that depend on other objects. When a class is registered with the container, it becomes immediately available for injection into other classes. This allows for the creation of complex object graphs with minimal boilerplate code.

Taking advantage of InversifyJS we created a wrapper to reduce complexity on how controllers, use cases, providers get injected within the application container. The wrapper is called `AppContainer` and it is responsible for registering all the application modules within the container.
Taking advantage of InversifyJS, we created a wrapper to reduce complexity on how controllers, use cases, and providers get injected within the application container. The wrapper is called `AppContainer` and it is responsible for registering all the application modules within the container.

## Creating the container
## Creating the Container

Upon creating the application container it is possible to define the default scope of the container as well as to set to skip base class check. The default scope is `RequestScope` which means that all the dependencies will be created once per request. This is the common scope for most web applications used in other frameworks such as Spring Boot or .NET Core as well.
Upon creating the application container, it is possible to define the default scope of the container as well as setting the container to skip base class checks. The default scope is `RequestScope` which means that all dependencies will be created once per request. This is the common scope for most web applications used in other frameworks such as Spring Boot or .NET Core.

Here is the interface options definition:

Expand Down Expand Up @@ -52,9 +52,9 @@ const container = appContainer.create([
export { container };
```

## Defining the container scope
## Defining the Container Scope

As mentioned above, if the `defaultScope` is not provided, the default is set to RequestScope. However, it is possible to change the default scope by passing the `defaultScope` as a an option in the container constructor. The BindingScopeEnum is an enum that contains the following values:
As mentioned above, if the `defaultScope` option is not provided, it defaults to `RequestScope`. However, it is possible to change the default scope by passing the `defaultScope` as a an option in the container constructor. The `BindingScopeEnum` contains the following values:

- `BindingScopeEnum.Singleton` - The dependency will be created once and will be shared across all requests.
- `BindingScopeEnum.Request` - The dependency will be created once per request.
Expand All @@ -74,11 +74,11 @@ const container = appContainer.create(
If you don't pass the `defaultScope` the default scope is set to `RequestScope`.
:::

## Registering modules
## Registering Modules

The `AppContainer` class has a `create` method that receives an array of modules and returns the container with all the modules registered. The container here created is the same container that is used by the `Application` class to initialize the server.
The `AppContainer` class has a `create` method that receives an array of modules and returns the container with all the modules registered. The newly created container is the same container that is used by the `Application` class to initialize the server.

Once the container is created developers can register **[modules](./module.md)** within the container:
Once the container is created, developers can register **[modules](./module.md)** within the container:

```typescript
// Create a new container
Expand All @@ -94,11 +94,11 @@ const container = appContainer.create([
export default container;
```

The reason why we created the `AppContainer` class is to reduce the complexity of how the container is constructed using Inversify directly, also was to provide a way to register modules without too much extra configuration.
The `AppContainer` class was created to reduce the complexity of how the container is constructed using Inversify directly. It also provides a way to register modules without too much extra configuration.

---

## Support the project
## 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:

Expand Down
Loading

0 comments on commit 0ffca52

Please sign in to comment.