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

angular15-generator

v1.2.0

Published

CLI tool to generate Angular 1.5 w/ TypeScript Routes and Components like Angular 2 CLI

Downloads

58

Readme

angular 1.5 generator

Latest NPM release TravisCI Build Status AppVeyor Build Status Test Coverage Dependency Status devDependency Status

A command line utility to quickly generate angular 1.5 component and route-component written in TypeScript.

Prerequisites

The generated project has dependencies that require Node 4.5.x and NPM 3.x.x.

Table of Contents

Installation

BEFORE YOU INSTALL: please read the prerequisites

npm install -g angular15-generator

Default structure

By default the tool assume that you use the following project structure:

root
└── src
    └── app
        ├── components
        ├── filters
        ├── routes
        └── services

If this is not your project structure, please have a look at the Configuration section.

Usage

ag --help
ag -v  / ag --version
ag g --help
ag g component --help
ag g route --help
ag g service --help
ag g filter --help

Generating Components

You can use the ag g command to generate Angular components:

ag g component my-new-component
ag g route my-new-route-component
ag g service my-new-route-service
ag g filter my-new-route-filter

If you want to create your component/route/service/filter in an other folder that the one configured you can use the following syntax (even on Windows system) :

ag g component down/my-new-component
    => will create the component in /src/app/components/down/my-new-component
ag g route ../up/my-new-route-component
    => will create the route in /src/app/up/my-new-route-component

Please note that this is also compatible with the --uc flag describe below.

Generating or Updating module's index file

You can use the --uc to update or create the module's index.ts file (with a name or not, the default one is in the config file).

ag g component my-new-component --uc
ag g route my-new-route-component --uc routes.ts

Alternatively you can set the option updateOrCreate to true in your config file to always update module's index.ts file.

If you use WebPack to build your project by setting the flag useWebpackRequire in the configuration file the tool will require the html template file instead of using the template URL.

Configuration

If our project's structure does not match yours, you can override it:

ag config

This will add a new file angular-generator.config.json in your root directory.

You can edit this file to specify your project's structure.

{
  "componentsRoot": "src/app/components",
  "routesRoot": "src/app/routes",
  "servicesRoot": "src/app/services",
  "filtersRoot": "src/app/filters",
  "componentsRootModuleName": "index.ts",
  "routesRootModuleName": "index.ts",
  "servicesRootModuleName": "index.ts",
  "filtersRootModuleName": "index.ts",
  "updateOrCreate": false,
  "useWebpackRequire": false
}

(This is the config.json file for our default project structure) N.B: even on Windows you should use the / separator, the CLI will handle it correctly.

Updating

Before updating it is recommended to backup your custom config file and regenerate it

To update angular15-generator to a new version, you must update both the global package and your project's local package.

Global package:

npm uninstall -g angular15-generator
npm cache clean
npm install -g angular15-generator@latest

=> then check for new configuration options in the config file.

Contributing

Currently the tool is available in French and English.

Feel free to send a PR with your locale file (see in /lib/cli/locales).

License

This project is licensed under the MIT License.