[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake/master] Copy completed translations over when building



commit 9c20ab398484301a8eb2b45db2aa2320a0b44b40
Author: Arlo Breault <arlolra@xxxxxxxxx>
Date:   Thu Aug 22 11:23:15 2019 -0400

    Copy completed translations over when building
---
 proxy/make.js | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/proxy/make.js b/proxy/make.js
index 58b7fce..2aa0bf4 100755
--- a/proxy/make.js
+++ b/proxy/make.js
@@ -37,11 +37,15 @@ var SHARED_FILES = [
 ];
 
 var concatJS = function(outDir, init, outFile) {
-  var files;
-  files = FILES.concat(`init-${init}.js`);
+  var files = FILES.concat(`init-${init}.js`);
   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 task = function(key, msg, func) {
@@ -68,16 +72,20 @@ task('test', 'snowflake unit tests', function() {
 });
 
 task('build', 'build the snowflake proxy', function() {
-  execSync('rm -rf build');
-  execSync('cp -r ' + STATIC + '/ build/');
-  concatJS('build', 'badge', 'embed.js');
+  const outDir = 'build';
+  execSync(`rm -rf ${outDir}`);
+  execSync(`cp -r ${STATIC}/ ${outDir}/`);
+  copyTranslations(outDir);
+  concatJS(outDir, 'badge', 'embed.js');
   console.log('Snowflake prepared.');
 });
 
 task('webext', 'build the webextension', function() {
-  execSync('mkdir -p webext');
-  execSync(`cp -r ${STATIC}/{${SHARED_FILES.join(',')}} webext/`, { shell: '/bin/bash' });
-  concatJS('webext', 'webext', 'snowflake.js');
+  const outDir = 'webext';
+  execSync(`git clean -f -x -d ${outDir}/`);
+  execSync(`cp -r ${STATIC}/{${SHARED_FILES.join(',')}} ${outDir}/`, { shell: '/bin/bash' });
+  copyTranslations(outDir);
+  concatJS(outDir, 'webext', 'snowflake.js');
   console.log('Webextension prepared.');
 });
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits