Skip to content

Commit 395de72

Browse files
committedNov 14, 2022
README: Usage and How it works
1 parent 4d676d2 commit 395de72

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed
 

‎README.md

+34-4
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,47 @@ Some examples of scripts that we might want to prevent from running when install
1919

2020
## Usage
2121

22+
Replace this:
23+
24+
```json
25+
// package.json
26+
27+
"name": "my-library",
28+
"scripts:" {
29+
// "start", "test", "build", etc
30+
"postinstall/preinstall/prepare/etc": "your && scripts && here"
31+
},
32+
```
33+
34+
To this:
35+
2236
```json
23-
"postinstall/preinstall/prepare/etc": "npx ignore-dependency-scripts \"your && scripts && here\""
37+
// package.json
38+
39+
"name": "my-library",
40+
"scripts:" {
41+
// "start", "test", "build", etc
42+
"postinstall/preinstall/prepare/etc": "npx --yes ignore-dependency-scripts \"your && scripts && here\""
43+
},
2444
```
2545

26-
TODO: complete
46+
> Replace `your && scripts && here` by any post/pre install script that you want, like `husky install`, `npx pod-install` or both.
47+
48+
Now, when you run `yarn install` or `npm install` in `./my-library` the `your && scripts && here` will run normally.
49+
50+
But, when you install `my-library` as a dependency (aka `yarn add url/to/my-library.git`) in another repository, the `your && scripts && here` will be ignored.
2751

2852
## How it works
2953

30-
Check if exists `.git` folders.
54+
Considering the [usage](#usage) example.
55+
56+
When `npx --yes ignore-dependency-scripts` is executed, it will check if exists a `.git` folder inside the root directory.
57+
58+
If `.git` folder exists, then you are installing the dependencies of `./my-library` directly.
59+
60+
If `.git` folder DOES NOT exists, then you are installing `my-library` as a dependency in another repository.
3161

32-
TODO: complete
62+
> I think that in future we can extend this package to use another strategies too. PRs will be welcome.
3363
3464
## Contribute
3565

0 commit comments

Comments
 (0)
Please sign in to comment.