Skip to content

Modular starter (seed) project for Angular 2 apps with fast, statically typed build

License

Notifications You must be signed in to change notification settings

KaiBirkenstock/angular2-seed

Β 
Β 

Repository files navigation

Introduction

Angular 2 Style Guide Build Status Build Status Join the chat at https://gitter.im/mgechev/angular2-seed MIT license Dependency Status devDependency Status

Provides fast, reliable and extensible starter for the development of Angular 2 projects.

angular2-seed provides the following features:

  • Allows you to painlessly update the seed tasks of your already existing project.
  • Out of the box ServiceWorkers and AppCache support thanks to the integration with angular/mobile-toolkit.
  • Ready to go, statically typed build system using gulp for working with TypeScript.
  • Production and development builds.
  • Sample unit tests with Jasmine and Karma including code coverage via istanbul.
  • End-to-end tests with Protractor.
  • Development server with Livereload.
  • Following the best practices.
  • Manager of your type definitions using typings.
  • Has autoprefixer and css-lint support.

How to start

Note that this seed project requires node v4.x.x or higher and npm 2.14.7.

Here is how to speed-up the build on Windows.

In order to start the seed use:

git clone --depth 1 https://github.com/mgechev/angular2-seed.git
cd angular2-seed
# install the project's dependencies
npm install
# watches your files and uses livereload by default
npm start
# api document for the app
# npm run build.docs

# dev build
npm run build.dev
# prod build
npm run build.prod

Does not rely on any global dependencies.

Table of Content

Configuration

Default application server configuration

var PORT             = 5555;
var LIVE_RELOAD_PORT = 4002;
var DOCS_PORT        = 4003;
var APP_BASE         = '/';

Configure at runtime

npm start -- --port 8080 --reload-port 4000 --base /my-app/

Environment configuration

If you have different environments and you need to configure them to use different end points, settings, etc. you can use the ./tools/env/config.json file. The keys in the file are the different environments.

The can be specified by using:

npm start -- --config-env ENV_NAME

Currently the ENV_NAMEs are dev, prod, staging, but you can simply add different key-value pairs to the config.json file in order to alter extra such environments.

Tools documentation

A documentation of the provided tools can be found in tools/README.md.

How to extend?

Visit the Wiki page of the project.

Running tests

npm test

# Debug - In two different shell windows
npm run build.test.watch      # 1st window
npm run karma.start           # 2nd window

# code coverage (istanbul)
# auto-generated at the end of `npm test`
# view coverage report:
npm run serve.coverage

# e2e (aka. end-to-end, integration) - In three different shell windows
# Make sure you don't have a global instance of Protractor

# npm run webdriver-update <- You will need to run this the first time
npm run webdriver-start
npm run serve.e2e
npm run e2e

# e2e live mode - Protractor interactive mode
# Instead of last command above, you can use:
npm run e2e.live

You can learn more about Protractor Interactive Mode here

Contributing

Please see the CONTRIBUTING file for guidelines.

Advanced Seed Option

An advanced option to this seed exists here which mirrors the latest changes here but adds core support for:

You may use it to learn how to extend this seed for your own use cases or use the advanced seed if your project needs those features.

Examples

Forks of this project demonstrate how to extend and integrate with other libraries:

Directory Structure

