├── .DS_Store
├── .bowerrc
├── .gitignore
├── .jshintrc
├── Gulpfile.js
├── README.md
├── app
├── app.js
├── config.js
├── css
│ └── app.css
├── index.html
└── modules
│ └── home
│ ├── home-controller.js
│ ├── home-controller_test.js
│ ├── home-service.js
│ ├── home.html
│ └── home.js
├── bower.json
├── karma.conf.js
└── package.json
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smaye81/angular-es6-seed/3ae25ba5564fdafdefd1e4e8817c1576a4938e16/.DS_Store
--------------------------------------------------------------------------------
/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "app/bower_components"
3 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/*
2 | app/bower_components/*
3 | app/dist/*
4 | .idea/*
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "node": true,
3 | "browser": true,
4 | "esnext": true,
5 | "bitwise": true,
6 | "camelcase": false,
7 | "curly": true,
8 | "eqeqeq": true,
9 | "immed": true,
10 | "indent": 2,
11 | "latedef": "nofunc",
12 | "newcap": true,
13 | "noarg": true,
14 | "quotmark": false,
15 | "regexp": true,
16 | "undef": true,
17 | "unused": true,
18 | "strict": true,
19 | "trailing": true,
20 | "smarttabs": true,
21 | "browserify" : true,
22 | "globals": {
23 | "angular": false,
24 | "_": false,
25 | "it": false,
26 | "xit": false,
27 | "describe": false,
28 | "xdescribe": false,
29 | "beforeEach": false,
30 | "browser": false,
31 | "expect": false,
32 | "spyOn" : false,
33 | "jasmine" : false
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Gulpfile.js:
--------------------------------------------------------------------------------
1 | var gulp = require('gulp');
2 | var traceur = require('gulp-traceur');
3 | var concat = require('gulp-concat');
4 | var jshint = require('gulp-jshint');
5 | var browserSync = require('browser-sync');
6 | var reload = browserSync.reload;
7 |
8 | var SOURCE_FILES = ['!app/**/*_test.js', 'app/*.js', 'app/modules/**/*.js'];
9 | var SOURCE_HTML = ['app/*.html', 'app/modules/**/*.html'];
10 |
11 | // Runs JSHint Report against all JS files in app
12 | gulp.task('lint', function () {
13 | return gulp.src(SOURCE_FILES)
14 | .pipe(jshint())
15 | .pipe(jshint.reporter('jshint-stylish'))
16 | .pipe(jshint.reporter('fail'));
17 | });
18 |
19 | gulp.task('browserSync', function() {
20 | browserSync({
21 | logConnections: true,
22 | logFileChanges: true,
23 | notify: true,
24 | open: true,
25 | server: {
26 | baseDir: "./app"
27 | }
28 | });
29 | });
30 |
31 | gulp.task('watch', function () {
32 |
33 | // Lint the JS files when they change
34 | gulp.watch(SOURCE_FILES, ['lint', 'traceur', reload]);
35 | gulp.watch(SOURCE_HTML, reload);
36 | });
37 |
38 | /* Sourcemaps seem to not be working when a base is specified */
39 | gulp.task('traceur', function () {
40 | return gulp.src(['!app/**/*_test.js', 'app/*.js', 'app/modules/**/*.js'], {base: './app'})
41 | .pipe(traceur({
42 | modules: 'register',
43 | moduleName : true
44 | }))
45 | .pipe(concat('bundle.js'))
46 | .pipe(gulp.dest('app/dist'))
47 | .pipe(reload({stream:true}));
48 | });
49 |
50 | gulp.task('default', ['traceur', 'lint', 'watch', 'browserSync']);
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | angular-es6-seed
3 | ================
4 |
5 | Seed project using Angular and all ES6 syntax (especially classes and modules)
6 |
7 | Uses:
8 |
9 | * Angular
10 | * Angular UI Router
11 | * Traceur
12 | * Bootstrap
13 | * Gulp
14 | * Karma
15 | * Jasmine
16 |
17 |
18 | To run app:
19 |
20 | * Clone repo
21 | * Install Gulp globally using `npm install gulp -g`
22 | * Run `npm install` from project root
23 | * Run `bower install` from project root
24 | * Run `gulp` from the project root
25 |
26 |
27 | Branches:
28 |
29 | _master_: Uses Traceur
30 |
31 | _babel_: Uses babel
32 |
33 |
34 | To Do:
35 |
36 | * Tests
37 |
38 |
--------------------------------------------------------------------------------
/app/app.js:
--------------------------------------------------------------------------------
1 | import homeModule from './modules/home/home';
2 | import Config from './config';
3 |
4 | var appModule = angular.module("App", ["ui.router", homeModule.name]);
5 |
6 | appModule.config(Config);
7 |
8 |
--------------------------------------------------------------------------------
/app/config.js:
--------------------------------------------------------------------------------
1 |
2 | class Config {
3 |
4 | constructor($stateProvider, $urlRouterProvider){
5 |
6 | // For any unmatched url, redirect to /home
7 | $urlRouterProvider.otherwise("/home");
8 |
9 | $stateProvider
10 | .state('home', {
11 | url: "/home",
12 | controller : "HomeCtrl as homeCtrl",
13 | templateUrl: "modules/home/home.html"
14 | })
15 | .state('details', {
16 | url: "/details",
17 | controller : "DetailsCtrl as detailsCtrl",
18 | templateUrl: "modules/home/details.html"
19 | });
20 |
21 | }
22 |
23 | }
24 |
25 | Config.$inject = ['$stateProvider', '$urlRouterProvider'];
26 |
27 | export default Config;
--------------------------------------------------------------------------------
/app/css/app.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding:15px;
3 | }
--------------------------------------------------------------------------------
/app/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Angular ES6 Seed
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/modules/home/home-controller.js:
--------------------------------------------------------------------------------
1 |
2 | class HomeController {
3 |
4 | constructor(HomeService){
5 | this.HomeService = HomeService;
6 | }
7 |
8 | sayHello(){
9 | this.HomeService.getGreeting(this.name).then(greeting => this.greeting = greeting);
10 | }
11 |
12 | }
13 |
14 | HomeController.$inject = ['HomeService'];
15 |
16 | export default HomeController;
--------------------------------------------------------------------------------
/app/modules/home/home-controller_test.js:
--------------------------------------------------------------------------------
1 | // Describe the Context for your tests
2 | describe('Home Controller Tests', function () {
3 |
4 | var sut;
5 |
6 | beforeEach(function () {
7 | module(homeModule.name);
8 | });
9 |
10 | beforeEach(function () {
11 |
12 | module(function ($provide) {
13 | $provide.value("HomeService", {
14 | getLocation : jasmine.createSpy("HomeService getLocation")
15 | });
16 |
17 | $provide.value("$state", {});
18 | })
19 | });
20 |
21 | beforeEach(function () {
22 |
23 | inject(function ($controller, _$rootScope_) {
24 | sut = $controller("HomeCtrl", {
25 | $scope : _$rootScope_
26 | })
27 | })
28 | });
29 |
30 | it('should be defined', function () {
31 | expect(sut).toBeDefined();
32 | })
33 | });
--------------------------------------------------------------------------------
/app/modules/home/home-service.js:
--------------------------------------------------------------------------------
1 |
2 | class HomeService {
3 |
4 | constructor($q){
5 | this.$q = $q;
6 | }
7 |
8 | getGreeting(name = "Noname McDefault"){
9 | return this.$q(resolve => resolve(`Hello, ${name}. Welcome to Angular in ES6!!`));
10 | }
11 |
12 | }
13 |
14 | HomeService.$inject = ['$q'];
15 |
16 | export default HomeService;
--------------------------------------------------------------------------------
/app/modules/home/home.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
{{homeCtrl.greeting}}
7 |
8 |
--------------------------------------------------------------------------------
/app/modules/home/home.js:
--------------------------------------------------------------------------------
1 | import HomeController from "./home-controller";
2 | import HomeService from "./home-service";
3 |
4 | var homeModule = angular.module("Home", []);
5 |
6 | homeModule.controller("HomeCtrl", HomeController);
7 | homeModule.service("HomeService", HomeService);
8 |
9 | export default homeModule;
10 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "devtool",
3 | "version": "1.0.0",
4 | "authors": [
5 | "Tapas Jena "
6 | ],
7 | "license": "MIT",
8 | "ignore": [
9 | "**/.*",
10 | "node_modules",
11 | "bower_components",
12 | "test",
13 | "tests"
14 | ],
15 | "dependencies": {
16 | "angular": "~1.4.x",
17 | "angular-mocks": "~1.4.x",
18 | "angular-animate": "v1.4.x",
19 | "angular-aria": "^1.4.x",
20 | "angular-material": "^0.8.0",
21 | "angular-local-storage": "~0.1.5",
22 | "ngprogress": "~1.0.7",
23 |
24 | "bootstrap": "~3.3.0",
25 | "angular-ui-router": "~0.2.11"
26 | },
27 | "resolutions": {
28 | "angular": "~1.4.x",
29 | "angular-animate": "v1.4.x",
30 | "angular-aria": "^1.4.x"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration
2 | // Generated on Sun Sep 07 2014 23:16:55 GMT-0400 (EDT)
3 |
4 | module.exports = function (config) {
5 | config.set({
6 |
7 | // base path that will be used to resolve all patterns (eg. files, exclude)
8 | basePath: '',
9 |
10 |
11 | // frameworks to use
12 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13 | frameworks: ['jasmine', 'traceur'],
14 |
15 |
16 | // list of files / patterns to load in the browser
17 | files: [
18 | 'app/bower_components/angular/angular.js',
19 | 'app/bower_components/angular-mocks/angular-mocks.js',
20 | 'app/*.js',
21 | 'app/modules/**/*.js'
22 | ],
23 |
24 |
25 | // list of files to exclude
26 | exclude: [
27 |
28 | ],
29 |
30 |
31 | // preprocess matching files before serving them to the browser
32 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
33 | preprocessors: {
34 | 'app/**/*.js': ['traceur'],
35 | 'app/*.js': ['traceur']
36 | },
37 |
38 | traceurPreprocessor: {
39 | // options passed to the traceur-compiler
40 | // see traceur --longhelp for list of options
41 | options: {
42 | sourceMaps: false,
43 | modules: 'register'
44 | }
45 | },
46 |
47 | // test results reporter to use
48 | // possible values: 'dots', 'progress'
49 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter
50 | reporters: ['progress'],
51 |
52 |
53 | // web server port
54 | port: 9876,
55 |
56 |
57 | // enable / disable colors in the output (reporters and logs)
58 | colors: true,
59 |
60 |
61 | // level of logging
62 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
63 | logLevel: config.LOG_INFO,
64 |
65 |
66 | // enable / disable watching file and executing tests whenever any file changes
67 | autoWatch: true,
68 |
69 |
70 | // start these browsers
71 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
72 | browsers: ['PhantomJS'],
73 |
74 |
75 | // Continuous Integration mode
76 | // if true, Karma captures browsers, runs the tests and exits
77 | singleRun: false
78 | });
79 | };
80 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "devtool",
3 | "version": "1.0.0",
4 | "description": "DigiBank Dev Tool",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "Tapas Jena",
10 | "license": "MIT",
11 | "dependencies": {
12 | "gulp-traceur": "^0.14.0",
13 | "gulp-concat": "^2.4.1",
14 | "traceur": "0.0.72",
15 | "karma": "^0.12.24",
16 | "karma-traceur-preprocessor": "^0.4.0",
17 | "karma-jasmine": "^0.2.3",
18 | "karma-phantomjs-launcher": "^0.1.4",
19 | "protractor": "^1.1.1",
20 | "shelljs": "^0.2.6",
21 | "karma-junit-reporter": "^0.2.2",
22 | "browser-sync": "^2.5.3",
23 | "gulp": "^3.8.11",
24 | "gulp-jshint": "^1.9.4",
25 | "jshint-stylish": "^1.0.1"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------