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

docs: fix package bundled TS type check #5867

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

clemyan
Copy link
Member

@clemyan clemyan commented Oct 25, 2023

What's the problem this PR addresses?

The existence of bundled TS types are not detected on some package page (e.g. xterm-headless)

image

How did you fix it?

The check was resolving the main (JS) entrypoint of the package then checking for an adjacent .ts, .tsx or .d.ts file. It should instead prioritize type entrypoints (types and typings fields in pacakge.json, types condition) before falling back to the main entrypoint.

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@clemyan clemyan marked this pull request as ready for review October 25, 2023 16:10
@clemyan clemyan mentioned this pull request Oct 27, 2023
29 tasks
@RDIL RDIL added this pull request to the merge queue Nov 1, 2023
@merceyz merceyz changed the title Fix package bundled TS type check docs: fix package bundled TS type check Nov 1, 2023
Merged via the queue into yarnpkg:master with commit 0cb9acd Nov 1, 2023
16 checks passed
arcanis pushed a commit that referenced this pull request Nov 3, 2023
**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.
@clemyan clemyan deleted the website-fix-package-bundled-types branch April 10, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants