~hatch/juju-gui/browser-fix-1217060

357.1.3 by Nicola Larosa
Improve Makefile targets, link the code doc from the main doc.
1
.. Run "make view-main-doc" to render this file and read it in the browser
2
   alongside the whole project documentation. To do this, you need the
3
   dependencies described in the "Documentation" section below.
357.1.2 by Nicola Larosa
Implement suggestions from Gary's review.
4
322.2.1 by Nicola Larosa
Add python-yaml to the doc requisites, some doc clarification.
5
=======
6
HACKING
7
=======
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
8
274.1.4 by Nicola Larosa
Add text to README, fix links and other text.
9
Here is how to develop on this codebase.
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
10
11
Developer Install
12
=================
13
379.1.3 by Jeff Pihach
added in changes from latest review
14
Before you get the GUI you need to get Juju. We use the fresh one from the Juju
15
PPA. For PyJuju, the original Python-based implementation, we also use a custom
16
branch of Juju that supplies the websocket API we need.  (GoJuju, the newer
17
Go-based implementation, will have a websocket API provided for us directly as
18
part of the software.)
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
19
20
::
21
379.1.2 by Jeff Pihach
added in requested changes from review and added in section
22
  sudo add-apt-repository ppa:juju/pkgs
23
  sudo apt-get update
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
24
  sudo apt-get install juju zookeeper
25
26
Next you will also need to get the Juju branch that has API access.
27
Currently that work resides in a pipeline of Juju branches. The
28
recommended branch to use as a server is ``rapi-rollup`` by hazmat::
29
30
  bzr branch lp:~hazmat/juju/rapi-rollup
31
32
For development, we always use a nice testing script in that branch that
33
allows you to interact with Juju without actually deploying real machines.  In
34
the rapi-rollup branch, run ``python improv.py -h`` to get an idea of its
35
capabilities.  Note that your Python needs Twisted and Zookeeper installed,
36
but the ``sudo apt-get install juju zookeeper`` command above should have
37
already taken care of that for you.
38
346.3.2 by Gary Poster
respond to review
39
Go ahead and use the branch's ``sample.json`` file to pre-populate the
40
environment.  In the future, you might want to investigate the ``large.json``
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
41
also available there.
42
43
::
44
45
  python improv.py -f sample.json
46
533.4.5 by Nicola Larosa
Add the generated npm-shrinkwrap.json file, add docs to the HACKING file, tweak the package.json file some more.
47
Now it is time to actually get the GUI itself set up.  Juju GUI uses
48
nodejs-based development tools, so you will need ``nodejs`` from Chris
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
49
Lea's node PPA. You also need ImageMagick for sprite generation, lbox to
346.3.2 by Gary Poster
respond to review
50
propose branches, python-sphinx and python-yaml to build docs, PyTZ to make
379.1.2 by Jeff Pihach
added in requested changes from review and added in section
51
releases, python-shelltoolbox and python-selenium for browser tests, and
52
python-virtualenv to build the Google Closure linter tools locally::
314.2.1 by Nicola Larosa
Reformat and revise docs.
53
54
  sudo add-apt-repository ppa:chris-lea/node.js
379.1.1 by Jeff Pihach
added missing PPA's and packages
55
  sudo add-apt-repository ppa:gophers/go
314.2.1 by Nicola Larosa
Reformat and revise docs.
56
  sudo apt-get update
533.4.9 by Nicola Larosa
Fix wrapping of one doc line.
57
  sudo apt-get install nodejs imagemagick lbox python-sphinx python-yaml \
678.4.2 by Benji York
checkpoint
58
    python-tz python-virtualenv python-shelltoolbox python-selenium \
678.4.6 by Benji York
add dependency
59
    python-tornado python-gflags
