|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | | -var gulp = require('gulp'); |
4 | | -var config = require('./gulp.config'); |
5 | | - |
6 | | -/* |
7 | | - debug = require('gulp-debug'), |
8 | | - inject = require('gulp-inject'), |
9 | | - tsc = require('gulp-typescript'), |
10 | | - sourcemaps = require('gulp-sourcemaps'), |
11 | | - connect = require('gulp-connect'), |
12 | | - rename = require('gulp-rename'); |
13 | | -*/ |
14 | | - |
15 | | -var loadTasks = require('./gulp-tasks/helpers/loadTasks'); |
16 | | -loadTasks(config); |
17 | | - |
18 | | -/* |
19 | | - * Moves only the necessary dependencys handled by Bower to scripts folder |
20 | | - */ |
21 | | - /* |
22 | | -gulp.task('bower-dependencies', function () { |
23 | | - |
24 | | - var mainBowerFiles = require('main-bower-files'); |
25 | | - var bowerNormalizer = require('gulp-bower-normalize'); |
26 | | -
|
27 | | - return gulp.src(mainBowerFiles(), {base: config.bowerComponents}) |
28 | | - .pipe(bowerNormalizer({bowerJson: './bower.json'})) |
29 | | - .pipe(rename(function (path) { |
30 | | - //console.log(path); |
31 | | - if (path.dirname.match(/font$/)) { |
32 | | - //console.log('font'); |
33 | | - path.dirname = 'font'; |
34 | | - } else if (path.dirname.match(/js$/)) { |
35 | | - //console.log('js'); |
36 | | - path.dirname = ''; |
37 | | - } else if (path.dirname.match(/map$/)) { |
38 | | - //console.log('map'); |
39 | | - path.dirname = ''; |
40 | | - } else if (path.dirname.match(/css$/)) { |
41 | | - //console.log('css'); |
42 | | - path.dirname = 'css'; |
43 | | - } |
44 | | - })) |
45 | | - .pipe(gulp.dest(config.dist.pathLibs)); |
46 | | -}); |
47 | | -
|
48 | | -gulp.task('angular2-dependencies', function () { |
49 | | - var libs = [ |
50 | | - config.nodeModules + 'angular2/node_modules/zone.js/zone.js', |
51 | | - config.nodeModules + 'angular2/node_modules/zone.js/long-stack-trace-zone.js' |
52 | | - ]; |
53 | | - return gulp.src(libs) |
54 | | - .pipe(gulp.dest(config.dist.pathLibs)); |
55 | | -}); |
56 | | -
|
57 | | -gulp.task('angular2', function () { |
58 | | -
|
59 | | - var buildConfig = { |
60 | | - paths: { |
61 | | - "angular2/*": "./node_modules/angular2/es6/prod/*.es6", |
62 | | - "rx": "./node_modules/angular2/node_modules/rx/dist/rx.js" |
63 | | - } |
64 | | - }; |
65 | | -
|
66 | | - var Builder = require('systemjs-builder'); |
67 | | - var builder = new Builder(buildConfig); |
68 | | -
|
69 | | - return builder.build('angular2/angular2', config.dist.pathLibs + 'angular2.js', {minify: true, sourceMaps: true}); |
70 | | -}); |
71 | | -*/ |
72 | | -/** |
73 | | - * Generates the app.d.ts references file dynamically from all application *.ts files. |
74 | | - */ |
75 | | - /* |
76 | | -gulp.task('gen-ts-refs', function () { |
77 | | - var sources = gulp.src([config.src.ts], {read: false}); |
78 | | - return gulp.src(config.dtsApp) |
79 | | - .pipe(debug({title: 'd.ts generation:'})) |
80 | | - .pipe(inject(sources, { |
81 | | - starttag: '//{', |
82 | | - endtag: '//}', |
83 | | - transform: function (filepath) { |
84 | | - return '/// <reference path="../..' + filepath + '" />'; |
85 | | - } |
86 | | - })) |
87 | | - .pipe(gulp.dest(config.typings)); |
88 | | -}); |
89 | | -*/ |
90 | | -/** |
91 | | - * Compile TypeScript and include references to library and app .d.ts files. |
92 | | - */ |
93 | | - /* |
94 | | -gulp.task('compile-ts', ['gen-ts-refs'], function () { |
95 | | - var sourceTsFiles = [config.src.ts, //path to typescript files |
96 | | - config.dtsLibs, //reference to library .d.ts files |
97 | | - config.dtsApp]; //reference to app.d.ts files |
98 | | -
|
99 | | - var tsResult = gulp.src(sourceTsFiles) |
100 | | - .pipe(debug({title: 'ts compiled:'})) |
101 | | - .pipe(sourcemaps.init()) |
102 | | - .pipe(tsc({ |
103 | | - target: 'ES5', |
104 | | - module: 'system', |
105 | | - declarationFiles: false, |
106 | | - noExternalResolve: true, |
107 | | - noLib: false, |
108 | | - noImplicitAny: true, |
109 | | - emitDecoratorMetadata: true, |
110 | | - declaration: false, |
111 | | - sourceMap: true, |
112 | | - listFiles: true, |
113 | | - typescript: require('typescript') // Used to exchange the default version of Typescript compiler |
114 | | - // by the version set in devDependnecies in package.json |
115 | | - })); |
116 | | -
|
117 | | - tsResult.dts.pipe(gulp.dest(config.dist.pathScripts)); |
118 | | - return tsResult.js |
119 | | - .pipe(sourcemaps.write('.')) |
120 | | - .pipe(gulp.dest(config.dist.pathScripts)); |
121 | | -}); |
122 | | -*/ |
123 | | - |
124 | | -//gulp.task('static-assets', ['angular2', 'angular2-dependencies', 'bower-dependencies']); |
125 | | - |
126 | | -//gulp.task('default', ['static-assets', 'process-html', 'process-css', 'compile-ts', 'watch', 'livereload']); |
127 | | - |
128 | | -gulp.task('default', ['process-html', 'process-css', 'watch', 'nw-run']); |
| 3 | +var requireDir = require('require-dir'); |
| 4 | +requireDir('./gulp/tasks', {recurse: true}); |
0 commit comments