@varionit/schematics

Varionit schematics

Usage no npm install needed!

<script type="module">
  import varionitSchematics from 'https://cdn.skypack.dev/@varionit/schematics';
</script>

README

Getting Started With Schematics

This repository is a basic Schematic implementation that serves as a starting point to create and publish Schematics to NPM.

Getting started

npm install @varionit/schematics --save-dev

or

yarn add @varionit/schematics --dev

To use the schematics, you need to install @angular-devkit/schematics-cli globally.

npm install -g @angular-devkit/schematics-cli

Then:

schematics @varionit/schematics:<command>

Where command can be:

  • store

Folder structure

├───store
│   │   root-state.interface.ts
│   │   root-store.module.ts
│   │
│   └───feature
│           index.ts
│           feature.actions.ts
│           feature.effects.ts
│           feature.module.ts
│           feature.reducer.ts
│           feature.selectors.ts
│           feature.state.ts
│   app.component.html
│   app.component.scss
│   app.component.spec.ts
│   app.component.ts
│   app.module.ts

Where root-store.module.ts is:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { FeatureModule } from './feature';

@NgModule({
  declarations: [],
  imports: [CommonModule, FeatureModule, StoreModule.forRoot({}), EffectsModule.forRoot([])],
})
export class RootStoreModule {}

and root-state.interface.ts is:

import { FeatureState } from './feature';

export interface RootState {
  feature: FeatureState;
}

Development

To test locally, install @angular-devkit/schematics-cli globally and use the schematics command line tool. That tool acts the same as the generate command of the Angular CLI, but also has a debug mode.

Check the documentation with

schematics --help

For publish

Update the version (patch, major, or minor), it will auto-publish it as well.

npm version <update_type>