Remove package.script
This commit is contained in:
		
							parent
							
								
									e9a6fb8558
								
							
						
					
					
						commit
						cdb5856854
					
				
					 3 changed files with 3563 additions and 67 deletions
				
			
		
							
								
								
									
										3574
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										3574
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
					@ -22,7 +22,6 @@
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "homepage": "https://github.com/ueokande/vim-vixen",
 | 
					  "homepage": "https://github.com/ueokande/vim-vixen",
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "adm-zip": "^0.4.7",
 | 
					 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^8.0.2",
 | 
					    "babel-eslint": "^8.0.2",
 | 
				
			||||||
    "babel-loader": "^7.1.1",
 | 
					    "babel-loader": "^7.1.1",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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);
 | 
					 | 
				
			||||||
		Reference in a new issue