379.1.2 by Jeff Pihach
added in requested changes from review and added in section
60
685.2.1 by Nicola Larosa
Review main docs and doc comments.
61
See :ref:`Browser Testing <browser-testing>` if you are curious about the
62
reason for ``python-shelltoolbox`` and ``python-selenium``.
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
63
64
The jshint linter will be installed locally per branch, but if you want editor
65
integration, you may want to install ``jshint`` globally in your system.  More
685.2.1 by Nicola Larosa
Review main docs and doc comments.
66
importantly, to support testing from the command line, ``phantomjs`` and
67
``mocha-phantomjs`` should be installed globally.
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
68
69
::
70
899.1.1 by Jeff Pihach
added version numbers to the mocha npm deps to avoid version missmatch issues with mocha.js
71
  sudo npm install -g jshint@2.1.3 mocha-phantomjs@2.0.0 phantomjs@1.9.1-0
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
72
385.3.3 by Rick Harding
Update hacking with note about not using .deb phantomjs
73
Note: Make sure to get the latest phantomjs from npm and not rely on an older
74
.deb packaged version. mocha-phantomjs will fail silently when running.
75
346.3.2 by Gary Poster
respond to review
76
If you receive an error installing phantomjs, you can manually download and
685.2.1 by Nicola Larosa
Review main docs and doc comments.
77
unpack the archive and then arrange for the ``phantomjs`` executable to be
346.3.2 by Gary Poster
respond to review
78
located on your path (e.g., by linking it into ``~/bin``).
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
79
80
The Juju GUI can now be installed and run with::
314.2.1 by Nicola Larosa
Reformat and revise docs.
81
82
  bzr branch lp:juju-gui trunk
83
  cd trunk
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
84
  make devel
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
85
86
It may take a while for the server to start the first time as npm will
314.2.1 by Nicola Larosa
Reformat and revise docs.
87
need to download packages.  When ready, the server will print::
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
88
314.2.1 by Nicola Larosa
Reformat and revise docs.
89
  Server listening on 8888
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
90
274.1.4 by Nicola Larosa
Add text to README, fix links and other text.
91
You can then access the GUI at <http://localhost:8888/>.
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
92
388.1.2 by Jeff Pihach
Added review changes
93
If you receive an error like::
388.1.1 by Jeff Pihach
restricted grunt to 0.3.17 and added possible sollution to ENOSPC error in HACKING
94
95
  fs.js:837
96
     throw errnoException(errno, 'watch');
97
           ^
98
  Error: watch ENOSPC
99
391.2.5 by Matthew Scott
Minor from review.
100
You can increase your watch limit by creating or editing::
391.2.1 by Matthew Scott
Docs updated with AppCache info; make appcache-force touches index.html too
101
388.1.1 by Jeff Pihach
restricted grunt to 0.3.17 and added possible sollution to ENOSPC error in HACKING
102
  /etc/sysctl.d/10-inotify.conf
103
388.1.2 by Jeff Pihach
Added review changes
104
Add in the following::
391.2.1 by Matthew Scott
Docs updated with AppCache info; make appcache-force touches index.html too
105
388.1.1 by Jeff Pihach
restricted grunt to 0.3.17 and added possible sollution to ENOSPC error in HACKING
106
  # expand inotify limit
107
  fs.inotify.max_user_watches=16384
108
388.1.2 by Jeff Pihach
Added review changes
109
Then::
391.2.1 by Matthew Scott
Docs updated with AppCache info; make appcache-force touches index.html too
110
388.1.2 by Jeff Pihach
Added review changes
111
  sudo sysctl -p
112
  cat /proc/sys/fs/inotify/max_user_watches
113
685.2.1 by Nicola Larosa
Review main docs and doc comments.
114
If it does not echo ``16384`` then you will need to restart.
388.1.1 by Jeff Pihach
restricted grunt to 0.3.17 and added possible sollution to ENOSPC error in HACKING
115
346.3.2 by Gary Poster
respond to review
116
Note that the Makefile supports ``make help`` to try to introduce some of the
117
more important targets.  Also note that if you use the "make prod" target
685.2.1 by Nicola Larosa
Review main docs and doc comments.
118
while using the PyJuju ``rapi-rollup`` improv script, the password you should
119
use is "admin," despite the help text you see.
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
120
379.1.2 by Jeff Pihach
added in requested changes from review and added in section
121
Typical Bzr workflow
122
=====================
123
379.1.3 by Jeff Pihach
added in changes from latest review
124
Bazaar allows you to work in a lot of different workflows. Here is one that
125
works well for our environemnt, if you are not already familiar with bzr.
379.1.2 by Jeff Pihach
added in requested changes from review and added in section
126
127
To set up the environment::
128
391.2.1 by Matthew Scott
Docs updated with AppCache info; make appcache-force touches index.html too
129
  bzr init-repo juju-gui
