2015-04-15 20:36:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								All of our npm dependencies are locked via the `npm-shrinkwrap.json`  file for the following reasons:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  our project has lots of dependencies which update at unpredictable times, so it's important that 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  we update them explicitly once in a while rather than implicitly when any of us runs npm install
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								-  locked dependencies allow us to do reuse npm cache on travis, significantly speeding up our builds 
						 
					
						
							
								
									
										
										
										
											2016-01-02 21:47:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  (by 5 minutes or more)
							 
						 
					
						
							
								
									
										
										
										
											2015-04-15 20:36:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								-  locked dependencies allow us to detect when node_modules folder is out of date after a branch switch 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  which allows us to build the project with the correct dependencies every time
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-01-02 21:47:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								We also generate `npm-shrinkwrap.clean.js`  file which is used during code reviews or debugging to easily review what has actually changed without extra noise.
							 
						 
					
						
							
								
									
										
										
										
											2015-04-15 20:36:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								To add a new dependency do the following:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-21 10:33:27 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								1.  if you are on linux or windows, then use MacOS or ask someone with MacOS to perform the  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   installation. This is due to an optional `fsevents`  dependency that is really required on MacOS 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   to get good performance from file watching.
							 
						 
					
						
							
								
									
										
										
										
											2015-05-21 23:11:10 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								2.  make sure you are in sync with `upstream/master`  
						 
					
						
							
								
									
										
										
										
											2016-01-02 21:47:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								3.  ensure that your `node_modules`  directory is not stale by running `npm install`  
						 
					
						
							
								
									
										
										
										
											2015-06-04 10:10:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								4.  add a new dependency via `npm install --save-dev <packagename>`  
						 
					
						
							
								
									
										
										
										
											2016-01-02 21:47:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								5.  run `./tools/npm/reshrinkwrap`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								6.  these steps should change 3 files: `package.json` , `npm-shrinkwrap.json`  and `npm-shrinkwrap.clean.json`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								7.  commit changes to these three files and you are done 
						 
					
						
							
								
									
										
										
										
											2015-04-15 20:36:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								To update existing dependency do the following:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-21 10:33:27 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								1.  if you are on linux or windows, then use MacOS or ask someone with MacOS to perform the  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   installation. This is due to an optional `fsevents`  dependency that is really required on MacOS 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   to get good performance from file watching.
							 
						 
					
						
							
								
									
										
										
										
											2015-05-21 23:11:10 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								2.  make sure you are in sync with `upstream/master` : `git fetch upstream && git rebase upstream/master`  
						 
					
						
							
								
									
										
										
										
											2016-01-02 21:47:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								3.  ensure that your `node_modules`  directory is not stale by running `npm install`  
						 
					
						
							
								
									
										
										
										
											2015-08-21 10:33:27 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								4.  run `npm install --save-dev <packagename>@<version|latest>`  or `npm update <packagename>`  to  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   update to the latest version that matches version constraint in `package.json` 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-02 21:47:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								5.  run `./tools/npm/reshrinkwrap`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								6.  these steps should change 2 files: `npm-shrinkwrap.json`  and `npm-shrinkwrap.clean.json` . 
						 
					
						
							
								
									
										
										
										
											2015-08-21 10:33:27 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   Optionally if you used `npm install ...`  in the first step, `package.json`  might be modified as 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   well.
							 
						 
					
						
							
								
									
										
										
										
											2016-01-02 21:47:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								7.  commit changes to these three files and you are done 
						 
					
						
							
								
									
										
										
										
											2015-04-15 20:36:02 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-04 10:10:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								To Remove an existing dependency do the following:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-21 10:33:27 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								1.  if you are on linux or windows, then use MacOS or ask someone with MacOS to perform the  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   installation. This is due to an optional `fsevents`  dependency that is really required on MacOS 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   to get good performance from file watching.
							 
						 
					
						
							
								
									
										
										
										
											2015-06-04 10:10:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								2.  make sure you are in sync with `upstream/master` : `git fetch upstream && git rebase upstream/master`  
						 
					
						
							
								
									
										
										
										
											2016-01-02 21:47:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								3.  ensure that your `node_modules`  directory is not stale by running `npm install`  
						 
					
						
							
								
									
										
										
										
											2015-06-04 10:10:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								4.  run `npm uninstall --save-dev <packagename>@<version|latest>`  
						 
					
						
							
								
									
										
										
										
											2016-01-02 21:47:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								5.  run `./tools/npm/reshrinkwrap`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								6.  these steps should change 3 files: `npm-shrinkwrap.json`  and `npm-shrinkwrap.clean.json` . 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								7.  commit changes to these three files and you are done