Skip to content
Snippets Groups Projects
Commit 0df7b041 authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

Add mkdirp to fix creating logs directory

parent e6e1d069
No related branches found
No related tags found
1 merge request!21Issue/68
Pipeline #
......@@ -14,40 +14,41 @@ const Cache = require('gulp-file-cache');
const jsdoc = require('gulp-jsdoc3');
const mkdirp = require('mkdirp');
const cache = new Cache();
function createLogDir() {
const logDirPath = 'build/logs';
fs.access(logDirPath, fs.F_OK, (err) => {
if (err) {
console.info(`Logs directory not found, creating it.`);
fs.mkdir(logDirPath, 0o700, (dirErr) => {
console.error(`Failed to create logs directory.\n\tError: ${dirErr}`);
});
}
mkdirp(logDirPath, (err) => {
if(err) console.error(err);
});
}
/**
* Compile source files
*/
gulp.task('compile', () => {
createLogDir();
gulp.task('lint', () => {
// run ESLint
gulp.src('src/**/*.js')
.pipe(eslint())
.pipe(eslint.format());
})
/**
* Compile source files
*/
gulp.task('compile', ['lint'], () => {
// compile source to ES5
gulp.src('src/**/*.js')
.pipe(cache.filter()) // cache source files
.pipe(babel()) // compile only modified files
.pipe(cache.cache()) // cache compiled files
// .pipe(cache.cache()) // cache compiled files
.pipe(gulp.dest('build')); // move compiled files to build directory
// copy configuration file to build directory
gulp.src('config.json')
.pipe(gulp.dest('build'));
createLogDir();
});
gulp.task('build', ['compile']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment