|
1 | 1 | # syncpack |
2 | 2 |
|
3 | 3 | <p align="center"> |
4 | | - <img src="https://jamiemason.github.io/syncpack/logo.svg" width="200" height="179" alt=""> |
| 4 | + <img src="https://jamiemason.github.io/syncpack/logo.svg" width="134" height="120" alt=""> |
5 | 5 | <br>Consistent dependency versions in large JavaScript Monorepos. |
6 | 6 | <br><a href="https://jamiemason.github.io/syncpack">https://jamiemason.github.io/syncpack</a> |
7 | 7 | </p> |
8 | 8 |
|
9 | 9 | ## Installation |
10 | 10 |
|
11 | 11 | ```bash |
12 | | -npm install --save-dev syncpack |
| 12 | +npm install --save-dev syncpack@alpha |
13 | 13 | ``` |
14 | 14 |
|
15 | 15 | ## Commands |
16 | 16 |
|
17 | | -### [fix-mismatches](https://jamiemason.github.io/syncpack/command/fix-mismatches) |
| 17 | +> All command line options can be combined to target packages and dependencies in multiple ways. |
18 | 18 |
|
19 | | -Ensure that multiple packages requiring the same dependency define the same version, so that every package requires eg. `react@16.4.2`, instead of a combination of `react@16.4.2`, `react@0.15.9`, and `react@16.0.0`. |
20 | | - |
21 | | -### [format](https://jamiemason.github.io/syncpack/command/format) |
22 | | - |
23 | | -Organise package.json files according to a conventional format, where fields appear in a predictable order and nested fields are ordered alphabetically. Shorthand properties are used where available, such as the `"repository"` and `"bugs"` fields. |
| 19 | +### [lint](https://jamiemason.github.io/syncpack/command/lint) and [fix](https://jamiemason.github.io/syncpack/command/fix) |
24 | 20 |
|
25 | | -### [lint](https://jamiemason.github.io/syncpack/command/lint) |
26 | | - |
27 | | -Lint all versions and ranges and exit with 0 or 1 based on whether all files match your Syncpack configuration file. |
28 | | - |
29 | | -### [lint-semver-ranges](https://jamiemason.github.io/syncpack/command/lint-semver-ranges) |
30 | | - |
31 | | -Check whether dependency versions used within "dependencies", "devDependencies", etc follow a consistent format. |
| 21 | +Ensure that multiple packages requiring the same dependency define the same version, so that every package requires eg. `react@16.4.2`, instead of a combination of `react@16.4.2`, `react@0.15.9`, and `react@16.0.0`. |
32 | 22 |
|
33 | | -### [list](https://jamiemason.github.io/syncpack/command/list) |
| 23 | +#### Examples |
34 | 24 |
|
35 | | -List all dependencies required by your packages. |
| 25 | +```bash |
| 26 | +# Find every issue in "dependencies" or "devDependencies" |
| 27 | +syncpack lint --dependency-types prod,dev |
| 28 | +# Look for issues in dependencies containing "react" in the name |
| 29 | +syncpack lint --dependencies '**react**' |
| 30 | +# Autofix the above issues |
| 31 | +syncpack fix --dependencies '**react**' |
| 32 | +# Find issues everywhere except "peerDependencies" |
| 33 | +syncpack lint --dependency-types '!peer' |
| 34 | +# Only look for issues where an exact version is used |
| 35 | +syncpack lint --specifier-types exact |
| 36 | +# Only look for issues where an exact version is specified |
| 37 | +syncpack lint --specifier-types exact |
| 38 | +# Sort dependencies by how many times they are used |
| 39 | +syncpack lint --sort count |
| 40 | +# Show a lot more detail about the issues |
| 41 | +syncpack lint --show hints,ignored,instances,statuses |
| 42 | +# See more examples |
| 43 | +syncpack lint --help |
| 44 | +syncpack fix --help |
| 45 | +# See a short summary of options |
| 46 | +syncpack lint -h |
| 47 | +syncpack fix -h |
| 48 | +``` |
36 | 49 |
|
37 | | -### [list-mismatches](https://jamiemason.github.io/syncpack/command/list-mismatches) |
| 50 | +### [update](https://jamiemason.github.io/syncpack/command/update) |
38 | 51 |
|
39 | | -List dependencies which are required by multiple packages, where the version is not the same across every package. |
| 52 | +Update packages to the latest versions from the npm registry, wherever they are in your monorepo.<br/>Semver range preferences are preserved when updating. |
40 | 53 |
|
41 | | -### [prompt](https://jamiemason.github.io/syncpack/command/prompt) |
| 54 | +#### Examples |
42 | 55 |
|
43 | | -Displays a series of prompts to fix mismatches which syncpack cannot fix automatically. |
| 56 | +```bash |
| 57 | +# Accept any update in latest (x.x.x) |
| 58 | +syncpack update --target latest |
| 59 | +# Only update minor versions (1.x.x) |
| 60 | +syncpack update --target minor |
| 61 | +# Only update patch versions (1.2.x) |
| 62 | +syncpack update --target patch |
| 63 | +# Check for outdated dependencies in one package |
| 64 | +syncpack update --check --source 'packages/pingu/package.json' |
| 65 | +# Update dependencies and devDependencies in the whole monorepo |
| 66 | +syncpack update --dependency-types dev,prod |
| 67 | +# Only update dependencies with a semver range specifier (^, ~, etc.) |
| 68 | +syncpack update --specifier-types range |
| 69 | +# Update dependencies where name exactly matches 'react' |
| 70 | +syncpack update --dependencies 'react' |
| 71 | +# Update dependencies where name contains 'react' |
| 72 | +syncpack update --dependencies '**react**' |
| 73 | +# Update dependencies with the '@aws-sdk' scope |
| 74 | +syncpack update --dependencies '@aws-sdk/**' |
| 75 | +# See more examples |
| 76 | +syncpack update --help |
| 77 | +# See a short summary of options |
| 78 | +syncpack update -h |
| 79 | +``` |
44 | 80 |
|
45 | | -### [set-semver-ranges](https://jamiemason.github.io/syncpack/command/set-semver-ranges) |
| 81 | +### [format](https://jamiemason.github.io/syncpack/command/format) |
46 | 82 |
|
47 | | -Ensure dependency versions used within `"dependencies"`, `"devDependencies"` etc follow a consistent format. |
| 83 | +Organise package.json files according to a conventional format, where fields appear in a predictable order and nested fields are ordered alphabetically. Shorthand properties are used where available, such as the `"repository"` and `"bugs"` fields. |
48 | 84 |
|
49 | | -### [update](https://jamiemason.github.io/syncpack/command/update) |
| 85 | +#### Examples |
50 | 86 |
|
51 | | -Interactively update packages to the latest versions from the npm registry, wherever they are in your monorepo. You can update every dependency, just dev/peer/prod dependencies, just packages which match a name filter, and more. |
| 87 | +```bash |
| 88 | +# Fix every formatting issue in the monorepo |
| 89 | +syncpack format |
| 90 | +# List all formatting issues in the monorepo |
| 91 | +syncpack format --check |
| 92 | +# Check the formatting of one package |
| 93 | +syncpack format --check --source 'packages/pingu/package.json' |
| 94 | +# See more examples |
| 95 | +syncpack format --help |
| 96 | +# See a short summary of options |
| 97 | +syncpack format -h |
| 98 | +``` |
52 | 99 |
|
53 | 100 | ## Badges |
54 | 101 |
|
|
0 commit comments