mediawiki-extensions-Growth.../documentation/frontend
Taavi Väänänen 997c3a8351
documentation: Convert eslint config to JSON
To allow LibUp to automatically work with it.

Change-Id: Ie505e035d321abba45322715d746502554b42b4f
2024-05-03 15:18:03 +03:00
..
component-demos Frontend documentation: fix visual issues in onboarding dialog styles 2023-06-27 17:59:26 +02:00
components Frontend documentation: fix visual issues in onboarding dialog styles 2023-06-27 17:59:26 +02:00
docs Frontend documentation: fix visual issues in onboarding dialog styles 2023-06-27 17:59:26 +02:00
store/example-store Frontend documentation: setup Pinia state manager 2023-05-08 12:26:53 +02:00
tests Frontend documentation: break vitest suite on console errors and warns 2023-03-15 15:02:53 +01:00
.eslintignore Frontend documentation: integrate i18n in VitePress project 2023-05-30 17:57:11 +02:00
.eslintrc.json documentation: Convert eslint config to JSON 2024-05-03 15:18:03 +03:00
.gitignore documentation/frontend: Generate coverage report 2023-06-07 12:04:38 +02:00
.stylelintrc.json Frontend docs: add build command in the root of the repository 2023-02-21 12:47:27 +01:00
README.md Frontend documentation: integrate i18n in VitePress project 2023-05-30 17:57:11 +02:00
package-lock.json Frontend documentation: Adapt OnboardingDialog styles to changes in CdxDialog 2023-06-09 10:33:04 +00:00
package.json Frontend documentation: Adapt OnboardingDialog styles to changes in CdxDialog 2023-06-09 10:33:04 +00:00
vite.components.config.js Frontend documentation: setup Pinia state manager 2023-05-08 12:26:53 +02:00
vitest.config.js [tests] Set a global coverage threshold for Vue files 2023-07-11 11:53:56 +00:00

README.md

GrowthExperiments frontend docs

The GrowthExperiments frontend docs site is built with VitePress, a static site generator built with Vite as build tool and Vue 3.

Getting started

Install NodeJS 14+ and then from the project root (documentation/frontend):

$ npm install
$ npm run docs:dev

This will serve the VitePress GrowthExperiments docs site locally at http://localhost:5173/GrowthExperiments/master/js/frontend/.

Writing docs

General docs are located in the docs/ directory. docs/index.md is the landing page of the static site, and other docs are organized into folders.

Docs are written in Markdown, see the VitePress docs for details.

Component demos

Components to demo should use Vue's SFC structure and .vue. Create them in the component-demos folder, then create a new markdown file in docs/demos directory, eg: docs/demos/my-component-demo.md.

Use npm run components:lint to lint the demo components with the same eslint configuration that will be used in Wikimedia's CI.

Standalone demos

Vite is also used to build the component demos in a stand-alone mode, suitable for embedding them in a MediaWiki environment (useful for QA-ing GrowthExperiments components in a more production-like setup).

The Vite config used to build standalone demos lives in the workspace root: vite.components.config.js. Running npm run components:build in this workspace will output bundled JS and CSS files in /dist that are suitable for importing into another project.

To add a new component to the bundle re-export the component in component/lib.js. Components used for demoing purposes should not be added to the lib file (eg: MyComponentDemo.vue ), only the relevant demoed components should be added (eg: MyComponent.vue ).

Steps to add a new component are:

  1. import and re-export the component in component/lib.js.
  2. npm run components:build
  3. mv dist/*.* ../../modules/lib/growthlib
  4. Load the resulting JS and CSS files in a ResourceLoader module

Configuration

VitePress config

General site information and sidebar configuration are housed in docs/.vitepress/config.js. See the VitePress docs or the Config type definition for more info.

Theme config

A theme config extending from VitePress' default theme is used in docs/.vitepress/theme/index.js to register vue-banana-i18n plugins on application bootstrap.

Vite config

VitePress uses Vite for building and serving the live GrowthExperiments docs site. Configuration can be overridden via docs/vite.config.js. For example, you can add Vite plugins here.

Note than vite.components.config.js is NOT the docs site vite configuration and serves other purposes. See Standalone demos