diff --git a/cmd b/cmd index 85aecc148..0d937af9b 100755 --- a/cmd +++ b/cmd @@ -432,6 +432,9 @@ if [ $# -gt 0 ]; then shift 1 run_exec php "php app/Models/clearHelper.php" run_exec php "php artisan ide-helper:models -W" + elif [[ "$1" == "translate" ]]; then + shift 1 + run_exec php "cd /var/www/language && php translate.php" elif [[ "$1" == "test" ]]; then shift 1 e="./vendor/bin/phpunit $@" && run_exec php "$e" diff --git a/electron/build.js b/electron/build.js index 81f28076e..f5296267e 100644 --- a/electron/build.js +++ b/electron/build.js @@ -52,10 +52,9 @@ function changeLog() { } let start = content.indexOf(array[0]); if (array.length > 5) { - let length = content.indexOf(array[5]) - start; - content = content.substr(start, length) + content = content.substring(start, content.indexOf(array[5])) } else { - content = content.substr(start) + content = content.substring(start) } return content; } @@ -120,8 +119,6 @@ function startBuild(data, publish, release) { // drawio cloneDrawio(systemInfo) } - // language - fse.copySync(path.resolve(__dirname, "../public/js/language"), path.resolve(electronDir, "js/language")) // config.js fs.writeFileSync(electronDir + "/config.js", "window.systemInfo = " + JSON.stringify(systemInfo), 'utf8'); fs.writeFileSync(nativeCachePath, utils.formatUrl(data.url)); @@ -129,10 +126,19 @@ function startBuild(data, publish, release) { // default (解决 Failed to load resource: net::ERR_FILE_NOT_FOUND 报错) fs.writeFileSync(electronDir + "/default", "default", 'utf8'); // index.html + let manifestFile = path.resolve(electronDir, "manifest.json"); + if (!fs.existsSync(manifestFile)) { + console.log("manifest non-existent!"); + process.exit() + } + let manifestContent = JSON.parse(fs.readFileSync(manifestFile, 'utf8')); let indexFile = path.resolve(electronDir, "index.html"); let indexString = fs.readFileSync(indexFile, 'utf8'); indexString = indexString.replace(/