Skip to content

Commit

Permalink
[#153] Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangmirs committed Aug 17, 2023
1 parent 980c7fa commit d40ae10
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 12 deletions.
49 changes: 40 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,20 @@ npm install

### Run the CLI locally

Run the following command and follow the instructions:
The CLI supports the following commands:

1. `generate` - to generate a new Terraform project

```bash
bin/dev generate {project-name}
```

2. `install` - to install a new addon/module to an existing Terraform project

```bash
bin/dev install {addon-name} --project {project-name}
```

### Project structure

The project has the following main files and folders:
Expand Down Expand Up @@ -76,13 +84,38 @@ The command documentation can be found [here](https://oclif.io/docs/commands).

### Add a new addon/module

To add a new addon/module, you need to create a new folder in the `src/templates` folder depending on the type of the addon/module:
#### Adding a New Addon/Module

To add a new addon or module, follow these steps:

1. Navigate to the `src/templates` folder in the project directory.
2. Create a new folder depending on the type of the addon/module you want to add:
- For addons, create a new folder in the `src/templates/addons` directory.
- For the core Terraform files, create a new folder/file in the `src/templates/core` directory.

Inside the newly created addon/module folder, you can include the code required to generate the templates.

3. Navigate to the `skeleton` folder at the same level as the `src` folder in the project directory.
4. Add the skeleton folders/files for the addon/module that you are adding inside the corresponding folder in the `skeleton` directory.

- For common addons, create a new folder in the `src/templates/addons` folder
- For AWS modules, create a new folder in the `src/templates/aws` folder
- For common files, create a new folder in the `src/templates/core` folder
> Note Before adding a new addon/module, it is recommended to check the existing ones for reference.
Check the existing addons/modules for the reference.
#### Using the Template as a Reference

To copy and include supporting modules from the template, you can follow these steps:

1. Open the `src/templates` directory in your project.
2. Explore the code and structure of the existing addon or module that you want to reference.

Inside each addon or module folder, you will find the necessary files and directories needed for that specific functionality.

3. Once you have identified the supporting modules or files you want to include in your own project, mirror the folder structure and file naming conventions of the existing addon or module that you are referencing.

4. Copy and paste the relevant files from the existing addon or module into your new addon/module folder.

> Note Make sure to update any necessary configuration or code inside the copied files to fit your specific requirements.
By following this process, you can use the existing templates as a reference to create your own addons or modules based on the provided structure and functionality.

## Testing

Expand All @@ -104,9 +137,7 @@ npm run lint:fix // to fix linting

- This project will be published to NPM automatically when a new release is created in GitHub. Therefore, the package version in `package.json` should be updated before creating a new release.

- The release should be created in the `main` branch.

- The release should be created with the following format: `{version}` e.g. `1.0.0`
- The release should be created in the `main` branch and created with the following format: `{major}.{minor}.{patch}`, e.g. `1.0.0`.

### Manual publishing

Expand Down
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,43 @@ An infrastructure template for web applications powered by Terraform.
**Supported cloud:** AWS. We are looking for contributions to implement support for GCP, Heroku, and Azure!

**Supported flavors:**
- A `Basic` flavor is in the plan, but not available yet
- A `Blank` flavor that generates a blank Terraform project.
- The `Complete` flavor generates the following infrastructure:

![Diagram of the Complete Infrastructure](/img/diagram_complete.svg?raw=true)

## Usage

The CLI can be installed globally or run directly with `npx`:

```bash
npm install -g @nimblehq/infra-template
nimble-infra generate {project-name}

# or

npx @nimblehq/infra-template generate {project-name}
```

The CLI supports the following commands:
- `generate` - to generate a new Terraform project:

```bash
nimble-infra generate {project-name}
```

or
- `install` - to install a new addon/module to an existing Terraform project:

```bash
npx @nimblehq/infra-template generate {project-name}
nimble-infra install {addon-name} --project {project-name}
```

### Reference as a template

> Note This template can be used for reference to add an addon/module to an existing Terraform project


## Contributing

Check out our [contributing guidelines](/CONTRIBUTING.md) to get started.
Expand Down

0 comments on commit d40ae10

Please sign in to comment.