.
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ gulpfile.ts                <- configuration of the gulp tasks
β”œβ”€β”€ karma.conf.js              <- configuration of the test runner
β”œβ”€β”€ package.json               <- dependencies of the project
β”œβ”€β”€ protractor.conf.js         <- e2e tests configuration
β”œβ”€β”€ src                        <- source code of the application
β”‚Β Β  └── client
β”‚Β Β      β”œβ”€β”€ app
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ +about
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ about.component.css
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ about.component.e2e-spec.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ about.component.html
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ about.component.spec.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ about.component.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  └── index.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ +home
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ home.component.css
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ home.component.e2e-spec.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ home.component.html
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ home.component.spec.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ home.component.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  └── index.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ app.component.e2e-spec.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ app.component.html
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ app.component.spec.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ app.component.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ hot_loader_main.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ main.ts
β”‚Β Β      β”‚Β Β  └── shared
β”‚Β Β      β”‚Β Β      β”œβ”€β”€ index.ts
β”‚Β Β      β”‚Β Β      β”œβ”€β”€ name-list
β”‚Β Β      β”‚Β Β      β”‚Β Β  β”œβ”€β”€ index.ts
β”‚Β Β      β”‚Β Β      β”‚Β Β  β”œβ”€β”€ name-list.service.spec.ts
β”‚Β Β      β”‚Β Β      β”‚Β Β  └── name-list.service.ts
β”‚Β Β      β”‚Β Β      β”œβ”€β”€ navbar
β”‚Β Β      β”‚Β Β      β”‚Β Β  β”œβ”€β”€ index.ts
β”‚Β Β      β”‚Β Β      β”‚Β Β  β”œβ”€β”€ navbar.component.css
β”‚Β Β      β”‚Β Β      β”‚Β Β  β”œβ”€β”€ navbar.component.html
β”‚Β Β      β”‚Β Β      β”‚Β Β  └── navbar.component.ts
β”‚Β Β      β”‚Β Β      └── toolbar
β”‚Β Β      β”‚Β Β          β”œβ”€β”€ index.ts
β”‚Β Β      β”‚Β Β          β”œβ”€β”€ toolbar.component.css
β”‚Β Β      β”‚Β Β          β”œβ”€β”€ toolbar.component.html
β”‚Β Β      β”‚Β Β          └── toolbar.component.ts
β”‚Β Β      β”œβ”€β”€ assets
β”‚Β Β      β”‚Β Β  └── svg
β”‚Β Β      β”‚Β Β      └── more.svg
β”‚Β Β      β”œβ”€β”€ css
β”‚Β Β      β”‚Β Β  └── main.css
β”‚Β Β      β”œβ”€β”€ index.html
β”‚Β Β      β”œβ”€β”€ tsconfig.json
β”‚Β Β      └── typings.d.ts
β”œβ”€β”€ test-main.js               <- testing configuration
β”œβ”€β”€ tools
β”‚Β Β  β”œβ”€β”€ README.md              <- build documentation
β”‚Β Β  β”œβ”€β”€ config
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ project.config.ts  <- configuration of the specific project
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ seed.config.interfaces.ts
β”‚Β Β  β”‚Β Β  └── seed.config.ts     <- generic configuration of the seed project
β”‚Β Β  β”œβ”€β”€ config.ts              <- exported configuration (merge both seed.config and project.config, project.config overrides seed.config)
β”‚Β Β  β”œβ”€β”€ debug.ts
β”‚Β Β  β”œβ”€β”€ manual_typings
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ project            <- manual ambient typings for the project
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── sample.package.d.ts
β”‚Β Β  β”‚Β Β  └── seed               <- seed manual ambient typings
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ angular2-hot-loader.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ autoprefixer.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ colorguard.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ connect-livereload.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ cssnano.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ doiuse.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ express-history-api-fallback.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ istream.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ karma.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ merge-stream.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ open.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ postcss-reporter.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ slash.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ stylelint.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ systemjs-builder.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ tildify.d.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ tiny-lr.d.ts
β”‚Β Β  β”‚Β Β      └── walk.d.ts
β”‚Β Β  β”œβ”€β”€ tasks                  <- gulp tasks
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ project            <- project specific gulp tasks
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── sample.task.ts
β”‚Β Β  β”‚Β Β  └── seed               <- seed generic gulp tasks. They can be overriden by the project specific gulp tasks
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.assets.dev.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.assets.prod.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.bundles.app.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.bundles.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.docs.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.html_css.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.index.dev.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.index.prod.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.js.dev.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.js.e2e.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.js.prod.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.js.test.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ build.js.tools.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ check.versions.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ clean.all.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ clean.dev.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ clean.prod.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ clean.tools.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ copy.js.prod.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ css-lint.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ e2e.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ generate.manifest.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ karma.start.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ serve.coverage.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ serve.docs.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ server.prod.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ server.start.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ tslint.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ watch.dev.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ watch.e2e.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ watch.test.ts
β”‚Β Β  β”‚Β Β      └── webdriver.ts
β”‚Β Β  β”œβ”€β”€ utils                  <- build utils
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ project            <- project specific gulp utils
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── sample_util.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ project.utils.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ seed               <- seed specific gulp utils
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ clean.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ code_change_tools.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ server.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ tasks_tools.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ template_locals.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ tsproject.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── watch.ts
β”‚Β Β  β”‚Β Β  └── seed.utils.ts
β”‚Β Β  └── utils.ts
β”œβ”€β”€ tsconfig.json              <- configuration of the typescript project (ts-node, which runs the tasks defined in gulpfile.ts)
β”œβ”€β”€ tslint.json                <- tslint configuration
β”œβ”€β”€ typings                    <- typings directory. Contains all the external typing definitions defined with typings
β”œβ”€β”€ typings.json
└── appveyor.yml

