Skip to content

Commit

Permalink
fix: update cli commands
Browse files Browse the repository at this point in the history
  • Loading branch information
rsaz committed Jun 3, 2023
1 parent e15b045 commit 0357e9e
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 175 deletions.
57 changes: 38 additions & 19 deletions docs/cli/generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This command allows developers to stay ahead of the curve by generating the boil

## Command syntax

Generate command can be expressed in its normal form:
Generate command can be expressed as followed:

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

### Command structure

We provide two different structures to scaffold the resources:

- **[entity-action]**: `expressots generate service user-create`
This will create this folder structure: `/user/create` and the file: `user-create.[resource].ts

- **[folder/subfolder/resource]**: `expressots generate service user/create`
This will create this folder structure: `/user/create` and the file: `create.[resource].ts

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

- 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

Current available resources:

| Long form | short |
| ----------- | ------ |
| usecase | u |
| controller | c |
| dto | d |
| provider | p |
| service | s |
| Long form | short |
| ---------- | ----- |
| usecase | u |
| controller | c |
| dto | d |
| provider | p |
| service | s |

## Example of usage

| 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 |
| 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 |

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

Expand All @@ -66,9 +85,9 @@ Here is the current configuration file with all the available options:
import { ExpressoConfig, Pattern } from "@expressots/core";

const config: ExpressoConfig = {
sourceRoot: "src",
scaffoldPattern: Pattern.KEBAB_CASE,
opinionated: false,
sourceRoot: "src",
scaffoldPattern: Pattern.KEBAB_CASE,
opinionated: false,
};

export default config;
Expand All @@ -93,4 +112,4 @@ Expresso TS is an MIT-licensed open source project. It's an independent 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
- Share the project with your friends and colleagues
24 changes: 16 additions & 8 deletions docs/cli/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ The ExpressoTS CLI is a command-line interface tool that helps you to `create` E
We use in this tutorial the `npm` package manager, but you can use your favorite package manager such as `yarn` or `pnpm`.
:::

## Installation πŸ’»
## Installation

First install the CLI globally using the command below:

```bash
npm install -g @expressots/cli
npm install @expressots/cli -g
```

## Basic usage
Expand All @@ -32,17 +32,22 @@ Verify the available commands and options:
expressots --help
```

### Version
### Info

Verify the CLI version:
Providers information about your Operational System, Project and CLI version:

```bash
expressots --version
expressots info
```

## Create a project

There are two options to create a new project, interactively or silently (passing the options as arguments)
There are two options to create a new project, interactively or silently (passing the options as arguments).
Here is the complete command syntax:

```bash
expressots new <project-name> -p <package-manager> -t <template> -d <directory>
```

### Interactively

Expand All @@ -53,11 +58,14 @@ expressots new <project-name>
### Silently

```bash
expressots new <project-name> -p <package-manager> -t <template>
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`

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.

---

Expand All @@ -70,4 +78,4 @@ Expresso TS is an MIT-licensed open source project. It's an independent 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
- Share the project with your friends and colleagues
26 changes: 13 additions & 13 deletions docs/hello.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ sidebar_position: 0

Thank you for embarking on this journey with us to create an ambitious and exciting developer experience that is continuously improving. πŸŽ‰πŸŽ‰πŸŽ‰

Expresso TS is so simple yet efficient in getting the job done. We want to continue doing that, abstract all the complexities that the software development world brings and make it easy for you to build your next project.
ExpressoTS is so simple yet efficient in getting the job done. We want to continue doing that, abstract all the complexities that the software development world brings and make it easy for you to build your next project.

If you think about it, every programming language feature, framework built, is to accelerate your development process, however we are continuously failing in delivering good documentation, good developer experience (**everything should simply work**), plus reducing the amount of boilerplate code you have to write.
If you think about it, every programming language feature, framework built, is to accelerate your development process, however we are continuously failing in delivering good documentation, good developer experience plus reducing the amount of boilerplate code you have to write. Everything should simply work!

This is our commitment, to make your life easier, and to make you more productive.

Expand All @@ -23,16 +23,16 @@ Thank you again for being part of this journey with us, Happy Coding! πŸš€
- **[links](intro.md)**: All bold texts are links to other pages of the documentation or external links.
- `code`: helps emphasize code snippets and commands, or key technical terms.
- Alerts: are used to highlight important information.
:::note Used to express general information
:::
:::tip This is a tip
:::
:::info Extra information that is not vital
:::
:::caution Used to indicate spoilers
:::
:::warning Used to indicate when something could go wrong
:::
:::note Used to express general information
:::
:::tip This is a tip
:::
:::info Extra information that is not vital
:::
:::caution Used to indicate spoilers
:::
:::warning Used to indicate when something could go wrong
:::

---

Expand All @@ -45,4 +45,4 @@ Expresso TS is an MIT-licensed open source project. It's an independent 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
- Share the project with your friends and colleagues
Loading

0 comments on commit 0357e9e

Please sign in to comment.