Copy completed translations over when building

This commit is contained in:
Arlo Breault 2019-08-22 11:23:15 -04:00
parent a0dd3d9edc
commit 9c20ab3984

View file

@ -37,11 +37,15 @@ var SHARED_FILES = [
]; ];
var concatJS = function(outDir, init, outFile) { var concatJS = function(outDir, init, outFile) {
var files; var files = FILES.concat(`init-${init}.js`);
files = FILES.concat(`init-${init}.js`);
execSync(`cat ${files.join(' ')} > ${outDir}/${outFile}`); execSync(`cat ${files.join(' ')} > ${outDir}/${outFile}`);
}; };
var copyTranslations = function(outDir) {
execSync('git submodule update --init -- translation')
execSync(`cp -rf translation/* ${outDir}/_locales/`);
};
var tasks = new Map(); var tasks = new Map();
var task = function(key, msg, func) { var task = function(key, msg, func) {
@ -68,16 +72,20 @@ task('test', 'snowflake unit tests', function() {
}); });
task('build', 'build the snowflake proxy', function() { task('build', 'build the snowflake proxy', function() {
execSync('rm -rf build'); const outDir = 'build';
execSync('cp -r ' + STATIC + '/ build/'); execSync(`rm -rf ${outDir}`);
concatJS('build', 'badge', 'embed.js'); execSync(`cp -r ${STATIC}/ ${outDir}/`);
copyTranslations(outDir);
concatJS(outDir, 'badge', 'embed.js');
console.log('Snowflake prepared.'); console.log('Snowflake prepared.');
}); });
task('webext', 'build the webextension', function() { task('webext', 'build the webextension', function() {
execSync('mkdir -p webext'); const outDir = 'webext';
execSync(`cp -r ${STATIC}/{${SHARED_FILES.join(',')}} webext/`, { shell: '/bin/bash' }); execSync(`git clean -f -x -d ${outDir}/`);
concatJS('webext', 'webext', 'snowflake.js'); execSync(`cp -r ${STATIC}/{${SHARED_FILES.join(',')}} ${outDir}/`, { shell: '/bin/bash' });
copyTranslations(outDir);
concatJS(outDir, 'webext', 'snowflake.js');
console.log('Webextension prepared.'); console.log('Webextension prepared.');
}); });