How to pack a Chrome extension on Mac OSX with commandline?
I am trying to automate my Chrome extension building process on OSX 10.5. I am 开发者_Python百科unable to find a similar command for OSX like this for Windows
chrome.exe --pack-extension=c:\myext --pack-extension-key=c:\myext.pem
Is it even possible on OSX? As there is no mention of it in the documentation.
Please guide me.
Thanks in advance. -Parimal Das
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --pack-extension...
Use the CRXMake gem.
Have a great day.
A complete example to run on the shell:
"/Users/varr/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --pack-extension="/Users/varr/Dropbox/Code/Projects/Bookmark Express/src"
Things to note:
- Chrome will not display any output of success or failure but it will return an exit code
- Your shell (ex. oh-my-zsh) may display exit codes so you can have an idea there
- Chrome will generate two files, the
.crx
and a.pem
To automate this, I used Geb (and Groovy). In GebConfig.groovy
, I tried using:
def chromePath = "/Users/varr/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
def packExtensionSwitch='--pack-extension="/Users/varr/Dropbox/Code/Projects/Bookmark Express/src"'
ProcessBuilder packExtension = new ProcessBuilder(chromePath, packExtensionSwitch)
Process process = packExtension.start()
But this returned an exit code 21 every time and no files were generated. I finalized my approach with:
def packageExtensionScript = '/Users/varr/package.sh'
ProcessBuilder packExtension = new ProcessBuilder(packageExtensionScript)
Process process = packExtension.start()
To finish it up, I made package.sh
a one-line script with the command to run and it all worked!
You can use A node.js command line app for packing Google Chrome extensions too. Enjoy!
精彩评论