130
  cd juju-gui
131
  bzr branch lp:juju-gui trunk
132
  mkdir yourUseName
133
  bzr branch trunk/{featureBranchName}
379.1.2 by Jeff Pihach
added in requested changes from review and added in section
134
135
To link branch to ticket::
136
391.2.1 by Matthew Scott
Docs updated with AppCache info; make appcache-force touches index.html too
137
  bzr commit --fixes=lp:{ticketNumber}
379.1.2 by Jeff Pihach
added in requested changes from review and added in section
138
139
To push code::
140
391.2.1 by Matthew Scott
Docs updated with AppCache info; make appcache-force touches index.html too
141
  bzr push lp:~{yourUserName}/juju-gui/{featureBranchName}
379.1.2 by Jeff Pihach
added in requested changes from review and added in section
142
143
To submit for review::
144
391.2.1 by Matthew Scott
Docs updated with AppCache info; make appcache-force touches index.html too
145
  lbox propose -cr
379.1.2 by Jeff Pihach
added in requested changes from review and added in section
146
147
After review, to merge into trunk::
148
391.2.1 by Matthew Scott
Docs updated with AppCache info; make appcache-force touches index.html too
149
  lbox submit
379.1.2 by Jeff Pihach
added in requested changes from review and added in section
150
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
151
Working with a Real Juju
152
========================
153
154
The easiest way to work with a real Juju installation, as opposed to the
685.2.1 by Nicola Larosa
Review main docs and doc comments.
155
``improv`` script described above, is to use the Juju charm.  See
357.1.1 by Nicola Larosa
Improve API docs, add metadoc to the style guide.
156
<http://jujucharms.com/~juju-gui/precise/juju-gui> or
157
<http://jujucharms.com/charms/precise/juju-gui> for details.
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
158
159
Alternatively, you can try the instructions below, but be warned that they
346.3.2 by Gary Poster
respond to review
160
have bit-rotted and we have not felt the need to update them.  If you get them
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
161
to work, please update the docs and submit a branch for review (see below).
162
163
Bit-Rotted Instructions
164
-----------------------
165
166
You can use the GUI with any environment, but for development purposes, a
167
local environment works well. One environment option specific to this branch
314.2.1 by Nicola Larosa
Reformat and revise docs.
168
is the ``api-port``. An appropriate sample configuration::
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
169
170
  default: dev
171
  environments:
172
    dev:
173
      type: local
174
      data-dir: /home/kapil/.juju/local
175
      admin-secret: b3a5dee4fb8c4fc9a4db04751e5936f4
176
      default-series: precise
177
      juju-origin: ppa
178
      api-port: 8081
179
314.2.1 by Nicola Larosa
Reformat and revise docs.
180
Note that ``juju-origin`` is set to the PPA, the API server runs outside of
181
the container, and it is launched using whichever branch you are using.
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
182
685.2.1 by Nicola Larosa
Review main docs and doc comments.
183
Also note that the ``api-port`` should be set at ``8081``, which the GUI's
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
184
initial environment connection currently defaults to.
185
314.2.1 by Nicola Larosa
Reformat and revise docs.
186
You will need to bootstrap the local environment, and deploy one service.
187
The API server needs access to the provisioning credentials which are
188
lazily initialized in Juju upon usage.
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
189
314.2.1 by Nicola Larosa
Reformat and revise docs.
190
``Juju-gui`` and ``rapi-rollup`` can communicate via an encrypted WebSocket
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
191
connection: to enable it, add the following line to the config above::
192
193
  api-secure: true
