forked from shlomiassaf/ngx-modialog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
39 lines (35 loc) · 1.19 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const path = require('path');
const fs = require('fs');
const del = require('del');
const gulp = require('gulp');
require('require-dir')('./gulp');
const runSequence = require('run-sequence');
const config = require('./gulp/config');
const ESM_PLUGINS_PATH = 'dist_package/plugins';
gulp.task('copyPluginsDummyPackageJson', (done) => {
const absPath = path.join(__dirname, ESM_PLUGINS_PATH);
const dirs = fs.readdirSync(absPath);
dirs.forEach( dir => {
const data = fs.readFileSync(path.join(config.PATHS.pluginDir, dir, 'package.json'));
fs.writeFileSync(path.join(__dirname, ESM_PLUGINS_PATH, dir, 'package.json'), data);
});
done();
});
const distPluginPath = { from: 'dist_package/esm/plugins/**/*', to: 'dist_package/plugins' };
gulp.task('copyDistPlugins', () => {
return gulp.src(distPluginPath.from)
.pipe(gulp.dest(distPluginPath.to));
});
gulp.task('extractPlugins', ['copyDistPlugins'], (done) => {
del.sync('dist_package/esm/plugins', {force: true});
done();
});
gulp.task('release', (done) => {
runSequence(
['clean:dist', 'clean:tmp'],
['copyReleaseAssets', 'bundle'],
['extractPlugins','createPackageJson'],
['copyPluginsDummyPackageJson'],
done
);
});