29. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/24/2017 6:38:26 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

29.1 Files compared

# Location File Last Modified
1 CHAMP_VA1.zip\CHAMP_VA1\node_modules\gulp-nodemon\node_modules\nodemon\node_modules\chokidar\node_modules\fsevents\node_modules\node-pre-gyp README.md Mon Oct 16 21:06:50 2017 UTC
2 CHAMP_VA1.zip\CHAMP_VA1\node_modules\gulp-nodemon\node_modules\nodemon\node_modules\chokidar\node_modules\fsevents\node_modules\node-pre-gyp README.md Mon Oct 23 19:34:43 2017 UTC

29.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 1166
Changed 2 4
Inserted 0 0
Removed 0 0

29.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

29.4 Active regular expressions

No regular expressions were active.

29.5 Comparison detail

  1   # node-pre -gyp
  2  
  3   #### node- pre-gyp ma kes it eas y to publi sh and ins tall Node. js C++ add ons from b inaries
  4  
  5   [![NPM](ht tps://node i.co/npm/n ode-pre-gy p.png?down loads=true &downloadR ank=true)] (https://n odei.co/np m/node-pre -gyp/)
  6  
  7   [![Build S tatus](htt ps://api.t ravis-ci.o rg/mapbox/ node-pre-g yp.svg)](h ttps://tra vis-ci.org /mapbox/no de-pre-gyp )
  8   [![Build s tatus](htt ps://ci.ap pveyor.com /api/proje cts/status /3nxewb425 y83c0gv)]( https://ci .appveyor. com/projec t/Mapbox/n ode-pre-gy p)
  9   [![Depende ncies](htt ps://david -dm.org/ma pbox/node- pre-gyp.sv g)](https: //david-dm .org/mapbo x/node-pre -gyp)
  10  
  11   `node-pre- gyp` stand s between  [npm](http s://github .com/npm/n pm) and [n ode-gyp](h ttps://git hub.com/To otallnate/ node-gyp)  and offers  a cross-p latform me thod of bi nary deplo yment.
  12  
  13   ### Featur es
  14  
  15    - A comma nd line to ol called  `node-pre- gyp` that  can instal l your pac kage's C++  module fr om a binar y.
  16    - A varie ty of deve loper targ eted comma nds for pa ckaging, t esting, an d publishi ng binarie s.
  17    - A JavaS cript modu le that ca n dynamica lly requir e your ins talled bin ary: `requ ire('node- pre-gyp'). find`
  18  
  19   For a hell o world ex ample of a  module pa ckaged wit h `node-pr e-gyp` see  <https:// github.com /springmey er/node-ad don-exampl e> and [th e wiki ](h ttps://git hub.com/ma pbox/node- pre-gyp/wi ki/Modules -using-nod e-pre-gyp)  for real  world exam ples.
  20  
  21   ## Credits
  22  
  23    - The mod ule is mod eled after  [node-gyp ](https:// github.com /Tootallna te/node-gy p) by [@To otallnate] (https://g ithub.com/ Tootallnat e)
  24    - Motivat ion for in itial deve lopment ca me from [@ ErisDS](ht tps://gith ub.com/Eri sDS) and t he [Ghost  Project](h ttps://git hub.com/Tr yGhost/Gho st).
  25    - Develop ment is sp onsored by  [Mapbox]( https://ww w.mapbox.c om/)
  26  
  27   ## FAQ
  28  
  29   See the [F requently  Ask Questi ons](https ://github. com/mapbox /node-pre- gyp/wiki/F AQ).
  30  
  31   ## Depends
  32  
  33    - Node.js  >= node v 0.10.x
  34  
  35   ## Install
  36  
  37   `node-pre- gyp` is de signed to  be install ed as a lo cal depend ency of yo ur Node.js  C++ addon  and acces sed like:
  38  
  39       ./node _modules/. bin/node-p re-gyp --h elp
  40  
  41   But you ca n also ins tall it gl obally:
  42  
  43       npm in stall node -pre-gyp - g
  44  
  45   ## Usage
  46  
  47   ### Comman ds
  48  
  49   View all p ossible co mmands:
  50  
  51       node-p re-gyp --h elp
  52  
  53   - clean -  Remove the  entire fo lder conta ining the  compiled . node modul e
  54   - install  - Install  pre-built  binary for  module
  55   - reinstal l - Run "c lean" and  "install"  at once
  56   - build -  Compile th e module b y dispatch ing to nod e-gyp or n w-gyp
  57   - rebuild  - Run "cle an" and "b uild" at o nce
  58   - package  - Pack bin ary into t arball
  59   - testpack age - Test  that the  staged pac kage is va lid
  60   - publish  - Publish  pre-built  binary
  61   - unpublis h - Unpubl ish pre-bu ilt binary
  62   - info - F etch info  on publish ed binarie s
  63  
  64   You can al so chain c ommands:
  65  
  66       node-p re-gyp cle an build u npublish p ublish inf o
  67  
  68   ### Option s
  69  
  70   Options in clude:
  71  
  72    - `-C/--d irectory`:  run the c ommand in  this direc tory
  73    - `--buil d-from-sou rce`: buil d from sou rce instea d of using  pre-built  binary
  74    - `--upda te-binary` : reinstal l by repla cing previ ously inst alled loca l binary w ith remote  binary
  75    - `--runt ime=node-w ebkit`: cu stomize th e runtime:  `node`, ` electron`  and `node- webkit` ar e the vali d options
  76    - `--fall back-to-bu ild`: fall back to bu ilding fro m source i f pre-buil t binary i s not avai lable
  77    - `--targ et=0.10.25 `: Pass th e target n ode or nod e-webkit v ersion to  compile ag ainst
  78    - `--targ et_arch=ia 32`: Pass  the target  arch and  override t he host `a rch`. Vali d values a re 'ia32', 'x64', or  `arm`.
  79    - `--targ et_platfor m=win32`:  Pass the t arget plat form and o verride th e host `pl atform`. V alid value s are `lin ux`, `darw in`, `win3 2`, `sunos `, `freebs d`, `openb sd`, and ` aix`.
  80  
  81   Both `--bu ild-from-s ource` and  `--fallba ck-to-buil d` can be  passed alo ne or they  can provi de values.  You can p ass `--fal lback-to-b uild=false ` to overr ide the op tion as de clared in  package.js on. In add ition to b eing able  to pass `- -build-fro m-source`  you can al so pass `- -build-fro m-source=m yapp` wher e `myapp`  is the nam e of your  module.
  82  
  83   For exampl e: `npm in stall --bu ild-from-s ource=myap p`. This i s useful i f:
  84  
  85    - `myapp`  is refere nced in th e package. json of a  larger app  and there fore `myap p` is bein g installe d as a dep endent wit h `npm ins tall`.
  86    - The lar ger app al so depends  on other  modules in stalled wi th `node-p re-gyp`
  87    - You onl y want to  trigger a  source com pile for ` myapp` and  the other  modules.
  88  
  89   ### Config uring
  90  
  91   This is a  guide to c onfiguring  your modu le to use  node-pre-g yp.
  92  
  93   #### 1) Ad d new entr ies to you r `package .json`
  94  
  95    - Add `no de-pre-gyp ` to `depe ndencies`
  96    - Add `aw s-sdk` as  a `devDepe ndency`
  97    - Add a c ustom `ins tall` scri pt
  98    - Declare  a `binary ` object
  99  
  100   This looks  like:
  101  
  102   ```js
  103       "depen dencies"   : {
  104         "nod e-pre-gyp" : "0.6.x"
  105       },
  106       "devDe pendencies ": {
  107         "aws -sdk": "2. x"
  108       }
  109       "bundl edDependen cies":["no de-pre-gyp "],
  110       "scrip ts": {
  111           "i nstall": " node-pre-g yp install  --fallbac k-to-build "
  112       },
  113       "binar y": {
  114           "m odule_name ": "your_m odule",
  115           "m odule_path ": "./lib/ binding/",
  116           "h ost": "htt ps://your_ module.s3- us-west-1. amazonaws. com"
  117       }
  118   ```
  119  
  120   For a full  example s ee [node-a ddon-examp les's pack age.json]( https://gi thub.com/s pringmeyer /node-addo n-example/ blob/maste r/package. json).
  121  
  122   Let's brea k this dow n:
  123  
  124    - Depende ncies need  to list ` node-pre-g yp`
  125    - Your de vDependenc ies should  list `aws -sdk` so t hat you ca n run `nod e-pre-gyp  publish` l ocally or  a CI syste m. We reco mmend usin g `devDepe ndencies`  only since  `aws-sdk`  is large  and not ne eded for ` node-pre-g yp install ` since it  only uses  http to f etch binar ies
  126    - You sho uld add `" bundledDep endencies" :["node-pr e-gyp"]`.  This ensur es that wh en you pub lish your  module tha t the corr ect versio n of node- pre-gyp wi ll be incl uded in th e `node_mo dules` fol der during  publishin g. Then wh en uses in stall your  module `n ode-pre-gy p` will al ready be p resent. Wi thout this  your modu le will no t be safel y installa ble for do wnstream a pplication s that hav e a depede ncy on nod e-pre-gyp  in the npm  tree (wit hout bundl ing npm de duping mig ht break t he install  when node -pre-gyp i s moved in  flight)
  127    - Your `s cripts` se ction shou ld optiona lly add `" prepublish ": "npm ls "` to ensu re the rig ht node-pr e-gyp vers ion is bun dled befor e publishi ng your mo dule. If n ode-pre-gy p is missi ng or an o ld version  is presen t then thi s will cat ch that er ror before  you publi sh a broke n package.
  128    - Your `s cripts` se ction shou ld overrid e the `ins tall` targ et with `" install":  "node-pre- gyp instal l --fallba ck-to-buil d"`. This  allows nod e-pre-gyp  to be used  instead o f the defa ult npm be havior of  always sou rce compil ing with ` node-gyp`  directly.
  129    - Your pa ckage.json  should co ntain a `b inary` sec tion descr ibing key  properties  you provi de to allo w node-pre -gyp to pa ckage opti mally. The y are deta iled below .
  130  
  131   Note: in t he past we  recommend ed using ` "preinstal l": "npm i nstall nod e-pre-gyp" ` as an al ternative  method to  avoid need ing to bun dle. But t his does n ot behave  predictabl y across a ll npm ver sions - se e https:// github.com /mapbox/no de-pre-gyp /issues/26 0 for the  details. S o we do no t recommen d using `p reinstall`  to instal l `node-pr e-gyp`. In stead we r ecommend b undling. M ore histor y on this  at https:/ /github.co m/stronglo op/fsevent s/issues/1 57#issueco mment-2655 45908.
  132  
  133   ##### The  `binary` o bject has  three requ ired prope rties
  134  
  135   ###### mod ule_name
  136  
  137   The name o f your nat ive node m odule. Thi s value mu st:
  138  
  139    - Match t he name pa ssed to [t he NODE_MO DULE macro ](http://n odejs.org/ api/addons .html#addo ns_hello_w orld)
  140    - Must be  a valid C  variable  name (e.g.  it cannot  contain ` -`)
  141    - Should  not includ e the `.no de` extens ion.
  142  
  143   ###### mod ule_path
  144  
  145   The locati on your na tive modul e is place d after a  build. Thi s should b e an empty  directory  without o ther Javas cript file s. This en tire direc tory will  be package d in the b inary tarb all. When  installing  from a re mote packa ge this di rectory wi ll be over written wi th the con tents of t he tarball .
  146  
  147   Note: This  property  supports v ariables b ased on [V ersioning] (#versioni ng).
  148  
  149   ###### hos t
  150  
  151   A url to t he remote  location w here you'v e publishe d tarball  binaries ( must be `h ttps` not  `http`).
  152  
  153   It is high ly recomme nded that  you use Am azon S3. T he reasons  are:
  154  
  155     - Variou s node-pre -gyp comma nds like ` publish` a nd `info`  only work  with an S3  host.
  156     - S3 is  a very sol id hosting  platform  for distri buting lar ge files.
  157     - We pro vide detai l document ation for  using [S3  hosting](# s3-hosting ) with nod e-pre-gyp.
  158  
  159   Why then n ot require  S3? Becau se while s ome applic ations usi ng node-pr e-gyp need  to distri bute binar ies as lar ge as 20-3 0 MB, othe rs might h ave very s mall binar ies and mi ght wish t o store th em in a Gi tHub repo.  This is n ot recomme nded, but  if an auth or really  wants to h ost in a n on-s3 loca tion then  it should  be possibl e.
  160  
  161   It should  also be me ntioned th at there i s an optio nal and en tirely sep arate npm  module cal led [node- pre-gyp-gi thub](http s://github .com/bchr0 2/node-pre -gyp-githu b) which i s intended  to comple ment node- pre-gyp an d be insta lled along  with it.  It provide s the abil ity to sto re and pub lish your  binaries w ithin your  repositor ies GitHub  Releases  if you wou ld rather  not use S3  directly.  Installat ion and us age instru ctions can  be found  [here](htt ps://githu b.com/bchr 02/node-pr e-gyp-gith ub), but t he basic p remise is  that inste ad of usin g the ```n ode-pre-gy p publish` `` command  you would  use ```no de-pre-gyp -github pu blish```.
  162  
  163   ##### The  `binary` o bject has  two option al propert ies
  164  
  165   ###### rem ote_path
  166  
  167   It **is re commended* * that you  customize  this prop erty. This  is an ext ra path to  use for p ublishing  and findin g remote t arballs. T he default  value for  `remote_p ath` is `" "` meaning  that if y ou do not  provide it  then all  packages w ill be pub lished at  the base o f the `hos t`. It is  recommende d to provi de a value  like `./{ name}/v{ve rsion}` to  help orga nize remot e packages  in the ca se that yo u choose t o publish  multiple n ode addons  to the sa me `host`.
  168  
  169   Note: This  property  supports v ariables b ased on [V ersioning] (#versioni ng).
  170  
  171   ###### pac kage_name
  172  
  173   It is **no t recommen ded** to o verride th is propert y unless y ou are als o overridi ng the `re mote_path` . This is  the versio ned name o f the remo te tarball  containin g the bina ry `.node`  module an d any supp orting fil es you've  placed ins ide the `m odule_path ` director y. Unless  you specif y `package _name` in  your `pack age.json`  then it de faults to  `{module_n ame}-v{ver sion}-{nod e_abi}-{pl atform}-{a rch}.tar.g z` which a llows your  binary to  work acro ss node ve rsions, pl atforms, a nd archite ctures. If  you are u sing `remo te_path` t hat is als o versione d by `./{m odule_name }/v{versio n}` then y ou could r emove thes e variable s from the  `package_ name` and  just use:  `{node_abi }-{platfor m}-{arch}. tar.gz`. T hen your r emote tarb all will b e looked u p at, for  example, ` https://ex ample.com/ your-modul e/v0.1.0/n ode-v11-li nux-x64.ta r.gz`.
  174  
  175   Avoiding t he version  of your m odule in t he `packag e_name` an d instead  only embed ding in a  directory  name can b e useful w hen you wa nt to make  a quick t ag of your  module th at does no t change a ny C++ cod e. In this  case you  can just c opy binari es to the  new versio n behind t he scenes  like:
  176  
  177   ```sh
  178   aws s3 syn c --acl pu blic-read  s3://mapbo x-node-bin ary/sqlite 3/v3.0.3/  s3://mapbo x-node-bin ary/sqlite 3/v3.0.4/
  179   ```
  180  
  181   Note: This  property  supports v ariables b ased on [V ersioning] (#versioni ng).
  182  
  183   #### 2) Ad d a new ta rget to bi nding.gyp
  184  
  185   `node-pre- gyp` calls  out to `n ode-gyp` t o compile  the module  and passe s variable s along li ke [module _name](#mo dule_name)  and [modu le_path](# module_pat h).
  186  
  187   A new targ et must be  added to  `binding.g yp` that m oves the c ompiled `. node` modu le from `. /build/Rel ease/modul e_name.nod e` into th e director y specifie d by `modu le_path`.
  188  
  189   Add a targ et like th is at the  end of you r `targets ` list:
  190  
  191   ```js
  192       {
  193         "tar get_name":  "action_a fter_build ",
  194         "typ e": "none" ,
  195         "dep endencies" : [ "<(mod ule_name)"  ],
  196         "cop ies": [
  197           {
  198              "files": [  "<(PRODUC T_DIR)/<(m odule_name ).node" ],
  199              "destinati on": "<(mo dule_path) "
  200           }
  201         ]
  202       }
  203   ```
  204  
  205   For a full  example s ee [node-a ddon-examp le's bindi ng.gyp](ht tps://gith ub.com/spr ingmeyer/n ode-addon- example/bl ob/2ff60a8 ded7f04286 4ad21db00c 3a5a06cf47 075/bindin g.gyp).
  206  
  207   #### 3) Dy namically  require yo ur `.node`
  208  
  209   Inside the  main js f ile that r equires yo ur addon m odule you  are likely  currently  doing:
  210  
  211   ```js
  212   var bindin g = requir e('../buil d/Release/ binding.no de');
  213   ```
  214  
  215   or:
  216  
  217   ```js
  218   var bindin gs = requi re('./bind ings')
  219   ```
  220  
  221   Change tho se lines t o:
  222  
  223   ```js
  224   var binary  = require ('node-pre -gyp');
  225   var path =  require(' path');
  226   var bindin g_path = b inary.find (path.reso lve(path.j oin(__dirn ame,'./pac kage.json' )));
  227   var bindin g = requir e(binding_ path);
  228   ```
  229  
  230   For a full  example s ee [node-a ddon-examp le's index .js](https ://github. com/spring meyer/node -addon-exa mple/blob/ 2ff60a8ded 7f042864ad 21db00c3a5 a06cf47075 /index.js# L1-L4)
  231  
  232   #### 4) Bu ild and pa ckage your  app
  233  
  234   Now build  your modul e from sou rce:
  235  
  236       npm in stall --bu ild-from-s ource
  237  
  238   The `--bui ld-from-so urce` tell s `node-pr e-gyp` to  not look f or a remot e package  and instea d dispatch  to node-g yp to buil d.
  239  
  240   Now `node- pre-gyp` s hould now  also be in stalled as  a local d ependency  so the com mand line  tool it of fers can b e found at  `./node_m odules/.bi n/node-pre -gyp`.
  241  
  242   #### 5) Te st
  243  
  244   Now `npm t est` shoul d work jus t as it di d before.
  245  
  246   #### 6) Pu blish the  tarball
  247  
  248   Then packa ge your ap p:
  249  
  250       ./node _modules/. bin/node-p re-gyp pac kage
  251  
  252   Once packa ged, now y ou can pub lish:
  253  
  254       ./node _modules/. bin/node-p re-gyp pub lish
  255  
  256   Currently  the `publi sh` comman d pushes y our binary  to S3. Th is require s:
  257  
  258    - You hav e installe d `aws-sdk ` with `np m install  aws-sdk`
  259    - You hav e created  a bucket a lready.
  260    - The `ho st` points  to an S3  http or ht tps endpoi nt.
  261    - You hav e configur ed node-pr e-gyp to r ead your S 3 credenti als (see [ S3 hosting ](#s3-host ing) for d etails).
  262  
  263   You can al so host yo ur binarie s elsewher e. To do t his requir es:
  264  
  265    - You man ually publ ish the bi nary creat ed by the  `package`  command to  an `https ` endpoint
  266    - Ensure  that the ` host` valu e points t o your cus tom `https ` endpoint .
  267  
  268   #### 7) Au tomate bui lds
  269  
  270   Now you ne ed to publ ish builds  for all t he platfor ms and nod e versions  you wish  to support . This is  best autom ated.
  271  
  272    - See [Ap pveyor Aut omation](# appveyor-a utomation)  for how t o auto-pub lish build s on Windo ws.
  273    - See [Tr avis Autom ation](#tr avis-autom ation) for  how to au to-publish  builds on  OS X and  Linux.
  274  
  275   #### 8) Yo u're done!
  276  
  277   Now publis h your mod ule to the  npm regis try. Users  will now  be able to  install y our module  from a bi nary.
  278  
  279   What will  happen is  this:
  280  
  281   1. `npm in stall <you r package> ` will pul l from the  npm regis try
  282   2. npm wil l run the  `install`  script whi ch will ca ll out to  `node-pre- gyp`
  283   3. `node-p re-gyp` wi ll fetch t he binary  `.node` mo dule and u npack in t he right p lace
  284   4. Assumin g that all  worked, y ou are don e
  285  
  286   If a a bin ary was no t availabl e for a gi ven platfo rm and `-- fallback-t o-build` w as used th en `node-g yp rebuild ` will be  called to  try to sou rce compil e the modu le.
  287  
  288   ## S3 Host ing
  289  
  290   You can ho st whereve r you choo se but S3  is cheap,  `node-pre- gyp publis h` expects  it, and S 3 can be i ntegrated  well with  [Travis.ci ](http://t ravis-ci.o rg) to aut omate buil ds for OS  X and Ubun tu, and wi th [Appvey or](http:/ /appveyor. com) to au tomate bui lds for Wi ndows. Her e is an ap proach to  do this:
  291  
  292   First, get  setup loc ally and t est the wo rkflow:
  293  
  294   #### 1) Cr eate an S3  bucket
  295  
  296   And have y our **key* * and **se cret key**  ready for  writing t o the buck et.
  297  
  298   It is reco mmended to  create a  IAM user w ith a poli cy that on ly gives p ermissions  to the sp ecific buc ket you pl an to publ ish to. Th is can be  done in th e [IAM con sole](http s://consol e.aws.amaz on.com/iam /) by: 1)  adding a n ew user, 2 ) choosing  `Attach U ser Policy `, 3) Usin g the `Pol icy Genera tor`, 4) s electing ` Amazon S3`  for the s ervice, 5)  adding th e actions:  `DeleteOb ject`, `Ge tObject`,  `GetObject Acl`, `Lis tBucket`,  `PutObject `, `PutObj ectAcl`, 6 ) adding a n ARN of ` arn:aws:s3 :::bucket/ *` (replac ing `bucke t` with yo ur bucket  name), and  finally 7 ) clicking  `Add Stat ement` and  saving th e policy.  It should  generate a  policy li ke:
  299  
  300   ```js
  301   {
  302     "Version ": "2012-1 0-17",
  303     "Stateme nt": [
  304       {
  305         "Sid ": "Stmt13 9458719700 0",
  306         "Eff ect": "All ow",
  307         "Act ion": [
  308           "s 3:DeleteOb ject",
  309           "s 3:GetObjec t",
  310           "s 3:GetObjec tAcl",
  311           "s 3:ListBuck et",
  312           "s 3:PutObjec t",
  313           "s 3:PutObjec tAcl"
  314         ],
  315         "Res ource": [
  316           "a rn:aws:s3: ::node-pre -gyp-tests /*"
  317         ]
  318       }
  319     ]
  320   }
  321   ```
  322  
  323   #### 2) In stall node -pre-gyp
  324  
  325   Either ins tall it gl obally:
  326  
  327       npm in stall node -pre-gyp - g
  328  
  329   Or put the  local ver sion on yo ur PATH
  330  
  331       export  PATH=`pwd `/node_mod ules/.bin/ :$PATH
  332  
  333   #### 3) Co nfigure AW S credenti als
  334  
  335   There are  several wa ys to do t his.
  336  
  337   You can us e any of t he methods  described  at http:/ /docs.aws. amazon.com /AWSJavaSc riptSDK/gu ide/node-c onfiguring .html.
  338  
  339   Or you can  create a  `~/.node_p re_gyprc`
  340  
  341   Or pass op tions in a ny way sup ported by  [RC](https ://github. com/domini ctarr/rc#s tandards)
  342  
  343   A `~/.node _pre_gyprc ` looks li ke:
  344  
  345   ```js
  346   {
  347       "acces sKeyId": " xxx",
  348       "secre tAccessKey ": "xxx"
  349   }
  350   ```
  351  
  352   Another wa y is to us e your env ironment:
  353  
  354       export  node_pre_ gyp_access KeyId=xxx
  355       export  node_pre_ gyp_secret AccessKey= xxx
  356  
  357   You may al so need to  specify t he `region ` if it is  not expli cit in the  `host` va lue you us e. The `bu cket` can  also be sp ecified bu t it is op tional bec ause `node -pre-gyp`  will detec t it from  the `host`  value.
  358  
  359   #### 4) Pa ckage and  publish yo ur build
  360  
  361   Install th e `aws-sdk `:
  362  
  363       npm in stall aws- sdk
  364  
  365   Then publi sh:
  366  
  367       node-p re-gyp pac kage publi sh
  368  
  369   Note: if y ou hit an  error like  `Hostname /IP doesn' t match ce rtificate' s altnames ` it may m ean that y ou need to  provide t he `region ` option i n your con fig.
  370  
  371   ## Appveyo r Automati on
  372  
  373   [Appveyor] (http://ww w.appveyor .com/) can  build bin aries and  publish th e results  per commit  and suppo rts:
  374  
  375    - Windows  Visual St udio 2013  and relate d compiler s
  376    - Both 64  bit (x64)  and 32 bi t (x86) bu ild config urations
  377    - Multipl e Node.js  versions
  378  
  379   For an exa mple of do ing this s ee [node-s qlite3's a ppveyor.ym l](https:/ /github.co m/mapbox/n ode-sqlite 3/blob/mas ter/appvey or.yml).
  380  
  381   Below is a  guide to  getting se t up:
  382  
  383   #### 1) Cr eate a fre e Appveyor  account
  384  
  385   Go to http s://ci.app veyor.com/ signup/fre e and sign  in with y our GitHub  account.
  386  
  387   #### 2) Cr eate a new  project
  388  
  389   Go to http s://ci.app veyor.com/ projects/n ew and sel ect the Gi tHub repo  for your m odule
  390  
  391   #### 3) Ad d appveyor .yml and p ush it
  392  
  393   Once you h ave commit ted an `ap pveyor.yml ` ([appvey or.yml ref erence](ht tp://www.a ppveyor.co m/docs/app veyor-yml) ) to your  GitHub rep o and push ed it AppV eyor shoul d automati cally star t building  your proj ect.
  394  
  395   #### 4) Cr eate secur e variable s
  396  
  397   Encrypt yo ur S3 AWS  keys by go ing to <ht tps://ci.a ppveyor.co m/tools/en crypt> and  hitting t he `encryp t` button.
  398  
  399   Then paste  the resul t into you r `appveyo r.yml`
  400  
  401   ```yml
  402   environmen t:
  403     node_pre _gyp_acces sKeyId:
  404       secure : ID_REDAC TED
  405     node_pre _gyp_secre tAccessKey :
  406       secure : ID_REDAC TED
  407   ```
  408  
  409   NOTE: keys  are per a ccount but  not per r epo (this  is differe nce than T ravis wher e keys are  per repo  but not re lated to t he account  used to e ncrypt the m).
  410  
  411   #### 5) Ho ok up publ ishing
  412  
  413   Just put ` node-pre-g yp package  publish`  in your `a ppveyor.ym l` after ` npm instal l`.
  414  
  415   #### 6) Pu blish when  you want
  416  
  417   You might  wish to pu blish bina ries only  on a speci fic commit . To do th is you cou ld borrow  from the [ Travis CI  idea of co mmit keywo rds](http: //about.tr avis-ci.or g/docs/use r/how-to-s kip-a-buil d/) and ad d special  handling f or commit  messages w ith `[publ ish binary ]`:
  418  
  419       SET CM =%APPVEYOR _REPO_COMM IT_MESSAGE %
  420       if not  "%CM%" ==  "%CM:[pub lish binar y]=%" node -pre-gyp - -msvs_vers ion=2013 p ublish
  421  
  422   If your co mmit messa ge contain s special  characters  (e.g. `&` ) this met hod might  fail. An a lternative  is to use  PowerShel l, which g ives you a dditional  possibilit ies, like  ignoring c ase by usi ng `ToLowe r()`:
  423  
  424       ps: if ($env:APPV EYOR_REPO_ COMMIT_MES SAGE.ToLow er().Conta ins('[publ ish binary ]')) { nod e-pre-gyp  --msvs_ver sion=2013  publish }
  425  
  426   Remember t his publis hing is no t the same  as `npm p ublish`. W e're just  talking ab out the bi nary modul e here and  not your  entire npm  package.
  427  
  428   ## Travis  Automation
  429  
  430   [Travis](h ttps://tra vis-ci.org /) can pus h to S3 af ter a succ essful bui ld and sup ports both :
  431  
  432    - Ubuntu  Precise an d OS X (64  bit)
  433    - Multipl e Node.js  versions
  434  
  435   For an exa mple of do ing this s ee [node-a dd-example 's .travis .yml](http s://github .com/sprin gmeyer/nod e-addon-ex ample/blob /2ff60a8de d7f042864a d21db00c3a 5a06cf4707 5/.travis. yml).
  436  
  437   Note: if y ou need 32  bit binar ies, this  can be don e from a 6 4 bit Trav is machine . See [the  node-sqli te3 script s for an e xample of  doing this ](https:// github.com /mapbox/no de-sqlite3 /blob/bae1 22aa6a2b8a 45f6b717fa b24e207740 e32b5d/scr ipts/build _against_n ode.sh#L54 -L74).
  438  
  439   Below is a  guide to  getting se t up:
  440  
  441   #### 1) In stall the  Travis gem
  442  
  443       gem in stall trav is
  444  
  445   #### 2) Cr eate secur e variable s
  446  
  447   Make sure  you run th is command  from with in the dir ectory of  your modul e.
  448  
  449   Use `travi s-encrypt`  like:
  450  
  451       travis  encrypt n ode_pre_gy p_accessKe yId=${node _pre_gyp_a ccessKeyId }
  452       travis  encrypt n ode_pre_gy p_secretAc cessKey=${ node_pre_g yp_secretA ccessKey}
  453  
  454   Then put t hose value s in your  `.travis.y ml` like:
  455  
  456   ```yaml
  457   env:
  458     global:
  459       - secu re: F+sEL/ v56CzHqmCS SES4pEyC9N eQlkoR0Gs/ ZuZxX1ytrj 8SKtp3MKqB j7zhIclSdX Bz4Ev966Da 5ctmcTd410 p0b240MV6B VOkLUtkjZJ yErMBOkeb8 n8yVfSoeMx 8RiIhBmIvE n+rlQq+bSF is61/JkE9r xsjkGRZi14 hHr4M=
  460       - secu re: o2nkUQ IiABD139XS 6L8pxq3XO5 gch27hvm/g OdV+dzNKc/ s2KomVPWcO yXNxtJGhte cAkABzaW8K HDDi5QL1kN EFx6BxFVML O8rjFPsMVa BG9Ks6JiDQ kkmrGNcnVd xI/6EKTLHT H5WLsz8+J7 caDBzvKbEf Tux5EamEhx IWgrI=
  461   ```
  462  
  463   More detai ls on Trav is encrypt ion at htt p://about. travis-ci. org/docs/u ser/encryp tion-keys/ .
  464  
  465   #### 3) Ho ok up publ ishing
  466  
  467   Just put ` node-pre-g yp package  publish`  in your `. travis.yml ` after `n pm install `.
  468  
  469   ##### OS X  publishin g
  470  
  471   If you wan t binaries  for OS X  in additio n to linux  you can e nable [mul ti-os for  Travis](ht tp://docs. travis-ci. com/user/m ulti-os/#S etting-.tr avis.yml)
  472  
  473   Use a conf iguration  like:
  474  
  475   ```yml
  476  
  477   language:  cpp
  478  
  479   os:
  480   - linux
  481   - osx
  482  
  483   env:
  484     matrix:
  485       - NODE _VERSION=" 0.10"
  486       - NODE _VERSION=" 0.11.14"
  487  
  488   before_ins tall:
  489   - rm -rf ~ /.nvm/ &&  git clone  --depth 1  https://gi thub.com/c reationix/ nvm.git ~/ .nvm
  490   - source ~ /.nvm/nvm. sh
  491   - nvm inst all $NODE_ VERSION
  492   - nvm use  $NODE_VERS ION
  493   ```
  494  
  495   See [Travi s OS X Got chas](#tra vis-os-x-g otchas) fo r why we r eplace `la nguage: no de_js` and  `node_js: ` sections  with `lan guage: cpp ` and a cu stom matri x.
  496  
  497   Also creat e platform  specific  sections f or any dep s that nee d install.  For examp le if you  need libpn g:
  498  
  499   ```yml
  500   - if [ $(u name -s) = = 'Linux'  ]; then ap t-get inst all libpng -dev; fi;
  501   - if [ $(u name -s) = = 'Darwin'  ]; then b rew instal l libpng;  fi;
  502   ```
  503  
  504   For detail ed multi-O S examples  see [node -mapnik](h ttps://git hub.com/ma pnik/node- mapnik/blo b/master/. travis.yml ) and [nod e-sqlite3] (https://g ithub.com/ mapbox/nod e-sqlite3/ blob/maste r/.travis. yml).
  505  
  506   ##### Trav is OS X Go tchas
  507  
  508   First, unl ike the Tr avis Linux  machines,  the OS X  machines d o not put  `node-pre- gyp` on PA TH by defa ult. To do  so you wi ll need to :
  509  
  510   ```sh
  511   export PAT H=$(pwd)/n ode_module s/.bin:${P ATH}
  512   ```
  513  
  514   Second, th e OS X mac hines do n ot support  using a m atrix for  installing  different  Node.js v ersions. S o you need  to bootst rap the in stallation  of Node.j s in a cro ss platfor m way.
  515  
  516   By doing:
  517  
  518   ```yml
  519   env:
  520     matrix:
  521       - NODE _VERSION=" 0.10"
  522       - NODE _VERSION=" 0.11.14"
  523  
  524   before_ins tall:
  525    - rm -rf  ~/.nvm/ &&  git clone  --depth 1  https://g ithub.com/ creationix /nvm.git ~ /.nvm
  526    - source  ~/.nvm/nvm .sh
  527    - nvm ins tall $NODE _VERSION
  528    - nvm use  $NODE_VER SION
  529   ```
  530  
  531   You can ea sily recre ate the pr evious beh avior of t his matrix :
  532  
  533   ```yml
  534   node_js:
  535     - "0.10"
  536     - "0.11. 14"
  537   ```
  538  
  539   #### 4) Pu blish when  you want
  540  
  541   You might  wish to pu blish bina ries only  on a speci fic commit . To do th is you cou ld borrow  from the [ Travis CI  idea of co mmit keywo rds](http: //about.tr avis-ci.or g/docs/use r/how-to-s kip-a-buil d/) and ad d special  handling f or commit  messages w ith `[publ ish binary ]`:
  542  
  543       COMMIT _MESSAGE=$ (git log - -format=%B  --no-merg es -n 1 |  tr -d '\n' )
  544       if [[  ${COMMIT_M ESSAGE} =~  "[publish  binary]"  ]]; then n ode-pre-gy p publish;  fi;
  545  
  546   Then you c an trigger  new binar ies to be  built like :
  547  
  548       git co mmit -a -m  "[publish  binary]"
  549  
  550   Or, if you  don't hav e any chan ges to mak e simply r un:
  551  
  552       git co mmit --all ow-empty - m "[publis h binary]"
  553  
  554   WARNING: i f you are  working in  a pull re quest and  publishing  binaries  from there  then you  will want  to avoid d ouble publ ishing whe n Travis C I builds b oth the `p ush` and ` pr`. You o nly want t o run the  publish on  the `push ` commit.  See https: //github.c om/Project -OSRM/node -osrm/blob /8eb837abe 2e2e30e595 093d16e535 4bc5c57357 5/scripts/ is_pr_merg e.sh which  is called  from http s://github .com/Proje ct-OSRM/no de-osrm/bl ob/8eb837a be2e2e30e5 95093d16e5 354bc5c573 575/script s/publish. sh for an  example of  how to do  this.
  555  
  556   Remember t his publis hing is no t the same  as `npm p ublish`. W e're just  talking ab out the bi nary modul e here and  not your  entire npm  package.  To automat e the publ ishing of  your entir e package  to npm on  Travis see  http://ab out.travis -ci.org/do cs/user/de ployment/n pm/
  557  
  558   # Versioni ng
  559  
  560   The `binar y` propert ies of `mo dule_path` , `remote_ path`, and  `package_ name` supp ort variab le substit ution. The  strings a re evaluat ed by `nod e-pre-gyp`  depending  on your s ystem and  any custom  build fla gs you pas sed.
  561  
  562    - `node_a bi`: The n ode C++ `A BI` number . This val ue is avai lable in J avascript  as `proces s.versions .modules`  as of [`>=  v0.10.4 > = v0.11.7` ](https:// github.com /joyent/no de/commit/ ccabd4a6fa 8a6eb79d29 bc3bbe9fe2 b6531c2d8e ) and in C ++ as the  `NODE_MODU LE_VERSION ` define m uch earlie r. For ver sions of N ode before  this was  available  we fallbac k to the V 8 major an d minor ve rsion.
  563    - `platfo rm` matche s node's ` process.pl atform` li ke `linux` , `darwin` , and `win 32` unless  the user  passed the  `--target _platform`  option to  override.
  564    - `arch`  matches no de's `proc ess.arch`  like `x64`  or `ia32`  unless th e user pas ses the `- -target_ar ch` option  to overri de.
  565    - `config uration` -  Either 'R elease' or  'Debug' d epending o n if `--de bug` is pa ssed durin g the buil d.
  566    - `module _name` - t he `binary .module_na me` attrib ute from ` package.js on`.
  567    - `versio n` - the s emver `ver sion` valu e for your  module fr om `packag e.json` (N OTE: ignor es the `se mver.build ` property ).
  568    - `major` , `minor`,  `patch`,  and `prele ase` match  the indiv idual semv er values  for your m odule's `v ersion`
  569    - `build`  - the sev mer `build ` value. F or example  it would  be `this.t hat` if yo ur package .json `ver sion` was  `v1.0.0+th is.that`
  570    - `prerel ease` - th e semver ` prerelease ` value. F or example  it would  be `alpha. beta` if y our packag e.json `ve rsion` was  `v1.0.0-a lpha.beta`
  571  
  572  
  573   The option s are visi ble in the  code at < https://gi thub.com/m apbox/node -pre-gyp/b lob/612b7b ca2604508d 881e118761 4870ba19a7 f0c5/lib/u til/versio ning.js#L1 14-L127>
  574  
  575   # Download  binary fi les from a  mirror
  576  
  577   S3 is brok en in Chin a for the  well known  reason.
  578  
  579   Using the  `npm` conf ig argumen t: `--{mod ule_name}_ binary_hos t_mirror`  can downlo ad binary  files thro ugh a mirr or.
  580  
  581   e.g.: Inst all [v8-pr ofiler](ht tps://www. npmjs.com/ package/v8 -profiler)  from `npm `.
  582  
  583   ```bash
  584   $ npm inst all v8-pro filer --pr ofiler_bin ary_host_m irror=http s://npm.ta obao.org/m irrors/nod e-inspecto r/
  585   ```