194
317.1.1 by Nicola Larosa
Revise the project documentation text.
195
You will also need to edit ``app/config-debug.js`` and ``app/config-prod.js``
196
replacing ``ws://localhost:8081/ws`` with ``wss://localhost:8081/ws``.
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
197
314.2.1 by Nicola Larosa
Reformat and revise docs.
198
By default, ``rapi-rollup`` uses a self-signed certificate; because of that you
199
will need to visit the <https://localhost:8081/ws> WebSocket URL with your
200
browser and accept the included self-signed certificate, or the WebSocket
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
201
encrypted connection will not work.
202
314.2.1 by Nicola Larosa
Reformat and revise docs.
203
In order to use a different certificate you add an ``api-keys`` option to the
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
204
config above: its value will be the path of the directory containing the
205
certificate and the private key, whose filenames will have to be respectively
206
``juju.crt`` and ``juju.key``.
207
314.2.1 by Nicola Larosa
Reformat and revise docs.
208
After this, the GUI should be functional (it automatically polls the
209
API server for establishing a websocket).
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
210
274.1.6 by Nicola Larosa
Revert capitalization changes, make new capitalization changes, add 'sphinx' target to Makefile.
211
Running Unit Tests
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
212
==================
213
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
214
``make test-prod`` or ``make test-debug`` will run the CLI based test
346.3.2 by Gary Poster
respond to review
215
runner. If you need to debug a test in the browser, use ``make test-server``.
340.1.2 by Benjamin Saller
Allow for a test server, doc it and the deps
216
274.1.6 by Nicola Larosa
Revert capitalization changes, make new capitalization changes, add 'sphinx' target to Makefile.
217
Running Lint
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
218
============
219
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
220
Run the linters with ``make lint``.  ``make beautify`` will use the Google
221
Closure tools to try and force the code to conform to some of the guidelines,
346.3.2 by Gary Poster
respond to review
222
with variable success.  It can help, but we suggest you first commit your code
223
to your branch and only then run make beautify, so you can easily see and
224
evaluate the changes it made.
225
226
If you have done a large refactoring and the yuidoc linter complains about a
227
lot of code that no longer exists or has been moved or renamed, note that
228
``make undocumented`` can reproduce the undocumented file so as to quiet the
229
linter. If you need to do this, please make sure that the length (``wc -l``)
230
of the new "undocumented" file is the same or smaller than it was before.
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
231
322.2.1 by Nicola Larosa
Add python-yaml to the doc requisites, some doc clarification.
232
.. _all-docs:
233
234
Documentation
235
=============
236
237
The ``make docs`` command generates the code and the project documentation
533.4.5 by Nicola Larosa
Add the generated npm-shrinkwrap.json file, add docs to the HACKING file, tweak the package.json file some more.
238
together. The ``make view-docs`` command does the above and also opens both
239
docs in the browser.
322.2.1 by Nicola Larosa
Add python-yaml to the doc requisites, some doc clarification.
240
241
Code Documentation
242
------------------
243
533.4.5 by Nicola Larosa
Add the generated npm-shrinkwrap.json file, add docs to the HACKING file, tweak the package.json file some more.
244
Generated documentation for the JavaScript code is available in the ``yuidoc/``
346.3.2 by Gary Poster
respond to review
245
directory.  You can build and view the docs by running::
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
246
533.4.5 by Nicola Larosa
Add the generated npm-shrinkwrap.json file, add docs to the HACKING file, tweak the package.json file some more.
247
  make view-code-doc
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
248
357.1.1 by Nicola Larosa
Improve API docs, add metadoc to the style guide.
249
See the :ref:`style guide <embedded-docs>` document for details on how to
250
write the embedded documentation.
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
251
274.1.6 by Nicola Larosa
Revert capitalization changes, make new capitalization changes, add 'sphinx' target to Makefile.
252
Project Documentation
322.2.1 by Nicola Larosa
Add python-yaml to the doc requisites, some doc clarification.
253
---------------------
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
254
346.3.2 by Gary Poster
respond to review
255
The project documentation is available in the ``docs/`` directory. As already
256
mentioned in the developer installation instructions above, it needs Sphinx
257
and Python-yaml.  To build and view the documentation, use these commands::
258
533.4.5 by Nicola Larosa
Add the generated npm-shrinkwrap.json file, add docs to the HACKING file, tweak the package.json file some more.
259
  make view-main-doc
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
260
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
261
Filing Bugs
262
===========
263
264
Please file bugs here:
265
266
https://bugs.launchpad.net/juju-gui/+filebug
267
268
Proposing Branches
269
==================
270
271
We use ``lbox`` to propose branches for review and submit them to the trunk.
685.2.1 by Nicola Larosa
Review main docs and doc comments.
272
Gustavo Niemeyer has `a helpful blogpost`_ about this tool.  See the
273
:ref:`Process document <preparing-reviews>` for a step-by-step checklist on how
274
to prepare branches for review.
346.3.2 by Gary Poster
respond to review
275
276
.. _`a helpful blogpost`:
277
    http://blog.labix.org/2011/11/17/launchpad-rietveld-happycodereviews
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
278
279
Making Targets Quickly Without Bazaar
280
=====================================
281
282
Within a checkout, a lightweight checkout, or a branch, you may run make as
283
``NO_BZR=1 make [target]`` in order to prevent the Makefile from running any
284
Bazaar commands, all of which access the parent branch over the network. Where
285
Bazaar may have provided information such as the revno, sensible defaults are
286
used instead.  Because many of these Bazaar commands are used to populate
287
variables regardless of the target, defining NO_BZR will have an effect on all
288
targets, except ``dist``, which will refuse to complete.
289
290
Note that this allows one to run any make target from the working copy, even
291
if it is a lightweight checkout, by skipping steps that involve network access
292
through Bazaar.  Because of this, make will assume that the revno is
293
0 and that the branch is clean and up to date without checking that it is a
294
checkout of trunk.  The resulting tarball or build may be used to test
295
releases by hand or in the charm.
296
274.1.6 by Nicola Larosa
Revert capitalization changes, make new capitalization changes, add 'sphinx' target to Makefile.
297
Making Releases
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
298
===============
299
685.2.1 by Nicola Larosa
Review main docs and doc comments.
300
See the :ref:`Process document <make-releases>` for step-by-step checklists to
301
make developer and stable releases.  The following is additional detail and an
302
overview.
346.3.1 by Gary Poster
Make some doc changes to try to help developers. The most important change was to introduce improv.
303
314.2.1 by Nicola Larosa
Reformat and revise docs.
304
To make a release, you must either be in a checkout of ``lp:juju-gui``
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
305
without uncommitted changes, or you must override one of the
306
`pertinent variable names`_ to force a release.
307
314.2.4 by Nicola Larosa
Fixes as per reviews.
308
.. _`pertinent variable names`:
309
    `Potentially Useful Release-Oriented Makefile Variables`_
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
310
314.2.1 by Nicola Larosa
Reformat and revise docs.
311
To make the release tarball use ``make distfile``.
312
313
In order to make and upload the release (``make dist``), you also need to have
314
a GPG key, and the ``python-pytz`` package installed (as well as
315
``launchpadlib``, but that is installed by default in Ubuntu).
316
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
317
Potentially Useful Release-Oriented Makefile Variables
318
------------------------------------------------------
319
320
The following is a list of pertinent Makefile variables.
321
314.2.1 by Nicola Larosa
Reformat and revise docs.
322
``FINAL``
323
  Set ``FINAL`` to any non-empty value to make a final release. This will cause
