Skip to content

Commit 865e071

Browse files
authored
Merge pull request #7 from Yukaii:feature/webpack
Bundle with webpack
2 parents 173f5e9 + 4880cea commit 865e071

File tree

6 files changed

+3156
-50
lines changed

6 files changed

+3156
-50
lines changed

.babelrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/typescript"
5+
],
6+
"plugins": [
7+
"@babel/plugin-proposal-class-properties",
8+
"@babel/plugin-transform-runtime"
9+
]
10+
}

gulpfile.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const gulp = require('gulp'),
66
inquirer = require('inquirer'),
77
merge = require('merge2'),
88
ts = require('gulp-typescript'),
9+
webpack = require('webpack-stream'),
910
tsProject = ts.createProject('tsconfig.json');
1011

1112
const distRoot = path.resolve('./dist')
@@ -51,23 +52,25 @@ async function scripts () {
5152
const tsResult = tsProject.src().pipe(tsProject())
5253

5354
return merge([
54-
tsResult
55-
.js
55+
gulp.src('./src/index.ts')
56+
.pipe(webpack({
57+
config : require('./webpack.config.js')
58+
}))
5659
// TODO: Do tslint
5760
// .pipe($.jshint())
5861
// .pipe($.jshint.reporter('jshint-stylish'))
5962
.pipe($.insert.prepend(`/*! ${pkg.name} - v${pkg.version} -
6063
* Copyright (c) Yukai Huang ${new Date().getFullYear()}
6164
*/`))
65+
.pipe($.rename({
66+
suffix: '.min'
67+
}))
68+
.pipe($.replace(/\/\*##EMOJILIST\*\/\n'';/, `/*##EMOJILIST*/'${emojiString}';`))
6269
.pipe($.uglify({
6370
output: {
6471
comments: /##EMOJILIST/
6572
}
6673
}))
67-
.pipe($.rename({
68-
suffix: '.min'
69-
}))
70-
.pipe($.replace(/(\/\*##EMOJILIST\*\/.+?),/, `/*##EMOJILIST*/"${emojiString}",`))
7174
.pipe(gulp.dest(paths.dist.scripts)),
7275
tsResult
7376
.dts

0 commit comments

Comments
 (0)