Skip to content

Commit

Permalink
docs(site): more progress adding documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMason committed Feb 17, 2023
1 parent d8ab5da commit 982cee4
Show file tree
Hide file tree
Showing 43 changed files with 625 additions and 344 deletions.
2 changes: 1 addition & 1 deletion site/docs/config-file.md → site/docs/config-file.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tree in the following places:
- 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)
configuration file (if present), you can use the [`--config`](./config-file.mdx)
option.

## Default Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ id: custom-types
title: customTypes
---

# `customTypes` object

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.
included in [versionGroups](./version-groups.mdx) or
[semverGroups](./semver-groups.mdx) etc.

The example below adds support for synchronising versions found in:

Expand Down Expand Up @@ -36,10 +38,10 @@ The example below adds support for synchronising versions found in:
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)
1. [`--types`](../option/types.mdx) and
[`dependencyTypes`](./dependency-types.mdx).
1. [`versionGroup.dependencyTypes`](./version-groups.mdx#dependencytypes)
1. [`semverGroup.dependencyTypes`](./semver-groups.mdx#dependencytypes)

## customTypes\[name\].path

Expand Down
81 changes: 0 additions & 81 deletions site/docs/config/dependency-types.md

This file was deleted.

77 changes: 77 additions & 0 deletions site/docs/config/dependency-types.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
id: dependency-types
title: dependencyTypes
---

import DefaultDependencyTypes from '@site/src/partials/default-dependency-types.mdx';

# `dependencyTypes` string[]

All of the [default dependency types](#default-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](#default-dependency-types) can be extended with
your own [`customTypes`](./custom-types.mdx), 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.mdx)
can be overridden on an ad hoc basis using the [`--types`](../option/types.mdx)
option.

:::

## Default dependency types

<DefaultDependencyTypes />

## 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`.
6 changes: 4 additions & 2 deletions site/docs/config/filter.md → site/docs/config/filter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ id: filter
title: filter
---

# `filter` string[]

A string which will be passed to `new RegExp()` to match against package names
that should be included.

Expand All @@ -12,7 +14,7 @@ that should be included.
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).
Instead use [`versionGroups`](./version-groups.mdx) and/or
[`semverGroups`](./semver-groups.mdx).

:::
6 changes: 4 additions & 2 deletions site/docs/config/indent.md → site/docs/config/indent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ id: indent
title: indent
---

# `indent` string

The character(s) to be used to indent your package.json files when writing to
disk.

Expand All @@ -14,8 +16,8 @@ disk.

:::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)
The `indent` configuration in your [config file](../config-file.mdx) can be
overridden on an ad hoc basis using the [`--indent`](../option/indent.mdx)
option.

:::
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ id: semver-groups
title: semverGroups
---

# `semverGroups` object[]

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.
Expand Down Expand Up @@ -91,23 +93,23 @@ and peer dependencies can be broader.

## `semverGroup.range`

Which of the [Supported Ranges](./semver-range.md#supported-ranges) this group
Which of the [Supported Ranges](./semver-range.mdx#supported-ranges) this group
should use.

## `semverGroup.dependencies`

Works the same as
[`versionGroup.dependencies`](./version-groups.md#dependencies).
[`versionGroup.dependencies`](./version-groups.mdx#dependencies).

## `semverGroup.isIgnored`

Works the same as [`versionGroup.isIgnored`](./version-groups.md#isignored).
Works the same as [`versionGroup.isIgnored`](./version-groups.mdx#isignored).

## `semverGroup.packages`

Works the same as [`versionGroup.packages`](./version-groups.md#packages).
Works the same as [`versionGroup.packages`](./version-groups.mdx#packages).

## `semverGroup.dependencyTypes`

Works the same as
[`versionGroup.dependencyTypes`](./version-groups.md#dependencytypes).
[`versionGroup.dependencyTypes`](./version-groups.mdx#dependencytypes).
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ id: semver-range
title: semverRange
---

# `semverRange` string

The semver range to be used consistently throughout your monorepo.

## Default Value
Expand All @@ -19,16 +21,16 @@ loose ranges.
:::tip

If you want to use different ranges in different packages and/or types of
dependencies, you can use [`semverGroups`](./semver-groups.md) to partition your
repo into different sets of rules.
dependencies, you can use [`semverGroups`](./semver-groups.mdx) to partition
your repo into different sets of rules.

:::

:::info

The `semverRange` configuration in your [config file](../config-file.md) can be
The `semverRange` configuration in your [config file](../config-file.mdx) can be
overridden on an ad hoc basis using the
[`--semver-range`](../option/semver-range.md) option.
[`--semver-range`](../option/semver-range.mdx) option.

:::

Expand Down
2 changes: 2 additions & 0 deletions site/docs/config/sort-az.md → site/docs/config/sort-az.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ id: sort-az
title: sortAz
---

# `sortAz` string[]

When using the `format` command, determines which fields within package.json
files should be sorted alphabetically. When the value is an Object, its keys are
sorted alphabetically. When the value is an Array, its values are sorted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ id: sort-first
title: sortFirst
---

# `sortFirst` string[]

When using the `format` command, determines which fields within package.json
files should appear at the top, and in what order.

Expand Down
14 changes: 10 additions & 4 deletions site/docs/config/source.md → site/docs/config/source.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ id: source
title: source
---

# `source` string[]

Patterns supported by [glob](https://github.com/isaacs/node-glob) to find
package.json files you want to manage with syncpack.

Expand Down Expand Up @@ -31,13 +33,17 @@ package.json files are resolved in this order of precendence:
`./pnpm-workspace.yaml`.
5. Default to `'package.json'` and `'packages/*/package.json'`.

> 👋 Always add quotes around your `--source` patterns
> [[more info](https://github.com/JamieMason/syncpack/issues/66#issuecomment-1146011769)].
:::tip

Always add quotes around your `--source` patterns
[[more info](https://github.com/JamieMason/syncpack/issues/66#issuecomment-1146011769)].

:::

:::info

Your `source` configuration in your [config file](../config-file.md) can be
overridden on an ad hoc basis using multiple [`--source`](../option/source.md)
Your `source` configuration in your [config file](../config-file.mdx) can be
overridden on an ad hoc basis using multiple [`--source`](../option/source.mdx)
options – one for each glob pattern.

:::

0 comments on commit 982cee4

Please sign in to comment.