1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-10-02 21:02:03 +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 path = require('path');
var { spawnSync } = require('child_process');
function file(which) {
return path.join(__dirname, '..', which);
@ -32,19 +33,20 @@ fs.writeFileSync(
'\n return twemoji;\n});'
);
require('child_process').spawn(
spawnSync(
'node',
[
path.join(__dirname, '../../', 'node_modules/uglify-js/bin/uglifyjs'),
'--verbose',
file('twemoji.js'),
'-o',
file('twemoji.min.js')
file('twemoji.tmp.js')
]
).on('close', function () {
fs.writeFileSync(
file('twemoji.min.js'),
'/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */\n' +
fs.readFileSync(file('twemoji.min.js')) + '\n'
);
});
);
fs.writeFileSync(
file('twemoji.min.js'),
'/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */\n' +
fs.readFileSync(file('twemoji.tmp.js'))
);
fs.unlinkSync(file('twemoji.tmp.js'));