Skip to content

Commit

Permalink
Merge ac18c2e into 3d8502f
Browse files Browse the repository at this point in the history
  • Loading branch information
jonniespratley committed Sep 10, 2016
2 parents 3d8502f + ac18c2e commit a86441e
Show file tree
Hide file tree
Showing 70 changed files with 4,460 additions and 2,050 deletions.
1 change: 1 addition & 0 deletions .cfignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 1 addition & 1 deletion .doclets.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dir: src
dir: release
packageJson: package.json
branches:
- master
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- iojs
- "6.1"
before_script:
- node -v
- npm -v
Expand Down
159 changes: 154 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,164 @@ A nodejs-sandbox project that contains boilerplate code for creating plugins.



[![Build Status](https://travis-ci.org/jonniespratley/nodejs-sandbox.svg?branch=develop)](https://travis-ci.org/jonniespratley/nodejs-sandbox)
[![Dependencies Status](https://david-dm.org/jonniespratley/nodejs-sandbox.svg)](https://david-dm.org/jonniespratley/nodejs-sandbox)
[![Build Status](https://travis-ci.org/jonniespratley/nodejs-sandbox.svg?branch=master)](https://travis-ci.org/jonniespratley/nodejs-sandbox)

[![Coverage Status](https://coveralls.io/repos/github/jonniespratley/nodejs-sandbox/badge.svg?branch=master)](https://coveralls.io/github/jonniespratley/nodejs-sandbox?branch=master)

[![Dependencies Status](https://david-dm.org/jonniespratley/nodejs-sandbox.svg)](https://david-dm.org/jonniespratley/nodejs-sandbox.svg)

[![Coverage Status](https://coveralls.io/repos/github/jonniespratley/nodejs-sandbox/badge.svg?branch=develop)](https://coveralls.io/github/jonniespratley/nodejs-sandbox?branch=develop)
[![API Doc](https://doclets.io/jonniespratley/nodejs-sandbox/master.svg)](https://doclets.io/jonniespratley/nodejs-sandbox/master)


## Get Started
First clone the repo.

```
/*
## sandbox
NodeJs sandbox class that is simualr to angularjs
## Get Started
First clone the repo.
//app/scripts/app.js
```
import router from './router';
export var app = angular.module('es6PredixApp', ['ngRoute']);
export function bootstrap(){
router(app);
angular.element(document).ready(function() {
console.warn('Bootstrapping es6 app', app);
angular.bootstrap(document, [app.name]);
});
}
```
//app/scripts/router.js
import {HomeController} from 'controllers/home';
import {Page1Controller} from 'controllers/page1';
import {Page2Controller} from 'controllers/page2';
import {DataService} from 'services/dataservice';
export default function mount(module){
console.warn('mounting routes on', module.name);
module.controller('HomeController', HomeController);
module.controller('Page1Controller', Page1Controller);
module.controller('Page2Controller', Page2Controller);
module.service('DataService', DataService);
module.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/', {
redirectTo: '/home'
})
.when('/home', {
templateUrl: 'views/home.html',
controller: 'HomeController'
})
.when('/page1', {
templateUrl: 'views/page1.html',
controller: 'Page1Controller'
})
.when('/page2', {
templateUrl: 'views/page2.html',
controller: 'Page2Controller'
})
.otherwise({
redirectTo: '/home'
});
}]);
}
//app/scripts/controllers/home.js
export class HomeController {
constructor($scope, DataService) {
$scope.name = 'Home';
$scope.feature = {
title : 'ES6 AngularJS',
body : 'Use this to quickly start a new AngularJS & ES6 project.'
};
$scope.features = [{
title : 'ECMAScript 6',
body : 'Using the latest version of ESnext prepare for the future!'
}, {
title : 'AngularJS',
body : 'Using AngularJS as the foundation for single page apps.'
}, {
title : 'HTML5',
body : 'Using HTML5 for a better user experience on all platforms.'
}];
console.log('HomeController constructor', this);
DataService.fetch('https://passbook-manager.jsapps.io/api/v1/passes');
}
name() {
return "World!!!";
}
}
//app/scripts/controllers/page1.js
export class Page1Controller {
constructor($scope) {
$scope.name = 'Page 1';
console.log('Page1Controller constructor', this);
}
get name() {
return "Page 1";
}
}
//app/scripts/controllers/page2.js
export class Page2Controller {
constructor($scope) {
$scope.name = 'Page 2';
console.log('Page2Controller constructor', this);
}
get name() {
return "Page 2";
}
}
//app/scripts/services/dataservice.js
export class DataService {
constructor($rootScope, $http, $q, $log) {
$log.info('DataService constructor', this);
this.$http = $http;
}
fetch(url){
return this.$http.jsonp(url, {params: {callback: 'JSON_CALLBACK'}});
}
}
const app = sandbox.module('learningYeomanCh3App', [
'express',
'models'
])
.controller('PostsCtrl', ['$scope', 'posts', function($scope, $location, posts) {
$scope.name = 'Posts';
$scope.posts = posts;
$scope.add = function() {
return $location.path('/posts/new');
};
$scope.view = function(id) {
return $location.path('/posts/view/' + id);
};
return $scope.edit = function(id) {
return $location.path('/posts/edit/' + id);
};
}
])
;
*/
```
58 changes: 43 additions & 15 deletions esdoc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{
"title": "NodeJS Sandbox",
"source": "./src",
"source": "./release/js",
"destination": "./docs",
"includes": ["\\.(js|es6)$"],
"excludes": ["\\.config\\.(js|es6)$"],
"access": ["public", "protected"],
"includes": [
"\\.(js|es6)$"
],
"excludes": [
"-spec\\.(js|es6)$",
"\\.config\\.(js|es6)$"
],
"access": [
"public",
"protected"
],
"autoPrivate": true,
"unexportIdentifier": false,
"undocumentIdentifier": true,
Expand All @@ -16,19 +24,39 @@
"lint": true,
"test": {
"type": "mocha",
"source": "./test",
"includes": ["-spec\\.(js|es6)$"],
"excludes": ["\\.config\\.(js|es6)$"]
"source": "./release/js",
"includes": [
"-spec\\.(js|es6)$"
],
"excludes": [
"\\.config\\.(js|es6)$"
]
},
"manual": {
"asset": "./manual/asset",
"overview": ["./manual/overview.md"],
"installation": ["./manual/installation.md"],
"usage": ["./manual/usage.md"],
"tutorial": ["./manual/tutorial.md"],
"configuration": ["./manual/configuration.md"],
"example": ["./manual/example.md"],
"faq": ["./manual/faq.md"],
"changelog": ["./CHANGELOG.md"]
"overview": [
"./manual/overview.md"
],
"installation": [
"./manual/installation.md"
],
"usage": [
"./manual/usage.md"
],
"tutorial": [
"./manual/tutorial.md"
],
"configuration": [
"./manual/configuration.md"
],
"example": [
"./manual/example.md"
],
"faq": [
"./manual/faq.md"
],
"changelog": [
"./CHANGELOG.md"
]
}
}
88 changes: 12 additions & 76 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
'use strict';
const gulp = require('gulp');
const gulpSequence = require('gulp-sequence');
const path = require('path');
const _ = require('lodash');
const ts = require('gulp-typescript');
const merge = require('merge2');
const concat = require('gulp-concat');

const rimraf = require('gulp-rimraf');

const sourcemaps = require('gulp-sourcemaps');
const $ = require('gulp-load-plugins')({
lazy: true
});
const mocha = require('gulp-mocha');
const istanbul = require('gulp-istanbul');
const coveralls = require('gulp-coveralls');


const config = {
tsSrc: [
Expand All @@ -31,7 +25,7 @@ const config = {
]
};


global.config = config;

/**
* Log a message or series of messages using chalk's blue color.
Expand Down Expand Up @@ -63,31 +57,6 @@ function notify(options) {
notifier.notify(notifyOptions);
}

var tsProject = ts({
noImplicitAny: true,
out: 'output.js',
"target": "ES6",
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true
});


gulp.task('typescript', function() {
var tsResult = gulp.src(config.tsSrc)
.pipe(sourcemaps.init())
.pipe(ts(tsProject));

return merge([
tsResult.dts.pipe(gulp.dest('release/definitions')),
tsResult.js
//.pipe(concat('output.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('release/js'))
]);
});



gulp.task('watch-coverage', ['pre-test'], function() {
Expand All @@ -98,25 +67,13 @@ gulp.task('watch-coverage', ['pre-test'], function() {
.pipe(istanbul.writeReports());
});

gulp.task('watch-compile', function() {
return gulp.watch(config.tsSrc, ['typescript']);
});
gulp.task('watch', ['watch-test'], function() {
return gulp.watch(config.tsSrc, ['typescript']);
gulp.task('watch', function() {
gulp.watch(config.tsSrc, ['typescript']);
gulp.watch(config.specs, ['watch-coverage']);
});

gulp.task('watch-test', function() {
return gulp.watch(config.specs, ['watch-coverage']);
});


gulp.task('mocha', function() {
return gulp.src(config.specs)
.pipe(mocha({
read: false
}));
});

gulp.task('clean', function() {
return gulp.src([
'data',
Expand All @@ -133,32 +90,11 @@ gulp.task('clean', function() {



gulp.task('coveralls', function() {
return gulp.src('./coverage/lcov.info')
.pipe(coveralls());
});
gulp.task('default', gulpSequence('compile', 'test'));
try {
require('require-dir')('tasks');
} catch (e) {

gulp.task('pre-test', ['typescript'], function() {
return gulp.src(config.jsSrc)
.pipe(istanbul({
includeUntested: true,
}))
.pipe(istanbul.hookRequire());
});
} finally {

gulp.task('test', ['pre-test'], function() {
return gulp.src(config.specs)
.pipe(mocha({
read: false
}))
.pipe(istanbul.writeReports())
.once('error', function() {
process.exit(1);
})
.once('end', function() {
process.exit();
});
});

gulp.task('compile', ['clean', 'typescript']);
gulp.task('default', ['compile', 'test']);
}
Loading

0 comments on commit a86441e

Please sign in to comment.