Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for running a local NPM Registry via Verdaccio.
A single new npm run command is added "start:npm-local". This will start an Verdaccio Registry and handle only the `@wvr` packages. All other packages are proxied. Custom settings are added to ensure that this does not cache proxied packages (the packages from the upstream NPM Registry). This is designed to operate anonymously. A connection to the local Verdaccio NPM Registry should not need an account. The more recent versions of NPM have made this more difficult by removing anonymous support. This is worked around by adding a .npmrc that injects a fake token specifically for the localhost registry.o This utilizes a verdaccio-memory module to have verdaccio store the registry in memory, keeping the local filesystem clean. This can be disabled by uncommenting the the appropriate section. The rest of the registry is already configured to work if the in-memory support is disabled. If uncommented, then be sure to handle cleaning up the .verdaccio directory yourself. I wanted to have the following in the package.json: ``` "publishConfig": { "access": "public", "registry": "http://localhost:4873/" }, ``` Which would also necessitate the following in `.npmrc`: ``` registry=http://localhost:4873/ ``` This cannot happen because the NPM developers have yet to realize the usefullness of a command line argument like `--registry`: ``` npm publish --registry https://registry.npmjs.org ``` The lack of the command like argument necessitates manually setting the localhost registry: ``` npm registry set http://localhost:4873/ ``` This increases the possibility of mistakes, so I suggest always performing a dry run as a practice before actual publishing: ``` npm publish --dry-run ``` Once done with the local Verdaccio NPM Registry, you can reset the registry like this: ``` npm set registry https://registry.npmjs.org/ ``` There are also additional configurations that reduce the needed changes for custom situations. 1) The `allow_offline` is enabled because localhost interaction should not require an active internet connection. 2) The `security.*` settings are provided in case one wants to set `web.login` to `true`.
- Loading branch information