CLI Commands
Docusaurus, üretmek, hizmet ve Web sitenizin dağıtmanıza yardımcı olacak komutlar kümesi sağlar. Bu komut dosyalarını run
komutuyla Yarn veya npm kullanırken çağırabilir. Sık kullanılan bazı komutlar şunlardır:
-
yarn run start
: oluşturmak için veya yerel sunucudan Web sitesi hizmeti için yarn run examples
:örnek yapılandırma dosyaları oluşturmanıza
Komut satırından çalıştırma
Yarn or npm kullanarak komut dosyalarını çalıştırabilirsiniz. Başlarken kılavuzunu zaten geçtiyseniz; zaten start </ code> komutunu biliyor olabilirsiniz. <code>docusaurus-start
komutu Docusaurus'u çalıştırmasını başlatan komuttur. siteyi oluşturan ve bir sunucu başlatan komut dosyası ve genellikle böyle çağrılır:
yarn run start
Aynı komut npm dosyası kullanılarak çağrılabilir:
npm run start
Belirli bir komut dosyası çalıştırmak için, sadece komutunu, start
yukarıdaki örneklerde komut dosyanızla ilişkili komutla birlikte kaydedin.
Argumentleri kullanmak
Some commands support optional arguments. For example, to start a server on port 8080, you can specify the --port
argument when running start
:
yarn run start --port 8080
Şayet npm kullanrak Docusaurus çalıştıyorsanız,komut satırına bağımsız değişkenler ekleyerek komut satırı değişkenlerini kullanmaya devam edebilirsiniz.`` arasındanpm run <command>
ve komut argumenleri:
npm run start -- --port 8080
Ayarlar
Bu komut dosyaları, "scripts"
sizin şifreniz website/package.json
dosyasını yükleme işleminin bir parçası olarak kullanın. Onları tekrar ayarlama konusunda yardıma ihtiyacınız varsa, Lütfen şunu seçiniz yükleme rehberi.
Docusaurus bazı varsayılan eşlemeleri düğümü kuralları aşağıdaki komutları çalıştırmanıza olanak sağlar. Yazarak yerine docusaurus-start
every time, you can type yarn run start
or npm start
.
Komutlar
<autogenerated_table_of_contents>
Referans
docusaurus-build
Eşdeğeri: build
.
Options | Default | Description |
---|---|---|
--skip-image-compression | false | Skip compression of image assets. You usually won't want to skip this unless your images have already been optimized. |
Generates the static website, applying translations if necessary. Useful for building the website prior to deployment.
See also docusaurus-start
.
docusaurus-examples
Eşdeğeri: -c
Arguments | Default | Description |
---|---|---|
<feature> | - | Specify a feature translations or versions to generate the extra example files for that feature. |
Example
docusaurus-examples <feature>
When no feature is specified, sets up a minimally configured example website in your project. This command is covered in depth in the Site Preparation guide.
docusaurus-publish
Alias: publish-gh-pages
Builds, then deploys the static website to GitHub Pages. This command is meant to be run during the deployment step in Circle CI, and therefore expects a few environment variables to be defined:
The following environment variables are generally set manually by the user in the CircleCI config.yml
file.
GIT_USER
: Açılım işlemesi ile ilişkilendirilmiş git kullanıcısı.USE_SSH
: Whether to use SSH instead of HTTPS for your connection to the GitHub repo.Example
GIT_USER=docusaurus-bot USE_SSH=true yarn run publish-gh-pages
The following environment variables are set by CircleCI during the build process.
CIRCLE_BRANCH
: CI çalışmasını tetikleyen işleme ilişkili git branşı.CI_PULL_REQUEST
: Geçerli CI çalışması bir çekme isteğindeki bir işlem tarafından tetiklendiğinde doğruluğu beklenir.
The following should be set by you in siteConfig.js
as organizationName
and projectName
, respectively. If they are not set in your site configuration, they fall back to the CircleCI environment.
CIRCLE_PROJECT_USERNAME
: The GitHub username or organization name that hosts the Git repo, e.g. "facebook".CIRCLE_PROJECT_REPONAME
: The name of the Git repo, e.g. "Docusaurus".
You can learn more about configuring automatic deployments with CircleCI in the Publishing guide.
docusaurus-rename-version
Alias: rename-version
Renames an existing version of the docs to a new version name.
Arguments | Default | Description |
---|---|---|
<currentVersion> | - | Version to be renamed. |
<newVersion> | - | Version to be renamed to. |
Example
docusaurus-rename-version <currentVersion> <newVersion>
See the Versioning guide to learn more.
docusaurus-start
Alias: start
.
This script will build the static website, apply translations if necessary, and then start a local server.
Options | Default | Description |
---|---|---|
--port <number> | 3000 | The website will be served from port 3000 by default, but if the port is taken up, Docusaurus will attempt to find an available one. |
docusaurus-version <version>
Alias: version
Generates a new version of the docs. This will result in a new copy of your site being generated and stored in its own versioned folder. Useful for capturing snapshots of API docs that map to specific versions of your software. Accepts any string as a version number.
See the Versioning guide to learn more.
docusaurus-write-translations
Alias: write-translations
Writes the English for any strings that need to be translated into an website/i18n/en.json
file. The script will go through every file in website/pages/en
and through the siteConfig.js
file and other config files to fetch English strings that will then be translated on Crowdin. See the Translation guide to learn more.