@@ -215,27 +215,24 @@ function bump (done) {
215215}
216216exports . bump = bump
217217
218- function update ( done ) {
219- var emoji = '' ;
220-
221- del ( './src/images/emoji' ) ;
222-
223- $ . download ( 'https://github.com/arvida/emoji-cheat-sheet.com/archive/master.zip' )
224- . pipe ( $ . unzip ( ) )
225- . pipe ( $ . filter ( function ( file ) {
226- return minimatch ( file . path , '**/public/graphics/emojis/*.png' ) ;
218+ function update ( ) {
219+ const emojiPath = `./v2/images/emoji`
220+ del ( emojiPath ) ;
221+
222+ const emojiMap = require ( 'emoji-datasource-apple' ) . reduce ( ( acc , emoji ) => ( {
223+ ...acc ,
224+ [ emoji . image ] : emoji
225+ } ) , { } )
226+ const availableFiles = Object . keys ( emojiMap )
227+
228+ return gulp . src ( 'node_modules/emoji-datasource-apple/img/apple/64/*.png' )
229+ . pipe ( $ . filter ( file => availableFiles . includes ( file . basename ) ) )
230+ . pipe ( $ . rename ( file => {
231+ const emojiData = emojiMap [ `${ file . basename } ${ file . extname } ` ]
232+
233+ file . basename = emojiData . short_name
234+ file . dirname = './'
227235 } ) )
228- . pipe ( $ . rename ( { dirname : './' } ) )
229- . pipe ( gulp . dest ( './src/images/emoji' ) )
230- . pipe ( through2 ( { objectMode : true } , function ( file , enc , cb ) {
231- emoji += ',' + path . basename ( file . path , path . extname ( file . path ) ) ;
232- this . push ( file ) ;
233- cb ( ) ;
234- } , function ( ) {
235- gulp . src ( './src/emojify.js' )
236- . pipe ( $ . replace ( / ( \/ \* # # E M O J I L I S T \* \/ ) .+ $ / m, '$1"' + emoji . substr ( 1 ) + '";' ) )
237- . pipe ( gulp . dest ( './src' ) )
238- . on ( 'end' , done ) ;
239- } ) ) ;
236+ . pipe ( gulp . dest ( emojiPath ) )
240237}
241238exports . update = update
0 commit comments