Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workspace schema #613

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/pnpm-workspace_yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ catalogs:
react-dom: ^17.10.0
```

A [_schema_](https://json-schema.org/understanding-json-schema/about) is available for this file:

```yaml title="$schema"
$schema: https://pnpm.io/schema/pnpm-workspace.json
```

[workspace]: workspaces.md
64 changes: 64 additions & 0 deletions static/schema/pnpm-workspace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pnpm.io/schema/pnpm-workspace.json",
"title": "pnpm Workspace Specification",
"description": "JSON schema for pnpm-workspace.yaml files.",
"$comment": "https://pnpm.io/pnpm-workspace_yaml",
"$defs": {
"dependency": {
"$comment": "https://json.schemastore.org/package.json",
"description": "Dependencies are specified with a simple hash of package name to version range.\nThe version range is a string which has one or more space-separated descriptors.\nDependencies can also be identified with a tarball or git URL.\n",
"type": "object",
"minProperties": 1,
"propertyNames": {
"type": "string",
"minLength": 1,
"maxLength": 214,
"pattern": "^(@[a-z0-9-~][a-z0-9-._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$"
},
"additionalProperties": {
"type": "string",
"minLength": 1,
"maxLength": 256,
"pattern": "^(\\*|latest|next|(^v?|\\sv?|[~^]|[<>]=?))?(0|[1-9xX*]\\d*)(\\.(0|[1-9xX*]\\d*)(\\.(0|[1-9xX*]\\d*)(-((0|[1-9xX*]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9xX*]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*))?)?)?$"
}
},
"catalog": {
"description": "Define dependency version ranges as reusable constants,\nfor later reference in package.json files.\nThis (singular) field creates a catalog named default.\n",
"type": "object",
"minProperties": 1,
"$ref": "#/$defs/dependency"
}
},
"type": "object",
"additionalProperties": false,
"required": [
"packages"
],
"properties": {
"packages": {
"description": "Workspace package paths. Glob patterns are supported.",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "string"
}
},
"catalog": {
"$comment": "https://pnpm.io/catalogs",
"description": "Define dependency version ranges as reusable constants,\nfor later reference in package.json files.\nThis (singular) field creates a catalog named default.\n",
"type": "object",
"minProperties": 1,
"$ref": "#/$defs/dependency"
},
"catalogs": {
"description": "Define arbitrarily named catalogs.",
"type": "object",
"minProperties": 1,
"additionalProperties": {
"$ref": "#/$defs/catalog"
}
}
}
}
Loading