44[ ![ NPM downloads] ( http://img.shields.io/npm/dm/syncpack.svg?style=flat-square )] ( https://www.npmjs.com/package/syncpack )
55[ ![ Build Status] ( http://img.shields.io/travis/JamieMason/syncpack/master.svg?style=flat-square )] ( https://travis-ci.org/JamieMason/syncpack )
66[ ![ Dependency Status] ( http://img.shields.io/david/JamieMason/syncpack.svg?style=flat-square )] ( https://david-dm.org/JamieMason/syncpack )
7+ [ ![ Code Climate] ( https://img.shields.io/codeclimate/github/JamieMason/syncpack.svg?style=flat-square )] ( https://codeclimate.com/github/JamieMason/syncpack )
78[ ![ Join the chat at https://gitter.im/JamieMason/syncpack ] ( https://badges.gitter.im/Join%20Chat.svg )] ( https://gitter.im/JamieMason/syncpack )
89[ ![ Analytics] ( https://ga-beacon.appspot.com/UA-45466560-5/syncpack?flat&useReferer )] ( https://github.com/igrigorik/ga-beacon )
10+ <br >
11+ [ ![ Donate via Gratipay] ( https://img.shields.io/gratipay/user/JamieMason.svg )] ( https://gratipay.com/~JamieMason/ )
12+ [ ![ Follow JamieMason on GitHub] ( https://img.shields.io/github/followers/JamieMason.svg?style=social&label=Follow )] ( https://github.com/JamieMason )
13+ [ ![ Follow fold_left on Twitter] ( https://img.shields.io/twitter/follow/fold_left.svg?style=social&label=Follow )] ( https://twitter.com/fold_left )
914
10- Synchronises the versions of dependencies used across multiple ` package.json ` files, such as
11- ` packages/*/package.json ` in [ Lerna] ( https://lernajs.io ) Monorepos.
15+ Synchronises the contents of multiple ` package.json ` files, such as ` packages/*/package.json ` in
16+ [ Lerna] ( https://lernajs.io ) Monorepos.
1217
13- ## Overview
18+ ## Contents
19+
20+ * [ Installation] ( #installation )
21+ * [ Usage] ( #usage )
22+ * [ ` sync-versions ` ] ( #sync-versions )
23+ * [ ` copy-values ` ] ( #copy-values )
24+
25+ ## Installation
26+
27+ ```
28+ npm install --global syncpack
29+ ```
30+
31+ ## Usage
32+
33+ ```
34+ Usage: syncpack [options] [command]
35+
36+ Options:
37+
38+ -V, --version output the version number
39+ -h, --help output usage information
40+
41+ Commands:
42+
43+ sync-versions synchronise dependency versions between packages
44+ copy-values <keys...> copy values from eg. ./package.json to ./packages/*/package.json
45+ help [cmd] display help for [cmd]
46+ ```
47+
48+ ### ` sync-versions `
49+
50+ ```
51+ Usage: syncpack sync-versions [options]
52+
53+ Options:
54+
55+ -p, --packages <glob> location of packages. defaults to ./packages/*/package.json
56+ -h, --help output usage information
57+ ```
1458
1559Imagine the packages ` guybrush ` , ` herman ` , and ` elaine ` all have ` react ` as a dependency, but
1660versions ` '15.4.0' ` , ` '15.5.4' ` , and ` '15.6.1' ` respectively.
@@ -25,27 +69,66 @@ versions `'15.4.0'`, `'15.5.4'`, and `'15.6.1'` respectively.
2569 └── package.json
2670```
2771
28- Running ` syncpack ` will update each ` package.json ` to use version ` '15.6.1' ` of ` react ` in
29- ` dependencies ` , ` devDependencies ` , and ` peerDependencies ` as needed.
72+ To update each ` package.json ` to use version ` '15.6.1' ` of ` react ` in ` dependencies ` ,
73+ ` devDependencies ` , and ` peerDependencies ` ( as needed) you can run
3074
31- ## Installation
75+ ```
76+ syncpack sync-versions
77+ ```
78+
79+ ### ` copy-values `
3280
3381```
34- npm install --global syncpack
82+ Usage: syncpack copy-values [options] <keys...>
83+
84+ Options:
85+
86+ -p, --packages <glob> location of packages. defaults to ./packages/*/package.json
87+ -s, --source <glob> location of source. defaults to ./package.json
88+ -h, --help output usage information
3589```
3690
37- ## Usage
91+ Imagine the packages ` carla ` and ` murray ` were previously hosted at their own repositories, but are
92+ now part of your new Monorepo.
93+
94+ ```
95+ /Users/foldleft/Dev/monorepo/packages/
96+ ├── carla
97+ │ └── package.json
98+ └── murray
99+ └── package.json
100+ ```
101+
102+ With the following contents
38103
39- ### Command Line
104+ ```
105+ "bugs": "https://github.com/Scumm/carla/issues",
106+ "homepage": "https://github.com/Scumm/carla#readme",
107+ "repository": "Scumm/carla",
108+ ```
40109
41110```
42- Usage: syncpack [options] [pattern]
111+ "bugs": "https://github.com/Scumm/murray/issues",
112+ "homepage": "https://github.com/Scumm/murray#readme",
113+ "repository": "Scumm/murray",
114+ ```
43115
44- Options:
116+ To copy these fields from your Monorepo's ` package.json ` to each of its packages, you can run
45117
46- -h, --help output usage information
47- -V, --version output the version number
118+ ```
119+ syncpack copy-values bugs homepage repository
48120```
49121
50- The default pattern of ` './packages/*/package.json' ` can be overridden as follows
51- ` syncpack './**/package.json' `
122+ to copy the value of those properties, leaving them like so
123+
124+ ```
125+ "bugs": "https://github.com/Scumm/monorepo/issues",
126+ "homepage": "https://github.com/Scumm/monorepo#readme",
127+ "repository": "Scumm/monorepo",
128+ ```
129+
130+ to copy deeply nested values, pass the path to the key as follows
131+
132+ ```
133+ syncpack copy-values scripts.test
134+ ```
0 commit comments