0.1.0 • Published 6 years ago

ngx-module-starter v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

starter package to build Angular5+ libraries

Angular 5 library starter application to create Angular5+ package with multiple modules which makes to import modules from pakcages. e.g. import {ButtonModule} form '@angular/material';, import {MyModule} from 'my-package';

It has two main directories; 1. app - to test all of your modules 2. modules - each module goes here.

Tech. Stack

  • Jest for unit test
  • CodeceptJS for acceptptance
  • ng-packagr for module packaging

Why Jest for unit test, not Mocha/Karma?

  • Test runner built-in
  • Less configuration
  • Faster test running
  • Test coverage built-in
  • Spies/Mocks(including timers) built-in
  • Snapshot testing
  • Simple/easy conding style

Why CodeceptJS for acceptance test, not WebDriver or Nightmare?

  • Automatic sync/wait handling
  • Business-friendly test language(Scenario Driven).
  • Expandalbe to more specific tests()
  • Easy to write test using interactive shell
  • Easy to write/read/maintain test scenarios even for business people.
  • Changable back-end tech stack.(WebdriverIO, Progractor, Puppeteer, etc)
  • Docker-ready
  • Full-stack test ready(REST api test, File system test)

Directory Structure

.
├── app                  # acceptance test application
│   ├── codecept.json
│   ├── index.html
│   ├── node_modules
│   ├── package.json
│   └── src
├── modules              # angular modules  directory 
│   ├── dist                 # build output directory
│   ├── index.ts      
│   ├── module-one           # module 1
│   │   ├── index.ts
│   │   ├── package.json
│   │   └── src
│   ├── module-two           # module 2
│   │   ├── index.ts
│   │   ├── package.json
│   │   └── src
│   ├── node_modules
│   ├── package.json
│   └── tsconfig.json
├── package.json
└── tslint.json

Commands

commandapp directorymodules directoryeach module directory
npm startx
npm run buildxx
npm testxxx
npm test:unitxxx
npm test:acceptancex

Build output example

modules/dist
├── README.md
├── bundles
│   ├── my-library-module-one.umd.js
│   ├── my-library-module-one.umd.min.js
│   ├── my-library-module-two.umd.js
│   ├── my-library-module-two.umd.min.js
│   ├── my-library.umd.js
│   └── my-library.umd.min.js
├── esm2015
│   ├── my-library-module-one.js
│   ├── my-library-module-two.js
│   └── my-library.js
├── esm5
│   ├── my-library-module-one.js
│   ├── my-library-module-two.js
│   └── my-library.js
├── index.d.ts
├── module-one
│   ├── index.d.ts
│   ├── my-library-module-one.d.ts
│   ├── my-library-module-one.metadata.json
│   ├── package.json
│   └── src
│       ├── one.component.d.ts
│       └── one.module.d.ts
├── module-one.tgz
├── module-two
│   ├── index.d.ts
│   ├── my-library-module-two.d.ts
│   ├── my-library-module-two.metadata.json
│   ├── package.json
│   └── src
│       ├── two.component.d.ts
│       └── two.module.d.ts
├── module-two.tgz
├── my-library.d.ts
├── my-library.metadata.json
└── package.json