Skip to content

Commit

Permalink
Add Gulp configuration
Browse files Browse the repository at this point in the history
(cherry picked from commit 4ae1353)
  • Loading branch information
Niels Dequeker committed Apr 27, 2015
1 parent e04dfda commit 1daa84f
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 45 deletions.
25 changes: 13 additions & 12 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
},
"main": [
"dist/angular-ui-tree.js",
"dist/angular-ui-tree.min.js",
"dist/angular-ui-tree.min.css"
],
"keywords": [
Expand All @@ -29,22 +28,24 @@
"node"
],
"dependencies": {
"angular": ">= 1.2.0",
"es5-shim": "2.3.0"
"angular": "~1.2.0"
},
"devDependencies": {
"angular": ">= 1.2.0",
"bootstrap": "~3.1.0",
"jquery": ">=1.10.x",
"jasmine-jquery": "~1.0.0",
"angular-mocks": "~1.2.11",
"firebase": "~1.0.11",
"angularfire": "~0.7.1"
"angular-mocks": ">= 1.2.0",
"jasmine-jquery": "~2.0.5",
"jquery": "~2.1.1"
},
"ignore": [
"node_modules",
"bower_components",
"test",
"tests"
"tests",
"build",
"demo",
"guide",
"source",
"**/.*",
"Gruntfile.js",
"karma.conf.js",
"package.json"
]
}
24 changes: 24 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

var gulp = require('gulp'),
requireDir = require('require-dir'),
$ = require('gulp-load-plugins')();

// Load application tasks
(function () {
var dir = requireDir('./tasks');

Object.keys(dir).forEach(function (key) {
dir[key] = dir[key](gulp, $);
});
}());

$.karma = require('karma');

gulp.task('build', function () {
return gulp.start('clean', 'jscs', 'jshint', 'concat', 'uglify', 'test', 'styles');
});

