高级 Angular 种子项目,支持 ngrx/store、ngrx/effects、ngx-translate、angulartics2、lodash、NativeScript (*native* 移动版)、Electron (Mac、Win)
高级 Angular 种子项目,支持 ngrx/store、ngrx/effects、ngx-translate、angulartics2、lodash、NativeScript (*native* 移动版)、Electron (Mac、Win)
Please read this notice first before continuing.
This is an advanced seed project for Angular apps based on Minko Gechev's angular-seed that expands on all of its great features to include core support for:
write_key here| 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. |
Advice: If your project is intended to target a single platform (i.e, web only), then angular-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.
Too Much?!: Don't worry it's ok, I completely understand. There is a simplified version of this seed which still allows web + mobile + desktop without the extra libraries and features like ngrx or analytics. Give this a shot: https://github.com/jlooper/angular-starter
It's built with a lot of the same structure found here so things work the same but is definitely easier to start with if just getting into multi-platform development.
Note you should have node v6.5.0 or higher and npm 3.10.3 or higher.
npm install -g nativescript
# install the project's dependencies
$ npm install
# fast install (via Yarn, https://yarnpkg.com)
$ yarn install # or yarn
# watches your files and uses livereload by default
$ npm start
# api document for the app
# npm run build.docs
# generate api documentation
$ npm run compodoc
$ npm run serve.compodoc
# to start deving with livereload site and coverage as well as continuous testing
$ npm run start.deving
# dev build
$ npm run build.dev
# prod build
$ npm run build.prod
Note that AoT compilation requires node v6.5.0 or higher and npm 3.10.3 or higher.
In order to start the seed with AoT use:
# prod build with AoT compilation, will output the production application in `dist/prod`
# the produced code can be deployed (rsynced) to a remote server
$ npm run build.prod.aot
The mobile app is provided via NativeScript, an open source framework for building truly native mobile apps.
npm install -g nativescript
You can make changes to files in src/client/app or nativescript/src/app folders. A symbolic link exists between the web src/client/app and the nativescript/src/app folder so changes in either location are mirrored because they are the same directory inside.
Create .tns.html and .tns.scss 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.
The root module for the mobile app is nativescript/src/native.module.ts: NativeModule.
iOS: npm run start.ios
iOS (device): npm run start.ios.device
// or...
Android: npm run start.android
Android (device): npm run start.android.device
OR...
Create AoT builds for deployment to App Store and Google Play.
Android: npm run build.android
iOS: npm run build.ios
The desktop app is provided via Electron, cross platform desktop apps with JavaScript, HTML, and CSS.
Mac: npm run start.desktop
Windows: npm run start.desktop.windows
Mac: npm run start.livesync.desktop
Windows: npm run start.livesync.desktop.windows
Mac: npm run build.desktop.mac
Windows: npm run build.desktop.windows
Linux: npm run build.desktop.linux
…
You can learn more about Protractor Interactive Mode here
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/
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 -- --env-config 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.
A documentation of the provided tools can be found in tools/README.md.
nativescript: Root of this directory is reserved for mobile app.src: mobile app src.app: Symbolic link of shared code from web app.App_Resources: iOS and Android platform specific config files and images.mobile: Mobile specific services, etc. Build out mobile specific services here as well as overrides for web services that need to be provided for in the mobile app. Safe to import {N} modules here.src/client: Root of this directory is reserved for web and desktop.app: All the code in this directory is shared with the mobile app via a symbolic link.components: Reserved for primary routing components. Since each app usually has it's own set of unique routes, you can provide the app's primary routing components here.shared: Shared code across all platforms. Reusable sub components, services, utilities, etc.analytics: Provides services for analytics. Out of the box, Segment is configured.core: Low level services. Foundational layer.electron: Services specific to electron integration. Could be refactored out in the future since this is not needed to be shared with the mobile app.i18n: Various localization features.ngrx: Central ngrx coordination. Brings together state from any other feature modules etc. to setup the initial app state.sample: Just a sample module pre-configured with a scalable ngrx setup.test: Testing utilities. This could be refactored into a different location in the future.assets: Various locale files, images and other assets the app needs to load.css: List of the main style files to be created via the SASS compilation (enabled by default).scss: Partial SASS files - reserved for things like _variables.scss and other imported partials for styling.src/e2e: Integration/end-to-end tests for the web app.暂无开放 Issues,或尚未同步最近议题。