forked from nestjs/nest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (56 loc) · 1.81 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const gulp = require('gulp');
const ts = require('gulp-typescript');
const gulpSequence = require('gulp-sequence');
const packages = {
common: ts.createProject('src/common/tsconfig.json'),
core: ts.createProject('src/core/tsconfig.json'),
microservices: ts.createProject('src/microservices/tsconfig.json'),
websockets: ts.createProject('src/websockets/tsconfig.json'),
testing: ts.createProject('src/testing/tsconfig.json'),
};
const modules = Object.keys(packages);
const source = 'src';
const distId = process.argv.indexOf('--dist');
const dist = distId < 0 ? 'node_modules/@nestjs' : process.argv[distId + 1];
gulp.task('default', function() {
modules.forEach(module => {
gulp.watch(
[`${source}/${module}/**/*.ts`, `${source}/${module}/*.ts`],
[module]
);
});
});
modules.forEach(module => {
gulp.task(module, () => {
return packages[module]
.src()
.pipe(packages[module]())
.pipe(gulp.dest(`${dist}/${module}`));
});
});
gulp.task('build', function(cb) {
gulpSequence('common', modules.filter((module) => module !== 'common'), cb);
});
gulp.task('move', function() {
gulp.src(['node_modules/@nestjs/**/*']).pipe(
gulp.dest('examples/01-cats-app/node_modules/@nestjs')
).pipe(
gulp.dest('examples/02-gateways/node_modules/@nestjs')
).pipe(
gulp.dest('examples/03-microservices/node_modules/@nestjs')
).pipe(
gulp.dest('examples/04-injector/node_modules/@nestjs')
).pipe(
gulp.dest('examples/05-sql-typeorm/node_modules/@nestjs')
).pipe(
gulp.dest('examples/06-mongoose/node_modules/@nestjs')
).pipe(
gulp.dest('examples/07-sequelize/node_modules/@nestjs')
).pipe(
gulp.dest('examples/08-passport/node_modules/@nestjs')
).pipe(
gulp.dest('examples/09-babel-example/node_modules/@nestjs')
).pipe(
gulp.dest('examples/11-swagger/node_modules/@nestjs')
);
});