-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
42 lines (35 loc) · 1.11 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
const gulp = require('gulp');
const ghpages = require('gh-pages');
const del = require('del');
const fs = require('fs');
exports.deleteUnnecessaryFiles = () => {
return del('./dist/src');
}
exports.afterTsc = () => {
return gulp.src('./dist/src/**/*').pipe(gulp.dest('dist'));
};
exports.handlesPackageInfo = async () => {
return new Promise((resolve) => {
let packageData = fs.readFileSync('./dist/src/package-data.js').toString();
packageData = packageData.replace(`const info = require('../package.json');`, `const info = require('./package.json');`);
fs.writeFile('./dist/src/package-data.js', packageData, resolve)
})
}
exports.copyDistFiles = async () => {
return gulp.src([
'package.json',
'README.md'
]).pipe(gulp.dest('./dist/src'));
}
exports.publishWebSite = () => {
return new Promise((resolve, reject) => {
ghpages.publish('website', (error) => {
if (error) {
reject(error)
} else {
console.info('Published Successfully!');
}
resolve();
});
});
}