11# syncpack
22
3- > Manage multiple package.json files, such as in Lerna Monorepos
3+ > Manage multiple package.json files, such as in Lerna Monorepos and Yarn
4+ > Workspaces
45
56[ ![ NPM version] ( http://img.shields.io/npm/v/syncpack.svg?style=flat-square )] ( https://www.npmjs.com/package/syncpack )
67[ ![ NPM downloads] ( http://img.shields.io/npm/dm/syncpack.svg?style=flat-square )] ( https://www.npmjs.com/package/syncpack )
1415[ ![ Follow JamieMason on GitHub] ( https://img.shields.io/github/followers/JamieMason.svg?style=social&label=Follow )] ( https://github.com/JamieMason )
1516[ ![ Follow fold_left on Twitter] ( https://img.shields.io/twitter/follow/fold_left.svg?style=social&label=Follow )] ( https://twitter.com/fold_left )
1617
17- ## : cloud : Installation
18+ ## ☁️ Installation
1819
1920```
2021npm install --global syncpack
2122```
2223
23- ## :memo : Commands
24+ ## 🕵🏾♀️ Resolving Packages
25+
26+ package.json files are resolved in this order of precendence:
27+
28+ 1 . If ` --source `
29+ [ glob patterns] ( https://github.com/isaacs/node-glob#glob-primer ) are
30+ provided, use those.
31+ 1 . If using [ Yarn Workspaces] ( https://yarnpkg.com/lang/en/docs/workspaces/ ) ,
32+ read ` workspaces ` from ` ./package.json ` .
33+ 1 . If using [ Lerna] ( https://lerna.js.org/ ) , read ` packages ` from ` ./lerna.json ` .
34+ 1 . Default to ` 'package.json' ` and ` 'packages/*/package.json' ` .
35+
36+ ## 📝 Commands
2437
2538### fix-mismatches
2639
2740Ensure that multiple packages requiring the same dependency define the same
2841version, so that every package requires eg. ` react@16.4.2 ` , instead of a
2942combination of ` react@16.4.2 ` , ` react@0.15.9 ` , and ` react@16.0.0 ` .
3043
31- #### Options
44+ <details >
45+ <summary >Options</summary >
3246
3347```
3448-s, --source [pattern] glob pattern for package.json files to read from
@@ -39,10 +53,13 @@ combination of `react@16.4.2`, `react@0.15.9`, and `react@16.0.0`.
3953-h, --help output usage information
4054```
4155
42- #### Examples
56+ </details >
57+
58+ <details >
59+ <summary >Examples</summary >
4360
4461``` bash
45- # uses packages defined in lerna.json by default
62+ # uses defaults for resolving packages
4663syncpack fix-mismatches
4764# uses packages defined by --source when provided
4865syncpack fix-mismatches --source " apps/*/package.json"
@@ -58,25 +75,31 @@ syncpack fix-mismatches --dev --peer
5875syncpack fix-mismatches --indent " "
5976```
6077
78+ </details >
79+
6180### format
6281
6382Organise package.json files according to a conventional format, where fields
6483appear in a predictable order and nested fields are ordered alphabetically.
6584Shorthand properties are used where available, such as the ` "repository" ` and
6685` "bugs" ` fields.
6786
68- #### Options
87+ <details >
88+ <summary >Options</summary >
6989
7090```
7191-s, --source [pattern] glob pattern for package.json files to read from
7292-i, --indent [value] override indentation. defaults to " "
7393-h, --help output usage information
7494```
7595
76- #### Examples
96+ </details >
97+
98+ <details >
99+ <summary >Examples</summary >
77100
78101``` bash
79- # uses packages defined in lerna.json by default
102+ # uses defaults for resolving packages
80103syncpack format
81104# uses packages defined by --source when provided
82105syncpack format --source " apps/*/package.json"
@@ -86,11 +109,14 @@ syncpack format --source "apps/*/package.json" --source "core/*/package.json"
86109syncpack format --indent " "
87110```
88111
112+ </details >
113+
89114### list
90115
91116List all dependencies required by your packages.
92117
93- #### Options
118+ <details >
119+ <summary >Options</summary >
94120
95121```
96122-s, --source [pattern] glob pattern for package.json files to read from
@@ -100,10 +126,13 @@ List all dependencies required by your packages.
100126-h, --help output usage information
101127```
102128
103- #### Examples
129+ </details >
130+
131+ <details >
132+ <summary >Examples</summary >
104133
105134``` bash
106- # uses packages defined in lerna.json by default
135+ # uses defaults for resolving packages
107136syncpack list
108137# uses packages defined by --source when provided
109138syncpack list --source " apps/*/package.json"
@@ -115,12 +144,15 @@ syncpack list --dev
115144syncpack list --dev --peer
116145```
117146
147+ </details >
148+
118149### list-mismatches
119150
120151List dependencies which are required by multiple packages, where the version is
121152not the same across every package.
122153
123- #### Options
154+ <details >
155+ <summary >Options</summary >
124156
125157```
126158-s, --source [pattern] glob pattern for package.json files to read from
@@ -130,10 +162,13 @@ not the same across every package.
130162-h, --help output usage information
131163```
132164
133- #### Examples
165+ </details >
166+
167+ <details >
168+ <summary >Examples</summary >
134169
135170``` bash
136- # uses packages defined in lerna.json by default
171+ # uses defaults for resolving packages
137172syncpack list-mismatches
138173# uses packages defined by --source when provided
139174syncpack list-mismatches --source " apps/*/package.json"
@@ -145,12 +180,15 @@ syncpack list-mismatches --dev
145180syncpack list-mismatches --dev --peer
146181```
147182
183+ </details >
184+
148185### set-semver-ranges
149186
150187Ensure dependency versions used within ` "dependencies" ` , ` "devDependencies" ` ,
151188and ` "peerDependencies" ` follow a consistent format.
152189
153- #### Options
190+ <details >
191+ <summary >Options</summary >
154192
155193```
156194-r, --semver-range <range> <, <=, "", ~, ^, >=, >, or *. defaults to ""
@@ -162,10 +200,13 @@ and `"peerDependencies"` follow a consistent format.
162200-h, --help output usage information
163201```
164202
165- #### Examples
203+ </details >
204+
205+ <details >
206+ <summary >Examples</summary >
166207
167208``` bash
168- # uses packages defined in lerna.json by default
209+ # uses defaults for resolving packages
169210syncpack set-semver-ranges
170211# uses packages defined by --source when provided
171212syncpack set-semver-ranges --source " apps/*/package.json"
@@ -181,7 +222,10 @@ syncpack set-semver-ranges --dev --peer --semver-range ~
181222syncpack set-semver-ranges --indent " "
182223```
183224
184- #### Supported Ranges
225+ </details >
226+
227+ <details >
228+ <summary >Supported Ranges</summary >
185229
186230```
187231< <1.4.2
@@ -194,9 +238,11 @@ syncpack set-semver-ranges --indent " "
194238* *
195239```
196240
197- ## :raising_hand : Get Help
241+ </details >
242+
243+ ## 🙋 Get Help
198244
199- There are few ways to get help:
245+ There are a few ways to get help:
200246
201- 1 . For bug reports and feature requests, open issues : bug :
202- 1 . For direct and quick help, you can use Gitter : rocket :
247+ 1 . For bug reports and feature requests, open issues 🐛
248+ 1 . For direct and quick help, you can use Gitter 🚀
0 commit comments