This document describes the process for running this project on your local computer, and the list of steps to perform when creating a new major or minor version branch of the monorepo.
First of all, make sure you have yarn installed.
Setup the repo:
yarnStart the development server:
yarn startRun all the code style checks:
yarn lintRun ESLint and Prettier checks:
yarn lint:jsRun Stylelint to check themes:
yarn lint:cssRun TypeScript to check typings:
yarn lint:typesSetup the environment variables needed by the scripts below, by copying the .env.dist template file to .env:
cp .env.dist .env
and then configure the individual variable values in the newly created .env file.
Not all variables are necessary for all scripts, individual sections below will note which variables are required to run a command.
Run tests in Chrome:
yarn testRun tests in Firefox:
yarn test:firefoxRun tests in WebKit:
yarn test:webkitBy default, tests will only run for changed packages. To run tests for all packages, use the --all flag:
yarn test --allRun tests for single package:
yarn test --group combo-boxDebug tests for single package:
yarn debug --group combo-boxRun or debug specific test files filtered by a glob pattern:
yarn test --group combo-box --glob="data-provider*" # all data provider tests
yarn debug --group combo-box --glob="data-provider*" # all data provider testsRun tests with code coverage:
yarn test --coverageVisual tests run inside a Docker container using Playwright to ensure consistent screenshots across environments. Make sure Docker is installed and running.
Run tests for base styles:
yarn test:baseUpdate reference screenshots for base styles:
yarn update:baseRun tests for Lumo:
yarn test:lumoUpdate reference screenshots for Lumo:
yarn update:lumoUpdate screenshots for single package:
yarn update:lumo --group combo-boxRun tests for Aura:
yarn test:auraUpdate reference screenshots for Aura:
yarn update:auraRun snapshot tests that are in test/dom folders under components:
yarn test:snapshotsUpdate snapshots for all components that have corresponding tests:
yarn update:snapshotsUpdate snapshots for single package:
yarn update:snapshots --group combo-boxRun integration tests that are in the separate integration folder:
yarn test:itUse the scripts/createVersionBranch.sh script to bump versions:
./scripts/createVersionBranch.sh <base-branch> <version-branch> <bump-version>The script requires:
- Node / NPM
- GitHub CLI (
gh)
New minor from main:
# Assuming latest major is 25, 25.1 is the current minor and we want to bump main to 25.2
./scripts/createVersionBranch.sh main 25.1 25.2.0-alpha0- Creates branch
25.1frommain - Creates PR against
mainto bump version to25.2.0-alpha0 - Creates PR against
25.1to update WTR script to detect changes against25.1branch
New major from main:
# Assuming latest major is 25, 25.1 is the current minor and we want to bump main to 26.0
./scripts/createVersionBranch.sh main 25.1 26.0.0-alpha0- Creates branch
25.1frommain - Creates PR against
mainto bump version to26.0.0-alpha0 - Creates PR against
25.1to update WTR script to detect changes against25.1branch
New minor for a previous major:
# Assuming 24 is a previous major, its current minor is 24.9 and we want to create 24.10
./scripts/createVersionBranch.sh 24.9 24.10 24.10.0-alpha0- Creates branch
24.10from24.9 - Creates PR against
24.10to bump version to24.10.0-alpha0 - Creates PR against
24.10to update WTR script to detect changes against24.10branch
- Review and merge the created PRs
- Add the new version branch to CI build parameters:
- Update
check-branches.jsin the release app to include the new version branch
Re-generate SVG icon sets and icon fonts from individual SVG files for the packages that have them (e.g. vaadin-icons):
npm -i @web-padawan/wc-icon-toolwc-icon-toolWhen using a Vaadin app, you can modify the frontend build tool config to resolve the web components modules from your local clone, instead of the versions downloaded from npm registry.
Using webpack
Modify the webpack.config.js in the root folder as follows:
module.exports = merge(
{
resolve: {
modules: ['/path/to/web-components/node_modules', 'node_modules'],
},
},
flowDefaults,
);Using Vite
Modify the vite.config.ts in the root folder as follows:
import path from 'path';
import { PluginOption, UserConfigFn } from 'vite';
import { overrideVaadinConfig } from './vite.generated';
function useLocalWebComponents(webComponentsNodeModulesPath: string): PluginOption {
return {
name: 'use-local-web-components',
enforce: 'pre',
config(config) {
config.server = config.server ?? {};
config.server.fs = config.server.fs ?? {};
config.server.fs.allow = config.server.fs.allow ?? [];
config.server.fs.allow.push(webComponentsNodeModulesPath);
config.server.watch = config.server.watch ?? {};
config.server.watch.ignored = [`!${webComponentsNodeModulesPath}/**`];
},
resolveId(id) {
if (/^(@polymer|@vaadin)/.test(id)) {
return this.resolve(path.join(webComponentsNodeModulesPath, id));
}
},
};
}
const customConfig: UserConfigFn = (env) => ({
// Disable the Vite dependencies pre-bundling
optimizeDeps: {
disabled: true,
},
plugins: [useLocalWebComponents('/path/to/web-components/node_modules')],
});
export default overrideVaadinConfig(customConfig);Note Make sure that the path you provide is an absolute one and that it points to the
node_modulesdirectory in the web components monorepo.
Then run the following command in the web components monorepo:
yarn
This will symlink the individual component packages into the node_modules folder.
After that you can start / restart your application and it should use the source code from the monorepo.
When maintaining two stable majors (e.g. 22.0.x and 23.0.x), it is important to maintain latest npm tag.
For example, we release 22.0.7 after 23.0.1 but we still want to keep latest pointing to 23.0.1.
Use the following script on main branch to run npm dist-tag for all packages:
./scripts/fixDistTag.shWhen running tests in Playwright WebKit on Mac OS, some tests using sendKeys({ press: 'Tab' }) might fail for components using native <button> elements internally e.g. <vaadin-upload>. To fix this, activate "Keyboard navigation" toggle in "System Preferences > Keyboard".