Skip to content

Commit 96b9ba9

Browse files
committed
chore: update gulpfile.js
1 parent db0dccb commit 96b9ba9

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

gulpfile.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
const fs = require('fs');
2+
const util = require('util');
13
const less = require('gulp-less');
24
const postcss = require('gulp-postcss');
35
const sourcemaps = require('gulp-sourcemaps');
46
const rename = require('gulp-rename');
57
const gulp = require('gulp');
68
const STYLE_SOURCE_DIR = './src/less';
79
const STYLE_DIST_DIR = './dist/styles';
10+
const pkg = require('./package.json');
11+
12+
const writeFile = util.promisify(fs.writeFile);
813

914
function buildLess() {
1015
return gulp
@@ -41,4 +46,23 @@ function copyLoader() {
4146
return gulp.src(['./webpack-md-loader/*']).pipe(gulp.dest('dist/webpack-md-loader'));
4247
}
4348

44-
exports.build = gulp.series(buildLess, buildCSS, copyLessFiles, copyDocs, copyLoader);
49+
function createPkgFile(done) {
50+
pkg.scripts = {};
51+
52+
writeFile('dist/package.json', JSON.stringify(pkg, null, 2) + '\n')
53+
.then(() => {
54+
done();
55+
})
56+
.catch(err => {
57+
if (err) console.error(err.toString());
58+
});
59+
}
60+
61+
exports.build = gulp.series(
62+
buildLess,
63+
buildCSS,
64+
copyLessFiles,
65+
copyDocs,
66+
copyLoader,
67+
createPkgFile
68+
);

0 commit comments

Comments
 (0)