Contribution Guide
How to Contribute
1. Clone the Cookbook
Fork the Starcoin Cookbook repo to make a copy of this cookbook in your account. Then clone that repo to your development environment and navigate to the local repo.
git clone [email protected]:your-username/starcoin-cookbook.git
cd starcoin-cookbook
2. Installing Packages
Node.js and yarn are required to build this cookbook, read the yarn installation page for details.
Execute the following command in the project root to install the packages and dependencies.
$ yarn
3. Running the Development Server
$ yarn start
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
English locale is used by default. Start your localized site in dev mode, using the locale of your choice:
$ yarn start --locale zh
Available locales defined in docusaurus.config.js
.
4. Build
This command generates static content into the /build
directory and can be served using any static contents hosting service.
$ yarn build
The default BaseUrl is /starcoin-cookbook
, if you want to change it, you can specify it via environment variable before build.
$ export BASE_URL='/'
(2) Run the following command, which will start a web service locally.
Then run serve to serving build directory at http://localhost:3000/starcoin-cookbook/
.
$ yarn serve
If you specify the BASE_URL environment variable as /
, the address will be: http://localhost:3000/
.
Guidelines
File Structure Guidelines
- A numerical prefix is required in the directory name and file, e.g.,
01-build.md
, which indicates the order of the document in the sidebar. kebab-case
naming convention is used in directory and file names.- The
README.md
in each directory is the front page of the directory. - The
_category_.yaml
is the configuration file for a directory, in which thelabel
property is the title of this directory showing in the sidebar. - The default documents are in English, translations can be found in
i18n/<language-code>/docusaurus-plugin-content-docs/current
. Translations should use the same file name as the English docs.
Document Style Guidelines
The Chinese version is following additional document conventions, read the Chinese document style for details.
FAQ
How to translate a section (directory)?
Adding Chinese translation for example. Run the following command after adding a new section (directory):
$ yarn write-translations --locale zh
Changes are made to
i18n/zh/docusaurus-plugin-content-docs/current.json
, and new directory name is added. Editing the file to add translation.Change
zh
to the corresponding language code for other languages.