Public | Automated Build

Last pushed: a year ago
Short Description
Chnoumis Angular 2 Base
Full Description







Considering Angular 2 for a large project? Do you need potential i18n support? Enhanced testing support? Oh and building for multiple platforms too? Web, native Mobile (Android/iOS), and even Desktop (Mac, Windows and Linux)?

This is an advanced seed project for Angular 2 apps based on Minko Gechev's angular2-seed that expands on all of its great features to include core support for:

Integration with:

The zen of multiple platforms. Chrome, Android and iPhone all running the same code.
Programming Nirvana. Mac and Windows desktop both running the same code.

Table of Contents

Enhanced development workflow

  • Decorators for components which reduce boilerplate for common component setups
  • Shared code can be found in frameworks:
    • app: your shared application architecture code
    • core: foundation layer (decorators and low-level services)
    • analytics: analytics provided by Segment
      • Only reports data in production build
    • i18n: internationalization features
    • electron: Electron specific code
    • test: test specific code providing conveniences to make testing your code easier and faster

Enhanced testing support options

  • mocks for various services
  • configurable provider blocks for easy test setup of common application providers
    • tired of setting up similar providers over and over again for different tests?
    • configure a reusable test provider which can be configured on a case-by-base basis
    • see example here
  • helpers for end-to-end (e2e, integration) tests
  • convenient shorthand to reduce test setup boilerplate and enhance speed of writing tests
    • are your test cases buried by multiple import lines requiring you to scroll just to get to the substance of the test?
    • removes noise allowing you to better focus on the substance of the test
    • provides full intellisense support
    • allows your team to add unique shorthands for various testing scenarios specific to your application needs
    • plays nice with tslint options like "no-unused-variable": true as the api hangs off a plain Object instead of globals
      • what's the value of that you ask? have you ever isolated a test with iit or ddescribe but didn't import those or vice versa, used iit leaving an unused it now in your tests? yeah, tslint will be all over you :/
      • avoids unused variable warnings altogether in tests since you are always using a valid key from the shorthand Object
    • see example here

Advice: If your project is intended to target a single platform (i.e, web only), then angular2-seed is likely more than suitable for your needs. However if your project goals are to target multiple platforms (web, native mobile and native desktop), with powerful out of the box library support and highly configurable/flexible testing options, then you might want to keep reading.

Prerequisites

  • node v5.x.x or higher and npm 3 or higher.

  • To run the NativeScript app:

npm install -g nativescript
npm install -g typescript

Usage

git clone --depth 1 https://github.com/NathanWalker/angular2-seed-advanced.git
cd angular2-seed-advanced

# install the project's dependencies
npm install
# watches your files and uses livereload by default
npm start
# api document for the app
npm run serve.docs

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

NativeScript App

Setup

npm install -g nativescript

Dev Workflow

You can make changes to files in src/client or nativescript folders. A symbolic link exists between the web src/client and the nativescript folder so changes in either location are mirrored because they are the same directory inside.

Create .tns.html and .tns.css NativeScript view files for every web component view file you have. You will see an example of the app.component.html as a NativeScript view file here.

Run

iOS:                      npm run start.ios
iOS (livesync emulator):  npm run start.livesync.ios
iOS (livesync device):    npm run start.livesync.ios.device

// or...

Android:                      npm run start.android
Android (livesync emulator):  npm run start.livesync.android
Android (livesync device):    npm run start.livesync.android.device

Electron App

Develop

Mac:      npm run start.desktop
Windows:  npm run start.desktop.windows

Develop with livesync

Mac:      npm run start.livesync.desktop
Windows:  npm run start.livesync.desktop.windows

Release: Package Electron App for Mac, Windows or Linux

Mac:      npm run build.desktop.mac
Windows:  npm run build.desktop.windows
Linux:    npm run build.desktop.linux

Testing

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

<<<<<<< HEAD

Framework How-Tos

i18n

  • how to add a language?
    • src/client/assets/i18n/
      • add [language code].json (copy existing one and adapt the translation strings)
    • src/client/app/frameworks/app/services/app-config.service.spec.ts
      • fix test
    • src/client/app/frameworks/app/services/app-config.service.ts
      • add language to SUPPORTED_LANGUAGES
    • src/client/app/frameworks/i18n/components/lang-switcher.component.spec.ts
      • fix test

upstream/master

Web Configuration Options

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/

Change Detection OnPush Note

Please Note: The seed uses Angular's ChangeDetectionStrategy.OnPush by default which requires some understanding of immutability and one-way data flows. Please check out the following resources to learn more:

If you experience issues with changes not occuring in your views, you can disable this by commenting out these lines. The seed uses OnPush by default because it provides optimal performance and if you decide to turn it off while developing your application, you can always turn it back on when you're ready to refactor your data services to utilize OnPush properly.

