forked from progress/JSDO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·169 lines (137 loc) · 5.39 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
var gulp = require('gulp');
var minify = require('gulp-minify');
var sequence = require('gulp-sequence');
var concat = require('gulp-concat');
var del = require('del');
var typescript = require('gulp-typescript');
var rename = require('gulp-rename');
/* JSDO Source Library tasks */
gulp.task('cleanup', function (done) {
del(['lib/*']).then(function () {
return del([
'packages/core/lib/*',
'packages/nativescript/lib/*',
'packages/node/lib/*'
])
}).then(function() { done(); })
.catch(function (err) { done(err); })
});
gulp.task('minify', function () {
return gulp.src(['lib/*.js'])
.pipe(minify({
ext: {
min: '.min.js'
},
noSource: false,
output: {
source_map: true
}
}))
.pipe(gulp.dest('lib'));
});
gulp.task('concat all', function () {
return gulp.src([
'src/progress.util.js',
'src/progress.js',
'src/auth/progress.auth.js',
'src/auth/progress.auth.basic.js',
'src/auth/progress.auth.form.js',
'src/auth/progress.auth.sso.js',
'src/progress.session.js',
'src/progress.data.kendo.js'
]).pipe(concat('progress.all.js'))
.pipe(gulp.dest('lib/'));
});
gulp.task('concat jsdo', function () {
return gulp.src([
'src/progress.util.js',
'src/progress.js',
'src/auth/progress.auth.js',
'src/auth/progress.auth.basic.js',
'src/auth/progress.auth.form.js',
'src/auth/progress.auth.sso.js',
'src/auth/progress.auth.bearer.js',
'src/progress.session.js',
]).pipe(concat('progress.jsdo.js'))
.pipe(gulp.dest('lib/'));
});
gulp.task('build jsdo', sequence('cleanup', 'concat all', 'concat jsdo'));
/* Core package tasks */
gulp.task('concat core', function () {
return gulp.src(['lib/progress.jsdo.js'])
.pipe(rename('progress.core.js'))
.pipe(gulp.dest('packages/core/lib/'));
});
gulp.task('core typings', function () {
return gulp.src(['typings/*']).pipe(rename('progress.core.d.ts')).pipe(gulp.dest('packages/core/typings'));
});
gulp.task('core license', function () {
return gulp.src(['LICENSE', 'notice.txt']).pipe(gulp.dest('packages/core'));
});
gulp.task('build core', sequence('build jsdo', 'concat core', 'core typings', 'core license'));
/* Angular Data Source package tasks */
gulp.task('compile ng', function () {
return gulp.src(['packages/ng-datasource/src/progress.data.ng.ds.ts']).pipe(typescript.createProject({
experimentalDecorators: true,
module: 'commonjs',
target: 'es5',
moduleResolution: 'node',
declaration: true,
noEmitHelpers: false,
lib: ['es6', 'dom', 'es2017'],
baseUrl: '.',
paths: {
'@consultingwerk/smartcomponents-jsdo-core': [
'packages/core'
],
'@consultingwerk/smartcomponents-jsdo-core/*': [
'packages/core/*'
]
}
})()).pipe(gulp.dest('packages/ng-datasource/src/'));
});
gulp.task('package ng', function () {
return gulp.src(['packages/ng-datasource/src/progress.data.ng.ds.js']).pipe(rename('progress.data.angular.js')).pipe(gulp.dest('packages/angular/lib/'));
});
gulp.task('ng typings', function () {
return gulp.src(['packages/ng-datasource/typings/progress.data.ng.ds.d.ts']).pipe(rename('progress.data.angular.d.ts')).pipe(gulp.dest('packages/angular/typings/'));
});
gulp.task('ng license', function () {
return gulp.src(['LICENSE', 'notice.txt']).pipe(gulp.dest('packages/angular'));
});
gulp.task('build ng', sequence('compile ng', 'package ng', 'ng typings', 'ng license'));
/* NativeScript Data Source package tasks */
gulp.task('concat ns', function () {
return gulp.src([
'packages/nativescript/src/loaddep.js',
'packages/ng-datasource/src/progress.data.ng.ds.js'
]).pipe(concat('progress.data.ns.js'))
.pipe(gulp.dest('packages/nativescript/lib/'));
});
gulp.task('ns typings', function () {
return gulp.src([
'packages/ng-datasource/typings/progress.data.ng.ds.d.ts',
'packages/nativescript/src/loaddep.d.ts'
]).pipe(concat('progress.data.ns.d.ts')).pipe(gulp.dest('packages/nativescript/typings/'));
});
gulp.task('ns license', function () {
return gulp.src(['LICENSE', 'notice.txt']).pipe(gulp.dest('packages/nativescript'));
});
gulp.task('build ns', sequence('compile ng', 'concat ns', 'ns typings', 'ns license'));
/* node.js Data Source package tasks */
gulp.task('concat node', function () {
return gulp.src([
'packages/node/src/loaddep.js',
'packages/ng-datasource/src/progress.data.ng.ds.js'
]).pipe(concat('progress.data.node.js'))
.pipe(gulp.dest('packages/node/lib/'));
});
gulp.task('node typings', function () {
return gulp.src(['packages/ng-datasource/typings/progress.data.ng.ds.d.ts']).pipe(rename('progress.data.node.d.ts')).pipe(gulp.dest('packages/node/typings/'));
});
gulp.task('node license', function () {
return gulp.src(['LICENSE', 'notice.txt']).pipe(gulp.dest('packages/node'));
});
gulp.task('build node', sequence('compile ng', 'concat node', 'node typings', 'node license'));
//build all
gulp.task('build all', sequence('build core', 'build ng', 'concat ns', 'ns typings', 'ns license', 'build ns', 'concat node', 'node typings', 'node license'));