-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.ts
More file actions
32 lines (25 loc) · 887 Bytes
/
gulpfile.ts
File metadata and controls
32 lines (25 loc) · 887 Bytes
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
// noinspection JSUnusedGlobalSymbols
import { dest, series, src, watch } from 'gulp';
import * as ts from 'gulp-typescript';
import * as del from 'del';
import * as zip from 'gulp-zip';
const project = ts.createProject('tsconfig.json');
export function compile(): NodeJS.ReadWriteStream {
return project.src().pipe(project()).pipe(dest('build'));
}
export function monitor(): NodeJS.EventEmitter {
return watch('src/**/*.ts', compile);
}
export function clean(): Promise<void> {
return del(['build/**/*.js', 'build/**/*.d.ts', 'dist/*.zip']).then(paths => {
paths.forEach(path => console.log(`Deleted ${path}`));
});
}
function createZip(): NodeJS.ReadWriteStream {
return src(['package*.json', 'build/**/*.js', 'build/**/*.d.ts'], {
base: '.',
})
.pipe(zip('typescript-example.zip'))
.pipe(dest('dist'));
}
export default series(compile, createZip);