How to contribute to xpm Core Library
This page is designed for developers who intend to contribute new features or resolve bugs within the xpm Core Library project and provides documentation on building and testing the package.
Prerequisites
@xpack/xpm-lib is a portable Node.js module; development can be conducted on macOS, GNU/Linux and Windows (although some npm scripts must be executed within a Git Bash terminal).
The prerequisites are:
- git
- node >= 20.0
- npm
To ensure compatibility with older node versions, it is preferable to revert to an older one:
nvm use --lts 20
code
Obtain project sources
The project is hosted on GitHub:
Branches
This project utilises multiple branches:
master, containing the latest stable version (default)development, containing the current development versionwebsite, containing the current website content; pushes to this branch automatically trigger publication of the main website
All development is conducted in the development branch, and contributions via
Pull Requests should be directed to this branch.
When new releases are published, the development branch is merged
into master.
To clone the stable branch (master), execute the following commands in a
terminal (on Windows use the Git Bash console):
rm -rf ~/Work/xpack/xpm-lib-ts.git && \
mkdir -p ~/Work/xpack && \
git clone \
--branch master \
https://github.com/xpack/xpm-lib-ts.git \
~/Work/xpack/xpm-lib-ts.git
For development purposes, clone the development branch.
rm -rf ~/Work/xpack/xpm-lib-ts.git && \
mkdir -p ~/Work/xpack && \
git clone \
--branch development \
https://github.com/xpack/xpm-lib-ts.git \
~/Work/xpack/xpm-lib-ts.git
Alternatively, if the repository has already been cloned:
git -C ~/Work/xpack/xpm-lib-ts.git pull
To contribute Pull Requests, fork the project and ensure the Copy the master branch only is disabled.
Utilise the development branch and ensure you contribute the
Pull Requests back to the development branch.
Add links for development
During development, it is convenient to maintain a writable instance of the module to enable changes in parallel with the parent project.
To facilitate the use of a writable instance of this library in other projects, add a link from the user's global npm store to this local development folder:
npm --prefix ~/Work/xpack/xpm-lib-ts.git link
And in the projects referring it:
npm link @xpack/xpm-lib
Satisfy dependencies
npm install
Start the compile background task
The TypeScript compiler can automatically recompile modified files. For
this, start it in watch mode.
npm run compile-watch
Language standard compliance
The current version is compiled with TypeScript 5.9.3:
The compiler is configured to produce ECMAScript6 es2020 files
that can be imported
by any other project either via import.
For more details on how to configure tsconfig.json, please see:
Style
As style, the project uses typescript-eslint, a set of rules for static analysis of JavaScript and TypeScript code
For spacial cases, it is possible to configure/disable some rules.
/* eslint-disable-next-line no-xxx-yyy */
The known rules are documented in the eslint project.
Known and accepted exceptions:
- none
Documentation metadata
The documentation metadata utilises the TSDoc tags, without explicit types, as they are provided by TypeScript.
Continuous Integration (CI)
The module is subject to CI testing on every push via GitHub Actions, on Ubuntu, Windows and macOS, utilising node 20, 22 and 24.
Tips & tricks
To trace which files module imports resolve to, enable TypeScript module resolution tracing:
"compile": "tsc --traceResolution -p ./",