An advanced Angular2 seed project with support for ngrx/store, ng2-translate, angulartics2, lodash, NativeScript (*native* mobile), Electron (Mac, Windows and Linux desktop) and more.
TypeScriptMIT
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'sangular2-seed that expands on all of its great features to include core support for:
Integration with:
ngrx/store RxJS powered state management, inspired by Redux
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
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.
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 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
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
npm run git.setup - This will initialize git as well as setup upstream properly.
git remote add origin ...your private repo...
npm run git.prepare - This will prepare git to handle the merge
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.
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.
Now you have git setup and ready to develop your application as well as merge in upstream changes in the future.
npm install (and all other usage docs in this README apply)
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.framework and start building out all your components and services in there. Create other frameworks as you see fit to organize.
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.framework, remove ng2-translate as dependency root package.json and nativescript/package.json. Then remove any references to i18n throughout.