324
  the ``bzr revno`` to be omitted from the tarball name, and (if you use the
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
325
  release target) will cause the release to be uploaded to the stable series
326
  rather than the trunk series. Example usage::
327
314.2.1 by Nicola Larosa
Reformat and revise docs.
328
    FINAL=1 make dist
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
329
314.2.1 by Nicola Larosa
Reformat and revise docs.
330
``PROD``
331
  By default, releases will be uploaded to ``staging.launchpad.net``, which is
332
  a separate version of Launchpad that uses a temporary database.  This can be
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
333
  convenient for trying out the release process in the Makefile without
314.2.1 by Nicola Larosa
Reformat and revise docs.
334
  affecting our actual production releases.  Set ``PROD`` to any non-empty
335
  value to send uploads to ``launchpad.net``, the production version of
336
  Launchpad, when you are ready to make a real release.
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
337
338
  Note that you may need to ask the webops to turn off the two-factor
339
  authentication on your Launchpad staging account in order for the staging to
314.2.1 by Nicola Larosa
Reformat and revise docs.
340
  work. Go to the ``#launchpad-ops`` channel on the Canonical IRC server and
341
  ask something like "webops, could you disable 2FA on my staging account?".
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
342
343
  Example usage::
344
314.2.1 by Nicola Larosa
Reformat and revise docs.
345
    PROD=1 make dist
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
346
314.2.1 by Nicola Larosa
Reformat and revise docs.
347
``IS_TRUNK_BRANCH``
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
348
  Set this to any non-empty value to force the Makefile to believe it is
