Skip to content

Commit 8c66cbd

Browse files
latin-1codex
andcommitted
Expose JSON schemas through website routes
Co-authored-by: Codex <noreply@openai.com>
1 parent f4e0b13 commit 8c66cbd

6 files changed

Lines changed: 22 additions & 4 deletions

File tree

‎website/config/manifest.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "Manifest files (also called `package.json` because of their name) contain everything needed to describe the settings unique to one particular package. Project will contain multiple such manifests if they use the workspace feature, as each workspace is described through its own manifest. Fields whose types include `null` accept it as an unset value. Dependency maps, script maps, workspace lists, and `publishConfig` must retain their documented collection or object types. Nested `exports` targets may be `null` to block an export; nested `imports` targets must be strings or objects.",
55
"__info": [
66
"This file contains the JSON Schema for Yarn Manifest files and is:",
7-
"1) Hosted on the Yarn Website at http://yarnpkg.com/configuration/manifest.json",
8-
"2) Used to generate the documentation page at http://yarnpkg.com/configuration/manifest",
7+
"1) Hosted on the Yarn Website at https://v6.yarnpkg.com/configuration/manifest.json",
8+
"2) Used to generate the documentation page at https://v6.yarnpkg.com/configuration/manifest",
99

1010
"Note: Properties prefixed with a single underscore (e.g. _examples, _hidden)",
1111
"are unique to our documentation generation interpreter. All others will be picked up",

‎website/config/yarnrc.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"description": "Yarnrc files (named this way because they must be called `.yarnrc.yml`) are the one place where you'll be able to configure Yarn's internal settings. While Yarn will automatically find them in the parent directories, they should usually be kept at the root of your project (often your repository). **Starting from the v2, they must be written in valid Yaml and have the right extension** (simply calling your file `.yarnrc` won't do).\n\nEnvironment variables can be accessed from setting definitions by using the `${NAME}` syntax when defining the values. By default Yarn will require the variables to be present, but this can be turned off by using either `${NAME-fallback}` (which will return `fallback` if `NAME` isn't set) or `${NAME:-fallback}` (which will return `fallback` if `NAME` isn't set, or is an empty string).\n\nNullable settings accept explicit `null` values. Omission lets configuration sources and defaults apply; `null` is an explicit value, with setting-specific behavior.\n\nFinally, note that most settings can also be defined through environment variables (at least for the simpler ones; arrays and objects aren't supported yet). To do this, just prefix the names and write them in snake case: `YARN_CACHE_FOLDER` will set the cache folder (such values will overwrite any that might have been defined in the RC files - use them sparingly).",
55
"__info": [
66
"This file contains the JSON Schema for Yarnrc files and is:",
7-
"1) Hosted on the Yarn Website at http://yarnpkg.com/configuration/yarnrc.json",
7+
"1) Hosted on the Yarn Website at https://v6.yarnpkg.com/configuration/yarnrc.json",
88
"2) Registered on the SchemaStore catalog so that editors can offer autocompletion and validation.",
9-
"3) Used to generate the documentation page at http://yarnpkg.com/configuration/yarnrc",
9+
"3) Used to generate the documentation page at https://v6.yarnpkg.com/configuration/yarnrc",
1010

1111
"Note: Properties prefixed with a single underscore (e.g. _exampleItems, _exampleKeys, _hidden)",
1212
"are unique to our documentation generation interpreter. All others will be picked up",

‎website/src/pages/configuration/manifest.astro‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ const fields = schemaFieldNames(schema);
2121

2222
<PageHeader title="Manifest (package.json)" lead="Allowed fields in package.json files" />
2323

24+
<p class="prose"><a href="/configuration/manifest.json">JSON schema</a> for editor validation and autocompletion.</p>
25+
2426
<div class="prose" set:html={html} />
2527
</DocsLayout>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type {APIRoute} from 'astro';
2+
3+
import schema from '../../../config/manifest.json';
4+
5+
export const GET: APIRoute = () => new Response(JSON.stringify(schema, null, 2), {
6+
headers: {'Content-Type': `application/json; charset=utf-8`},
7+
});

‎website/src/pages/configuration/yarnrc.astro‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ const fields = schemaFieldNames(schema);
2121

2222
<PageHeader title="Settings (.yarnrc.yml)" lead="Allowed fields in .yarnrc.yml files" />
2323

24+
<p class="prose"><a href="/configuration/yarnrc.json">JSON schema</a> for editor validation and autocompletion.</p>
25+
2426
<div class="prose" set:html={html} />
2527
</DocsLayout>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type {APIRoute} from 'astro';
2+
3+
import schema from '../../../config/yarnrc.json';
4+
5+
export const GET: APIRoute = () => new Response(JSON.stringify(schema, null, 2), {
6+
headers: {'Content-Type': `application/json; charset=utf-8`},
7+
});

0 commit comments

Comments
 (0)