Verdaccio 5 migration guidelines
Verdaccio 5 will introduce a few breaking changes, either way the migration should be light for the most of the users, here the big details.
The latest Node.js v12 is required to run verdaccio. The upgrade only affects those are not using the Docker.
Verdaccio goes hand to hand with the official Node.js releases roadmap.
We recommend, always try to use the latest LTS version to avoid next major forces you to upgrade Node.js again.
Pino.js is the new logger
Verdaccio replaces Bunyan by Pino.js as logger, with the objective to improve the performance and delegate some features to the external tools. The new logger configuration does not support multiple streams, thus the configuration must contain one single object.
Pretty logging
Verdaccio logging pretty print is a distinguished feature the very first time verdaccio
commands runs.
http <-- 200, user: test(127.0.0.1), req: 'GET /is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz', bytes: 0/3250
http <-- 200, user: test(127.0.0.1), req: 'GET /extend-shallow/-/extend-shallow-3.0.2.tgz', bytes: 0/3210
http <-- 200, user: test(127.0.0.1), req: 'GET /define-property/-/define-property-2.0.2.tgz', bytes: 0/4047
http <-- 200, user: test(127.0.0.1), req: 'GET /mute-stream/-/mute-stream-0.0.8.tgz', bytes: 0/2663
http <-- 200, user: test(127.0.0.1), req: 'GET /ms/-/ms-2.1.2.tgz', bytes: 0/3017
http <-- 200, user: test(127.0.0.1), req: 'GET /mkdirp/-/mkdirp-0.5.1.tgz', bytes: 0/4991
But is expensive in and not recommended to using in production environment, thus, if the environment variable NODE_ENV=production
is detected, it will fall back automatically to json
format.
One tecnical reasons is that pino.final
does not work with prettier option.
To improve the performance of your registry, always use format: json
in production.
Multiple streams
Even if is supported by Pino.js is not recommended for performance reasons. The log property only recognize one single option. If you were using this feature and want it back, feel free to open a discussion or contribute as opt-in feature.
logs: { type: stdout, format: pretty, level: http }
FYI: pino v7 might bring back a good performant multi-streams support, this feature might be restored in the future.
Rotating file is not longer supported
Pino.js does not support log rotation, thus if you were using this feature is recommended use an external tool.
// this is not longer valid
{type: rotating-file, format: json, path: /path/to/log.jsonl, level: http, options: {period: 1d}}
Deprecation
Old configuration won't crash the application, rather will display a deprecation warning and will use the very first option in your configuration as fallback. Consider update your configuration due in the next major will throw an error.
➜ verdaccio
warn --- config file - /home/xxxx/.config/verdaccio/config.yaml
(node:22047) Warning: deprecate: multiple logger configuration is deprecated, please check the migration guide.
(Use `node --trace-warnings ...` to show where the warning was created)
warn --- Plugin successfully loaded: verdaccio-htpasswd
warn --- Plugin successfully loaded: verdaccio-audit
warn --- http address - http://localhost:4873/ - verdaccio/5.0.0-alpha.0
npm token
The command npm token
has been an experiment in Verdaccio 4 and on this major release is enabled by default, but was based on LevelDB which requires a C and Python compiler on install to make it work. By request has been removed and replaced by a pure JS solution.
The default token database now is plain json file .token-db.json
and is located in the same directory as .verdaccio-db.json
, with this format:
{
"jpicado": [
{
"user": "jpicado",
"token": "MWFlM...yZDBl",
"key": "4201e4bc47c31b3434034e40b5c35175",
"cidr": [],
"readonly": false,
"created": 1609512433710
},
{
"user": "jpicado",
"token": "ZjQwZ...wYTE1",
"key": "cc249bc2f4d248308733d70291acdc2a",
"cidr": [],
"readonly": false,
"created": 1609512441024
}
],
"test": [
{
"user": "test",
"token": "M2RiM...0Mzhj",
"key": "2ae85deba977e00fb099d323173c925a",
"cidr": [],
"readonly": false,
"created": 1609533131779
}
]
}