Skip to content

Commit

Permalink
[#20] Extract the project architecture from the Contributing guidelin…
Browse files Browse the repository at this point in the history
…e page
  • Loading branch information
longnd committed Aug 30, 2023
1 parent 105e18a commit e745e5a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 55 deletions.
51 changes: 51 additions & 0 deletions .github/wiki/Architecture-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
This project uses TypeScript and [OCLIF](https://oclif.io/) to build the CLI, Jest for testing, and ESLint for code formatting and linting.

### Dependencies and Prerequisites

- [Node.js](https://nodejs.org/en/download/) 12.x or higher - 18.x LTS is recommended
- NPM is preferred to use with this project

### Project structure

The project has the following main files and folders:

```bash
├── bin # the executable file for the CLI
│ ├── dev # the executable file for the CLI in development mode
│ └── run # the executable file for the CLI in production mode
├── skeleton # the skeleton files for the project
│ ├── addons # the skeleton files for common addons e.g. version control, CI/CD, etc.
│ │ ├── aws # the skeleton files for AWS modules
│ │ └── versionControl # the skeleton files for version control
│ └── core # the skeleton folders
│ ├── base # the skeleton files for the base folder
│ └── shared # the skeleton files for the shared folder
├── src # the source code of the CLI
│ ├── commands # the commands of the CLI
│ │ ├── generate
│ │ └── installAddon
│ ├── helpers # the helper functions of the CLI
│ │ ├── childProcess.ts
│ │ ├── file.ts
│ │ └── terraform.ts
│ ├── hooks # the hooks of the CLI
│ │ └── postProcess.ts
│ ├── index.ts # the entry point of the CLI
│ └── templates # the code to generate the templates
│ ├── addons # the code to generate the common addons e.g. version control, CI/CD, AWS, etc.
│ └── core # the code to generate the main Terraform files e.g. `main.tf`, `variables.tf`, etc.
└── test # the test helpers and configurations
└── matchers # the custom matchers for Jest
├── file.ts
├── index.d.ts
└── index.ts
```

> [!NOTE]\
> The `skeleton` folder and the `templates` folder are the two main folders that are used to generate the project files
- The `skeleton` folder contains the addon's files and folders ready to be directly copy-pasted into the generated project if the related addon has been selected. These files serve as a starting point or "skeleton" for the specific addon.

- On the other hand, the `templates` folder houses the logic for determining which files need to be copied from the templates folder into the core project files. It includes instructions on what files should be formed based on the type of addon/module being added (common addons, AWS modules, or standard files).

In summary, while the `skeleton` folder provides the files and folders needed for the addon, the `templates` folder handles the dynamic copying and integration of those files within the core project structure.
54 changes: 2 additions & 52 deletions .github/wiki/Contributing-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ The following is a set of guidelines for contributing to this project. These are

## Introduction

This project uses TypeScript and [OCLIF](https://oclif.io/) to build the CLI, Jest for testing, and ESLint for code formatting and linting.

## Issues and feature requests

If you have any issues or feature requests, please create an issue in the [GitHub issues](https://github.com/nimblehq/infrastructure-templates/issues) page.

## Development

### Prerequisites

- [Node.js](https://nodejs.org/en/download/) 12.x or higher - 18.x LTS is recommended
- NPM is preferred to use with this project
Please refer to the [[Architecture Overview]] to understand the project's architecture first.

### Install dependencies

Expand All @@ -39,51 +34,6 @@ bin/dev generate {project-name}
bin/dev install {addon-name} --project {project-name}
```

### Project structure

The project has the following main files and folders:

```bash
├── bin # the executable file for the CLI
│ ├── dev # the executable file for the CLI in development mode
│ └── run # the executable file for the CLI in production mode
├── skeleton # the skeleton files for the project
│ ├── addons # the skeleton files for common addons e.g. version control, CI/CD, etc.
│ │ ├── aws # the skeleton files for AWS modules
│ │ └── versionControl # the skeleton files for version control
│ └── core # the skeleton folders
│ ├── base # the skeleton files for the base folder
│ └── shared # the skeleton files for the shared folder
├── src # the source code of the CLI
│ ├── commands # the commands of the CLI
│ │ ├── generate
│ │ └── installAddon
│ ├── helpers # the helper functions of the CLI
│ │ ├── childProcess.ts
│ │ ├── file.ts
│ │ └── terraform.ts
│ ├── hooks # the hooks of the CLI
│ │ └── postProcess.ts
│ ├── index.ts # the entry point of the CLI
│ └── templates # the code to generate the templates
│ ├── addons # the code to generate the common addons e.g. version control, CI/CD, AWS, etc.
│ └── core # the code to generate the main Terraform files e.g. `main.tf`, `variables.tf`, etc.
└── test # the test helpers and configurations
└── matchers # the custom matchers for Jest
├── file.ts
├── index.d.ts
└── index.ts
```

> [!NOTE]\
> The `skeleton` folder and the `templates` folder are the two main folders that are used to generate the project files
- The `skeleton` folder contains the addon's files and folders ready to be directly copy-pasted into the generated project if the related addon has been selected. These files serve as a starting point or "skeleton" for the specific addon.

- On the other hand, the `templates` folder houses the logic for determining which files need to be copied from the templates folder into the core project files. It includes instructions on what files should be formed based on the type of addon/module being added (common addons, AWS modules, or standard files).

In summary, while the `skeleton` folder provides the files and folders needed for the addon, the `templates` folder handles the dynamic copying and integration of those files within the core project structure.

### Add a new command

To add a new command, create a new folder in the `src/commands` and add the `index.ts` file.
Expand All @@ -110,7 +60,7 @@ Inside the newly created addon/module folder, you can include the code required
#### Using the Template as a Reference

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

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.
Expand Down
2 changes: 1 addition & 1 deletion .github/wiki/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ An infrastructure template for web applications powered by Terraform.
- A `Blank` flavor that generates a blank Terraform project.
- The `Complete` flavor generates the following infrastructure:

![Diagram of the Complete Infrastructure](/assets/images/diagram_complete.svg?raw=true)
![Diagram of the Complete Infrastructure](assets/images/architecture/diagram_complete.svg?raw=true)
9 changes: 7 additions & 2 deletions .github/wiki/_Sidebar.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Table of Contents

- [[Home]]
- [[Getting-Started]]
- [[Contributing|Contributing-guidelines]]
- [[Getting Started]]

## Architecture
- [[Architecture Overview]]

## Contributing
- [[Contributing guidelines]]

0 comments on commit e745e5a

Please sign in to comment.