Skip to content

Commit

Permalink
improves build script
Browse files Browse the repository at this point in the history
  • Loading branch information
blindfish3 committed Jun 15, 2020
1 parent e478523 commit 2ae8a33
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1,387 deletions.
15 changes: 12 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,26 @@ function reload(done) {
}

function clean() {
return del([getBuildTarget() + '/**']);
return del([BUILD + '/**']);
};

function cleanDist() {
return del([DIST + '/**']);
}

function assets() {
return gulp.src([SRC + '/**/*',
'!' + SRC + '/**/*.js',
SRC + '/**/*.min.js',
])
.pipe(cache('assets'))
.pipe(gulp.dest(getBuildTarget()));
};

function scripts() {
const dev = isDevEnv();
return gulp.src('src/**/*.js')
return gulp.src([SRC + '/**/*.js',
'!' + SRC + '/**/*.min.js'])
.pipe(cache('scripts'))
.pipe(gulpif(!!dev, sourcemaps.init()))
.pipe(babel({
Expand All @@ -62,7 +67,8 @@ function scripts() {
};

function prettify() {
return gulp.src('./src/**/*.js')
return gulp.src([SRC + '/**/*.js',
'!' + SRC + '/**/*.min.js'])
.pipe(prettier({ singleQuote: true }))
.pipe(gulp.dest(SRC));
}
Expand Down Expand Up @@ -98,7 +104,10 @@ function serve(done) {

gulp.task('prettier', prettify);
gulp.task('lint', lint);
gulp.task('scripts', scripts);
gulp.task('clean', clean);
gulp.task('assets', assets);
gulp.task('cleanDist', cleanDist);
gulp.task('build', series(clean, assets, scripts));


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "MIT",
"scripts": {
"format": "gulp lint && gulp prettier",
"build": "NODE_ENV=production gulp lint && gulp build"
"export": "NODE_ENV=production gulp lint && NODE_ENV=production gulp build"
},
"devDependencies": {
"@babel/core": "^7.9.6",
Expand Down
Loading

0 comments on commit 2ae8a33

Please sign in to comment.