Feature Branches

Several branches exist with certain features integrated:

How best to use for your project

Setup

  1. Download a zip of the seed. (Do not fork)
  2. npm run git.setup - This will initialize git as well as setup upstream properly.
  3. git remote add origin ...your private repo...
  4. npm run git.prepare - This will prepare git to handle the merge
  5. npm run git.merge - This will fetch upstream and run the first merge (*Important)
    • IMPORTANT: You will see a wall of Conflicts after doing above (a Conflict for every single file). This is normal. There actually will not be any problematic conflicts as it's just reporting every single file which both sides (upstream and your first commit) added.
  6. git add .; git commit -m'ready'. Yes, you will be committing all those conflicts, which actually are not a problem in this 1 time case.
  7. Now you have git setup and ready to develop your application as well as merge in upstream changes in the future.
  8. npm install (and all other usage docs in this README apply)
  9. Create a new framework for your application in src/client/app/frameworks to build your codebase out. Say your app is called AwesomeApp, then create awesomeapp and start building out all your components and services in there. Create other frameworks as you see fit to organize.
  10. If you don't want an integration that comes out of box with this seed; for example. let's say you don't want to use i18n. Then just delete the i18n, remove ng2-translate as dependency root package.json and nativescript/package.json. Then remove any references to i18n throughout.

You can read more about configuring a remote for a fork here

Merging latest upstream changes

  1. npm run git.merge.preview - This will fetch upstream and show you how the merge would look
  2. npm run git.merge - This will actually do the merge
  3. Handle any conflicts to get latest upstream into your application.
  4. Continue building your app.

You can read more about syncing a fork here.

If you have any suggestions to this workflow, please post here.

Contributing

Please see the CONTRIBUTING file for guidelines.

Awesome Contributors

<img alt="mgechev" src="https://avatars.githubusercontent.com/u/455023?v=3&s=117" width="117"> <img alt="ludohenin" src="https://avatars.githubusercontent.com/u/1011516?v=3&s=117" width="117"> <img alt="NathanWalker" src="https://avatars.githubusercontent.com/u/457187?v=3&s=117" width="117"> <img alt="d3viant0ne" src="https://avatars.githubusercontent.com/u/8420490?v=3&s=117" width="117"> <img alt="tarlepp" src="https://avatars.githubusercontent.com/u/595561?v=3&s=117" width="117"> <img alt="Shyam-Chen" src="https://avatars.githubusercontent.com/u/13535256?v=3&s=117" width="117">
mgechev ludohenin NathanWalker d3viant0ne tarlepp Shyam-Chen
<img alt="TheDonDope" src="https://avatars.githubusercontent.com/u/1188033?v=3&s=117" width="117"> <img alt="nareshbhatia" src="https://avatars.githubusercontent.com/u/1220198?v=3&s=117" width="117"> <img alt="hank-ehly" src="https://avatars.githubusercontent.com/u/11639738?v=3&s=117" width="117"> <img alt="kiuka" src="https://avatars.githubusercontent.com/u/11283191?v=3&s=117" width="117"> <img alt="jesperronn" src="https://avatars.githubusercontent.com/u/6267?v=3&s=117" width="117"> <img alt="the-ult" src="https://avatars.githubusercontent.com/u/4863062?v=3&s=117" width="117">
TheDonDope nareshbhatia hank-ehly kiuka jesperronn the-ult
<img alt="aboeglin" src="https://avatars.githubusercontent.com/u/8297302?v=3&s=117" width="117"> <img alt="gkalpak" src="https://avatars.githubusercontent.com/u/8604205?v=3&s=117" width="117"> <img alt="ryzy" src="https://avatars.githubusercontent.com/u/994940?v=3&s=117" width="117"> <img alt="JakePartusch" src="https://avatars.githubusercontent.com/u/6424140?v=3&s=117" width="117"> <img alt="njs50" src="https://avatars.githubusercontent.com/u/55112?v=3&s=117" width="117"> <img alt="pgrzeszczak" src="https://avatars.githubusercontent.com/u/3300099?v=3&s=117" width="117">
aboeglin gkalpak ryzy JakePartusch njs50 pgrzeszczak
<img alt="natarajanmca11" src="https://avatars.githubusercontent.com/u/9244766?v=3&s=117" width="117"> <img alt="JohnCashmore" src="https://avatars.githubusercontent.com/u/2050794?v=3&s=117" width="117"> <img alt="jerryorta-dev" src="https://avatars.githubusercontent.com/u/341155?v=3&s=117" width="117"> <img alt="domfarolino" src="https://avatars.githubusercontent.com/u/9669289?v=3&s=117" width="117"> <img alt="LuxDie" src="https://avatars.githubusercontent.com/u/12536671?v=3&s=117" width="117"> <img alt="larsthorup" src="https://avatars.githubusercontent.com/u/1202959?v=3&s=117" width="117">
natarajanmca11 JohnCashmore jerryorta-dev domfarolino LuxDie larsthorup
<img alt="juristr" src="https://avatars.githubusercontent.com/u/542458?v=3&s=117" width="117"> <img alt="e-oz" src="https://avatars.githubusercontent.com/u/526352?v=3&s=117" width="117"> <img alt="ouq77" src="https://avatars.githubusercontent.com/u/1796191?v=3&s=117" width="117"> <img alt="tsm91" src="https://avatars.githubusercontent.com/u/4459551?v=3&s=117" width="117"> <img alt="devanp92" src="https://avatars.githubusercontent.com/u/4533277?v=3&s=117" width="117"> <img alt="hAWKdv" src="https://avatars.githubusercontent.com/u/4449497?v=3&s=117" width="117">
juristr e-oz ouq77 tsm91 devanp92 hAWKdv
<img alt="ivannugo" src="https://avatars.githubusercontent.com/u/8823899?v=3&s=117" width="117"> <img alt="c-ice" src="https://avatars.githubusercontent.com/u/347238?v=3&s=117" width="117"> <img alt="markharding" src="https://avatars.githubusercontent.com/u/851436?v=3&s=117" width="117"> <img alt="gotenxds" src="https://avatars.githubusercontent.com/u/3519520?v=3&s=117" width="117"> <img alt="ojacquemart" src="https://avatars.githubusercontent.com/u/1189345?v=3&s=117" width="117"> <img alt="Nightapes" src="https://avatars.githubusercontent.com/u/15911153?v=3&s=117" width="117">
ivannugo c-ice markharding gotenxds ojacquemart Nightapes
<img alt="evanplaice" src="https://avatars.githubusercontent.com/u/303159?v=3&s=117" width="117"> <img alt="vyakymenko" src="https://avatars.githubusercontent.com/u/7300673?v=3&s=117" width="117"> <img alt="divramod" src="https://avatars.githubusercontent.com/u/1331662?v=3&s=117" width="117"> <img alt="turbohappy" src="https://avatars.githubusercontent.com/u/437299?v=3&s=117" width="117"> <img alt="troyanskiy" src="https://avatars.githubusercontent.com/u/1538862?v=3&s=117" width="117"> <img alt="ip512" src="https://avatars.githubusercontent.com/u/1699735?v=3&s=117" width="117">
evanplaice vyakymenko divramod turbohappy troyanskiy ip512
<img alt="Green-Cat" src="https://avatars.githubusercontent.com/u/3328823?v=3&s=117" width="117"> <img alt="Yonet" src="https://avatars.githubusercontent.com/u/3523671?v=3&s=117" width="117"> <img alt="TuiKiken" src="https://avatars.githubusercontent.com/u/959821?v=3&s=117" width="117"> <img alt="tandu" src="https://avatars.githubusercontent.com/u/273313?v=3&s=117" width="117"> <img alt="amaltsev" src="https://avatars.githubusercontent.com/u/2480962?v=3&s=117" width="117"> <img alt="yassirh" src="https://avatars.githubusercontent.com/u/4649139?v=3&s=117" width="117">
Green-Cat Yonet TuiKiken tandu amaltsev yassirh
<img alt="sonicparke" src="https://avatars.githubusercontent.com/u/1139721?v=3&s=117" width="117"> <img alt="brendanbenson" src="https://avatars.githubusercontent.com/u/866866?v=3&s=117" width="117"> <img alt="eppsilon" src="https://avatars.githubusercontent.com/u/5643?v=3&s=117" width="117"> <img alt="brian428" src="https://avatars.githubusercontent.com/u/140338?v=3&s=117" width="117"> <img alt="briantopping" src="https://avatars.githubusercontent.com/u/158115?v=3&s=117" width="117"> <img alt="cadriel" src="https://avatars.githubusercontent.com/u/205520?v=3&s=117" width="117">
sonicparke brendanbenson eppsilon brian428 briantopping cadriel
<img alt="dszymczuk" src="https://avatars.githubusercontent.com/u/539352?v=3&s=117" width="117"> <img alt="dstockhammer" src="https://avatars.githubusercontent.com/u/1156637?v=3&s=117" width="117"> <img alt="dwido" src="https://avatars.githubusercontent.com/u/154235?v=3&s=117" width="117"> <img alt="totev" src="https://avatars.githubusercontent.com/u/4454638?v=3&s=117" width="117"> <img alt="sfabriece" src="https://avatars.githubusercontent.com/u/3108592?v=3&s=117" width="117"> <img alt="koodikindral" src="https://avatars.githubusercontent.com/u/6285484?v=3&s=117" width="117">
dszymczuk dstockhammer dwido totev sfabriece koodikindral
<img alt="allenhwkim" src="https://avatars.githubusercontent.com/u/1437734?v=3&s=117" width="117"> <img alt="alexweber" src="https://avatars.githubusercontent.com/u/14409?v=3&s=117" width="117"> <img alt="hpinsley" src="https://avatars.githubusercontent.com/u/750098?v=3&s=117" width="117"> <img alt="jeffbcross" src="https://avatars.githubusercontent.com/u/463703?v=3&s=117" width="117"> <img alt="Jimmysh" src="https://avatars.githubusercontent.com/u/230652?v=3&s=117" width="117"> <img alt="johnjelinek" src="https://avatars.githubusercontent.com/u/873610?v=3&s=117" width="117">
allenhwkim alexweber hpinsley jeffbcross Jimmysh johnjelinek
<img alt="fourctv" src="https://avatars.githubusercontent.com/u/15777910?v=3&s=117" width="117"> <img alt="justindujardin" src="https://avatars.githubusercontent.com/u/101493?v=3&s=117" width="117"> <img alt="lihaibh" src="https://avatars.githubusercontent.com/u/4681233?v=3&s=117" width="117"> <img alt="Brooooooklyn" src="https://avatars.githubusercontent.com/u/3468483?v=3&s=117" width="117"> <img alt="nulldev07" src="https://avatars.githubusercontent.com/u/2115712?v=3&s=117" width="117"> <img alt="inkidotcom" src="https://avatars.githubusercontent.com/u/100466?v=3&s=117" width="117">
fourctv justindujardin lihaibh Brooooooklyn nulldev07 inkidotcom
<img alt="mjwwit" src="https://avatars.githubusercontent.com/u/4455124?v=3&s=117" width="117"> <img alt="ocombe" src="https://avatars.githubusercontent.com/u/265378?v=3&s=117" width="117"> <img alt="gdi2290" src="https://avatars.githubusercontent.com/u/1016365?v=3&s=117" width="117"> <img alt="typekpb" src="https://avatars.githubusercontent.com/u/499820?v=3&s=117" width="117"> <img alt="philipooo" src="https://avatars.githubusercontent.com/u/1702399?v=3&s=117" width="117"> <img alt="pidupuis" src="https://avatars.githubusercontent.com/u/2828353?v=3&s=117" width="117">
mjwwit ocombe gdi2290 typekpb philipooo pidupuis
<img alt="redian" src="https://avatars.githubusercontent.com/u/816941?v=3&s=117" width="117"> <img alt="Bigous" src="https://avatars.githubusercontent.com/u/6886560?v=3&s=117" width="117"> <img alt="robbatt" src="https://avatars.githubusercontent.com/u/1379424?v=3&s=117" width="117"> <img alt="robertpenner" src="https://avatars.githubusercontent.com/u/79827?v=3&s=117" width="117"> <img alt="sclausen" src="https://avatars.githubusercontent.com/u/916076?v=3&s=117" width="117"> <img alt="heavymery" src="https://avatars.githubusercontent.com/u/3417123?v=3&s=117" width="117">
redian Bigous robbatt robertpenner sclausen heavymery
<img alt="tjvantoll" src="https://avatars.githubusercontent.com/u/544280?v=3&s=117" width="117"> <img alt="tapas4java" src="https://avatars.githubusercontent.com/u/2254963?v=3&s=117" width="117"> <img alt="gitter-badger" src="https://avatars.githubusercontent.com/u/8518239?v=3&s=117" width="117"> <img alt="vincentpalita" src="https://avatars.githubusercontent.com/u/2738822?v=3&s=117" width="117"> <img alt="Yalrafih" src="https://avatars.githubusercontent.com/u/7460011?v=3&s=117" width="117"> <img alt="blackheart01" src="https://avatars.githubusercontent.com/u/1414277?v=3&s=117" width="117">
tjvantoll tapas4java gitter-badger vincentpalita Yalrafih blackheart01
<img alt="butterfieldcons" src="https://avatars.githubusercontent.com/u/12204784?v=3&s=117" width="117"> <img alt="jgolla" src="https://avatars.githubusercontent.com/u/1542447?v=3&s=117" width="117"> <img alt="sebfag" src="https://avatars.githubusercontent.com/u/6400825?v=3&s=117" width="117"> <img alt="ultrasonicsoft" src="https://avatars.githubusercontent.com/u/4145169?v=3&s=117" width="117"> <img alt="taguan" src="https://avatars.githubusercontent.com/u/1026937?v=3&s=117" width="117">
butterfieldcons jgolla sebfag ultrasonicsoft taguan

License

MIT

Docker Pull Command
Owner
chnoumis
Source Repository

Comments (0)