Skip to content

Commit 0aa12ec

Browse files
committed
Replace emoji string in dist script
1 parent c6255d1 commit 0aa12ec

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

gulpfile.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const gulp = require('gulp'),
2+
glob = require('glob'),
23
$ = require('gulp-load-plugins')(),
34
path = require('path'),
45
del = require('del'),
@@ -27,8 +28,25 @@ const paths = {
2728
}
2829
}
2930
}
30-
function scripts () {
31+
32+
33+
const globPromise = pattern => new Promise((resolve, reject) => {
34+
glob(pattern, {}, function (err, files) {
35+
if (err) {
36+
reject(err)
37+
} else {
38+
resolve(files)
39+
}
40+
})
41+
})
42+
43+
async function scripts () {
3144
const pkg = require('./package.json');
45+
46+
const emojiString = (await globPromise(`${paths.dist.images.separate}/*.png`)).map(file => {
47+
return path.basename(file, path.extname(file));
48+
}).join(',')
49+
3250
return tsProject.src()
3351
.pipe(tsProject())
3452
.js
@@ -46,7 +64,7 @@ function scripts () {
4664
.pipe($.rename({
4765
suffix: '.min'
4866
}))
49-
// .pipe($.replace(/(\/\*##EMOJILIST\*\/).+$/m, '$1"' + emoji.substr(1) + '";'))
67+
.pipe($.replace(/(\/\*##EMOJILIST\*\/.+?),/, `/*##EMOJILIST*/"${emojiString}",`))
5068
.pipe(gulp.dest(paths.dist.scripts));
5169
}
5270
exports.scripts = scripts

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
"bugs": {
2222
"url": "https://github.com/hassankhan/emojify.js/issues"
2323
},
24-
"engineStrict": true,
25-
"engines": {
26-
"node": "7.5.0"
27-
},
2824
"devDependencies": {
2925
"del": "~0.1.3",
3026
"emoji-datasource-apple": "^4.1.0",

0 commit comments

Comments
 (0)