-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
55 lines (41 loc) · 1.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
const gulp = require('gulp');
const del = require('del');
const replace = require('gulp-string-replace');
const path = require('path');
const editorSrcDir = "editorSrc";
const electronSrcDir = "electron/app";
const electronDistDir = "electron/dist";
gulp.task('clean:editorSrc', function () {
return del([
editorSrcDir
]);
});
gulp.task('clean:electron', function () {
return del([
electronSrcDir,
electronDistDir
]);
});
gulp.task('swagger-editor', ['clean:editorSrc'], function () {
const swaggerEditorDistDir = path.dirname(require.resolve('swagger-editor-dist'));
return gulp.src(swaggerEditorDistDir + "/**/*")
.pipe(gulp.dest(editorSrcDir));
});
gulp.task('clean', ['clean:editorSrc', 'clean:electron']);
gulp.task('main', function() {
return gulp.src('./main.js')
.pipe(gulp.dest(electronSrcDir));
});
gulp.task('postinstall', ['swagger-editor']);
gulp.task('package.json', function () {
return gulp.src('./package.json')
.pipe(replace('dependencies', 'rendererDependencies'))
.pipe(replace('electronDependencies', 'dependencies'))
.pipe(gulp.dest(electronSrcDir));
});
gulp.task('src', ['swagger-editor'], function () {
return gulp.src(editorSrcDir + "/*", { "base" : "." })
.pipe(gulp.dest(electronSrcDir));
});
gulp.task('build', ['main', 'package.json', 'src']);
gulp.task('default', ['build']);