UNPKG

2.12 kBMarkdownView Raw
1# Sharec
2
3> 📦 Share your configs between projects without pain
4
5## Installation
6
7Install **sharec** into your configuration package with npm:
8
9```
10npm i --save-dev sharec
11```
12
13Or with yarn:
14
15```
16yarn add -D sharec
17```
18
19## Usage
20
21If you want to share you configs – initialize new package and install `sharec`,
22than you must create `configs` directory and move to it all your configuration
23files with `package.json`. In `package.json` you can define required dependecies,
24`sharec` will install them.
25
26`sharec` implements similar flow:
27
281. Searching `configs`
292. Copying configuration files
303. Merging target project's `package.json` with `package.json` from configuration package
314. Install dependencies from configuration package's `package.json`
32
333 and 4 steps possibly only if you create `package.json` file in `configs` directory
34of your configuration package.
35
36## Examples
37
38_You can see example [here](https://www.npmjs.com/package/sharec-demo-config) – install it or just look at sources._
39
40So, you want to share your configuration files between projects.
41
42### 1. Initialize new package
43
44Create new directory and initialize it:
45
46```
47mkdir my-awesome-configs
48cd my-awesome-configs
49npm init -y
50```
51
52### 2. Install `sharec`
53
54Install `sharec` in the created package:
55
56```
57npm i --save sharec
58```
59
60### 3. Add `sharec` to npm `postinstall` stript
61
62You can easily inatall your config with `postinstall` script, just add following
63line into your `package.json` `sciprts` section:
64
65```
66"postinstall": "sharec"
67```
68
69After this it should looks like:
70
71```json
72{
73 "name": "my-awesome-configs",
74 "scripts": {
75 "postinstall": "sharec"
76 },
77 "dependencies": {
78 "sharec": "1.0.0"
79 }
80}
81```
82
83### 4. Publish your configs package
84
85Congrats, you are ready for starting configuration sharing. You can publish it
86with `npm publish` or just push it to github.
87
88### 5. Share it!
89
90For example you have publish your `my-awesome-configs` into npm, now you ready
91to install it.
92
93Navigate to your existing or new project and makes:
94
95```
96npm i --save-dev my-awesome-configs
97```
98
99Here we are! Configs were successfully installed 🙌