npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-feat-generator-cli

v0.0.5

Published

ngx script to generate feature from a json config input file

Downloads

8

Readme

:rocket: NgxFeatGeneratorCLI

Node.js CI

CLI for generating Angular feature from a json config input file.

NgxFeatGeneratorCLI is a simple CLI for generating Angular feature directory, inside an existing Angular application. Under the hood it uses the angular schematics to generate components, services, guard etc.

Alt Text

Prerequisites

First, you should install the Angular CLI globally.

npm i -g @angular/cli

Installation

npm i -g ngx-feat-generator-cli

Usage

To display CLI help use the following command :

ngx-feat-generator --help


Usage: ngx-feat-generator [options]

Ngx CLI for generating Angular feature directory from a json config input file

Options:
  -V, --version             output the version number
  -f, --file-config <type>  JSON input config file
  -h, --help                output usage information

Generating a new Angular feature directory

You must create a json input file, in order to orchestrate the CLI. The json describes your desired files tree.

Below an example json config file :

{
  "feature": "broadcast",
  "projectPath": "test/fake-ng-project",
  "featurePath": "src/app/broadcast",
  "tree": [
    {
      "type": "module",
      "name": "broadcast",
      "opts": "--routing=true"
    },
    {
      "type": "component",
      "name": "broadcast/components/real-estate-card",
      "opts": "--changeDetection=OnPush --module=broadcast/broadcast.module.ts",
      "extra": {
        "isolatedTest": true
      }
    },
    {
      "type": "component",
      "name": "broadcast/components/broadcast-information-dialog",
      "opts": "--changeDetection=OnPush --module=broadcast/broadcast.module.ts",
      "extra": {
        "isolatedTest": true
      }
    },
    {
      "type": "guard",
      "name": "broadcast/shared/guard/elysium-guard",
      "opts": "--implements=CanActivate",
      "extra": {
        "isolatedTest": true
      }
    },
    {
      "type": "interface",
      "name": "broadcast/shared/models/broadcast"
    },
    {
      "type": "interface",
      "name": "broadcast/shared/models/shopping-cart"
    },
    {
      "type": "interface",
      "name": "broadcast/shared/models/cart-item"
    },
    {
      "type": "enum",
      "name": "broadcast/shared/models/cart-item-type"
    },
    {
      "type": "service",
      "name": "broadcast/shared/services/broadcast",
      "extra": {
        "isolatedTest": true
      }
    },
    {
      "type": "service",
      "name": "broadcast/shared/services/pack",
      "extra": {
        "isolatedTest": true
      }
    }
  ]
}

You 'll find below the json fields description :

| Field | Type | Description | |----------|:-------------:|------:| | feature | string | The name of the feature to generate | | projectPath | string | The location of the existing Angular project | | featurePath | string | The path of the feature inside the existing Angular project | | tree | TreeItem[] | TreeItem Array which describes the tree files of the desired feature

Below the description of the TreeItem object :

| Field | Type | Description | |----------|:-------------:|------:| | type | string | Angular CLI schematic type : 'component', 'module', 'interface', 'guard', 'enum', 'service'. A special type has been added for our needs : 'spec'. It allows us to update the default Angular test to make isolated-test.| | name | string | the path of the generated item. | | opts? | string | Angular CLI options. ex: --changeDetection=OnPush --module=broadcast/broadcast.module.ts | | extra? | ExtraConfig | Extra config for our needs for isolated test generation |

Finally, run the generation command :

ngx-feat-generator --file-config ./test/broadcast.json

Contributing

If you want to contribute, you could setup the project in your local machine, with a standard git clone :

git clone [email protected]:IAD-INTERNATIONAL/NgxFeatGeneratorCLI.git

Next you must generate the fake ng project in ./test/fake-ng-project:

npm run setup:fake-project

To run the integration test :

npm run test:integration

To run the Jest test :

npm test

or

npm run test:watch

License

ISC