Ver Fonte

优化firefox版,清理掉xpi中无用的目录

zxlie há 6 anos atrás
pai
commit
4b15001968
2 ficheiros alterados com 13 adições e 2 exclusões
  1. 1 1
      apps/options/index.js
  2. 12 1
      gulpfile.js

+ 1 - 1
apps/options/index.js

@@ -70,7 +70,7 @@ new Vue({
                     'SHOW_PAGE_LOAD_TIME', 'GRID_RULER', 'AJAX_DEBUGGER'].includes(key);
             } else {
                 return ['MENU_PAGE_CAPTURE', 'MENU_COLOR_PICKER',
-                    'MENU_STR_ENDECODE', 'MENU_AJAX_DEBUGGER', 'MENU_PAGE_OPTIMI', 'MENU_DOWNLOAD_CRX',
+                    'MENU_AJAX_DEBUGGER', 'MENU_PAGE_OPTIMI', 'MENU_DOWNLOAD_CRX',
                     'MENU_CODE_STANDARD', 'MENU_GRID_RULER', 'MENU_REMOVE_BG'].includes(key);
             }
         },

+ 12 - 1
gulpfile.js

@@ -159,6 +159,17 @@ gulp.task('zip', () => {
 gulp.task('firefox', () => {
     shell.exec('rm -rf output-firefox && cp -r output output-firefox && rm -rf output-firefox/fehelper.zip');
 
+    // 清理掉firefox里不支持的tools
+    let rmTools = ['page-capture', 'color-picker', 'ajax-debugger', 'wpo', 'code-standards', 'ruler', 'remove-bg'];
+    shell.cd('output-firefox/apps');
+    shell.find('./').forEach(f => {
+        if (rmTools.includes(f)) {
+            shell.rm('-rf', f);
+            console.log('已删除不支持的工具:', f);
+        }
+    });
+    shell.cd('../../');
+
     // 更新firefox所需的配置文件
     let pathOfMF = './output-firefox/apps/manifest.json';
     let manifest = require(pathOfMF);
@@ -170,7 +181,7 @@ gulp.task('firefox', () => {
             "strict_min_version": "57.0"
         }
     };
-    manifest.version = manifest.version.replace(/\./,'') + 'stable';
+    manifest.version = manifest.version.replace(/\./, '') + 'stable';
     fs.writeFileSync(pathOfMF, JSON.stringify(manifest));
 
     shell.exec('cd output-firefox/apps && zip -r ../fehelper.xpi ./ > /dev/null && cd ../../');