-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.ts
61 lines (56 loc) · 1.86 KB
/
gulpfile.ts
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
import Bluebird from 'bluebird';
import { execSync } from 'child_process';
import { existsSync, rmSync } from 'fs-extra';
import gulp from 'gulp';
import concat from 'gulp-concat';
import { join } from 'upath';
function clean() {
const paths = ['dist', 'docs'].map((str) => join(__dirname, str)).filter((path) => existsSync(path));
return Bluebird.all(paths).each((str) => {
rmSync(str, { recursive: true, force: true });
});
}
function build(done: CallableFunction) {
const exclude = ['!**/node_modules/**', '!**/.git**', '!**/.github/**', '!**.gitmodules**', '!**/tmp'];
return Bluebird.all(exclude)
.then(() => {
console.log('copy sitemaps xml/xsl to dist');
return gulp.src('./src/**/*.{xml,xsl}').pipe(gulp.dest('./dist/src'));
})
.then(() => {
console.log('copy packages to dist');
return gulp
.src(['./packages/**/*'].concat(exclude), {
base: '.'
// dot: true
})
.pipe(gulp.dest('./dist'));
})
.then(() => {
console.log('copy dist to master build');
return gulp.src(['./dist/**/*'].concat(exclude)).pipe(gulp.dest('./docs/dist'));
})
.then(() => {
console.log('copy main js to master build');
return gulp.src(['./index.*', './package.json']).pipe(gulp.dest('./docs'));
})
.then(() => {
console.log('build readme master build');
return gulp.src(['./readme.md', './CHANGELOG.md']).pipe(concat('readme.md')).pipe(gulp.dest('./docs'));
})
.then(() => {
console.log('copy source to master build');
gulp
.src(['./*.json', './src/**/*', './packages/**/*', './source/**/*'].concat(exclude), {
base: '.'
// dot: true
})
.pipe(gulp.dest('./docs'));
return done();
});
}
gulp.task('git', () => {
execSync('git');
});
gulp.task('default', build);
gulp.task('clean', clean);