OLD | NEW |
(Empty) | |
| 1 <h1 class="page_title">Packaging</h1> |
| 2 <p> |
| 3 This page describes how to package your extension. |
| 4 As the <a href="overview.html">Overview</a> explains, |
| 5 extensions are packaged as signed ZIP files |
| 6 with the file extension "crx"—for example, |
| 7 <code>myextension.crx</code>. |
| 8 </p> |
| 9 <p> |
| 10 <b>Note:</b> |
| 11 You might not need to package your extension. |
| 12 If you publish your extension using the |
| 13 <a href="https://chrome.google.com/webstore/developer/dashboard">Chrome Develope
r Dashboard</a>, |
| 14 then the only reason to create your own <code>.crx</code> file |
| 15 would be to distribute a non-public version—for example, |
| 16 to alpha testers. |
| 17 You can find information on publishing extensions and apps in the |
| 18 Chrome Web Store getting started tutorial, starting at |
| 19 <a href="http://code.google.com/chrome/webstore/docs/get_started_simple.html#ste
p5">Step 5: Zip up your app</a>. |
| 20 </p> |
| 21 <p> |
| 22 When you package an extension, |
| 23 the extension is assigned a unique key pair. |
| 24 The extension's ID is based on a hash of the public key. |
| 25 The private key is kept private |
| 26 and used to sign each version of the extension. |
| 27 </p> |
| 28 <h2>Creating a package</h2> |
| 29 <p>To package an extension:</p> |
| 30 <ol> |
| 31 <li> |
| 32 Bring up the Extensions management page |
| 33 by going to this URL: |
| 34 <blockquote> |
| 35 <b>chrome://extensions</b> |
| 36 </blockquote> |
| 37 </li> |
| 38 <li> |
| 39 If <b>Developer mode</b> has a + by it, |
| 40 click the +. |
| 41 </li> |
| 42 <li> |
| 43 Click the <b>Pack extension</b> button. |
| 44 A dialog appears. |
| 45 </li> |
| 46 <li> |
| 47 In the <b>Extension root directory</b> field, |
| 48 specify the path to the extension's folder—for example, |
| 49 <code>c:\myext</code>. |
| 50 (Ignore the other field; |
| 51 you don't specify a private key file |
| 52 the first time you package a particular extension.) |
| 53 </li> |
| 54 <li> |
| 55 Click <b>OK</b>. |
| 56 The packager creates two files: |
| 57 a <code>.crx</code> file, |
| 58 which is the actual extension that can be installed, |
| 59 and a <code>.pem</code> file, |
| 60 which contains the private key. |
| 61 </li> |
| 62 </ol> |
| 63 <p> |
| 64 <b>Do not lose the private key!</b> |
| 65 Keep the <code>.pem</code> file secret and in a safe place. |
| 66 You'll need it later if you want to do any of the following: |
| 67 </p> |
| 68 <ul> |
| 69 <li><a href="#update">Update</a> the extension</li> |
| 70 <li><a href="#upload">Upload</a> the extension to the Chrome Web Store</li> |
| 71 </ul> |
| 72 <p> |
| 73 If the extension is successfully packaged, you'll see a dialog like this |
| 74 that tells you where to find |
| 75 the <code>.crx</code> and <code>.pem</code> files:</p> |
| 76 </p> |
| 77 <img src="{{static}}/images/package-success.gif" |
| 78 width="554" height="208" /> |
| 79 <h2 id="update">Updating a package</h2> |
| 80 <p>To create an updated version of your extension:</p> |
| 81 <ol> |
| 82 <li> |
| 83 Increase the version number in <code>manifest.json</code>. |
| 84 </li> |
| 85 <li> |
| 86 Bring up the Extensions management page |
| 87 by going to this URL: <b>chrome://extensions</b> |
| 88 </li> |
| 89 <li> |
| 90 Click the <b>Pack extension</b> button. |
| 91 A dialog appears. |
| 92 </li> |
| 93 <li> |
| 94 In the <b>Extension root directory</b> field, |
| 95 specify the path to the extension's folder—for example, |
| 96 <code>c:\myext</code>. |
| 97 </li> |
| 98 <li> |
| 99 In the <b>Private key file</b> field, |
| 100 specify the location of the |
| 101 already generated <code>.pem</code> file for this extension—for |
| 102 example, <code>c:\myext.pem</code>. |
| 103 </li> |
| 104 <li> |
| 105 Click <b>OK</b>. |
| 106 </li> |
| 107 </ol> |
| 108 <p>If the updated extension is successfully packaged, you'll see a dialog like t
his:</p> |
| 109 <img src="{{static}}/images/update-success.gif" |
| 110 width="298" height="160" /> |
| 111 <h2 id="upload"> Uploading a previously packaged extension to the Chrome Web Sto
re</h2> |
| 112 <p> |
| 113 You can use the Chrome Developer Dashboard |
| 114 to upload an extension that you've previously packaged yourself. |
| 115 However, unless you take special steps, |
| 116 the extension's ID in the Chrome Web Store |
| 117 will be different from its ID in the package you created. |
| 118 This different ID might be a problem if you've |
| 119 distributed your extension package, |
| 120 because it allows users to install multiple versions of your extension, |
| 121 each with its own local data. |
| 122 </p> |
| 123 <p> |
| 124 If you want to keep the extension ID the same, |
| 125 follow these steps: |
| 126 </p> |
| 127 <ol> |
| 128 <li> Rename the private key that was generated |
| 129 when you created the <code>.crx</code> file to <code>key.pem</code>. </li> |
| 130 <li> Put <code>key.pem</code> in the top directory |
| 131 of your extension. </li> |
| 132 <li> Compress that directory into a ZIP file. </li> |
| 133 <li> Upload the ZIP file using the |
| 134 <a href="https://chrome.google.com/webstore/developer/dashboard">Chrome Deve
loper Dashboard</a>. </li> |
| 135 </ol> |
| 136 <h2>Packaging at the command line</h2> |
| 137 <p> |
| 138 Another way to package extensions |
| 139 is by invoking <code>chrome.exe</code> at the command line. |
| 140 Use the <code>--pack-extension</code> flag |
| 141 to specify the location of the extension's folder. |
| 142 Use <code>--pack-extension-key</code> |
| 143 to specify the location of the extension's private key file. |
| 144 For example: |
| 145 </p> |
| 146 <pre> |
| 147 chrome.exe --pack-extension=c:\myext --pack-extension-key=c:\myext.pem |
| 148 </pre> |
| 149 <p> |
| 150 To suppress the dialog, |
| 151 add <code>--no-message-box</code> to the command. |
| 152 </p> |
| 153 <h2>Package format and scripts</h2> |
| 154 <p> |
| 155 For more information on the format, as well as pointers to scripts you can use |
| 156 to create <code>.crx</code> files, see <a href="crx.html">CRX Package Format</a>
. |
| 157 </p> |
OLD | NEW |