- This is a monorepo that uses npm workspaces to publish the components as individual packages
Run npm i
in the root directory. It will install all dependencies for all workspaces.
- Run
npm run test -ws
in the root directory to run all tests in all packages - Run
npm run build -ws --if-present
to run build scripts in all packages where one exits; it might be missing for packages that directly export ESM modules. - Commit and push the generated files
- Checkout main and merge feature branch
- Run
npm version <patch|major|minor> -w <packageName>
to create a new version for a specific package or-ws
for all packages. - Commit
package.json
files with new version. - Create tag for packages that will change their version:
@helga-agency/<packageName>@<version>
- Push the Git tag:
git push origin <tag>
- Run
npm publish -w <packageName>
to publish a specific package or-ws
for all packages.
Configuration flags for npm commands in relation to workspaces:
--workspace=<packageName>
or-w <packageName>
to run a command in a specific workspace. Valid values for<packageName>
are either:- Workspace names (e.g.
@helga-agency/async-loader
) - Path to a workspace directory (e.g.
packages/AsyncLoader
) - Path to a parent workspace directory (will result in selecting all workspaces within that folder)
- Workspace names (e.g.
--workspaces
or-ws
to run a command across all workspaces.- By running the command with the
--if-present
flag, npm will ignore workspaces missing the target script; e.g.npm run build --workspaces --if-present
.
- By running the command with the
- Run tests:
npm test
- Lint JS files:
npm run lint
- Run build script:
npm run build
- All components are custom elements.
- Make sure to use the appropriate polyfill for old browsers. If not noted otherwise, only the custom element polyfill is needed.
- Embed the JavaScript file that ends with
Element
; it defines the custom element onwindow
. - If you are using Babel, install regenerator-runtime
and import it before the elements via
import 'regenerator-runtime/runtime.js';
There are type declarations for all components that expose something. This is not the case for components
that already register custom elements themselves. (You import them with e.g. import '@helga-agency/overlay/OverlayElement
.)
The type declarations are tested using a *.d-test.ts
file. With npm run ts-test
, the test files are compiled
by the TypeScript compiler and if the types are not correct, the compiler displays an error.
- YouTube Player
- YouTube Preview Image
- Overlay and Buttons
- Audio Player
- Table of Contents
- Slider
- Form Sync
- Vimeo Player
- Vimeo Preview Image
- Dynamic Content Loader
- Async Loader
- Dynamic Page Loader
- Relative Time
- readAttribute
- splitText
- once
- slide, import as
import { slide } from '@helga-agency/ui-components'
- createDebounce
Changesets helps to manage package versioning and publishing. Acctually it is not in use. This is just a reminder in case we want to use it sometime.