Skip to content
Nick Gallimore edited this page Aug 3, 2024 · 2 revisions

Nufacturing Angular App Wiki

Table of Contents

  1. Overview
  2. Getting Started
  3. Configuration
  4. Running the Development Server
  5. Project Structure
  6. Code Scaffolding
  7. Build
  8. Running Unit Tests
  9. Running End-to-End Tests
  10. Environment Setup
  11. Branching Strategy
  12. Contribution Guidelines

Overview

The Nufacturing Angular App is the frontend component of the Nufacturing application. It is built using Angular and follows best practices for frontend development, including a multi-environment setup and continuous integration processes.

Getting Started

Prerequisites

  • Node.js (v14.x or higher)
  • npm (v6.x or higher)
  • Angular CLI (v16.x or higher)

Installation

Clone the repository:

git clone https://github.com/yourusername/nufacturing-angular.git
cd nufacturing-angular

Install dependencies:

npm install

Configuration

The Angular app uses environment files for configuration. Modify the environment.ts and environment.prod.ts files in the src/environments directory to set up your local and production configurations.

Running the Development Server

Run the following command to start the development server:

ng serve

Navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.

Project Structure

The project follows a modular structure with separate folders for components, pages, services, and environments.

nufacturing-angular/
├── .vscode/
│   ├── extensions.json
│   ├── launch.json
│   └── tasks.json
├── src/
│   ├── app/
│   │   ├── components/
│   │   ├── pages/
│   │   ├── services/
│   │   ├── app-routing.module.ts
│   │   ├── app.component.html
│   │   ├── app.component.scss
│   │   ├── app.component.spec.ts
│   │   └── app.module.ts
│   ├── assets/
│   ├── environments/
│   │   ├── environment.prod.ts
│   │   └── environment.ts
│   ├── styles.scss
│   ├── index.html
│   └── main.ts
├── angular.json
├── package.json
├── README.md
└── tsconfig.json

Code Scaffolding

Run the following command to generate a new component, directive, pipe, service, class, guard, interface, enum, or module:

ng generate component component-name

You can also use the following variations:

ng generate directive|pipe|service|class|guard|interface|enum|module

Build

Run the following command to build the project. The build artifacts will be stored in the dist/ directory.

ng build

Running Unit Tests

Run the following command to execute the unit tests via Karma:

ng test

Running End-to-End Tests

Run the following command to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.

ng e2e

Environment Setup

The Nufacturing Angular App employs a multi-environment setup to facilitate streamlined development, testing, and deployment. The environments include Local, Development, Testing, Staging, and Production.

Environments

1. Local Environment

  • Purpose: Provides an isolated space for developers to work on new features and fixes.
  • Setup:
    • Local MongoDB
    • Local Node.js API
    • Local Angular App
  • Branching Strategy: Developers create branches from each epic with the epic key ID in the branch name, ensuring organized and traceable changes.

2. Development Environment

  • Purpose: Integrates all individual feature branches to test their interaction.
  • Setup:
    • Development MongoDB
    • Development API

3. Testing Environment

  • Purpose: Runs a full suite of automated tests to catch bugs before code reaches staging or production.
  • Setup:
    • Testing MongoDB
    • Testing API

4. Staging Environment

  • Purpose: Simulates the production environment for final validation before deployment.
  • Setup:
    • Staging MongoDB
    • Staging API

5. Production Environment

  • Purpose: The live environment where the application is available to end-users.
  • Setup:
    • Production MongoDB
    • Production API

Branching Strategy

Branch Types

  • Feature Branches: For new features or enhancements.
  • Hotfix Branches: For urgent fixes.
  • Staging Branch: For pre-production testing.
  • Production Branch: For production deployment.

Branching Rules

  • Enforce Branch Naming Policies: Use Git hooks and GitHub Actions.
  • Commit Message Pattern: Follow conventional commit standards.
  • Pull Requests: Require pull requests for merging into development, staging, and production branches.

Contribution Guidelines

  1. Fork the repository.
  2. Create a new feature branch (git checkout -b feature/NFG-<issue-number>-<short-description>).
  3. Commit your changes with descriptive messages.
  4. Push your branch (git push origin feature/NFG-<issue-number>-<short-description>).
  5. Create a pull request.