Skip to content

Wykks/ng-schematics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This repository contains a single schematic usable with angular CLI ng new command.

It will generate a new project in replacement of angular CLI default one.

It can be used like this:

# With Yarn
yarn global install @wykks/schematics

# With Npm
npm install -g @wykks/schematics

# In a unix-like shell
ng new <app name> --collection=@wykks/schematics [--directory=<folder name>] [--title=<some text>] [--prefix=<some prefix>]

Keep in mind that, dependencies listed in generated package.json may not be up to date.

What's in it?

Run ng-new of Angular CLI, then apply the following changes :

  • Add Jest (in place of karma) with @ngneat/spectator and ng-mocks
  • Remove protractor
  • Add prettier and tslint-config-prettier
  • Add lint-staged with husky to launch lint and prettier on commit
  • Add commitizen (without husky hooks, just through commit script)
  • Add typescript-tslint-plugin with vscode config
  • Enable typescript strict mode (with strictTemplates)
  • Enforce onPush change detection strategy

Development

Building

Before testing it locally you need to build (transpile typescript to javascript).

yarn build

If you want to build automatically after changes, just use tsc watch mode:

yarn build -w

Running locally

ng new --collection="." test --dry-run [--routing=false]

Debugging

You can debug it with the classic toolkit (chrome devtools or your IDE):

node --inspect-brk ./node_modules/.bin/ng new --collection="." test --dry-run --routing=false

With Chrome devtools for instance, you can then go to chrome://inspect and start debugging. For Webstorm, you will need to create a node debugging task, etc.

Publishing

To publish, simply do:

yarn build
yarn publish

That's it!

About

Opinionated angular ng-new schematic

Resources

License

Stars

Watchers

Forks

Packages

No packages published