-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·168 lines (134 loc) · 3.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
168
/**
* Oberstes Gulpfile fuer das Speech-Angular SDK
*/
const gulp = require('gulp');
const path = require('path');
const childProcess = require('child_process');
const runSequence = require('gulp4-run-sequence');
const shell = require('gulp-shell');
// Konstanten fuer Verzeichnisse
const rootDir = path.resolve( __dirname );
const credentialsDir = 'credentials';
const docsDir = 'docs';
const srcDir = 'src';
const srcSpeechDir = 'src/speech';
const appDir = 'app';
const examplesDir = 'examples';
const assetsDir = 'src/assets';
const bundleDir = 'bundle';
const buildDir = 'build';
const speechDir = 'build/src/speech';
const distDir = 'dist';
const distAppDir = 'dist-app';
const e2eDir = 'e2e';
const testDir = 'test';
const cordovaDir = 'cordova-app';
const cordovaRootDir = path.join( rootDir, cordovaDir );
const cordovaAppDir = path.join( rootDir, cordovaDir, 'app');
const cordovaWwwDir = path.join( rootDir, cordovaDir, 'app/www');
/**
* Ausfuehrungsfunktion
*
* @param {*} cmd
* @param {*} done
*/
const exec = (cmd, done) => {
const proc = childProcess.exec(cmd, {maxBuffer: 1024 * 500}, (error, stdout, stderr) => {
if(error) {
// eslint-disable-next-line
console.log(`${cmd} exited with code ${error.code}`);
done(error);
return;
}
done();
});
proc.stdout.pipe(process.stdout);
proc.stderr.pipe(process.stderr);
};
const settings = {
gulp,
exec,
rootDir,
credentialsDir,
docsDir,
srcDir,
srcSpeechDir,
appDir,
examplesDir,
assetsDir,
bundleDir,
buildDir,
speechDir,
distDir,
distAppDir,
e2eDir,
testDir,
cordovaDir,
cordovaRootDir,
cordovaAppDir,
cordovaWwwDir,
};
// Gulp-Skripte
require('./gulp/gulp-install')(settings);
require('./gulp/gulp-docs')(settings);
require('./gulp/gulp-dist')(settings);
require('./gulp/gulp-test')(settings);
require('./gulp/gulp-cordova')(settings);
// Gulp-Task
/**
* Installiert Cordova-NPM-Package
*/
gulp.task('install-cordova-npm', shell.task('npm install --save-dev cordova'));
/**
* Erzeugt das oeffentliche Speech-Framework
*/
gulp.task('install-cordova', function(callback) {
runSequence(
'install-cordova-npm',
'cordova-install',
callback);
});
/**
* Erzeugt die lauffaehige Speech-Angular Bibliothek speech-angular.js aus dem API-Quellcode
*/
gulp.task('build', function(callback) {
runSequence(
'test-unit',
'dist-build',
'docs-dist-typedoc',
'test-e2e',
'dist-pack',
'test-examples-lint',
'test-examples-unit',
'test-examples-e2e',
callback);
});
/**
* Erzeugt die lauffaehige Speech-Angular Bibliothek speech-angular.js aus dem API-Quellcode
*/
gulp.task('build-npm', function(callback) {
runSequence(
'build',
// 'test-install',
'dist-build',
callback);
});
/**
* Erzeugt die lauffaehige Speech-Angular Bibliothek speech-angular.js aus dem API-Quellcode
*/
gulp.task('publish-npm', function(callback) {
runSequence(
'build-npm',
'dist-publish',
callback);
});
/**
* Erzeugt die lauffaehige Speech-Angular Bibliothek speech-angular.js aus dem API-Quellcode
*/
gulp.task('build-examples', function(callback) {
runSequence(
'test-examples-unit',
'test-examples-e2e',
'test-examples-lint',
callback);
});