Skip to content

Commit 318dd03

Browse files
authored
Various minor tweaks for website (#5863)
**What's the problem this PR addresses?** There are a number of build tooling and minor problems with the website. (Listed below) **How did you fix it?** Maintainers: I have marked this as draft for now due to the Questions/TODOs/TBDs. Most of these I just implemented the fix that I think is the most straightforward/reasonable. Feel free to edit/merge/cherry-pick anything here as you see fit. - [x] ~~The bundled TS type check is bugged (e.g. [xterm-headless](https://yarnpkg.com/package?q=xterm-head&name=xterm-headless) is reported as "no types")~~ - [x] ~~Fix: prioritize type entrypoints (`types` and `typings` fields in `pacakge.json`, `types` condition) instead of normal (JS) entrypoints when resolving the package.~~ - On second thought I think it is better to split this to another PR (#5867) - [x] Building the website fails on Windows due to [quirks of child_process](https://nodejs.org/api/child_process.html#child_process_spawning_bat_and_cmd_files_on_windows) on Windows - [x] Fix: use `cross-spawn`, which `@yarnpkg/core` already depends on - [x] There are a number of unused files/assets/patches/dependencyMetas - [x] Fix: delete them - [x] The README is the default one generated by Docusuarus - [x] Fix: Update it to have slightly more useful info - [x] There are a number of broken links, as reported by docusaurus during `build` - In particular, the [Release Workflow](https://v3.yarnpkg.com/features/release-workflow) was not ported to the new website. - [x] Fix: port the Release Workflow page from the old website - [x] Fix: Delete the extraneous "Publishing" page, for now - [x] Fix: change broken links to new URLs - [x] ~~**Question**: What is the "Publishing" page? Is it supposed to be a re-written Release Workflow page?~~ - [ ] There are also a number of broken links from other places in this repo - There are a total of 12 broken links (404 or not the intended page) - 1 of them is to https://yarnpkg.com/advanced/sherlock, where there is no short-term resolution (see #5859) - 2 of them are to https://yarnpkg.com/api, see below - 4 of them are in old blog posts. Let's leave them be - [x] Fix: Fix the other 5 - There are a few links to https://yarnpkg.com/features/zero-installs, which 301-redirects to https://yarnpkg.com/features/caching#zero-installs - 2 of them are in old blog posts / CHANGELOG. Let's leave them be - [x] Fix: Change the others to the canonical URL - There are a few links to package pages like https://yarnpkg.com/package/eslint, which 301-redirects to https://yarnpkg.com/package?name=eslint - [ ] **Question**: Should we change those to the canonical URLs - [x] There is an extraneous TOC block in the [Rulebook](https://yarnpkg.com/advanced/rulebook), a remnant of the old Gatsby-based website - [x] Fix: Remove it. Docusaurus adds a right sidebar/"On this page" block automatically - [x] The output during build is quite excessive. In particular, our own commandLineHighlight plugin is spewing multi-line "fail to parse" errors onto the console, which interferes with docusaurus' own progress bar - [x] Fix: reduce the commandLineHighlight plugin output to only display the command line that failed to parse - ~~**Question**: This a not a very elegant solution. Are there better alternatives?~~ - I have an idea for a better solution. Will be a separate PR - [x] There are two warnings during build: - `webpack` warns `js-yaml` on using `buffer` - [x] Fix: Explicitly disable the `buffer` polyfill as suggested - `autoprefixer` warns `src/css/custom.css` on using `text-decoration-skip` CSS property - [x] Fix: Use `text-decoration-skip-ink` instead as suggested - [x] Add a dropdown to the navbar that links to the old websites - [x] ~~**Question**: Should we use [versioned docs](https://docusaurus.io/docs/versioning) for v4+?~~ - ~~**TBD**: While generating the CLI docs, run the CLI in JS instead of via the OS shell to avoid spawning a terminal window~~ - ~~**TBD**: The API reference is completely removed. What should we do about it?~~ - ~~**TBD**: Should we update `caniuse-lite` as suggested? Should we do it regularly?~~ Closes #5667 (supersedes) Closes #5860 (supersedes) ~~Closes #5894 (supersedes)~~ Fixes #5707 Fixes #5805 Fixes #5832 ~~Fixes #5861~~ ~~Fixes #5869~~ Fixes #5926 **Checklist** <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [x] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [x] I will check that all automated PR checks pass before the PR gets reviewed.
1 parent 0ee6213 commit 318dd03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+172
-501
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# https://yarnpkg.com/getting-started/qa/#which-files-should-be-gitignored
1+
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
22
.yarn/*
33
!.yarn/cache
44
!.yarn/patches

.pnp.cjs

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.yarn/patches/typedoc-npm-0.17.0-3-0ce05847cf.patch

Lines changed: 0 additions & 14 deletions
This file was deleted.

.yarn/versions/aa1cf688.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
releases:
2+
"@yarnpkg/cli": patch
3+
"@yarnpkg/doctor": patch
4+
"@yarnpkg/plugin-essentials": patch
5+
"@yarnpkg/plugin-init": patch
6+
"@yarnpkg/plugin-patch": patch
7+
8+
declined:
9+
- "@yarnpkg/plugin-compat"
10+
- "@yarnpkg/plugin-constraints"
11+
- "@yarnpkg/plugin-dlx"
12+
- "@yarnpkg/plugin-interactive-tools"
13+
- "@yarnpkg/plugin-nm"
14+
- "@yarnpkg/plugin-npm-cli"
15+
- "@yarnpkg/plugin-pack"
16+
- "@yarnpkg/plugin-pnp"
17+
- "@yarnpkg/plugin-pnpm"
18+
- "@yarnpkg/plugin-stage"
19+
- "@yarnpkg/plugin-typescript"
20+
- "@yarnpkg/plugin-version"
21+
- "@yarnpkg/plugin-workspace-tools"
22+
- "@yarnpkg/builder"
23+
- "@yarnpkg/core"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
Yarn is a modern package manager split into various packages. Its novel architecture allows to do things currently impossible with existing solutions:
2020

21-
- Yarn supports [plugins](https://yarnpkg.com/features/plugins); adding a plugin is as simple as adding it to your repository
21+
- Yarn supports [plugins](https://yarnpkg.com/features/extensibility); adding a plugin is as simple as adding it into your repository
2222
- Yarn supports Node by default but isn't limited to it - plugins can add support for other languages
2323
- Yarn supports [workspaces](https://yarnpkg.com/features/workspaces) natively, and its CLI takes advantage of that
2424
- Yarn uses a bash-like [portable shell](https://github.com/yarnpkg/berry/tree/master/packages/yarnpkg-shell#yarnpkgshell) to make package scripts portable across Windows, Linux, and macOS

package.json

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
},
3333
"resolutions": {
3434
"ink": "patch:ink@npm%3A3.0.8#~/.yarn/patches/ink-npm-3.0.8-3a8005f59f.patch",
35-
"yoga-layout-prebuilt": "patch:[email protected]#./.yarn/patches/yoga-layout-prebuilt.patch",
36-
"typedoc@npm:0.16.0": "patch:typedoc@npm%3A0.17.0-3#~/.yarn/patches/typedoc-npm-0.17.0-3-0ce05847cf.patch",
37-
"typedoc@npm:0.17.0-3": "patch:typedoc@npm%3A0.17.0-3#~/.yarn/patches/typedoc-npm-0.17.0-3-0ce05847cf.patch"
35+
"yoga-layout-prebuilt": "patch:[email protected]#./.yarn/patches/yoga-layout-prebuilt.patch"
3836
},
3937
"dependenciesMeta": {
4038
"core-js": {
@@ -48,27 +46,6 @@
4846
},
4947
"fsevents": {
5048
"built": false
51-
},
52-
"gatsby": {
53-
"built": false
54-
},
55-
"gatsby-cli": {
56-
"built": false
57-
},
58-
59-
"unplugged": true
60-
},
61-
"gatsby-telemetry": {
62-
"built": false
63-
},
64-
65-
"unplugged": true
66-
},
67-
68-
"unplugged": true
69-
},
70-
"svg2png": {
71-
"unplugged": true
7249
}
7350
},
7451
"scripts": {

packages/docusaurus/README.md

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22

33
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
44

5-
### Installation
6-
7-
```
8-
$ yarn
9-
```
10-
11-
### Local Development
5+
### Development
126

137
```
148
$ yarn start
@@ -26,16 +20,4 @@ This command generates static content into the `build` directory and can be serv
2620

2721
### Deployment
2822

29-
Using SSH:
30-
31-
```
32-
$ USE_SSH=true yarn deploy
33-
```
34-
35-
Not using SSH:
36-
37-
```
38-
$ GIT_USER=<Your GitHub username> yarn deploy
39-
```
40-
41-
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
23+
The `master` branch is automatically deployed to https://yarnpkg.com/ via [Netlify](https://www.netlify.com/). Pull Requests are also deployed as Deploy Previews.

packages/docusaurus/docs/advanced/01-general-reference/lexicon.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ See also: [Workspaces](/features/workspaces)
132132

133133
A range is a string that, when combined with a package name, can be used to select multiple versions of a single package. Ranges typically follow <abbr>semver</abbr>, but can use any of the supported Yarn protocols.
134134

135-
See also: [Protocols](/features/protocols)
135+
See also: [Protocols](/protocols)
136136

137137
### Reference
138138

139139
A reference is a string that, when combined with a package name, can be used to select one single version of a single package. References typically follow <abbr>semver</abbr>, but can use any of the supported Yarn protocols.
140140

141-
See also: [Protocols](/features/protocols)
141+
See also: [Protocols](/protocols)
142142

143143
### Resolver
144144

@@ -192,7 +192,7 @@ Generally speaking workspaces are a Yarn features used to work on multiple proje
192192

193193
In the context of Yarn's vocabulary, workspaces are local <abbr>packages</abbr> that directly belong to a <abbr>project</abbr>.
194194

195-
See also: [Packages](/features/packages), [Workspaces](/features/workspaces)
195+
See also: [Workspaces](/features/workspaces)
196196

197197
### Worktree
198198

packages/docusaurus/docs/advanced/02-package-management/lifecycle-scripts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Although rarely called directly, `yarn pack` is a crucial part of Yarn. Each tim
2626
This script is called before `yarn npm publish` before the package has even been packed. This is the place where you'll want to check that the project is in an ok state.
2727

2828
:::caution
29-
Because it's only called on prepublish, **the prepublish hook shouldn't have side effects.** In particular don't transpile the package sources in `prepublish`, as people consuming directly your repository (such as through the [`git:` protocol](/features/protocols#git)) wouldn't be able to use your project. Instead, use `prepack`.
29+
Because it's only called on prepublish, **the prepublish hook shouldn't have side effects.** In particular don't transpile the package sources in `prepublish`, as people consuming directly your repository (such as through the [`git:` protocol](/protocol/git)) wouldn't be able to use your project. Instead, use `prepack`.
3030
:::
3131

3232
## `postinstall`

packages/docusaurus/docs/advanced/02-package-management/rulebook.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ Writing portable packages is incredibly important, as it ensures that your users
99

1010
To help with that, this page details the up-to-date collection of good practices you should follow in order to make your package work seamlessly on all three main package managers (Yarn, pnpm, and npm), and explanations if you want to learn more.
1111

12-
```toc
13-
# This code block gets replaced with the Table of Contents
14-
```
15-
1612
## Packages should only ever require what they formally list in their dependencies
1713

1814
**Why?** Because otherwise your package will be susceptible to unpredictable [hoisting](/advanced/lexicon#hoisting) that will lead some of your consumers to experience pseudo-random crashes, depending on the other packages they will happen to use.

packages/docusaurus/docs/advanced/03-pnp/pnp-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ This function will return `null` if the request is a builtin module, unless `con
265265
export function resolveVirtual(path: string): string | null;
266266
```
267267

268-
**Important:** This function is not part of the Plug'n'Play specification and only available as a Yarn extension. In order to use it, you first must check that the [`VERSIONS`](/advanced/pnp-api#versions) dictionary contains a valid `resolveVirtual` property.
268+
**Important:** This function is not part of the Plug'n'Play specification and only available as a Yarn extension. In order to use it, you first must check that the [`VERSIONS`](/advanced/pnpapi#versions) dictionary contains a valid `resolveVirtual` property.
269269

270270
The `resolveVirtual` function will accept any path as parameter and return the same path minus any [virtual component](/advanced/lexicon#virtual-package). This makes it easier to store the location to the files in a portable way as long as you don't care about losing the dependency tree information in the process (requiring files through those paths will prevent them from accessing their peer dependencies).
271271

packages/docusaurus/docs/advanced/03-pnp/pnp-spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ FIND_PNP_MANIFEST(url)
295295

296296
Finding the right PnP manifest to use for a resolution isn't always trivial. There are two main options:
297297

298-
- Assume that there is a single PnP manifest covering the whole project. This is the most common case, as even when referencing third-party projects (for example via the [`portal:` protocol](/features/protocols#whats-the-difference-between-link-and-portal)) their dependency trees are stored in the same manifest as the main project.
298+
- Assume that there is a single PnP manifest covering the whole project. This is the most common case, as even when referencing third-party projects (for example via the [`portal:` protocol](/protocol/portal#portals-vs-links)) their dependency trees are stored in the same manifest as the main project.
299299

300300
To do that, call [`FIND_CLOSEST_PNP_MANIFEST`](#find_closest_pnp_manifest)`(require.main.filename)` once at the start of the process, cache its result, and return it for each call to [`FIND_PNP_MANIFEST`](#find_pnp_manifest) (if you're running in Node.js, you can even use `require.resolve('pnpapi')` which will do this work for you).
301301

packages/docusaurus/docs/advanced/04-technical/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ What happens when running `yarn install` can be summarized in a few different st
3131

3232
- Now that we have the exact set of packages that make up our dependency tree, we iterate over it and for each of them we start a new request to the cache to know whether the package is anywhere to be found. If it isn't we do just like we did in the previous step and we ask our plugins (through the [`Fetcher`](https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-core/sources/Fetcher.ts) interface) whether they know about the package ([`supports`](https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-core/sources/Fetcher.ts#L43)) and if so to retrieve it from whatever its remote location is ([`fetch`](https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-core/sources/Fetcher.ts#L67)).
3333

34-
- Interesting tidbit regarding the fetchers: they communicate with the core through an abstraction layer over `fs`. We do this so that our packages can come from many different sources - it can be from a zip archive for packages downloaded from a registry, or from an actual directory on the disk for [`portal:`](/features/protocols#portal) dependencies.
34+
- Interesting tidbit regarding the fetchers: they communicate with the core through an abstraction layer over `fs`. We do this so that our packages can come from many different sources - it can be from a zip archive for packages downloaded from a registry, or from an actual directory on the disk for [`portal:`](/protocol/portal) dependencies.
3535

3636
3. And finally, once all the packages are ready for consumption, comes the "link step":
3737

packages/docusaurus/docs/advanced/04-technical/plugin-tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: "Plugin Tutorial"
55
description: A basic plugin tutorial which shows how to work with Yarn's plugin API.
66
---
77

8-
Starting from the Yarn 2, Yarn now supports plugins. For more information about what they are and in which case you'd want to use them, consult the [dedicated page](/features/plugins). We'll talk here about the exact steps needed to write one. It's quite simple, really!
8+
Starting from the Yarn 2, Yarn now supports plugins. For more information about what they are and in which case you'd want to use them, consult the [dedicated page](/features/extensibility). We'll talk here about the exact steps needed to write one. It's quite simple, really!
99

1010
## What does a plugin look like?
1111

packages/docusaurus/docs/features/constraints.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: An in-depth guide to Yarn's constraints, a feature that provides an
66
---
77

88
:::info
9-
This page documents the new JavaScript-based constraints. The older constraints, based on Prolog, are still supported but should be considered deprecated. Their documentation can be found [here](/features/constraints-prolog).
9+
This page documents the new JavaScript-based constraints. The older constraints, based on Prolog, are still supported but should be considered deprecated. Their documentation can be found [here](https://v3.yarnpkg.com/features/constraints).
1010
:::
1111

1212
## Overview
@@ -156,4 +156,3 @@ module.exports = defineConfig({
156156
},
157157
});
158158
```
159-

packages/docusaurus/docs/features/patching.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ By default, `yarn patch` will always reset the patch. If you wish to add new cha
2727

2828
## Limitations
2929

30-
- Because they're currently computed at fetch time rather than resolution time, the package dependencies have already been resolved and patches won't be able to alter them.
30+
- Because they're currently computed at fetch time rather than resolution time, the package dependencies have already been resolved and patches won't be able to alter them. Instead, use the `packageExtensions` mechanism which is specifically made to add new runtime dependencies to packages.
3131

3232
- Patches are ill-suited for modifying binary files. Minified files are problematic as well, although we could improve the feature to automatically process such files through a Prettier-like tool.

packages/docusaurus/docs/features/publishing.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)