Skip to content

Commit 9ea134e

Browse files
committed
Build with declaration
1 parent 73c8681 commit 9ea134e

File tree

4 files changed

+36
-21
lines changed

4 files changed

+36
-21
lines changed

gulpfile.js

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ const gulp = require('gulp'),
33
$ = require('gulp-load-plugins')(),
44
path = require('path'),
55
del = require('del'),
6-
inquirer = require('inquirer');
6+
inquirer = require('inquirer'),
7+
merge = require('merge2'),
78
ts = require('gulp-typescript'),
89
tsProject = ts.createProject('tsconfig.json');
910

@@ -47,25 +48,31 @@ async function scripts () {
4748
return path.basename(file, path.extname(file));
4849
}).join(',')
4950

50-
return tsProject.src()
51-
.pipe(tsProject())
52-
.js
53-
// TODO: Do tslint
54-
// .pipe($.jshint())
55-
// .pipe($.jshint.reporter('jshint-stylish'))
56-
.pipe($.insert.prepend('/*! ' + pkg.name + ' - v' + pkg.version + ' - \n' +
57-
' * Copyright (c) Hassan Khan ' + new Date().getFullYear() + '\n' +
58-
' */'))
59-
.pipe($.uglify({
60-
output: {
61-
comments: /##EMOJILIST/
62-
}
63-
}))
64-
.pipe($.rename({
65-
suffix: '.min'
66-
}))
67-
.pipe($.replace(/(\/\*##EMOJILIST\*\/.+?),/, `/*##EMOJILIST*/"${emojiString}",`))
68-
.pipe(gulp.dest(paths.dist.scripts));
51+
const tsResult = tsProject.src().pipe(tsProject())
52+
53+
return merge([
54+
tsResult
55+
.js
56+
// TODO: Do tslint
57+
// .pipe($.jshint())
58+
// .pipe($.jshint.reporter('jshint-stylish'))
59+
.pipe($.insert.prepend(`/*! ${pkg.name} - v${pkg.version} -
60+
* Copyright (c) Yukai Huang ${new Date().getFullYear()}
61+
*/`))
62+
.pipe($.uglify({
63+
output: {
64+
comments: /##EMOJILIST/
65+
}
66+
}))
67+
.pipe($.rename({
68+
suffix: '.min'
69+
}))
70+
.pipe($.replace(/(\/\*##EMOJILIST\*\/.+?),/, `/*##EMOJILIST*/"${emojiString}",`))
71+
.pipe(gulp.dest(paths.dist.scripts)),
72+
tsResult
73+
.dts
74+
.pipe(gulp.dest(paths.dist.root))
75+
])
6976
}
7077
exports.scripts = scripts
7178

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"jsdom-global": "^3.0.2",
4545
"jshint-stylish": "~1.0.0",
4646
"jstest": "~1.0.4",
47+
"merge2": "^1.2.4",
4748
"minimatch": "~1.0.0",
4849
"q": "^1.0.1",
4950
"through2": "~0.6.3",

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"es2017"
99
],
1010
"rootDir": "v2",
11-
"outDir": "distv2"
11+
"outDir": "distv2",
12+
"declaration": true
1213
}
1314
}

0 commit comments

Comments
 (0)