Init gulp
This commit is contained in:
parent
3eb7780d11
commit
03fde8d3e5
3 changed files with 2624 additions and 18 deletions
45
gulpfile.js
Normal file
45
gulpfile.js
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
const { dest, src, task, watch } = require('gulp');
|
||||||
|
const { createProject } = require('gulp-typescript');
|
||||||
|
|
||||||
|
const tsconf = createProject('tsconfig.json');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {String} dir
|
||||||
|
*/
|
||||||
|
const copy = (dir) => {
|
||||||
|
return src([`${dir}/**/*`]).pipe(dest(dir.replace('src', 'dist')));
|
||||||
|
};
|
||||||
|
|
||||||
|
const build = () => {
|
||||||
|
return src('src/**/*.ts').pipe(tsconf()).js.pipe(dest('dist'));
|
||||||
|
};
|
||||||
|
|
||||||
|
task('build', () => {
|
||||||
|
copy('src/public');
|
||||||
|
copy('src/app/Views');
|
||||||
|
return build();
|
||||||
|
});
|
||||||
|
|
||||||
|
task('copy', () => {
|
||||||
|
copy('src/public');
|
||||||
|
return copy('src/app/Views');
|
||||||
|
});
|
||||||
|
|
||||||
|
task('default', () => {
|
||||||
|
let space = String();
|
||||||
|
|
||||||
|
for (let _ = 0; _ < process.stdout.columns; _++) {
|
||||||
|
space += "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(space);
|
||||||
|
console.error("No default task has been created");
|
||||||
|
console.log(space);
|
||||||
|
});
|
||||||
|
|
||||||
|
task('watch', () => {
|
||||||
|
return watch(['src/public/**/*', 'src/app/Views/**/*'], () => {
|
||||||
|
copy('src/public');
|
||||||
|
return copy('src/app/Views');
|
||||||
|
});
|
||||||
|
});
|
||||||
2559
package-lock.json
generated
2559
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -16,6 +16,8 @@
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"ejs": "^3.1.3",
|
"ejs": "^3.1.3",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
"gulp": "^4.0.2",
|
||||||
|
"gulp-typescript": "^6.0.0-alpha.1",
|
||||||
"mongoose": "^5.9.20",
|
"mongoose": "^5.9.20",
|
||||||
"typescript": "^3.9.5"
|
"typescript": "^3.9.5"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue