uno/doc
Jérôme Laban 37e1d2e769
Merge pull request #17762 from unoplatform/dev/jela/unpackaged-docs
docs: Add unpackaged winappsdk publishing
2024-07-31 22:57:17 -04:00
..
ReleaseNotes docs: Align code snippet blocks syntax to follow docfx and microsoft related documentation 2024-06-03 11:20:39 -04:00
api
articles Merge pull request #17762 from unoplatform/dev/jela/unpackaged-docs 2024-07-31 22:57:17 -04:00
blog docs: Align code snippet blocks syntax to follow docfx and microsoft related documentation 2024-06-03 11:20:39 -04:00
images
qa
templates/uno fix: Replace deprecated DOMNodeInserted with MutationObserver for Algolia DocSearch initialization 2024-07-09 00:27:48 -04:00
.browserlistrc
.feature-template-uno-only.md docs: Misc articles updates 2024-01-19 15:25:12 +02:00
.feature-template.md chore: Update doc/.feature-template.md 2024-01-19 17:14:44 +02:00
.gitignore
.howto-template.md docs: Fix multiple docfx, css, js, mermaid layout related issues 2024-06-03 10:13:05 -04:00
.nvmrc
README.md chore: Update doc 2024-01-11 21:54:37 +02:00
docfx.json chore: adjust extensions 2024-07-19 10:16:47 -04:00
gulpfile.js
import_external_docs.ps1 docs: Update bootstrapper docs 2024-07-19 13:53:32 -04:00
import_external_docs_test.ps1 docs: Remove current doc from Uno repo to use external doc from Uno.Samples to have the proper updated samples list 2024-04-17 10:15:30 -04:00
index.md
package-lock.json chore(deps): bump ws, socket.io-client and socket.io-adapter in /doc 2024-06-25 19:24:04 +00:00
package.json

README.md

Documentation Uno

This folder contains source code for the generation of uno's documentation

[!IMPORTANT] It's very important that you read the deploy section before committing anything to the repo.

Running a local environment

Install dependencies

Download and install docfx on your computer.

macOS

brew install docfx

Windows

choco install docfx

Node

Use a node version manager or the version of node specified in the .nvmrc file nvm or nvs

nvs use

or

nvm use

Then install the dependencies

npm install

Generated Implemented views

The process of generating implemented views is documented on this page. Building docs website locally with DocFX. As stated in the documentation, it will probably fail, but it will create stub files and let DocFx build without errors. By default, the build swallows DocFx errors (it prints them in the console), that is for simplicity since you don't need the implemented views. To test DocFx and break on error run the npm run strict command.

Deploy

DocFx will use the content of the styles folder when building. When working locally, source-maps are generated to help debugging the site; the javascript and css are not minified for the same reason. It's very important that the build command is ran just before committing your work; this will minify the code, clean up the styles and _site folders and build the DocFx according to the docfx.json. The CI only runs the DocFx command, it will not regenerate the styles folder.

Commands

Start

With browsersync and gulp watch, any changes in the sass, js and Docfx templates should be rebuilt automatically. This command starts the project with the debug flag. This prevents the js from being minified and generates source-maps (easier debugging). It will concatenate all the js into one docfx.js file.

npm start

Build

Will build the docfx documentation according to the docfx.json file, will minify and concatenate all javascript everything in the docfx.js file (exceptmain.js) and will compile and minify the sass. This command needs to be run before committing any changes to the repos.

npm run build

Prod

This command is similar to start, but it will minify the js and the sass and won't generate any source-maps.

npm run prod

Strict

The reference pages are generate by the CI and are not there locally. This causes errors when building docfx. You can generate stub pages (see in the Generate Implemented Views section). Since generating those is often unnecessary, it's faster to generate them only if they are needed. When running the command strict, it is the same as running the Prod command but the errors won't be ignored.

npm run strict

Clean

This command will erase the content of the styles and _site/styles folders.

npm run clean

Basic structure

The templating files are in the folder layout and partial. The javascript and scss files associated to a component are in the component directory. The javascript functions and utilities are in the service folder. The shared constant are in the constant.js file. The render order of the component is important; the functions are called in the render.js file. Every js file is concatenated into the docfx.js file in the styles folder and every scss file is concatenated into the main.css.

The docfx.vendor.* files in the vendor folder are there to freeze the dependencies. To update them, delete the files and copy the newly generated files from the _site/style folder.

Every file in the styles folder is automatically generated and should not be modified manually.

Spell-checking the docs

Spell-checking for the docs is done as part of a GitHub Action.

If you'd like to perform the same check locally, you can run:

  • npm install -g cspell@8.3.2 to install the cSpell CLI
  • cspell --config ./cSpell.json "doc/**/*.md" --no-progress to check all the markdown files in the doc folder.

Markdown linting the docs

Markdown linting for the docs is done as part of a GitHub Action.

If you'd like to perform the same check locally, you can run:

  • npm install -g markdownlint-cli@0.38.0 to install the markdownlint CLI
  • markdownlint "doc/**/*.md" to lint all the markdown files in the doc folder.

You can also install the markdownlint Visual Studio Code Extension to easily check markdown linting and style while writing documentation.

Notes

The local environment is usually located on port 3000 unless another process is already using it.

You have to remove the docs fragment from the WordPress menu to reach your local documentation server.

There are some additional information on running DocFx locally that can be found here.