๐Ÿ’ง plop generator ngxs store

June 8, 2023 ยท View on GitHub

version downloads size

A plop generator for allowing easily create slices of state for ngxs state management pattern + library for Angular.

This package aims to follow closely the ngxs style guide .

๐Ÿ“ฆ Installation

This package is hosted on npm.

npm install --save-dev plop-generator-ngxs-store

๐Ÿฅ‘ Usage

First, be sure you have plop installed. Then, add the following line to your plopfile.js.

plop.load("plop-generator-ngxs-store");

A minimal plopfile.js can be

module.exports = (plop) => plop.load('plop-generator-ngxs-store');

Now you'll have access to the store generator as shown below.

> plop

? store name (examples: HelloWorld, hello-world): HelloWorld

The store generator scaffolds ngxs slice of state. Generated files include actions .actions.ts, default state model .constant.ts, selectors .selector.ts, state .state.ts, tests for the state .state.spec.ts and state model .types.ts. Tests are written in jest. All the generated files are exported via index.ts file for easy importing.

src
โ””โ”€โ”€ store
   โ”œโ”€โ”€ index.ts
   โ””โ”€โ”€ hello-world.actions.ts
   โ””โ”€โ”€ hello-world.constant.ts
   โ””โ”€โ”€ hello-world.selector.ts
   โ””โ”€โ”€ hello-world.state.ts
   โ””โ”€โ”€ hello-world.state.spec.ts
   โ””โ”€โ”€ hello-world.types.ts

โ” Questions

๐Ÿ› report bugs by filing issues
๐Ÿ“ข provide feedback with issues or on twitter