-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathgulpfile.js
63 lines (52 loc) · 1.44 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
var gulp = require('gulp');
var del = require('del');
var run = require('gulp-run');
var ru = require('rollup');
var ruTS = require('@rollup/plugin-typescript');
const paths = {
src: ['./src/**/*.ts', '!./src/**/*.spec.ts'],
entry: './src/big-decimal.ts',
lib: './lib/',
dist: './dist/'
}
const webpackConfig = require('./webpack.config.js');
gulp.task('clean', function () {
return del(['./dist/*']);
})
gulp.task('dist', gulp.series('clean', function (done) {
// build es module with rollup
ru.rollup({
input: paths.entry,
plugins: [
ruTS.default({
outDir: paths.dist + 'esm',
}),
],
}).then((bundle) => {
bundle.write({
dir: paths.dist + 'esm',
format: 'esm',
sourcemap: true,
});
});
var cmd = new run.Command('webpack-cli', { silent: true });
//web non-prod
process.env.USE_ENV = 'web';
process.env.NODE_ENV = 'dev';
cmd.exec();
//web prod
process.env.USE_ENV = 'web';
process.env.NODE_ENV = 'production';
cmd.exec();
//node non-prod
process.env.USE_ENV = 'node';
process.env.NODE_ENV = 'dev';
cmd.exec();
//node prod
process.env.USE_ENV = 'node';
process.env.NODE_ENV = 'production';
cmd.exec();
gulp.src([`${paths.lib}/big-decimal.d.ts`, `${paths.lib}/roundingModes.d.ts`])
.pipe(gulp.dest(`${paths.dist}/node`));
done();
}));