- Node.js = 22.11.0
- pnpm >= 10.9.0
Cloning the repository from github
git clone git@github.com:ec-europa/ecl-webcomponents.gitThen running pnpm install in the folder where the repository was cloned into.
pnpm installTo run stencil that will compile the components and the documentation:
pnpm startIn a different shell you can then start storybook:
pnpm devIt will open a tab in your browser with storybook loaded. Any change the developers make on a file used by the component, or to the component itself will also trigger an hmr action, out of the box. If the change is on a scss file in the src folder, you will need to run the build script of the component itself:
cd src/components/ecl-{name of the component}
pnpm buildpnpm generate ecl-{component}Stencil uses jest, we use the tests generated by stencil and we run them through stencil but we modify the test in order to produce a screenshot and check the rendered markup against that, as it happens in ECL.
We currently define only what stencil defines as a spec test, so when generating the new component with yarn generate you can disable the other test file and the scss file as well before hitting return.
The test is defined in the test folder inside the component root and it is named ecl-{component}.spec.tsx, it's a very basic file that renders the custom-elements and stores a file in the __snapshosts__ folder, if not present or checks the rendered markup against it.
pnpm test ecl-{component}pnpm lintThis will run linters on css and js files separately. Stylelint is used for scss, eslint for js files, configuration files for these two libas are in the root of the project.
ECL webcomponents uses the @ecl/builder package, which is capable of compiling sass, bundling js, copy files around.
Please refer to the documentation of the package for details on how to setup the tool, it's easy to understand by looking at existing ecl-builder.config.js files in the root of each component, the operations are pretty standard.