diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-05-14 21:03:37 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-05-14 21:06:38 +0900 |
commit | cdb58568547388182ca3f7cf312cb701e62c3a24 (patch) | |
tree | 0e78730128460c95d1a14b74f7fc16f3c736b094 /script | |
parent | e9a6fb85583a891cba2683f2abb05f34e13bff43 (diff) |
Remove package.script
Diffstat (limited to 'script')
-rw-r--r-- | script/package.js | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/script/package.js b/script/package.js deleted file mode 100644 index 0128f0f..0000000 --- a/script/package.js +++ /dev/null @@ -1,55 +0,0 @@ -let path = require('path'); -let fs = require('fs'); -let AdmZip = require('adm-zip'); -let manifest = require('../manifest'); - -manifest.iconFiles = function() { - return Object.keys(this.icons).map(key => this.icons[key]); -}; - -manifest.contentScriptFiles = function() { - let files = this.content_scripts.map(entry => entry.js); - return [].concat.apply([], files); -}; - -manifest.backgroundScriptFiles = function() { - return this.background.scripts; - -}; - -manifest.webAccessibleResourceFiles = function() { - return this.web_accessible_resources; -}; - -manifest.optionFiles = function() { - let uiFile = this.options_ui.page; - let dir = path.dirname(uiFile); - let html = fs.readFileSync(uiFile, 'utf-8'); - - let files = [uiFile]; - let regex = /<\s*script\s+src\s*=\s*'(.*)'\s*>/g; - let match = regex.exec(html); - while (match) { - files.push(path.join(dir, match[1])); - match = regex.exec(html); - } - return files; -}; - -let files = [] - .concat('manifest.json') - .concat(manifest.iconFiles()) - .concat(manifest.contentScriptFiles()) - .concat(manifest.backgroundScriptFiles()) - .concat(manifest.webAccessibleResourceFiles()) - .concat(manifest.optionFiles()); -let zip = new AdmZip(); -let output = `${manifest.version}.zip`; -console.log(output); -for (let f of files) { - let dir = path.dirname(f); - zip.addLocalFile(f, dir); - console.log('=>', path.join(dir, f)); -} - -zip.writeZip(output); |