Initial commit
[yaffs-website] / node_modules / in-publish / README.md
1 in-publish
2 ==========
3
4 Detect if we were run as a result of `npm publish`. This is intended to allow you to
5 easily have prepublish lifecycle scripts that don't run when you run `npm install`.
6
7 ```
8 $ npm install --save in-publish
9 in-publish@1.0.0 node_modules/in-publish
10 ```
11
12 Then edit your package.json to have:
13
14 ```json
15   "scripts": {
16     "prepublish": "in-publish && thing-I-dont-want-on-dev-install || not-in-publish"
17   }
18 ```
19
20 Now when you run:
21
22 ```
23 $ npm install
24 ```
25 Then `thing-I-dont-want-on-dev-install` won't be run, but...
26
27 ```
28 $ npm publish
29 ```
30 And `thing-I-dont-want-on-dev-install` will be run.
31
32 It's worth noting that the `prepublish` lifecycle is _ALSO_ called when you build a tarball, so:
33
34 ```
35 $ npm pack
36 ```
37
38 Will call your `prepublish` lifecycle, but with the examplea above,
39 `thing-I-dont-want-on-dev-install` won't be run.
40
41 If you want this, you can use another helper included here:
42
43 ```json
44   "scripts": {
45     "prepublish": "not-in-install && thing-I-dont-want-on-dev-install || in-install"
46   }
47 ```
48
49 The above will run your `thing-I-dont-want-on-dev-install` on `publish` and
50 on `pack` but not on `install`.