加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gulpfile-desktop.js 1.57 KB
一键复制 编辑 原始数据 按行查看 历史
夏培旭 提交于 2019-01-21 11:29 . 添加桌面应用测试
const gulp = require('gulp');
const shell = require('gulp-shell');
gulp.task('compile-ts', shell.task('tsc -p ./tsconfig-desktop.json'));
gulp.task('watch-ts', shell.task('tsc -p ./tsconfig-desktop.json -w'));
gulp.task('clean', () => {
const del = require('del');
return del('./dist/');
});
// gulp.task('desktop', ['watch-tests-ts-umd', 'daoke:build-html', 'daoke:browser-sync']);
// gulp.task('desktop:watch-ts', shell.task('tsc -w'));
gulp.task('desktop:copy-files', () => {
return gulp.src('./src-desktop/pages/*.html').pipe(gulp.dest('./dist/pages'));
});
gulp.task('copy-config-files', () => {
return gulp.src(['./log4js.json', 'package.json']).pipe(gulp.dest('./dist'));
});
gulp.task('modify-config-files', async () => {
const fs = require('fs');
const file_content = require('./dist/package.json');
file_content.main = './app/app.js';
delete file_content['dependencies']['@feidao/widgets'];
file_content['dependencies']['@feidao-factory/framework'] = 'latest';
file_content['dependencies']['log4js'] = 'latest';
return await fs.writeFileSync('./dist/package.json', JSON.stringify(file_content, null, '\t'));
});
gulp.task('copy-modify-config-file', gulp.series('copy-config-files', 'modify-config-files'));
gulp.task('desktop:watch-files', () => {
return gulp.watch('./pages/*.html', (file) => {
// file.type added renamed deleted changed
if (file.type !== 'deleted') {
gulp.src(file.path)
.pipe(gulp.dest('./dist/pages/'));
}
});
});
gulp.task('desktop', gulp.series('clean', 'desktop:copy-files', 'compile-ts', gulp.parallel('desktop:watch-files', 'watch-ts')));
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化