gulp.task('serve', ['clean'], function () {
return gulp.start('connect', 'watch', 'open');
});
14 changes: 11 additions & 3 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ module.exports = function(config) {
'use strict';

var cfg = {
bowerComponents: 'demo/bower_components'
bowerComponents: 'bower_components'
};

config.set({
basePath: '',
frameworks: ['jasmine'],
autoWatch: false,
browsers: ['PhantomJS'],

// files to load in the browser
files: [
Expand All @@ -25,6 +27,11 @@ module.exports = function(config) {
'tests/**/*.spec.js'
],

plugins: [
'karma-phantomjs-launcher',
'karma-jasmine'
],

// generate js files from html templates to expose them during testing
preprocessors: {
'**/*.html': 'ng-html2js'
Expand All @@ -44,6 +51,7 @@ module.exports = function(config) {
logLevel: config.LOG_INFO,

port: 9876,
reporters: 'dots'
reporters: 'dots',
singleRun: true
});
};
};
53 changes: 23 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
{
"name": "Angular-NestedSortable",
"version": "2.1.5",
"dependencies": {
"grunt": "~0.4.2",
"grunt-contrib-jshint": "~0.8.0",
"load-grunt-tasks": "~0.2.1"
"description": "An AngularJS UI component that can sort nested lists, provides drag & drop support and doesn't depend on jQuery",
"repository": {
"type": "git",
"url": "https://github.com/JimLiu/angular-ui-tree"
},
"devDependencies": {
"bower": "~1.2.6",
"jshint-stylish": "~0.1.5",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-uglify": "~0.3.2",
"grunt-closure-compiler": "~0.0.21",
"grunt-contrib-concat": "~0.3.0",
"grunt-open": "~0.2.3",
"grunt-contrib-connect": "~0.6.0",
"karma-script-launcher": "~0.1.0",
"karma-chrome-launcher": "~0.1.2",
"karma-firefox-launcher": "~0.1.3",
"karma-ng-html2js-preprocessor": "~0.1.0",
"grunt-html2js": "~0.2.4",
"grunt-karma": "~0.6.2",
"karma-phantomjs-launcher": "~0.1.2",
"karma-html2js-preprocessor": "~0.1.0",
"karma-jasmine": "~0.1.5",
"karma-coffee-preprocessor": "~0.1.2",
"requirejs": "~2.1.10",
"karma-requirejs": "~0.2.1",
"karma": "~0.10.9",
"grunt-tasks-list": "~0.1.1",
"grunt-ngdocs": "~0.2.1",
"grunt-contrib-cssmin": "~0.9.0"
"connect-livereload": "^0.5.2",
"gulp": "^3.8.10",
"gulp-clean": "^0.3.1",
"gulp-concat": "^2.4.3",
"gulp-connect": "^2.2.0",
"gulp-jscs": "^1.4.0",
"gulp-jshint": "^1.9.0",
"gulp-load-plugins": "^0.8.0",
"gulp-rename": "^1.2.0",
"gulp-sass": "^1.3.2",
"gulp-uglify": "^1.1.0",
"jshint-stylish": "^1.0.0",
"karma": "^0.12.24",
"karma-firefox-launcher": "^0.1.3",
"karma-jasmine": "~0.1.0",
"karma-phantomjs-launcher": "^0.1.4",
"load-grunt-tasks": "^0.6.0",
"open": "0.0.5",
"require-dir": "^0.1.0"
},
"engines": {
"node": ">=0.8.0"
Expand Down
8 changes: 8 additions & 0 deletions tasks/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

module.exports = function (gulp, $) {
gulp.task('clean', function () {
return gulp.src('dist', { read: false })
.pipe($.clean());
});
};
45 changes: 45 additions & 0 deletions tasks/scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'use strict';

module.exports = function (gulp, $) {

gulp.task('jscs', function () {
return gulp.src('source')
.pipe($.jscs());
});

gulp.task('jshint', function () {
return gulp.src([
'source/**/*.js'
])
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.jshint.reporter('fail'));
});

gulp.task('concat', function () {
return gulp.src([
'source/**/*.js',
'!**/*.spec.js'
])
.pipe($.concat('angular-ui-tree.js'))
.pipe(gulp.dest('dist'));
});

gulp.task('uglify', function () {
return gulp.src('dist/angular-ui-tree.js')
.pipe($.uglify({
preserveComments: 'some'
}))
.pipe($.rename('angular-ui-tree.min.js'))
.pipe(gulp.dest('dist'));
});

gulp.task('test', function () {
return $.karma.server.start({
configFile: __dirname + '/../karma.conf.js',
singleRun: true
}, function (err) {
process.exit(err ? 1 : 0);
});
});
};
49 changes: 49 additions & 0 deletions tasks/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict';

module.exports = function (gulp, $) {

gulp.task('connect', function () {
var livereloadPort = 35729;

$.connect.server({
port: 9000,
livereload: {
port: livereloadPort
},
middleware: function (connect) {
function mountFolder(connect, dir) {
return connect.static(require('path').resolve(dir));
}

return [
require('connect-livereload')({ port: livereloadPort }),
mountFolder(connect, 'dist'),
mountFolder(connect, 'examples')
];
}
});
});

gulp.task('watch', ['connect'], function () {
gulp.watch([
'source/**/*.js',
'examples/**/*.html'
], function (event) {
return gulp.src(event.path)
.pipe($.connect.reload());
});

gulp.watch([
'source/**/*.js'
], ['jshint', 'jscs']);

gulp.watch([
'source/**/*.scss'
], ['styles']);
});

gulp.task('open', ['connect'], function () {
require('open')('http://localhost:9000');
});

};
15 changes: 15 additions & 0 deletions tasks/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

module.exports = function (gulp, $) {

gulp.task('styles', function () {
return gulp.src('source/angular-ui-tree.scss')
.pipe($.sass({
errLogToConsole: true,
outputStyle: 'compressed'
}))
.pipe($.rename('angular-ui-tree.min.css'))
.pipe(gulp.dest('dist'));
});

};

0 comments on commit 1daa84f

Please sign in to comment.