# midgard-schematics

> CLI tool for assembling a Walhall app based on Midgard and other modules

Latest version **1.2.1** (published 2019-06-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install midgard-schematics
pnpm add midgard-schematics
yarn add midgard-schematics
bun add midgard-schematics
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2019-06-14 |
| First published | 2019-03-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 111.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Aziz Haddad |
| Maintainers | humanitec-builder-bot |
| Keywords | schematics |

## Links

- npm: https://www.npmjs.com/package/midgard-schematics
- npm.io page: https://npm.io/package/midgard-schematics

## Dependencies (15)

- [gulp](https://npm.io/package/gulp.md) ^4.0.0
- [cheerio](https://npm.io/package/cheerio.md) 0.20.0
- [jasmine](https://npm.io/package/jasmine.md) ^2.8.0
- [gulp-git](https://npm.io/package/gulp-git.md) ^2.8.0
- [gulp-exec](https://npm.io/package/gulp-exec.md) ^3.0.2
- [typescript](https://npm.io/package/typescript.md) ^2.5.2
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.1.0
- [@types/node](https://npm.io/package/@types/node.md) ^8.0.31
- [@types/cheerio](https://npm.io/package/@types/cheerio.md) ^0.22.9
- [@types/jasmine](https://npm.io/package/@types/jasmine.md) ^2.6.0
- [@babel/register](https://npm.io/package/@babel/register.md) ^7.0.0
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.1.0
- [@schematics/angular](https://npm.io/package/@schematics/angular.md) ^0.8.1
- [@angular-devkit/core](https://npm.io/package/@angular-devkit/core.md) ^0.8.1
- [@angular-devkit/schematics](https://npm.io/package/@angular-devkit/schematics.md) ^0.8.1

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 1.2.1 (latest) — 2019-06-14
- 1.2.0 — 2019-06-14
- 1.1.25 — 2019-05-28
- 1.1.24 — 2019-05-28
- 1.1.23 — 2019-05-28
- 1.1.22 — 2019-04-15
- 1.1.21 — 2019-04-05
- 1.1.20 — 2019-04-05
- 1.1.19 — 2019-04-05
- 1.1.18 — 2019-04-04
- 1.1.16 — 2019-03-26

## README

# Midgard-schematics

Midgard-schematics is an npm package that uses [@angular-devkit/schematics](https://www.npmjs.com/package/@angular-devkit/schematics) and [gulp.js](https://gulpjs.com/) to clone the repositories of all the frontend clients in a Walhall application and auto-generate the necessary code to build a single UI. 

## Usage

The Walhall application will run the schematics gulp commands when it initializes (`npm run init`), utilizing `midgard-schematics` as a dev-dependency. 

To use this package for local development, you need to install [gulp-cli](https://github.com/gulpjs/gulp-cli) globally.

The gulp command looks like this:

`gulp <taskname> --gulpfile node_modules/midgard-schematics/lib/gulpfile.js [--cwd optional_custom_execution_path]`

Example:

`gulp schematics --gulpfile node_modules/midgard-schematics/lib/gulpfile.js`

The gulp task will clone the application's frontend clients to the `projects` folder in your application root, install each client as an npm package, and make the following configuration modifications: 

1.  `tsconfig.json`: Add the client's paths to the `paths` object.
2.  `angular.json`: Add the Angular configurations of the imported client.
3.  `src/tsconfig.app.json`: Include the client's TypeScript files in the application's TypeScript compilation.
4.  `projects/midgard-angular/src/lib/midgard-routing.module.ts`: Add the client's routes to the Midgard-Angular routing component.
5.  `projects/midgard-angular/src/lib/modules/store/store.ts`: Add the reducers and the epics to the Midgard-Angular Redux store.
6.  `[DOM]`: Add exit point component to the DOM depending on the exitPointComponent defined in the Walhall application's configuration.

## Available schematics rules

The aforementioned configuration modifications are carried out according to different schematics rules that can be found under `src/utils`:

1.  `updateTsConfigRule(options)`: Updates `tsconfig.json`.
2.  `addLibraryToWorkspaceFileRule(options)`: Updates `angular.json`.
3.  `updateAppTsConfigRule(options)`: Updates `src/tsconfig.app.json`.
4.  `addRouteRule(options)`: Responsible for adding routes to `midgard-routing.module.ts`.
5.  `addAddReducersAndEpicsRule(options)`: Responsible for adding epics and reducers to the Redux store.
6.  `addExitPointRule(options)`: Responsible for adding an exitPoint element to the DOM.

<!-- Need more details -->
<!-- Midgard-schematics has separate compodoc - this is going to be a bigger task -->

---
_Source: https://npm.io/package/midgard-schematics · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
