Граф коммитов

49 Коммитов

Автор SHA1 Сообщение Дата
Piotr Płaczek 457bd50df0
feat: API History (#594)
* feat(api-history): basic webpack and remark plugin

* feat(api-history): basic table

* feat(api-history): minor table styling

* refactor(api-history): move regexp to variable

* feat(api-history): better regexp

* feat(api-history): move plugin to own file

* feat(api-history): remove `removed` property

* feat(api-history): fetch version using pr

* feat(api-history): types for data fetch code

* refactor(api-history): more readable row sorting

* feat(api-history): changes markdown support

* feat(api-history): strip comment tags in pre-build instead of plugin

* feat(api-history): `pr-release-versions-plugin`

* feat(api-history): use react component instead of handmade AST

* fix(api-history): revert accidental dependency

* refactor(api-history): get pr releases in transformer, remove plugin

* docs(api-history): todo in transformer

* docs(api-history): add temp example api history and schema for pr review

* fix(api-history): update `yarn.lock` for now

* feat(api-history): use example pr versions by default for now

https://github.com/electron/website/pull/594#discussion_r1662921815

* refactor(api-history): move `ApiHistoryTable` styles to module

https://github.com/electron/website/pull/594#discussion_r1665401454

* style(api-history): better var name, fix style lint

https://github.com/electron/website/pull/594#discussion_r1665405557

* feat(api-history): map pre-releases to released stable versions

* feat(api-history): better styles, remove pr number

* feat(api-history): link table change to breaking-changes

* fix(api-history): provide key for table elements

* feat(api-history): table semver ranges

Co-authored-by: Samuel Attard <sam@electronjs.org>

* feat(api-history): better error handling

https://github.com/electron/website/pull/594#discussion_r1671021901

* feat(api-history): type predicates in transformer

https://github.com/electron/website/pull/594#discussion_r1671021901

* feat(api-history): update to accepted schema

https://github.com/electron/rfcs/pull/6

* docs(api-history): remove old comments

* feat(api-history): only pre-process `/docs/api/*.md` containing `<!--`

* Update scripts/tasks/preprocess-api-history.ts

Co-authored-by: Kevin Cui <158blackhole@gmail.com>

* fix(api-history): match api history block consistently

* feat(api-history): pre-process more error checking

* Update docs/latest/api-history.schema.json

Co-authored-by: Erick Zhao <erick@hotmail.ca>

* fix(api-history): duplicate dependencies

* docs(api-history): remove unnecessary comment

* refactor(api-history): move pre-process deps to dev deps

* feat(api-history): `isHtml(node)` type guard

https://github.com/electron/website/pull/594#discussion_r1678184944

* fix(api-history): missing `toLowerCase()`

* Update scripts/tasks/preprocess-api-history.ts

Co-authored-by: Kevin Cui <158blackhole@gmail.com>

* Update scripts/tasks/preprocess-api-history.ts

Co-authored-by: Kevin Cui <158blackhole@gmail.com>

* Update src/components/ApiHistoryTable.tsx

Co-authored-by: Kevin Cui <158blackhole@gmail.com>

* revert(api-history): `isHtml(node)` type guard

This reverts commit 9481b1caa5.

* feat(api-history): tell user to run `lint-roller`

* fix(api-history): stricter change type param

* Apply suggestions from code review

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* style(api-history): fix lint

* fix(api-history): remove unnecessary null check

* style(api-history): fix lint

* docs(api-history): stricter schema

Reference: c9de2c5f63

* docs(api-history): `ipc-renderer`

Reference: https://github.com/electron/electron/pull/42982#discussion_r1692533981

* docs(api-history): `browser-view`

* ci: use GH token with correct permissions

* fix(api-history): change semver sign if backport is `x.0.0`

Reported-by: David Sanders <dsanders11@ucsbalum.com>

* fix(api-history): preprocess warn on missing schema

* Update src/components/ApiHistoryTable.tsx

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* refactor(api-history): better semver logic

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
Based-on-patch-by: David Sanders <dsanders11@ucsbalum.com>
Reference: https://github.com/electron/website/pull/594#discussion_r1712450684

* refactor(api-history): remove test `docs/`

`git diff feat/api-history origin/main -- docs/latest/api/ | git apply`

* refactor(api-history): remove test PR data

---------

Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Kevin Cui <158blackhole@gmail.com>
Co-authored-by: Erick Zhao <erick@hotmail.ca>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2024-08-12 11:01:41 -07:00
David Sanders 8d3248b1c8
chore: remove got dependency in favor of built-in fetch (#609) 2024-08-01 13:04:02 -07:00
David Sanders 79cd8b131f
chore(prebuild): remove make-dir dependency (#600) 2024-07-10 13:51:24 -07:00
Erick Zhao c3c1078169
fix(prebuild): clean up doc sync matcher (#598) 2024-07-05 10:09:32 +08:00
Erick Zhao 7f807efdc8
build: upgrade to Docusaurus 3 (#563)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2024-05-31 15:10:27 -07:00
Erick Zhao cd0a4bc5c8
build: upgrade to TypeScript 5.3 (#560) 2024-05-07 12:21:40 -07:00
Erick Zhao fd88af004f
fix(md): ensure <img> tags self-close (#465) 2023-11-02 12:36:44 -07:00
Erick Zhao 329c555360
fix(md): ensure `</details>` tag is on newline (#458)
fix(md): ensure </details> is on newline
2023-10-16 21:14:01 -07:00
David Sanders f5be1c69d3
feat: support inlining API structure links with ?inline query param (#394) 2023-04-18 16:22:46 -07:00
David Sanders 915282a5d0
chore: fix typos in comments (#399) 2023-03-30 11:04:53 -07:00
Erick Zhao 2edde7b069
style(pre-build) apply prettier on sidebar gen (#384) 2023-03-15 11:24:22 -07:00
Erick Zhao 053e6e7e01
chore: ignore synopsis doc for sidebar generation (#383) 2023-03-14 18:14:48 -07:00
David Sanders eeffd0cbe6
fix: remove old support page from sidebar (#363)
* fix: remove old support page from sidebar

* ignorelist the doc from script

---------

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2023-01-31 15:39:51 -08:00
Erick Zhao 965262db64
refactor: convert website to TypeScript (#330) 2023-01-16 11:21:30 -08:00
Erick Zhao 2da282468a
build: remove unused versioned docs scripts (#327) 2022-11-30 13:40:45 -08:00
Erick Zhao 1c3829cb4d
fix(i18n): remove unnecessary Docusaurus config hacks (#311) 2022-11-25 07:42:12 -08:00
Antón Molleda aa6a0fb986 chore: sidebar improvements
Move the "Tutorial" category towards the top.
Ignore "support".
2022-07-05 16:19:50 -07:00
Erick Zhao 97510889ef chore: update discord link 2022-06-15 15:25:38 -04:00
Erick Zhao a3f69ec6c8
fix: proper str replace in multiline image title (#217) 2022-04-18 11:41:48 -07:00
Antón Molleda b228804a5a
fix: admonitions for crowdin
Close #186
2022-03-09 11:16:35 -08:00
Erick Zhao 7473e835fa
build: add ESLint + Prettier config (#179) 2022-02-22 12:00:21 -08:00
Erick Zhao d545194854
fix(prebuild): better sidebar automation (#178) 2022-02-16 17:06:23 -08:00
Erick Zhao adf029c3cb build: fix crowdin build for admonition syntax 2022-02-14 23:43:39 -08:00
Erick Zhao 5efd4d770d
feat: sidebar guide improvements (#172) 2022-02-11 12:54:46 -08:00
Erick Zhao 64616efb0b
fix(prebuild): only prefix electron docs (#164) 2022-01-13 11:39:00 -08:00
Antón Molleda b1b40ab1a2 chore: fix sidebars 2021-11-04 10:37:44 -07:00
Antón Molleda 2fd49164b9 chore: better handle versions menu
Use the version number instead of `Current` in the versions drop down as
well as its title when visiting the latest documentation. Previous
branches only have a link to the most up-to-date docs to avoid getting
stale.

This also removes the pre-commit hook to avoid issues adding new
versions to translate (which is unnecessary).
2021-10-22 16:48:12 -07:00
Antón Molleda 3cd8630e2e chore: improve adding new docs to sidebars'
Fix #95
2021-10-22 16:34:44 -07:00
Antón Molleda 707718fa7a fix: new docs process
The `.gitignore` was too aggressive and new files under `docs/latest`
weren't added. Now we ignore the `vXX-y-z` folders.

Also tweaked the `sidebars.js` creation process so new tutorials are
added under `How To` instead of creating a new section.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Rel #95
2021-10-22 09:54:33 -07:00
Antón Molleda 17a1bd6872 feat: versioned docs
The way versioned documents are supported on the site differs a bit from
Docusaurus' documentation:

- Each doc change to a branch is build and publish separately.
- The links to the versions are `_blank` to bypass `react-router` even
  though the content is in the same server. The reason is that because
  it is built at different steps it is not "found".

This is achieve thanks to `electron-website-updater` sending a
`repository_dispatch` event with 2 different types of actions for each
`push` event that happens in `electron/electron` that contains doc
changes. The 2 types of events are:

* `doc_changes_branches`: Updates to documentation branches (does not
  matter if they are the latest or not).
* `doc_changes`: Updates to the latest stable branch.

The tasks to perform are almost identical and are split in two different
GitHub actions for each event:

1. Download the markdown for the SHA, check if there are new version
   branches and update `versions-info.json`, update the SHA, and publish
   those changes to Git.
   This is done in `update-docs-XXX.yml` when we receive the event.
2. Build the content for that branch and publish in the right place.
   This is done in `push-XXX.yml` when there is a push to `main` or a
   `vXX` branch.

The deployment is done to the storage service. The difference is that a
branch will only push `assets` and `docs` while `main` will publish
everything.

Additionally, Crowdin gets updated every time there is a change in
`main` to make sure the latest content is always uploaded.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #118
2021-10-21 17:36:22 -07:00
Antón Molleda 8fb226af91 feat: Crowdin integration
Integrates with Crowdin to enable i18n of the site. This PR changes the
source of truth for Crowdin and moves it to this repository instead of
relying on `electron/i18n`.

Additionally it uses Crowdin's CLI to do the upload/download of assets
making it more reliable.

The website is built on locale at a time via `yarn i18n:build`.
Otherwise the process crashed with an out of memory error. The regular
`yarn build` command still compiles the `en` locale.

Because we cannot get notifications when there are new translations
avaiable, there is a GitHub workflow (`update-i18n-deploy.yml`) that
downloads the content every few minutes, builds, and deploy. To speed up
this process, the previous generated assets are download. In local tests
this reduces the build times from 250s to 40s so the whole process
should take about 5 minutes.

The previous generated content is stored in Azure Storage. Because this
is a static website it makes more sense than having a dyno and will make
it easier to:
- deploy multiple locales at the same time if we still need to speed up
  the process
- have versioned docs because we just need to "take a snapshot" and
  publish to a different folder

The current live site is still not using this storage but will soon-ish.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #64
2021-10-11 06:09:39 -07:00
Erick Zhao da41a71ed4
feat: improve sidebar organization
Close #96
2021-09-03 15:31:01 -07:00
Antón Molleda cf657d5f30
chore: no docs only mode and folder structure (#70)
Disables Docusaurus' "docs only mode" and changes the folder structure
to be the same as upstream for easier content reorganization and
redirects.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #68
Fix #69
Close #70
Rel https://docusaurus.io/docs/docs-introduction#docs-only-mode
2021-07-19 20:50:56 -07:00
Erick Zhao 4e7b2655a9
fix: only trim trailing spaces for API markdown mod
We trim the final string output in this transformation, which inadvertently resets all
leading whitespace and flattens all Markdown lists in the API docs.

This PR uses `trimEnd()` instead of `trim()` to only remove trailing whitespace instead.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Close #57
2021-06-21 10:24:44 -07:00
Antón Molleda 51e5f58435 feat: navigation improvements
If a page has the same name as the folder where it is, it will become
the landing page for that section. E.g.: `/security/security.md` will be
available via `/security` instead of `/security`.

Also add the sections `Performance` and `Security` to the footer
navigation to increase awareness.
2021-06-10 08:46:32 -07:00
Erick Zhao 8f07acb75c
chore: switch to docs-only mode
Enable `docs-only` mode by setting `get-started/introduction` as the starting
point by setting its `slug` to `/` (page can be changed in
`scripts/tasks/add-frontmatter.js`).

In order to work correctly in production, the output path and `baseUrl` are
updated to `/docs/latest/`. If we add versioning this might need to change.

It also deletes previous homepage and makes sure that documents that are not
needed are not copied.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Ref: https://docusaurus.io/docs/docs-introduction#docs-only-mode
Close #47

Co-authored-by: Antón Molleda <amolleda@gmail.com>
2021-06-04 11:33:57 -07:00
Erick Zhao 47f544362b
chore: update `electron/electron` trunk name (#39) 2021-06-02 12:22:04 -07:00
github-actions[bot] 422490072a
chore: update documentation content (#37)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-06-02 00:30:14 -07:00
Antón Molleda 11a0f9d3f1
build: update content when upstream changes
This commit adds support to respond to `repository_dispatch` events
coming from `electron/electron-website-updater` that contain the
SHA of the new commit in `electron/electron` to pin to in
`package.json`.

More information about the architecture can be found in #19.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #19
Close #23
2021-05-13 21:08:47 -07:00
Erick Zhao ac21aa7f3b
chore: continue API sidebar re-org
Close #24
2021-05-13 16:53:09 -07:00
Antón Molleda eda594a8d7
feat: add "Examples" navigation link
Add the top navigation link "Examples" and a new page that explains how
to acquire Fiddle and run the examples available in the sidebar.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Close #26
Partial work on #2

Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-05-12 13:44:53 -07:00
Antón Molleda d97a03dbeb fix: show titles in docs
With the update to .75 the titles are hidden and `hide_title` has to be
disabled. It was enabled initially because otherwise titles were
duplicated (one from frontmatter, the other from the markdown).
2021-05-12 12:53:11 -07:00
Antón Molleda bc9caa2d3b
build: enable CI
Enables CI via GitHub actions. Additionally it uses the action
`bahmutov/npm-install` to reduce the process of installing
dependencies by ~40%.

- - - - - - - - - - - - - - - - - - - -

Close #25
2021-05-07 13:43:24 -07:00
Erick Zhao bd09153344
fix: ignore docs to be removed
Close #18
2021-04-29 12:03:54 -07:00
Antón Molleda d3951bd803
fix: format of generated `sidebars.js`
Use `json5` to `stringify` the content of `sidebars` so it can be read
as a regular JS object instead of a JSON one.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #15
Close #16
2021-04-28 13:17:38 -07:00
Antón Molleda 4ecc9a53aa
build: allow building from local electron/electron
This PR allows developers to pass a parameter to indicate where in the
file system the `prebuild` script should look for the documentation. It
assumes it is a clone of `electron/electron` so the content should be
under a `/docs` folder. E.g.:

```console
yarn prebuild ../electron
```

In the future there might be a `watch` option enabled by default. This
is the MVP for #4.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #4
Close #9
2021-04-26 06:48:00 -07:00
Antón Molleda 5b9da1ecfb feat: preserve sidebar order with new content
This change makes sure that `sidebars.js` is not generated from scratch
each time that `prebuild` is called:

- New content is added at the end of the corresponding category or in
a new one if it does not exist.
- If no new content is found, `sidebars.js` is left unmodified.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #8
2021-04-26 06:44:20 -07:00
Antón Molleda a54f6ecbc1 build: transform fiddle markdown
The documentation in `electron/electron` uses the current format to
embed a fiddle:

```
```javascript fiddle='docs/fiddles/screen/fit-screen'
```

The new fiddle remark plugin uses:

```
```fiddle docs/fiddles/example
```

This PR updates all the old style to use the new one.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Ref https://github.com/electron/electronjs.org-new/pull/5
2021-04-22 13:24:33 -07:00
Antón Molleda 972a54e1d7 build: pre-build script
The pre-build scripts does the following:
1. Downloads the documentation from electron/electron and data/blog
   from electron/electronjs.org
2. Moves the files to the right folders based on the contents of
   `docs-reorg.json`
3. Add frontmatter to each file
4. Fixes internal links and multiline image titles
5. Generates the sidebar using the folder structure

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #6
Ref: Solves parts of #2
2021-04-21 14:44:15 -07:00