Skip to content

Commit 40678de

Browse files
committed
feat: document how to use
1 parent b326e25 commit 40678de

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,50 @@
1313
Requires [Node](https://nodejs.org/en/) version 6 or above.
1414

1515
```sh
16-
npm install --save commit-message-install
16+
npm install --save-dev commit-message-install
1717
```
1818

1919
## Use
2020

21+
### Install NPM package from commit message
22+
23+
Imagine you have a CI build that installs NPM dependencies, but you also want to
24+
override one or more dependencies and test by creating a commit. Instead of changing
25+
`package.json` you can make a commit message with embedded JSON block describing
26+
custom installation. Then use this CLI tool to install based on the commit message.
27+
28+
Example CI file command
29+
30+
```
31+
- npm i -g commit-message-install
32+
- commit-message-install
33+
```
34+
35+
If commit message is this
36+
37+
```
38+
this will install package debug and chalk and while
39+
installing them will set environment variable FOO to "bar".
40+
The install will happen on all platforms
41+
42+
```json
43+
{
44+
"platform": "*",
45+
"packages": "debug,chalk"
46+
}
47+
```
48+
49+
Happy installation
50+
```
51+
52+
**note** `platform` can be `*` or specific one like `darwin` (from Node `os.platform()`) or a
53+
list of several platforms like `darwin,linux`
54+
55+
## Debugging
56+
57+
- Run this tool with `DEBUG=commit-message-install` environment variable set
58+
- Force reading commit message from a local file with `--file <filename>` option
59+
2160
### Small print
2261

2362
Author: Gleb Bahmutov &lt;gleb.bahmutov@gmail.com&gt; &copy; 2017

0 commit comments

Comments
 (0)