1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-11-20 05:14:09 +00:00

Refactor create-dist script to not mix sync and async

This commit is contained in:
Nathan Downs 2019-05-28 17:01:14 -07:00
parent cb19c3f777
commit cc12da6fff

View File

@ -6,6 +6,7 @@
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var { spawnSync } = require('child_process');
function file(which) { function file(which) {
return path.join(__dirname, '..', which); return path.join(__dirname, '..', which);
@ -32,19 +33,20 @@ fs.writeFileSync(
'\n return twemoji;\n});' '\n return twemoji;\n});'
); );
require('child_process').spawn( spawnSync(
'node', 'node',
[ [
path.join(__dirname, '../../', 'node_modules/uglify-js/bin/uglifyjs'), path.join(__dirname, '../../', 'node_modules/uglify-js/bin/uglifyjs'),
'--verbose', '--verbose',
file('twemoji.js'), file('twemoji.js'),
'-o', '-o',
file('twemoji.min.js') file('twemoji.tmp.js')
] ]
).on('close', function () { );
fs.writeFileSync(
fs.writeFileSync(
file('twemoji.min.js'), file('twemoji.min.js'),
'/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */\n' + '/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */\n' +
fs.readFileSync(file('twemoji.min.js')) + '\n' fs.readFileSync(file('twemoji.tmp.js'))
); );
}); fs.unlinkSync(file('twemoji.tmp.js'));