Instalación
Docusaurus was designed from the ground up to be easily installed and used to get your website up and running quickly. To install Docusaurus, we have created an easy script that will get all of the infrastructure set up for you:
Asegúrese de tener la última versión de Node instalada. También recomendamos que instale Yarn también.
Tienes que estar en el node> = 8.x y yarn> = 1.5.
Go into the root of your GitHub repo directory where you will be creating the docs.
npx docusaurus-init
Si no tiene el Node 8.2+ o si prefiere instalar Docusaurus globalmente, ejecute
yarn global add docusaurus-init
onpm install --global docusaurus-init
. Después de eso, ejecutedocusaurus-init
.
Verificar la instalación
Along with previously existing files and directories, your root directory will now contain a structure similar to:
root-directory
├── docs-examples-from-docusaurus
│ ├── doc1.md
│ ├── doc2.md
│ ├── doc3.md
│ ├── exampledoc4.md
│ └── exampledoc5.md
└── website
├── blog-examples-from-docusaurus
│ ├── 2016-03-11-blog-post.md
│ ├── 2017-04-10-blog-post-two.md
│ ├── 2017-09-25-testing-rss.md
│ ├── 2017-09-26-adding-rss.md
│ └── 2017-10-24-new-version-1.0.0.md
├── core
│ └── Footer.js
├── package.json
├── pages
├── sidebars.json
├── siteConfig.js
└── static
Running the Docusaurus initialization script, docusaurus-init
, produces a runnable, example website to base your site upon.
- En su raíz, cambie el nombre de
docs-examples-from-docusaurus
adocs
. cd webiste
- Cambie el nombre de
blog-examples-from-docusaurus
ablog
. - Run the local webserver via
yarn start
ornpm start
. - Load the example site at http://localhost:3000. You should see the example site loaded in your web browser. There's also a LiveReload server running and any changes made to the docs and files in the
website
directory will cause the page to refresh.
Ejecutar el servidor detrás de un proxy
If you are behind a corporate proxy, you need to disable it for the development server requests. It can be done using the NO_PROXY
environment variable.
SET NO_PROXY = localhost
yarn start (o npm run start)
Updating Your Docusaurus Version
After Docusaurus is installed, moving forward, you can check your current version of Docusaurus by going into the website
directory and typing yarn outdated docusaurus
or npm outdated docusaurus
.
You will see something like this:
$ yarn outdated
Using globally installed version of Yarn
yarn outdated v1.5.1
warning package.json: No license field
warning No license field
info Color legend :
"<red>" : Major Update backward-incompatible updates
"<yellow>" : Minor Update backward-compatible features
"<green>" : Patch Update backward-compatible bug fixes
Package Current Wanted Latest Package Type URL
docusaurus 1.0.9 1.2.0 1.2.0 devDependencies https://github.com/facebook/Docusaurus#readme
✨ Done in 0.41s.
Si no hay una salida de versión notable de los comandos
obsoletos, entonces está actualizado.
You can update to the latest version of Docusaurus by:
yarn upgrade docusaurus --latest
o
npm update docusaurus
Si encuentra errores después de la actualización, intente borrar su caché de Babel (generalmente está en un directorio temporal o ejecute el servidor Docusaurus (por ejemplo,
yarn start
) con la configuración de entornoBABEL_DISABLE_CACHE = 1
.