Contributors

mgechev ludohenin d3viant0ne Shyam-Chen tarlepp NathanWalker
mgechev ludohenin d3viant0ne Shyam-Chen tarlepp NathanWalker
TheDonDope nareshbhatia hank-ehly kiuka jesperronn aboeglin
TheDonDope nareshbhatia hank-ehly kiuka jesperronn aboeglin
vyakymenko ryzy gkalpak njs50 pgrzeszczak natarajanmca11
vyakymenko ryzy gkalpak njs50 pgrzeszczak natarajanmca11
JayKan jerryorta-dev domfarolino JakePartusch ouq77 larsthorup
JayKan jerryorta-dev domfarolino JakePartusch ouq77 larsthorup
tsm91 eppsilon juristr e-oz JohnCashmore LuxDie
tsm91 eppsilon juristr e-oz JohnCashmore LuxDie
devanp92 hAWKdv c-ice markharding gotenxds ojacquemart
devanp92 hAWKdv c-ice markharding gotenxds ojacquemart
evanplaice TuiKiken turbohappy troyanskiy ip512 Green-Cat
evanplaice TuiKiken turbohappy troyanskiy ip512 Green-Cat
Yonet Nightapes nulldev07 yassirh taguan sonicparke
Yonet Nightapes nulldev07 yassirh taguan sonicparke
brendanbenson brian428 briantopping ckapilla cadriel dszymczuk
brendanbenson brian428 briantopping ckapilla cadriel dszymczuk
dstockhammer dwido totev nosachamos sfabriece koodikindral
dstockhammer dwido totev nosachamos sfabriece koodikindral
allenhwkim alexweber hpinsley jeffbcross johnjelinek justindujardin
allenhwkim alexweber hpinsley jeffbcross johnjelinek justindujardin
lihaibh Brooooooklyn tandu inkidotcom daixtrose mjwwit
lihaibh Brooooooklyn tandu inkidotcom daixtrose mjwwit
ocombe gdi2290 typekpb philipooo redian Bigous
ocombe gdi2290 typekpb philipooo redian Bigous
robbatt robertpenner sclausen heavymery tapas4java vincentpalita
robbatt robertpenner sclausen heavymery tapas4java vincentpalita
Yalrafih blackheart01 butterfieldcons jgolla ultrasonicsoft amaltsev
Yalrafih blackheart01 butterfieldcons jgolla ultrasonicsoft amaltsev

Wiki Contributors

Here are all the awesome guys who are helping to make the project's wiki even better!

37  Minko Gechev
22  Clayton K. N. Passos
15  Shyam-Chen
14  Vincent van Proosdij
 8  Christian Dobert
 8  Robert van Kints
 8  matthew harwood
 6  Ludovic HENIN
 5  Attila Egyed
 3  Stefan SchΓΌller
 3  Patrick Hillert
 3  Ezequiel Cicala
 2  Nathan Walker
 2  Yannick Koehler
 2  Giovanni Candido da Silva
 2  Simon Hampton
 2  Cy Klassen
 2  Joshua Wiens
 2  Drake Wilson
 2  Dinsitro
 1  zcsongor
 1  BouncingBit
 1  Brian Kotek
 1  Chris Kapilla
 1  Dang Tung
 1  Eddie Sun
 1  Enrico Secondulfo
 1  Eugene Serkin
 1  Ishara Samantha
 1  Myrmex
 1  Pol Stafford
 1  Raphael Schmitt
 1  Sebastian Fuss
 1  Sebastien de Salvador
 1  The Ult
 1  graham
 1  kiuka
 1  Ankit Kamboj

Change Log

You can follow the Angular 2 change log here.

License

MIT

About

Modular starter (seed) project for Angular 2 apps with fast, statically typed build

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 66.0%
  • JavaScript 22.3%
  • HTML 6.2%
  • CSS 5.5%