From 8ce46e4b67f56136dcd4b9186b8d39801c402113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Norman=20Hauk=C3=A5s?= Date: Sat, 24 Oct 2015 17:04:07 +0200 Subject: [PATCH] added gulp-load-plugins and ng-annotate dependencies --- Gulpfile.js | 41 ++++++++++++++-------------- package.json | 2 ++ src/menu/menu.controller.ts | 10 ++----- src/services/data.service.ts | 4 +-- src/services/selectedWord.service.ts | 2 +- 5 files changed, 27 insertions(+), 32 deletions(-) diff --git a/Gulpfile.js b/Gulpfile.js index 0209116..3951d84 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -1,27 +1,26 @@ 'use strict'; var gulp = require('gulp'); -var sourcemaps = require('gulp-sourcemaps'); +var $ = require('gulp-load-plugins')({ + pattern: ['gulp-*', 'del', 'merge2'], + rename: { + 'merge2': 'merge' + } +}); var browserSync = require('browser-sync').create(); -var del = require('del'); -var flatten = require('gulp-flatten'); -var ts = require('gulp-typescript'); -var merge = require('merge2'); -var concat = require('gulp-concat'); -var fileinclude = require('gulp-file-include'); - -var tsProject = ts.createProject('tsconfig.json', { +var tsProject = $.typescript.createProject('tsconfig.json', { sortOutput : true }); gulp.task('scripts', function() { var tsResult = gulp.src('src/*.ts') - .pipe(sourcemaps.init()) - .pipe(ts(tsProject)); + .pipe($.sourcemaps.init()) + .pipe($.typescript(tsProject)); return tsResult.js - .pipe(concat('bundle.js')) - .pipe(sourcemaps.write()) // Now the sourcemaps are added to the .js file + .pipe($.concat('bundle.js')) + .pipe($.ngAnnotate()) + .pipe($.sourcemaps.write()) // Now the sourcemaps are added to the .js file .pipe(gulp.dest('tmp')); }); @@ -32,8 +31,8 @@ gulp.task('tmp', ['scripts', 'dist-node-modules'], function () { 'src/**/*.css', 'src/content_script_web.js' ], {base: 'src'}) - .pipe(flatten()) - .pipe(fileinclude({ + .pipe($.flatten()) + .pipe($.fileInclude({ prefix: '@@', basePath: '@file' })) @@ -51,13 +50,13 @@ gulp.task('dist', ['tmp'], function () { 'src/content_script.js', 'manifest.json' ]) - .pipe(flatten()) - .pipe(fileinclude({ - prefix: '@@', - basePath: '@file' + .pipe($.flatten()) + .pipe($.fileInclude({ + prefix: '@@', + basePath: '@file' })); - return merge([tmp, chromePluginResources]) + return $.merge([tmp, chromePluginResources]) .pipe(gulp.dest('dist')); }); @@ -71,7 +70,7 @@ gulp.task('dist-node-modules', function () { }); gulp.task('clean', function () { - return del(['tmp', 'dist']); + return $.del(['tmp', 'dist']); }); gulp.task('serve', ['tmp'], function () { diff --git a/package.json b/package.json index f402ad4..8bd0def 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,8 @@ "gulp-concat": "^2.6.0", "gulp-file-include": "^0.13.7", "gulp-flatten": "^0.2.0", + "gulp-load-plugins": "^1.0.0", + "gulp-ng-annotate": "^1.1.0", "gulp-typescript": "^2.9.2", "jquery": "^2.1.4", "merge2": "^0.3.6" diff --git a/src/menu/menu.controller.ts b/src/menu/menu.controller.ts index c9bd0cc..8d3ae90 100644 --- a/src/menu/menu.controller.ts +++ b/src/menu/menu.controller.ts @@ -12,13 +12,7 @@ module tagIt { $log : ng.ILogService; $scope: ng.IScope; - static $inject = [ - "$scope", - "$log", - "DataService", - "SelectedWordService" - ]; - + /* @ngInject */ constructor ($scope: IVMScope, $log: angular.ILogService, DataService: DataService, SelectedWordService: SelectedWordService) { @@ -35,7 +29,7 @@ module tagIt { onTagSelect (sense: ISense) { this.selectedWordService.addTagToPage(sense); - this.dataService.storeTagingInformation({}); + this.dataService.storeTaggingInformation({}); } onWordSelected = (newWord : string) => { diff --git a/src/services/data.service.ts b/src/services/data.service.ts index eb2f6a0..c68952c 100644 --- a/src/services/data.service.ts +++ b/src/services/data.service.ts @@ -13,7 +13,7 @@ module tagIt { $http : ng.IHttpService; private serverUrl = 'http://lexitags.dyndns.org/server/lexitags2/Semtags?data='; - static $inject = ["$http", "$log"]; + /* @ngInject */ constructor($http: ng.IHttpService, $log: ng.ILogService) { this.$http = $http; } @@ -31,7 +31,7 @@ module tagIt { // save tagging information // Params: email, tagging, sentence - storeTagingInformation (tag : Object) { + storeTaggingInformation (tag : Object) { storeTagData(); } diff --git a/src/services/selectedWord.service.ts b/src/services/selectedWord.service.ts index 1ed1ff9..30b3d84 100644 --- a/src/services/selectedWord.service.ts +++ b/src/services/selectedWord.service.ts @@ -10,7 +10,7 @@ module tagIt { $log : ng.ILogService; currentSelectionRange : any; - static $inject = ["$log"]; + /* @ngInject */ constructor($log: ng.ILogService) { this.$log = $log; }