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:
parent
cb19c3f777
commit
cc12da6fff
@ -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(
|
|
||||||
file('twemoji.min.js'),
|
fs.writeFileSync(
|
||||||
'/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */\n' +
|
file('twemoji.min.js'),
|
||||||
fs.readFileSync(file('twemoji.min.js')) + '\n'
|
'/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */\n' +
|
||||||
);
|
fs.readFileSync(file('twemoji.tmp.js'))
|
||||||
});
|
);
|
||||||
|
fs.unlinkSync(file('twemoji.tmp.js'));
|
||||||
|
Loading…
Reference in New Issue
Block a user