Contributing
This guidelines refers to the main (
master
) that host the v6.x, if you want to contribute to5.x
please read the following link.
We're happy that you're considering contributing!
To help you getting started we've prepared these guidelines for you, any change matter, just do it:
How Do I Contribute?
There are many ways to contribute:
- Report a bug
- Request a feature you think would be great for Verdaccio
- Fixing bugs
- Test and triage bugs reported by others
- Working on requested/approved features
- Improve the codebase (linting, naming, comments, test descriptions, etc...)
- Improve code coverage for unit testing for every module, end to end or UI test (with cypress).
The Verdaccio project is split into several areas, the first three hosted in the main repository:
- Core: The core is the main repository, built with Node.js.
- Website: we use Docusaurus for the website and if you are familiar with this technology, you might become the official webmaster.
- User Interface: The user Interface is based in react and material-ui and looking for front-end contributors.
- Kubernetes and Helm: Ts the official repository for the Helm chart.
There are other areas to contribute, like documentation or translations.
Prepare local setup
Note: The size of the Verdaccio project is quite significant. Unzipped it is about 33 MB. However, a full build with all node_modules installed takes about 2.8 GB of disk space (~190k files)!
Verdaccio uses pnpm as the package manager for development in this repository.
If you are using pnpm for the first time the pnpm configuration documentation may be useful to avoid any potential problems with the following steps.
Note: pnpm uses npm's configuration formats so check that your global .npmrc
file does not inadvertently disable package locks. In other words, your .npmrc
file should not contain
package-lock=false
This setting would cause the pnpm install
command to install incorrect versions of package dependencies and the subsequent pnpm build
step would likely fail.
We use corepack to install and use a specific (latest) version of pnpm. Please run the following commands which is use a specific version on Node.js and configure it to use a specific version of pnpm. The version of pnpm is specified in the package.json
file in packageManager
field.
nvm install
corepack enable
pnpm
version will be updated mainly by the maintainers but if you would like to set it to a specific version, you can do so by running the following command:
packageManager
at thepackage.json
defines the default version to be used.
corepack prepare
With pnpm installed, the first step is installing all dependencies:
pnpm install
Building the project
Each package is independent, dependencies must be build first, run:
pnpm build
Running test
pnpm test
Verdaccio is a mono repository. To run the tests for a specific package:
cd packages/store
pnpm test
or a specific test in that package:
pnpm test test/merge.dist.tags.spec.ts
or a single test unit:
pnpm test test/merge.dist.tags.spec.ts -- -t 'simple'
Coverage reporting is enabled by default, but you can turn it off to speed up test runs:
pnpm test test/merge.dist.tags.spec.ts -- -t 'simple' --coverage=false
You can enable increased debug
output:
DEBUG=verdaccio:* pnpm test
More details in the debug section
Running and debugging
Check the debugging guidelines here
We use debug
to add helpful debugging
output to the code. Each package has it owns namespace.
Developing with local server
To run the application from the source code, ensure the project has been built with pnpm build
, once this is done, there are few commands that helps to run server:
The command pnpm start
runs web server on port 8000
and user interface (webpack-server) on port 4873
. This is particularly useful if you want to contribute to the UI, since it runs with hot reload. The request to the server are proxy through webpack proxy support through the port 4873
.
The user interface is split in two packages, the /packages/plugins/ui-theme
and the /packages/ui-components
. The ui-components
package uses storybook in order to develop component, but if you need to reload ui components with ui-theme
do the following.
Go to /packages/ui-component
and run pnpm watch
to enable babel in watch mode, every change on the components will be hot reloaded in combination with the pnpm start
command.
Any change on the server packages, must be build independently (server does not have hot reload, pnpm start
should be triggered again).
Any interaction with the server should be done through the port 8000
eg: npm login --registry http://localhost:8000
.
Useful commands
pnpm debug
: Run the server in debug mode--inspect
. UI runs too but without hot reload. For automatic break usepnpm debug:break
.pnpm debug:fastify
: To contribute on the fastify migration this is a temporary command for such purpose.pnpm website
: Build the website, for more commands to run the website, runcd website
and thenpnpm serve
, website will run on port3000
.pnpm docker
: Build the docker image. Requiresdocker
command available in your system.
Debugging compiled code
Currently, you can only run pre-compiled packages in debug mode. To enable debug
while running add the verdaccio
namespace using the DEBUG
environment
variable, like this:
DEBUG=verdaccio:* node packages/verdaccio/debug/bootstrap.js
You can filter this output to just the packages you're interested in using namespaces:
DEBUG=verdaccio:plugin:* node packages/verdaccio/debug/bootstrap.js
The debug code is intended to analyze what is happening under the hood and none of the output is sent to the logger module.
Testing your changes in a local registry
Once you have performed your changes in the code base, the build and tests passes you can publish a local version:
- Ensure you have built all modules by running
pnpm build
(or the one you have modified) - Run
pnpm local:publish:release
to launch a local registry and publish all packages into it. This command will be alive until server is killed (Control Key + C)
pnpm build
pnpm local:publish:release
The last step consist on install globally the package from the local registry which runs on the default port (4873).
npm i -g verdaccio --registry=http://localhost:4873
verdaccio
If you perform more changes in the source code, repeat this process, there is no hot reloading support.
Feature Request
New feature requests are welcome. Analyse whether the idea fits within scope of the project. Adding in context and the use-case will really help!
Please provide:
- Create a discussion.
- A detailed description the advantages of your request.
- Whether or not it's compatible with
npm
,pnpm
and yarn classic or yarn modern . - A potential implementation or design
- Whatever else is on your mind! 🤓