-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(site): migrate docs from readme
- Loading branch information
1 parent
92d2f23
commit d397ea7
Showing
44 changed files
with
1,023 additions
and
848 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
id: config-file | ||
title: Configuration File | ||
--- | ||
|
||
Creating a configuration file is optional, syncpack will search up the directory | ||
tree in the following places: | ||
|
||
- a `syncpack` property in `package.json` | ||
- a `.syncpackrc` file in JSON or YAML format | ||
- a `.syncpackrc.json`, `.syncpackrc.yaml`, `.syncpackrc.yml`, `.syncpackrc.js`, | ||
or `.syncpackrc.cjs` file | ||
- a `syncpack.config.js` or `syncpack.config.cjs` CommonJS module exporting an | ||
object | ||
- a `config.syncpack` property in `package.json` | ||
|
||
If you want to specify a path to a configuration file, overriding the discovered | ||
configuration file (if present), you can use the [`--config`](./config-file.md) | ||
option. | ||
|
||
## Default Configuration | ||
|
||
```json | ||
{ | ||
"customTypes": [], | ||
"dependencyTypes": [ | ||
"dev", | ||
"overrides", | ||
"peer", | ||
"pnpmOverrides", | ||
"prod", | ||
"resolutions", | ||
"workspace" | ||
], | ||
"filter": ".", | ||
"indent": " ", | ||
"semverGroups": [], | ||
"semverRange": "", | ||
"sortAz": [ | ||
"contributors", | ||
"dependencies", | ||
"devDependencies", | ||
"keywords", | ||
"peerDependencies", | ||
"resolutions", | ||
"scripts" | ||
], | ||
"sortFirst": ["name", "description", "version", "author"], | ||
"source": ["package.json", "packages/*/package.json"], | ||
"versionGroups": [] | ||
} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
id: custom-types | ||
title: customTypes | ||
--- | ||
|
||
Extend syncpack to find and fix versions in your packages which are not | ||
available by default. Custom types behave like any other dependency, so can be | ||
included in [versionGroups](./version-groups.md) or | ||
[semverGroups](./semver-groups.md) etc. | ||
|
||
The example below adds support for synchronising versions found in: | ||
|
||
1. The | ||
[`engines`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#engines) | ||
object. | ||
1. The [`packageManager`](https://nodejs.org/api/packages.html#packagemanager) | ||
string. | ||
|
||
```json | ||
{ | ||
"customTypes": { | ||
"engines": { | ||
"path": "engines", | ||
"strategy": "versionsByName" | ||
}, | ||
"packageManager": { | ||
"path": "packageManager", | ||
"strategy": "name@version" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## customTypes\[name\] | ||
|
||
The key of each custom type is its name, this can be used in the following | ||
places to toggle when it is enabled: | ||
|
||
1. [`--types`](../option/types.md) and | ||
[`dependencyTypes`](./dependency-types.md). | ||
1. [`versionGroup.dependencyTypes`](./version-groups.md#dependencytypes) | ||
1. [`semverGroup.dependencyTypes`](./semver-groups.md#dependencytypes) | ||
|
||
## customTypes\[name\].path | ||
|
||
Where the version can be found in each package.json file, such as `engines`, | ||
`packageManager` or `some.nested.property`. | ||
|
||
## customTypes\[name\].strategy | ||
|
||
A strategy defines how syncpack needs to read and write dependency names and | ||
versions, there are 3 to choose from: | ||
|
||
| Name | Example | | ||
| ---------------- | -------------------------------------- | | ||
| `name@version` | `pnpm@7.27.0` | | ||
| `version` | `12.4.2` | | ||
| `versionsByName` | `{"pnpm":"7.27.0", "semver": "7.3.8"}` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
--- | ||
id: dependency-types | ||
title: dependencyTypes | ||
--- | ||
|
||
All of the [default dependency types](#dependency-types) are enabled by default, | ||
but can be reduced to a smaller list via the `dependencyTypes` property of your | ||
config file. | ||
|
||
In this example, only dependencies found in the | ||
[`dependencies`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#dependencies) | ||
and | ||
[`devDependencies`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#devDependencies) | ||
properties of package.json files will be inspected by syncpack: | ||
|
||
```json | ||
{ | ||
"dependencyTypes": ["dev", "prod"] | ||
} | ||
``` | ||
|
||
:::tip | ||
|
||
The [default dependency types](#dependency-types) can be extended with your own | ||
[`customTypes`](./custom-types.md), so you can find and fix versions found in | ||
other parts of your package.json files. | ||
|
||
::: | ||
|
||
:::info | ||
|
||
Your `dependencyTypes` configuration in your [config file](../config-file.md) | ||
can be overridden on an ad hoc basis using the [`--types`](../option/types.md) | ||
option. | ||
|
||
::: | ||
|
||
## Default dependency types | ||
|
||
| Value | Property in package.json | | ||
| --------------- | ------------------------------------------------------------------------------------------------- | | ||
| `dev` | [`devDependencies`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#devDependencies) | | ||
| `overrides` | [`overrides`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides) | | ||
| `peer` | [`peerDependencies`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#peerDependencies) | | ||
| `pnpmOverrides` | [`pnpm.overrides`](https://pnpm.io/package_json#pnpmoverrides) | | ||
| `prod` | [`dependencies`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#dependencies) | | ||
| `resolutions` | [`resolutions`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#resolutions) | | ||
| `workspace` | [`version`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#version) | | ||
|
||
## The `workspace` type | ||
|
||
This option synchronises the versions of your dependencies with the | ||
[`version`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#version) | ||
properties of the package.json files developed in your own local | ||
workspace/project, when they relate to eachother. | ||
|
||
Take this example, `@your-repo/fetch` is developed in your repo: | ||
|
||
```jsonc | ||
{ | ||
"name": "@your-repo/fetch", | ||
"version": "1.0.2" | ||
// ...rest of the file | ||
} | ||
``` | ||
|
||
and another package developed in your repo depends on it: | ||
|
||
```jsonc | ||
{ | ||
"name": "@your-repo/ui", | ||
// ...other stuff | ||
"dependencies": { | ||
"@your-repo/fetch": "0.9.4" | ||
} | ||
// ...rest of the file | ||
} | ||
``` | ||
|
||
When `workspace` is enabled, syncpack will fix `@your-repo/ui` so it depends on | ||
version `1.0.2` of `@your-repo/fetch`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
id: filter | ||
title: filter | ||
--- | ||
|
||
A string which will be passed to `new RegExp()` to match against package names | ||
that should be included. | ||
|
||
:::danger | ||
|
||
`filter` was originally intended as a convenience to be used from the command | ||
line to filter the output of `syncpack list`, **it is not recommended to add | ||
this to your config file to manage your project more generally**. | ||
|
||
Instead use [`versionGroups`](./version-groups.md) and/or | ||
[`semverGroups`](./semver-groups.md). | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
id: indent | ||
title: indent | ||
--- | ||
|
||
The character(s) to be used to indent your package.json files when writing to | ||
disk. | ||
|
||
```json | ||
{ | ||
"indent": " " | ||
} | ||
``` | ||
|
||
:::info | ||
|
||
The `indent` configuration in your [config file](../config-file.md) can be | ||
overridden on an ad hoc basis using the [`--indent`](../option/indent.md) | ||
option. | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
--- | ||
id: semver-groups | ||
title: semverGroups | ||
--- | ||
|
||
Allow some packages to have different semver range rules to the rest of your | ||
monorepo. Each dependency can only belong to one semver group, the first rule | ||
which matches a given dependency and package will apply. | ||
|
||
## Example use cases | ||
|
||
1: Every dependency of `@myrepo/library` should have a semver range of `~`, | ||
regardless of what the rest of the monorepo uses: | ||
|
||
```json | ||
{ | ||
"semverGroups": [ | ||
{ | ||
"range": "~", | ||
"dependencies": ["**"], | ||
"packages": ["@myrepo/library"] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
2: Every dependency of `@myrepo/library` whose name matches `@alpha/**` should | ||
have a semver range of `^`, regardless of what the rest of that package or the | ||
rest of the monorepo uses: | ||
|
||
```json | ||
{ | ||
"semverGroups": [ | ||
{ | ||
"range": "^", | ||
"dependencies": ["@alpha/**"], | ||
"packages": ["@myrepo/library"] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
3: Every dependency in the monorepo whose name matches `@alpha/**` should have a | ||
semver range of `~`, regardless of what the rest of the monorepo uses: | ||
|
||
```json | ||
{ | ||
"semverGroups": [ | ||
{ | ||
"range": "~", | ||
"dependencies": ["@alpha/**"], | ||
"packages": ["**"] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
3: Production dependencies should have fixed version numbers, but development | ||
and peer dependencies can be broader. | ||
|
||
```json | ||
{ | ||
"semverGroups": [ | ||
{ | ||
"range": "", | ||
"dependencyTypes": [ | ||
"dependencies", | ||
"resolutions", | ||
"overrides", | ||
"pnpmOverrides", | ||
"workspace" | ||
], | ||
"dependencies": ["**"], | ||
"packages": ["**"] | ||
}, | ||
{ | ||
"range": "~", | ||
"dependencyTypes": ["devDependencies"], | ||
"dependencies": ["**"], | ||
"packages": ["**"] | ||
}, | ||
{ | ||
"range": "^", | ||
"dependencyTypes": ["peerDependencies"], | ||
"dependencies": ["**"], | ||
"packages": ["**"] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## `semverGroup.range` | ||
|
||
Which of the [Supported Ranges](./semver-range.md#supported-ranges) this group | ||
should use. | ||
|
||
## `semverGroup.dependencies` | ||
|
||
Works the same as | ||
[`versionGroup.dependencies`](./version-groups.md#dependencies). | ||
|
||
## `semverGroup.isIgnored` | ||
|
||
Works the same as [`versionGroup.isIgnored`](./version-groups.md#isignored). | ||
|
||
## `semverGroup.packages` | ||
|
||
Works the same as [`versionGroup.packages`](./version-groups.md#packages). | ||
|
||
## `semverGroup.dependencyTypes` | ||
|
||
Works the same as | ||
[`versionGroup.dependencyTypes`](./version-groups.md#dependencytypes). |
Oops, something went wrong.