Commit 8d14d956 authored by rockyl's avatar rockyl

增加脚本执行的能力

parent 3b5a19b4
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
*/ */
const path = require('path'); const path = require('path');
const fs = require('fs');
const gulp = require('gulp'); const gulp = require('gulp');
const glob = require('glob');
const rollup = require('rollup'); const rollup = require('rollup');
const {uglify} = require('rollup-plugin-uglify'); const {uglify} = require('rollup-plugin-uglify');
const resolve = require('rollup-plugin-node-resolve'); const resolve = require('rollup-plugin-node-resolve');
...@@ -40,7 +42,19 @@ if (pathsConfig) { ...@@ -40,7 +42,19 @@ if (pathsConfig) {
} }
} }
} }
//console.log(tsPaths);
gulp.task('executeScripts', function(cb){
const files = glob.sync("scripts/*.js");
for(const file of files){
try {
const process = require(path.resolve(file));
process.execute();
}catch (e) {
console.log(e);
}
}
cb();
});
gulp.task('compileTs', async function () { gulp.task('compileTs', async function () {
let plugins = [ let plugins = [
...@@ -92,12 +106,12 @@ gulp.task('watch', function () { ...@@ -92,12 +106,12 @@ gulp.task('watch', function () {
gulp.watch('src/**', ['compile']); gulp.watch('src/**', ['compile']);
}); });
gulp.task('dev', ['compileTs', 'watch'], function (cb) { gulp.task('dev', ['compile', 'watch'], function (cb) {
completeCallback && completeCallback('success'); completeCallback && completeCallback('success');
cb(); cb();
}); });
gulp.task('compile', ['compileTs'], function (cb) { gulp.task('compile', ['executeScripts', 'compileTs'], function (cb) {
completeCallback && completeCallback('success'); completeCallback && completeCallback('success');
cb(); cb();
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment