1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
|
---
title: jpm
slug: Mozilla/Add-ons/SDK/Tools/jpm
translation_of: Archive/Add-ons/Add-on_SDK/Tools/jpm
---
<div class="note">
<p>Вы можете использовать <code>jpm</code> для Firefox 38 или более поздних версий.</p>
<p>Данный материал относится только для jpm.</p>
</div>
<p><span class="seoSummary">Это Node-ориентированная замена устаревшего <a href="/en-US/Add-ons/SDK/Tools/cfx">cfx</a>. Позволяет тестировать, запускать и создавать дополнения для Firefox.</span></p>
<p>Смотри также <a href="/en-US/Add-ons/SDK/Tutorials/Getting_Started_%28jpm%29">jpm tutorial</a>.</p>
<p>jpm вызывается через:</p>
<pre class="brush: bash">jpm [command] [options]
</pre>
<p>jpm поддерживает следующие глобальные опции:</p>
<pre class="brush: bash">-h, --help - show a help message and exit
-V, --version - print the jpm version number
</pre>
<h2 id="Установка">Установка</h2>
<p>jpm распространяется с помощью менеджера пакетов <a class="external external-icon" href="https://www.npmjs.org/package/jpm">npm</a>, поэтому чтобы установить jpm, вам необходимо предварительно установить менеджер пакетов npm, если вы этого ещё не сделали. npm входит в Node.js, поэтому чтобы установить npm - посетите <a class="external external-icon" href="http://nodejs.org/">nodejs.org</a> и нажмите кнопку INSTALL.</p>
<p>После этого вы можете установить jpm, как и любой другой npm пакет:</p>
<pre>npm install jpm -g</pre>
<p>В зависимости от настроек и операционной системы, вам может потребоваться запустить его с правами администратора (Linux: Debian, Ubuntu, и т.п.):</p>
<pre class="brush: bash">sudo npm install jpm -g</pre>
<p>После установки введите в командной строке:</p>
<pre class="brush: bash">jpm</pre>
<p>Вы должны увидеть краткое описание доступных команд. Обратите внимание, что в отличие от cfx, jpm доступно из любой запущенной командной строки, в случае, если при установке jpm использовался флаг -g.</p>
<h3 id="Проблемы">Проблемы?</h3>
<p>Если у вас возникли проблемы, то обратитесь за помощью. Пользователи SDK и участники проекта готовы обсудить и предложения в <a class="external external-icon" href="http://groups.google.com/group/mozilla-labs-jetpack/topics">project mailing list</a>. Попробуйте поискать там, возможно похожий вопрос уже обсуждался там. Вы также можете обратиться к пользователям SDK в <a class="external external-icon" href="http://mibbit.com/?channel=%23jetpack&server=irc.mozilla.org">#jetpack</a> на <a class="external external-icon" href="http://irc.mozilla.org/">Mozilla's IRC network</a>.</p>
<h2 id="Справочник_команд">Справочник команд</h2>
<p>В jpm доступно шесть команд:</p>
<table class="fullwidth-table standard-table">
<tbody>
<tr>
<td style="width: 20%;"><a href="/en-US/Add-ons/SDK/Tools/jpm#jpm_init"><code>jpm init</code></a></td>
<td>Создать каркас дополнения в качестве отправной точки для создания вашего дополнения.</td>
</tr>
<tr>
<td><a href="/en-US/Add-ons/SDK/Tools/jpm#jpm_run"><code>jpm run</code></a></td>
<td>Запустить копию Firefox с установленным дополнением.</td>
</tr>
<tr>
<td><a href="/en-US/Add-ons/SDK/Tools/jpm#jpm_test"><code>jpm test</code></a></td>
<td>Запуск тестирования модуля вашего дополнения.</td>
</tr>
<tr>
<td><a href="/en-US/Add-ons/SDK/Tools/jpm#jpm_xpi"><code>jpm xpi</code></a></td>
<td>Упаковать дополнение в <a href="https://developer.mozilla.org/en/XPI">XPI</a> пакет, формат файла установки для дополнений Firefox.</td>
</tr>
<tr>
<td><a href="/en-US/Add-ons/SDK/Tools/jpm#jpm_post"><code>jpm post</code></a></td>
<td>Упаковать дополнение в пакет <a href="https://developer.mozilla.org/en/XPI">XPI</a> и отправить на URL.</td>
</tr>
<tr>
<td><a href="/en-US/Add-ons/SDK/Tools/jpm#jpm_watchpost"><code>jpm watchpost</code></a></td>
<td>Упаковывать дополнение в пакет <a href="https://developer.mozilla.org/en/XPI">XPI</a> и отправлять на URL при каждом изменении файла.</td>
</tr>
</tbody>
</table>
<h3 id="jpm_init">jpm init</h3>
<p>Данная команда инициализирует новое дополнение, с нуля.</p>
<p>Для этого создайте новый каталог, перейдите в него и запустите <code>jpm init</code>.</p>
<pre class="brush: bash">mkdir my-addon
cd my-addon
jpm init</pre>
<p>Вам будет предложено указать некоторую информацию о вашем дополнении: данная информация будет использована для создания файла настроек дополнения <a href="https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json">package.json</a>.</p>
<ul>
<li><a href="https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json#title">title</a></li>
<li><a href="https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json#name">name</a>: По умолчанию это имя каталога, в котором была запущена команда jpm init. За исключнием случаев, когда заполненно поле <a href="https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json#id"><code>id</code></a> в файле package.json, тогда jpm добавит указатель "@" перед именем и использует в качестве него значение поля <a href="https://developer.mozilla.org/en-US/Add-ons/Install_Manifests#id"><code>id</code> field in the add-on's install manifest</a>.</li>
<li><a href="https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json#version">version</a></li>
<li><a href="https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json#description">description</a></li>
<li><a href="https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json#main">entry point</a> (which maps to "main" in package.json)</li>
<li><a href="https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json#author">author</a></li>
<li><a href="https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json#engines">engines</a> (supported applications)</li>
<li><a href="https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json#license">license</a></li>
</ul>
<p>Большинство из этих полей имеют значения по умолчанию, который указан в скобках после вопроса. Если вы просто нажмите Enter, то в настройках будет указано значение по умолчанию.</p>
<p>После того как вы укажете значения или выберите значение по умолчанию для этих свойств, вам будет показано полное содержание "package.json" и предложено принять его.</p>
<p>После jpm создаст каркас дополнения в качестве отправной точки для разрабатываемого вами дополнения, со следующей структурой файлов:</p>
<ul class="directory-tree">
<li>my-addon
<ul>
<li>index.js</li>
<li>package.json</li>
<li>test
<ul>
<li>test-index.js</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="jpm_run">jpm run</h3>
<p>Эта команда запускает новый экземпляр Firefox с подключенным дополнением:</p>
<pre class="brush: bash">jpm run</pre>
<p><code>jpm run</code> принимает следующие значения:</p>
<table class="fullwidth-table standard-table">
<tbody>
<tr>
<td style="width: 30%;"><code>-b --binary BINARY</code></td>
<td>
<p>Use the version of Firefox specified in BINARY. BINARY may be specified as a full path or as a path relative to the current directory.</p>
<pre class="brush: bash">
jpm run -b /path/to/Firefox/Nightly</pre>
See <a href="/en-US/Add-ons/SDK/Tools/jpm#Selecting_a_browser_version">Selecting a browser version</a>.</td>
</tr>
<tr>
<td><code>--binary-args CMDARGS</code></td>
<td>
<p>Pass <a href="/en-US/docs/Mozilla/Command_Line_Options">extra arguments</a> to Firefox.</p>
<p>For example, to pass the <code>-jsconsole</code> argument to Firefox, which will launch the <a href="/en-US/docs/Tools/Browser_Console">Browser Console</a>, try the following:</p>
<pre class="brush: bash">
jpm run --binary-args -jsconsole</pre>
<p>To pass multiple arguments, or arguments containing spaces, quote them:</p>
<pre class="brush: bash">
jpm run --binary-args '-url mzl.la -jsconsole'</pre>
</td>
</tr>
<tr>
<td><code>--debug</code></td>
<td>Run the <a href="/en-US/Add-ons/Add-on_Debugger">add-on debugger</a> attached to the add-on.</td>
</tr>
<tr>
<td><code>-o --overload PATH</code></td>
<td>
<p>Rather than use the SDK modules built into Firefox, use the modules found at PATH. If <code>-o</code> is specified and PATH is omitted, jpm will look for the JETPACK_ROOT environment variable and use its value as the path.</p>
<p>See <a href="/en-US/Add-ons/SDK/Tools/jpm#Overloading_the_built-in_modules">Overloading the built-in modules</a> for more information.</p>
</td>
</tr>
<tr>
<td><code>-p --profile=<code> PROFILE</code></code></td>
<td>
<p>By default, jpm uses a clean temporary Firefox <a href="http://support.mozilla.com/en-US/kb/profiles">profile</a> each time you call jpm run. Use the <code>--profile</code> option to instruct jpm to launch Firefox with an existing profile.</p>
<p>The PROFILE value may be a profile name or the path to the profile.</p>
<p>See <a href="/en-US/Add-ons/SDK/Tools/jpm#Using_profiles">Using profiles</a> for more information.</p>
</td>
</tr>
<tr>
<td><code>-v --verbose</code></td>
<td>Verbose operation.</td>
</tr>
<tr>
<td><code>--no-copy</code></td>
<td>
<div class="warning">Use with caution because <code>jpm run|test</code> changes many preferences, never use with your main profile.</div>
<div class="note">This only applies when <code>--profile</code> is used.</div>
Disables the copying of the profile used, which allows one to reuse a profile.</td>
<td> </td>
</tr>
</tbody>
</table>
<h3 id="jpm_test">jpm test</h3>
<p>Команда запускает тестирование дополнения. Происходит следующее:</p>
<ul>
<li>Обзор каталога с именем "test" в корневом каталоге дополнения</li>
<li>Открывается каждый файл, имя которого начинается с "test-" в этом каталоге (обратите внимание на дефис после слова "test" в имени jpm файла - в тест будет включён файл вида "test-myCode.js", но исключены файлы вида "test_myCode.js" или "testMyCode.js"</li>
<li>Вызываются все функции, извлечённые из файла, имя которого начинается с "test"</li>
</ul>
<pre class="brush: bash">jpm test
</pre>
<p>See the <a href="https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Unit_testing">tutorial on unit testing</a> and the <a href="https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level_APIs/test_assert">reference documentation for the <code>assert</code> module</a> for more details on this.</p>
<p><code>jpm test</code> accepts the following options:</p>
<table class="fullwidth-table standard-table">
<tbody>
<tr>
<td><code>-b --binary BINARY</code></td>
<td>
<p>Use the version of Firefox specified in BINARY. BINARY may be specified as a full path or as a path relative to the current directory.</p>
<pre class="brush: bash">
jpm test -b /path/to/Firefox/Nightly</pre>
<p>See <a href="/en-US/Add-ons/SDK/Tools/jpm#Selecting_a_browser_version">Selecting a browser version</a>.</p>
</td>
</tr>
<tr>
<td><code>--binary-args CMDARGS</code></td>
<td>
<p>Pass <a href="http://kb.mozillazine.org/Command_line_arguments">extra arguments</a> to Firefox.</p>
<p>For example, to pass the <code>-jsconsole</code> argument to Firefox, which will launch the <a href="/en-US/docs/Tools/Browser_Console">Browser Console</a>, try the following:</p>
<pre class="brush: bash">
jpm test --binary-args -jsconsole</pre>
<p>To pass multiple arguments, or arguments containing spaces, quote them:</p>
<pre class="brush: bash">
jpm test --binary-args '-url mzl.la -jsconsole'</pre>
</td>
</tr>
<tr>
<td><code>--debug</code></td>
<td>Run the <a href="/en-US/Add-ons/Add-on_Debugger">add-on debugger</a> attached to the add-on.</td>
</tr>
<tr>
<td style="width: 30%;"><code>-f --filter FILE[:TEST]</code></td>
<td>
<p>Only run tests whose filenames match FILE and optionally match TEST, both regexps.</p>
<pre class="brush: bash">
jpm test --filter base64:btoa</pre>
<p>The above command only runs tests in files whose names contain "base64", and in those files only runs tests whose names contain "btoa".</p>
</td>
</tr>
<tr>
<td style="width: 30%;"><code>-o --overload PATH</code></td>
<td>
<p>Rather than use the SDK modules built into Firefox, use the modules found at PATH. If <code>-o</code> is specified and PATH is omitted, jpm will look for the JETPACK_ROOT environment variable and use its value as the path.</p>
<p>See <a href="/en-US/Add-ons/SDK/Tools/jpm#Overloading_the_built-in_modules">Overloading the built-in modules</a> for more information.</p>
</td>
</tr>
<tr>
<td style="width: 30%;"><code>-p --profile<code> PROFILE</code></code></td>
<td>
<p>By default, jpm uses a clean temporary Firefox <a href="http://support.mozilla.com/en-US/kb/profiles">profile</a> each time you call jpm run. Use the <code>--profile</code> option to instruct jpm to launch Firefox with an existing profile.</p>
<p>The PROFILE value may be a profile name or the path to the profile.</p>
<p>See <a href="/en-US/Add-ons/SDK/Tools/jpm#Using_profiles">Using profiles</a> for more information.</p>
</td>
</tr>
<tr>
<td><code>--stop-on-error</code></td>
<td>
<p>By default jpm test keeps running tests even after tests fail. Specify <code>--stop-on-error</code> to stop running tests after the first failure:</p>
<pre class="brush: bash">
jpm test --stop-on-error</pre>
</td>
</tr>
<tr>
<td><code>--tbpl</code></td>
<td>Print test output in <a href="https://treeherder.mozilla.org/">Treeherder</a> format</td>
</tr>
<tr>
<td><code>--times NUMBER</code></td>
<td>
<p>Run tests NUMBER of times:</p>
<pre class="brush: bash">
jpm test --times 2</pre>
</td>
</tr>
<tr>
<td><code>-v --verbose</code></td>
<td>Verbose operation.</td>
</tr>
<tr>
<td><code>--no-copy</code></td>
<td>
<div class="warning">Use with caution because <code>jpm run|test</code> changes many preferences, never use with your main profile.</div>
<div class="note">This only applies when <code>--profile</code> is used.</div>
Disables the copying of the profile used, which allows one to reuse a profile.</td>
</tr>
</tbody>
</table>
<h3 id="jpm_xpi">jpm xpi</h3>
<p>Эта команда собирает дополнение в пакет XPI. Это формат дополнений, которые можно легко установить Mozilla.</p>
<pre class="brush: bash">jpm xpi</pre>
<p>It looks for a file called <code>package.json</code> in the current directory and creates the corresponding XPI file. It ignores any ZIPs or XPIs in the add-on's root, and any test files.</p>
<p>Once you have built an XPI file you can distribute your add-on by submitting it to <a href="http://addons.mozilla.org">addons.mozilla.org</a>.</p>
<p><code>jpm xpi</code> accepts the following option:</p>
<table class="fullwidth-table standard-table">
<tbody>
<tr>
<td><code>-v --verbose</code></td>
<td>
<p>Verbose operation:</p>
<pre class="brush: bash">
jpm xpi -v</pre>
</td>
</tr>
</tbody>
</table>
<h3 id="jpm_post">jpm post</h3>
<p>This command packages the add-on as an <a href="https://developer.mozilla.org/en/XPI">XPI</a> file, the posts it to some url.</p>
<pre class="brush: bash">jpm post</pre>
<p>It looks for a file called <code>package.json</code> in the current directory and creates a XPI file with which to post to the <code>--post-url</code>.</p>
<p><code>jpm post</code> accepts the following options:</p>
<table class="fullwidth-table standard-table">
<tbody>
<tr>
<td><code>--post-url URL</code></td>
<td>
<p>The url to post the extension to after creating a XPI.</p>
<pre class="brush: bash">
jpm post --post-url http://localhost:8888/</pre>
<p>See <a href="https://www.npmjs.com/package/jpm#using-post-and-watchpost">Using Post and Watchpost</a> for more information.</p>
</td>
</tr>
<tr>
<td><code>-v --verbose</code></td>
<td>
<p>Verbose operation:</p>
<pre class="brush: bash">
jpm post --post-url http://localhost:8888/ -v</pre>
</td>
</tr>
</tbody>
</table>
<h3 id="jpm_watchpost">jpm watchpost</h3>
<p>This command packages the add-on as an <a href="https://developer.mozilla.org/en/XPI">XPI</a> file, the posts it to some url whenever a file in the current working directory changes.</p>
<pre class="brush: bash">jpm watchpost</pre>
<p>Creates a XPI whenever a file in the current working directory changes and posts that to the <code>--post-url</code>.</p>
<p><code>jpm watchpost</code> accepts the following options:</p>
<table class="fullwidth-table standard-table">
<tbody>
<tr>
<td><code>--post-url URL</code></td>
<td>
<p>The url to post the extension to after creating a XPI.</p>
<pre class="brush: bash">
jpm watchpost --post-url http://localhost:8888/</pre>
<p>See <a href="https://www.npmjs.com/package/jpm#using-post-and-watchpost">Using Post and Watchpost</a> for more information.</p>
</td>
</tr>
<tr>
<td><code>-v --verbose</code></td>
<td>
<p>Verbose operation:</p>
<pre class="brush: bash">
jpm watchpost --post-url http://localhost:8888/ -v</pre>
</td>
</tr>
</tbody>
</table>
<h2 id="Techniques">Techniques</h2>
<h3 id="Selecting_a_browser_version">Selecting a browser version</h3>
<p>By default, <code>jpm run</code> and <code>jpm test</code> will run the release version of Firefox. You can instruct jpm to use a different version in one of two ways:</p>
<ul>
<li>
<p>you can use the <code>-b</code> or <code>--binary</code> option to instruct jpm to run a different version of Firefox. You can supply a path to a specific binary:</p>
<pre class="brush: bash">jpm run -b /path/to/Firefox/Nightly</pre>
<p>As a shorthand for this, you can pass "nightly", "aurora", "beta", or "firefox" and jpm will look in the default location for these Firefox versions:</p>
<pre class="brush: bash">jpm run -b nightly</pre>
</li>
<li>
<p>you can set the <code>JPM_FIREFOX_BINARY</code> environment variable with the path to the version of Firefox you want to run. When you invoke <code>jpm run</code> or <code>jpm test</code> without the <code>-b</code> option, jpm will first check <code>JPM_FIREFOX_BINARY</code>, and use this as the path if it is set.</p>
</li>
</ul>
<h3 id="Using_.jpmignore_to_ignore_files">Using <code>.jpmignore</code> to ignore files</h3>
<p>Using <code>.jpmignore</code> is similar to using <code>.gitignore</code> with <code>git</code>, <code>.hgignore</code> with Mercurial, or <code>.npmignore</code> with <code>npm</code>. By using this file you can let <code>jpm</code> know which files you would like it to ignore when building a <code>.xpi</code> file with <code>jpm xpi</code>.</p>
<p>Here is an example:</p>
<pre class="brush: bash"># Ignore .DS_Store files created by mac
.DS_Store
# Ignore any zip or xpi files
*.zip
*.xpi
</pre>
<p>A <code>.jpmignore</code> file with the above contents would ignore all zip files and <code>.DS_Store</code> files from the xpi generated by <code>jpm xpi</code>.</p>
<h3 id="Using_profiles_2"><a name="Using_profiles">Using profiles</a></h3>
<p>By default, <code>jpm run</code> uses a new profile each time it is executed. This means that any profile-specific data entered from one run of <code>jpm</code> will not, by default, be available in the next run.</p>
<p>This includes, for example, any extra add-ons you installed, or your history, or any data stored using the <a href="/en-US/Add-ons/SDK/High-Level_APIs/simple-storage">simple-storage</a> API.</p>
<p>To make <code>jpm</code> use a specific profile, pass the <code>--profile</code> option, specifying the name of the profile you wish to use, or the path to the profile.</p>
<pre class="brush: bash">jpm run --profile boogaloo
</pre>
<pre class="brush: bash">jpm run --profile path/to/boogaloo</pre>
<p>If you supply <code>--profile</code> but its argument is not the name of or path to an existing profile, jpm will open the <a href="https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles">profile manager</a>, enabling you to select and existing profile or create a new one:</p>
<pre class="brush: bash">jpm run --profile i-dont-exist</pre>
<h3 id="Developing_without_browser_restarts">Developing without browser restarts</h3>
<p>Because <code>jpm run</code> restarts the browser each time you invoke it, it can be a little cumbersome if you are making very frequent changes to an add-on. An alternative development model is to use the <a href="https://addons.mozilla.org/en-US/firefox/addon/autoinstaller/" rel="noreferrer">Extension Auto-Installer</a> add-on: this listens for new XPI files on a specified port and installs them automatically. That way you can test new changes without needing to restart the browser:</p>
<ul>
<li>make a change to your add-on</li>
<li>run <code>jpm post --post-url http://localhost:8888/</code>, to make a xpi and post it.</li>
</ul>
<p>You could even automate this workflow with a simple script. For example:</p>
<pre class="brush: bash">jpm watchpost --post-url http://localhost:8888/
</pre>
<p>Note that the logging level defined for the console is different when you use this method, compared to the logging level used when an add-on is run using <code>jpm run</code>. This means that if you want to see output from <a href="/en-US/Add-ons/SDK/Tutorials/Logging" rel="noreferrer"><code>console.log()</code></a> messages, you'll have to tweak a setting. See the documentation on <a href="/en-US/Add-ons/SDK/Tools/console#Logging_Levels" rel="noreferrer">logging levels</a> for the details on this.</p>
<h3 id="Overloading_the_built-in_modules">Overloading the built-in modules</h3>
<p>The SDK modules you use to implement your add-on are built into Firefox. When you run or package an add-on using <code>jpm run</code> or <code>jpm xpi</code>, the add-on will use the versions of the modules in the version of Firefox that hosts it.</p>
<p>As an add-on developer, this is usually what you want. But if you're developing the SDK modules themselves, of course, it isn't. In this case you need to:</p>
<ul>
<li>get a local copy of the SDK modules that you want: this usually means checking out the SDK from its <a href="https://github.com/mozilla/addon-sdk" rel="noreferrer">GitHub repo</a></li>
<li>set the <code>JETPACK_ROOT</code> environment variable to your local copy</li>
<li>pass the <code>-o</code> option to <code>jpm run</code> or <code>jpm xpi</code>:</li>
</ul>
<pre>jpm run -o
</pre>
<p>This instructs jpm to use the local copies of the SDK modules, not the ones in Firefox. If you don't want to set the <code>JETPACK_ROOT</code> environment variable, you can pass the location of your copy of the SDK modules along with <code>-o</code>:</p>
<pre>jpm run -o "/path/to/SDK/"</pre>
|