add package step
This commit is contained in:
		
							parent
							
								
									b8a3e431c7
								
							
						
					
					
						commit
						2e7301b6ba
					
				
					 4 changed files with 33 additions and 1 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -1,2 +1,3 @@
 | 
				
			||||||
/node_modules/
 | 
					/node_modules/
 | 
				
			||||||
/build/
 | 
					/build/
 | 
				
			||||||
 | 
					*.zip
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,15 @@
 | 
				
			||||||
  "name": "Vim Vixen",
 | 
					  "name": "Vim Vixen",
 | 
				
			||||||
  "description": "Vim Vixen",
 | 
					  "description": "Vim Vixen",
 | 
				
			||||||
  "version": "0.0.1",
 | 
					  "version": "0.0.1",
 | 
				
			||||||
 | 
					  "icons": {
 | 
				
			||||||
 | 
					    "48": "resources/icon_48x48.png",
 | 
				
			||||||
 | 
					    "96": "resources/icon_96x96.png"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "applications": {
 | 
				
			||||||
 | 
					    "gecko": {
 | 
				
			||||||
 | 
					      "id": "vim-vixen@i-beam.org"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
  "content_scripts": [
 | 
					  "content_scripts": [
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      "matches": [ "http://*/*", "https://*/*" ],
 | 
					      "matches": [ "http://*/*", "https://*/*" ],
 | 
				
			||||||
| 
						 | 
					@ -21,7 +30,8 @@
 | 
				
			||||||
    "tabs"
 | 
					    "tabs"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "web_accessible_resources": [
 | 
					  "web_accessible_resources": [
 | 
				
			||||||
    "build/console.html"
 | 
					    "build/console.html",
 | 
				
			||||||
 | 
					    "build/console.js"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "options_ui": {
 | 
					  "options_ui": {
 | 
				
			||||||
    "page": "build/settings.html"
 | 
					    "page": "build/settings.html"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,7 @@
 | 
				
			||||||
    "start": "webpack -w -d",
 | 
					    "start": "webpack -w -d",
 | 
				
			||||||
    "lint": "eslint --ext .jsx,.js src",
 | 
					    "lint": "eslint --ext .jsx,.js src",
 | 
				
			||||||
    "build": "NODE_ENV=production webpack --progress --display-error-details",
 | 
					    "build": "NODE_ENV=production webpack --progress --display-error-details",
 | 
				
			||||||
 | 
					    "package": "npm run build && ./package.sh",
 | 
				
			||||||
    "lint": "eslint src",
 | 
					    "lint": "eslint src",
 | 
				
			||||||
    "test": "karma start"
 | 
					    "test": "karma start"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										20
									
								
								package.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								package.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,20 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MANIFEST="manifest.json"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					version=$(jq -r '.version' $MANIFEST)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					icons=$(jq -r '.icons[]' $MANIFEST)
 | 
				
			||||||
 | 
					content_scripts=$(jq -r '.content_scripts[].js[]' $MANIFEST)
 | 
				
			||||||
 | 
					background_scripts=$(jq -r '.background.scripts[]' $MANIFEST)
 | 
				
			||||||
 | 
					web_accessible_resources=$(jq -r '.web_accessible_resources[]' $MANIFEST)
 | 
				
			||||||
 | 
					options_ui=$(jq -r '.options_ui.page' $MANIFEST)
 | 
				
			||||||
 | 
					options_scripts=""
 | 
				
			||||||
 | 
					for html in $options_ui; do
 | 
				
			||||||
 | 
					  scripts=$(grep -Po "(?<=src=['\"])[^'\"]*" "$html")
 | 
				
			||||||
 | 
					  for js in $scripts; do
 | 
				
			||||||
 | 
					    options_scripts="$options_scripts $(dirname $html)/$js"
 | 
				
			||||||
 | 
					  done
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					zip ${version}.zip $MANIFEST $icons $content_scripts $background_scripts $web_accessible_resources $options_ui $options_scripts
 | 
				
			||||||
		Reference in a new issue