349
  working with a trunk checkout. Example usage::
350
314.2.1 by Nicola Larosa
Reformat and revise docs.
351
    IS_TRUNK_BRANCH=1 make dist
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
352
314.2.1 by Nicola Larosa
Reformat and revise docs.
353
``BRANCH_IS_CLEAN``
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
354
  Set this to any non-empty value to force the Makefile to believe that the
355
  current code tree has no changes. Example usage::
356
314.2.1 by Nicola Larosa
Reformat and revise docs.
357
    BRANCH_IS_CLEAN=1 make dist
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
358
314.2.1 by Nicola Larosa
Reformat and revise docs.
359
``BRANCH_IS_GOOD``
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
360
  Set this to any non-empty value to force the Makefile to bypass checks of
314.2.1 by Nicola Larosa
Reformat and revise docs.
361
  ``IS_TRUNK_BRANCH`` and ``BRANCH_IS_CLEAN``. Example usage::
274.1.1 by Nicola Larosa
Move the hacking doc from README to HACKING, updating it.
362
314.2.1 by Nicola Larosa
Reformat and revise docs.
363
    BRANCH_IS_GOOD=1 make dist
533.4.5 by Nicola Larosa
Add the generated npm-shrinkwrap.json file, add docs to the HACKING file, tweak the package.json file some more.
364
365
Updating the ``nodejs`` dependencies
366
====================================
367
368
The ranges of allowed versions for the ``nodejs`` dependency packages are
369
specified in the top-level ``package.json`` file. However, the actual installed
370
versions are frozen in the top-level ``npm-shrinkwap.json`` file, which
371
overrides the former.
372
373
The ``npm-shrinkwap.json`` file is generated by the ``npm shrinkwrap`` command
374
(see `shrinkwrap - Lock down dependency versions`_) on the basis of the
375
packages currently installed by any of the ``make build-[something]`` commands.
376
377
The procedure for updating the dependency versions is described in the
378
`Building shrinkwrapped packages`_ section of the aforementioned document. In
379
a nutshell:
380
381
1) review the ``package.json`` file and see whether any constraints may be
382
   updated, in order to allow using newer package versions;
383
2) delete the ``npm-shrinkwrap.json`` file;
384
3) run ``make``, getting all new dependencies;
385
4) check that everything works well;
386
387
If everything is fine, regenerate the ``npm-shrinkwap.json`` file by running
388
the ``npm shrinkwrap`` command.
389
390
If something is broken find the culprit, adjust the ``package.json`` file
391
accordingly, and go back to step #3.
392
393
Alternatively, you might use the ``npm outdated`` command to get the update
394
candidates, and do the job one step at a time rather than all at once.
395
396
.. _`shrinkwrap - Lock down dependency versions`:
397
    https://npmjs.org/doc/shrinkwrap.html
398
.. _`Building shrinkwrapped packages`:
399
    https://npmjs.org/doc/shrinkwrap.html#Building-shrinkwrapped-packages