Skip to content
This repository has been archived by the owner on May 21, 2018. It is now read-only.

Latest commit

Β 

History

History
513 lines (430 loc) Β· 38.5 KB

README.md

File metadata and controls

513 lines (430 loc) Β· 38.5 KB

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.
  • Supports multiple Angular applications with shared codebase in a single instance of the seed.
  • Ready to go, statically typed build system using gulp for working with TypeScript.
  • Production and development builds.
  • Ahead-of-Time compilation support.
  • 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 @types.
  • 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
# prod build with AoT compilation
npm run build.prod.exp

# dev build of multiple applications (by default the value of --app is "app")
npm start -- --app baz
npm start -- --app foo
npm start -- --app bar

Does not rely on any global dependencies.

Table of Contents

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 files dev.ts or prod.ts in./tools/env/. The name of the file is environment you want to use.

The environment can be specified by using:

npm start -- --config-env ENV_NAME

Currently the ENV_NAMEs are dev, prod, staging, but you can simply add a different file "ENV_NAME.ts". 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

# Development. Your app will be watched by karma
# on each change all your specs will be executed.
npm run test.watch
# NB: The command above might fail with a "EMFILE: too many open files" error.
# Some OS have a small limit of opened file descriptors (256) by default
# and will result in the EMFILE error.
# You can raise the maximum of file descriptors by running the command below:
ulimit -n 10480


# 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
# Make sure you do have Java in your PATH (required for webdriver)

# npm install webdriver-manager <- Install this first for e2e testing
# 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
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ about.module.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ about.routes.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  └── index.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ +home
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ home.component.css
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ home.component.e2e-spec.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ home.component.html
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ home.component.spec.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ home.component.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ home.module.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ home.routes.ts
β”‚Β Β      β”‚Β Β  β”‚Β Β  └── index.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ app.component.e2e-spec.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ app.component.html
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ app.component.spec.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ app.component.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ app.module.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ app.routes.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ hot_loader_main.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ main.ts
β”‚Β Β      β”‚Β Β  └── shared
β”‚Β Β      β”‚Β Β      β”œβ”€β”€ config
β”‚Β Β      β”‚Β Β      β”‚Β Β  └── env.config.ts
β”‚Β Β      β”‚Β Β      β”œβ”€β”€ index.ts
β”‚Β Β      β”‚Β Β      β”œβ”€β”€ shared.module.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
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ data.json
β”‚Β Β      β”‚Β Β  └── svg
β”‚Β Β      β”‚Β Β      └── more.svg
β”‚Β Β      β”œβ”€β”€ css
β”‚Β Β      β”‚Β Β  └── main.css
β”‚Β Β      β”œβ”€β”€ index.html
β”‚Β Β      β”œβ”€β”€ testing
β”‚Β Β      β”‚Β Β  └── router
β”‚Β Β      β”‚Β Β      β”œβ”€β”€ mock-location-strategy.ts
β”‚Β Β      β”‚Β Β      └── router-testing-providers.ts
β”‚Β Β      └── tsconfig.json
β”œβ”€β”€ 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
β”‚Β Β  β”œβ”€β”€ env                    <- environment configuration
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ base.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ dev.ts
β”‚Β Β  β”‚Β Β  └── prod.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.coverage.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
Nightapes TheDonDope nareshbhatia hank-ehly kiuka daniru
Nightapes TheDonDope nareshbhatia hank-ehly kiuka daniru
vyakymenko jesperronn njs50 sasikumardr aboeglin ryzy
vyakymenko jesperronn njs50 sasikumardr aboeglin ryzy
gkalpak sfabriece jerryorta-dev pgrzeszczak eppsilon e-oz
gkalpak sfabriece jerryorta-dev pgrzeszczak eppsilon e-oz
natarajanmca11 domfarolino JayKan larsthorup JakePartusch LuxDie
natarajanmca11 domfarolino JayKan larsthorup JakePartusch LuxDie
robstoll amedinavalencia tsm91 jvitor83 juristr JohnCashmore
robstoll amedinavalencia tsm91 jvitor83 juristr JohnCashmore
ouq77 devanp92 hAWKdv c-ice markharding ojacquemart
ouq77 devanp92 hAWKdv c-ice markharding ojacquemart
tiagomapmarques TuiKiken evanplaice gotenxds turbohappy troyanskiy
tiagomapmarques TuiKiken evanplaice gotenxds turbohappy troyanskiy
Bigous ip512 Green-Cat Yonet edud69 daixtrose
Bigous ip512 Green-Cat Yonet edud69 daixtrose
amaltsev taguan yassirh sonicparke brendanbenson brian428
amaltsev taguan yassirh sonicparke brendanbenson brian428
briantopping ckapilla cadriel dszymczuk dmurat rousdan
briantopping ckapilla cadriel dszymczuk dmurat rousdan
peah90 dstockhammer dwido totev nosachamos koodikindral
peah90 dstockhammer dwido totev nosachamos koodikindral
Falinor allenhwkim hpinsley NN77 jeffbcross Drane
Falinor allenhwkim hpinsley NN77 jeffbcross Drane
johnjelinek JunusErgin justindujardin lihaibh Brooooooklyn tandu
johnjelinek JunusErgin justindujardin lihaibh Brooooooklyn tandu
inkidotcom nulldev07 mjwwit ocombe gdi2290 typekpb
inkidotcom nulldev07 mjwwit ocombe gdi2290 typekpb
philipooo redian alexweber robbatt robertpenner Sjiep
philipooo redian alexweber robbatt robertpenner Sjiep
sclausen heavymery tapas4java vincentpalita Yalrafih billsworld
sclausen heavymery tapas4java vincentpalita Yalrafih billsworld
blackheart01 butterfieldcons danielcrisp jgolla karlhaas omerfarukyilmaz
blackheart01 butterfieldcons danielcrisp jgolla karlhaas omerfarukyilmaz
pbazurin-softheme rossedfort savcha ultrasonicsoft bbarry
pbazurin-softheme rossedfort savcha ultrasonicsoft bbarry

Wiki Contributors

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

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

Change Log

You can follow the Angular 2 change log here.

License

MIT