Giter VIP home page Giter VIP logo

angular1-webpack-starter's Introduction

angular1-webpack-starter

Travis Codecov David David node npm

A starter project using Angular 1.x with Webpack. A Webpack + ES6 re-implementation of the generator-aio-angular project.

Still wanna use Gulp + ES5? Check the generator-aio-angular project.

Pure front-end implementation, all API interaction are mocked using angular-mocks.

Preview

Check out the demo site.

The dome site is a pure front-end implementation, so you can use any email/password to login, see mock file for detail. It is hosted on Github pages, no back-end support, so we use # style URL.

Features

  • ES6
  • Component based structure proposed in fouber/blog#10
  • Lazy load resources(js/css/images/templates...) for each page
  • Material Design using MaterializeCSS
  • Flex Layout
  • Responsive Design
    • Support multiple devices with different screen size.
    • Easy responsive implementation, very convenient to support small screen devices. (see responsive.styl)
  • Animation
    • Using animate.css.
    • All the animation defined by animate.css can be used directly as keyframe animation. (see animation.styl)
  • More understandable router design
  • Easy implementation for Sidebar Navigation and Breadcrumb

Get Started

git clone https://github.com/PinkyJie/angular1-webpack-starter.git
cd angular1-webpack-starter
npm install
npm start

Then open your browser with URL http://localhost:8080/webpack-dev-server/.

Tests

  • Unit Test: npm test
  • Unit Test with auto watch: npm run test:watch
  • E2E Test: npm run e2e
    • run npm run webdriver-update first
    • make sure a local mock server is running

Check the Unit test coverage report.

Check the E2E test report: Sauce Test Status

Sauce Test Status

Building

npm run build

The optimized files will be generated in build folder.

CI

Proudly use Travis to do Continuous Integration.

Every push will trigger a build on Travis, it will automatically:

  • run unit test.
  • run build script, deploy website and test coverage report to Github pages.
  • run E2E test on different browsers using Sauce Labs.

Check .travis.yml and publish-to-gh-pages.sh for detail implementation.

Check Travis build log for build results.

Blog series

http://pinkyjie.com/tags/angular1-webpack-starter/

License

MIT

angular1-webpack-starter's People

Contributors

pinkyjie avatar yperevoznikov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular1-webpack-starter's Issues

Unit test

Try to achieve 100% unit test coverage.

Need to cover the following folders:

  • components/_common/directives/
  • components/_common/services/
  • components/_common/production/
  • components/_layout/
  • components/banner/
  • components/breadcrumb/
  • components/footer/
  • components/header/
  • components/home-hero/
  • components/loading/
  • components/login-form/
  • components/modal
  • components/phone-form
  • components/phone-table
  • components/sidebar
  • components/sidebar-sm
  • components/square-menu
  • pages/404/
  • pages/dashboard/
  • pages/home/
  • pages/login/
  • pages/phone/

Lazy load

  • Support lazy load for each page.
  • Extract 3rd packages to external files.
  • Make webpack config ready for production.

Travis CI support

  • Automatically run all the tests.
  • Build the project and push to gh-pages branch.
  • Also push the test coverage HTML report to gh-pages branch.
  • Add badges.

E2E test

Need to cover the following pages:

  • protractor basic settings
  • 404
  • Home
  • Login
  • Dashboard
  • Phone List
  • Add Phone
  • Phone Detail
  • Edit Phone

resolve problem

不好意思,又来麻烦了,请教一个问题:我没有使用你封装好的RouterHelper,而是采用普通的在config中配置自己的项目,但是在需要登录的界面使用一个resolve:{ Login: ['LoginResolve', function(LoginResolve){return LoginResolve.login();}]}这样的resolve,相比你的{loginResolve: self.Resolve.login}确实很丑,但是angular.config的resolve要注入service没有办法,结果竟然无法工作。

发现是ResolveService.prototype.login.$inject = ['UserAPI', '$q'];这个UserAPI和$q都没有注入进来。我修改了一下这个LoginResolve类,可以正常工作了:

class LoginResolve {
	constructor (UserAPI, $q){
		Object.assign(this, {UserAPI, $q});
	}
	login () {
		const self = this;
		if (self.UserAPI.isLoggedIn() !== true) {
			return self.UserAPI.checkLoggedInStatus()
				 .catch(_error);
		}

		function _error () {
			return self.$q.reject('requireLogin');
		}
	}
}
LoginResolve.$inject = ['UserAPI', '$q'];

为什么你采用self.Resolve.login就可以使用login的inject,而我采用LoginResolve.login()则必须将注入放到LoginResolve再通过login来使用,LoginResolve.login()不会触发login的依赖注入工作吗?非常感谢!

$stateProvider problem

请教一个问题:
看到把stateProvider包装到一个自己的Provider中,然后在run函数中就可以定义路由,顺带登录认证一起做了,感觉流程简单了不少。但是我直接run一个function A,A中inject[‘$stateProvider‘],却会报错:Error: [$injector:unpr] Unknown provider: $stateProviderProvider <- $stateProvider。
run不能注册provider这是事实,请问你的方式为什么可行呢?

Error at npm run

npm start

[email protected] start /home/Desktop/github/angular1-webpack-starter
webpack-dev-server --mock

events.js:141
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE 0.0.0.0:8080
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at Server._listen2 (net.js:1237:14)
at listen (net.js:1273:10)
at net.js:1382:9
at nextTickCallbackWith3Args (node.js:452:9)
at process._tickCallback (node.js:358:17)
at Function.Module.runMain (module.js:444:11)
at startup (node.js:136:18)
at node.js:966:3

npm ERR! Linux 4.8.0-51-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: webpack-dev-server --mock
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'webpack-dev-server --mock'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular1-webpack-starter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack-dev-server --mock
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular1-webpack-starter
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular1-webpack-starter
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/Desktop/github/angular1-webpack-starter/npm-debug.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.