Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: verdaccio/verdaccio
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.0.4
Choose a base ref
...
head repository: verdaccio/verdaccio
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.1.0
Choose a head ref

Commits on May 16, 2019

  1. feat: plugin support to filter packages

    Add a plugin that can filter all package metadata before being returned.
    This enables blocking of packages from verdaccio.
    
    IPluginStorageFilter are loaded like other plugins from the config.
    Verdaccio will look for plugins in config.filters and pass this to
    storage.init. This is the same design as other plugins and will be
    dynamically found with the same rules. These plugins must impliment
    a filter_metadata method, which is called serially (in the order
    loaded from the config) for every metadata request. It gets a current
    copy of a package metadata and may choose to modify it as required.
    For example, this may be used to block a bad version of a package or
    add a time delay from when new packages can be used from your
    registry. Errors in a filter will cause a 404, similar to upLinkErrors
    as it is not safe to recover gracefully from them. Note: When version
    is removed, be careful about updating tags.
    
    Fixes: #818
    Marc Udoff committed May 16, 2019
    Copy the full SHA
    b9ffac5 View commit details
  2. Merge pull request #1161 from mlucool/filters

    Filter packages
    juanpicado authored May 16, 2019
    Copy the full SHA
    5c6b515 View commit details

Commits on May 17, 2019

  1. Copy the full SHA
    26c5e2d View commit details
  2. chore: update lock file

    juanpicado committed May 17, 2019
    Copy the full SHA
    cb7b695 View commit details

Commits on May 19, 2019

  1. test: relocate helpers

    juanpicado committed May 19, 2019
    Copy the full SHA
    d052bce View commit details
  2. Copy the full SHA
    2f3ec2c View commit details
  3. test: relocate spec test

    juanpicado committed May 19, 2019
    Copy the full SHA
    b4c42c1 View commit details
  4. test: relocate test

    juanpicado committed May 19, 2019
    Copy the full SHA
    3929633 View commit details

Commits on May 20, 2019

  1. Copy the full SHA
    e7400ce View commit details
  2. Copy the full SHA
    596c727 View commit details
  3. test: relocate unit test

    juanpicado committed May 20, 2019
    Copy the full SHA
    ca2e23c View commit details
  4. Copy the full SHA
    b1eb7c6 View commit details
  5. Copy the full SHA
    4bf6b3b View commit details
  6. Copy the full SHA
    8786a37 View commit details
  7. Copy the full SHA
    134a738 View commit details
  8. Copy the full SHA
    197095e View commit details

Commits on May 22, 2019

  1. feat: parse YAML/JSON/JS config file (#1258)

    * Parse JSON/YAML config file.
    
    * fix missing export
    
    * fix: typos
    
    * test(config): remove JSON test
    
    * feat: better config error handling, tests
    
    * fix: detect YAML config file via extension
    
    * docs: verdaccio/website#99
    honzahommer authored and juanpicado committed May 22, 2019
    Copy the full SHA
    95d134b View commit details
  2. Copy the full SHA
    63695e2 View commit details

Commits on May 23, 2019

  1. Copy the full SHA
    01a48af View commit details

Commits on May 25, 2019

  1. Copy the full SHA
    995350f View commit details

Commits on May 26, 2019

  1. Copy the full SHA
    cb20169 View commit details
  2. Copy the full SHA
    f0b8673 View commit details

Commits on May 29, 2019

  1. Copy the full SHA
    390d0d6 View commit details

Commits on Jun 13, 2019

  1. Copy the full SHA
    0fa2629 View commit details
  2. Copy the full SHA
    e3da67f View commit details
  3. Copy the full SHA
    9f5f563 View commit details

Commits on Jun 20, 2019

  1. Merge remote-tracking branch 'origin/master' into 4.1.x

    # Conflicts:
    #	test/unit/modules/cli/cli.spec.js
    juanpicado committed Jun 20, 2019
    Copy the full SHA
    d252e66 View commit details
  2. Copy the full SHA
    b38ef96 View commit details

Commits on Jun 27, 2019

  1. docs: fix typo (#1362)

    Jason-Cooke authored and juanpicado committed Jun 27, 2019
    Copy the full SHA
    a6a4eee View commit details

Commits on Jun 29, 2019

  1. Minor tweaks

    typo fix and grammar
    jamesgeorge007 authored Jun 29, 2019
    Copy the full SHA
    0177241 View commit details
  2. Merge pull request #1363 from jamesgeorge007/feat/update-docs

    docs: minor tweaks
    juanpicado authored Jun 29, 2019
    Copy the full SHA
    20bc433 View commit details
  3. chore: update stale config

    Inspired by gatsby community adding this message
    juanpicado authored Jun 29, 2019
    Copy the full SHA
    41310ca View commit details
  4. Copy the full SHA
    acf5a79 View commit details

Commits on Jun 30, 2019

  1. Copy the full SHA
    6ff356b View commit details
  2. feat(chore): Included provision to show up local environment informat…

    …ion (#1365)
    
    * feat: adds provision to show up environment information
    
    Fixes #1364
    
    * feat: include docker info
    
    * fix: pin envinfo
    
    * fix: lock file
    
    * fix: docker config
    
    * fix: minor refactor
    
    handle async behaviour
    
    * feat: add short version for info
    jamesgeorge007 authored and juanpicado committed Jun 30, 2019
    Copy the full SHA
    eb6bf51 View commit details

Commits on Jul 6, 2019

  1. Copy the full SHA
    318f868 View commit details

Commits on Jul 8, 2019

  1. Copy the full SHA
    0061e38 View commit details
  2. chore: update dependencies

    regular maintenance
    juanpicado committed Jul 8, 2019
    Copy the full SHA
    a0cf985 View commit details
  3. Merge pull request #1376 from verdaccio/update-dependencies

    chore: update dependencies
    juanpicado authored Jul 8, 2019
    Copy the full SHA
    45b8a76 View commit details
  4. Copy the full SHA
    44c1610 View commit details
  5. chore(release): 4.1.0

    juanpicado committed Jul 8, 2019
    Copy the full SHA
    274bb1a View commit details
Showing with 1,996 additions and 1,831 deletions.
  1. +1 −0 .eslintignore
  2. +11 −5 .github/lock.yml
  3. +11 −5 .github/stale.yml
  4. +1 −0 .gitignore
  5. +26 −1 CHANGELOG.md
  6. +2 −1 README.md
  7. +16 −15 package.json
  8. +8 −2 src/api/index.js
  9. +49 −28 src/lib/cli.js
  10. +5 −0 src/lib/constants.js
  11. +19 −4 src/lib/storage.js
  12. +6 −6 src/lib/up-storage.js
  13. +26 −3 src/lib/utils.js
  14. +11 −11 test/lib/server.js
  15. +2 −2 test/unit/{api/__api-helper.js → __helper/api.js}
  16. +1 −1 test/unit/{__helper.js → __helper/index.js}
  17. +63 −0 test/unit/__helper/mock.js
  18. +0 −18 test/unit/api/mock.js
  19. +0 −53 test/unit/api/validate_all.spec.js
  20. +1 −1 test/unit/functionalLibs/request.spec.js
  21. +9 −9 test/unit/{api/api.pkg.access.spec.js → modules/access/pkg.access.spec.js}
  22. 0 ...nit/{api/__snapshots__/api.publish.spec.js.snap → modules/api/__snapshots__/publish.spec.js.snap}
  23. +62 −25 test/unit/{ → modules}/api/api.spec.js
  24. +24 −0 test/unit/modules/api/partials/plugin/filter.js
  25. +2 −2 test/unit/{api/api.publish.spec.js → modules/api/publish.spec.js}
  26. +41 −0 test/unit/modules/api/validate.api.params.middleware.spec.js
  27. +16 −16 test/unit/{api → modules/auth}/auth-utils.spec.js
  28. +16 −14 test/unit/{api/api.jwt.spec.js → modules/auth/jwt.spec.js}
  29. +9 −9 test/unit/{api/api.profile.spec.js → modules/auth/profile.spec.js}
  30. +1 −0 test/unit/{api → modules}/basic_system.spec.js
  31. +8 −8 test/unit/{api → modules/cli}/cli.spec.js
  32. +24 −20 test/unit/{api/listen_addr.spec.js → modules/cli/parseAddress.spec.js}
  33. +10 −5 test/unit/{api → modules/config}/config.spec.js
  34. +7 −7 test/unit/{api → modules/notifications}/notify.spec.js
  35. +7 −7 test/unit/{api/notify-request.spec.js → modules/notifications/request.spec.js}
  36. +6 −6 test/unit/{api → modules/plugin}/auth.spec.js
  37. +12 −0 test/unit/modules/plugin/helper/plugin.js
  38. 0 test/unit/{ → modules/plugin}/partials/test-plugin-storage/invalid-package/package.json
  39. 0 test/unit/{ → modules/plugin}/partials/test-plugin-storage/invalid-plugin-sanity/index.js
  40. 0 test/unit/{ → modules/plugin}/partials/test-plugin-storage/invalid-plugin-sanity/package.json
  41. 0 test/unit/{ → modules/plugin}/partials/test-plugin-storage/invalid-plugin/index.js
  42. 0 test/unit/{ → modules/plugin}/partials/test-plugin-storage/invalid-plugin/package.json
  43. 0 test/unit/{ → modules/plugin}/partials/test-plugin-storage/verdaccio-es6-plugin/dummy.js
  44. 0 test/unit/{ → modules/plugin}/partials/test-plugin-storage/verdaccio-es6-plugin/index.js
  45. 0 test/unit/{ → modules/plugin}/partials/test-plugin-storage/verdaccio-plugin/index.js
  46. 0 test/unit/{ → modules/plugin}/partials/test-plugin-storage/verdaccio-plugin/package.json
  47. +3 −3 test/unit/{api → modules/plugin}/plugin_loader.spec.js
  48. +5 −5 test/unit/{api → modules/search}/search.spec.js
  49. +9 −9 test/unit/{api → modules/storage}/local-storage.spec.js
  50. +3 −3 test/unit/{api/st_merge.spec.js → modules/storage/merge.dist.tags.spec.js}
  51. +3 −3 test/unit/{api → modules/storage}/storage-utils.spec.js
  52. +10 −10 test/unit/{api → modules/storage}/store.spec.js
  53. +14 −14 test/unit/{api/uplink.auth.spec.js → modules/uplinks/headers.auth.spec.js}
  54. +13 −4 test/unit/{api/no_proxy.spec.js → modules/uplinks/noProxy.spec.js}
  55. +8 −8 test/unit/{api → modules/uplinks}/up-storage.spec.js
  56. 0 test/unit/{api → modules/utils}/__snapshots__/utils.spec.js.snap
  57. +8 −8 test/unit/{api/api.__test.template.spec.js → modules/utils/api.__test.template.js}
  58. +49 −6 test/unit/{api → modules/utils}/config-utils.spec.js
  59. +1 −1 test/unit/{api/parse_interval.spec.js → modules/utils/parseInterval.spec.js}
  60. +2 −2 test/unit/{api/tag_version.spec.js → modules/utils/tag.version.spec.js}
  61. +6 −6 test/unit/{api → modules/utils}/utils.spec.js
  62. +12 −12 test/unit/{api → modules/web}/api.web.spec.js
  63. +15 −0 test/unit/partials/config/js/default.js
  64. +1 −0 test/unit/partials/config/js/invalid.js
  65. +55 −0 test/unit/partials/config/json/default.json
  66. +1 −0 test/unit/partials/config/json/invalid.json
  67. +0 −10 test/unit/partials/config/plugin.js
  68. +1 −1 test/unit/partials/config/yaml/server/keepalivetimeout-undefined.yaml
  69. +87 −0 test/unit/partials/mock-store/npm_test/package.json
  70. +1,177 −1,442 yarn.lock
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -14,4 +14,5 @@ Dockerfile
*.scss
*.png
*.jpg
*.sh
test/unit/partials/
16 changes: 11 additions & 5 deletions .github/lock.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Configuration for lock-threads - https://github.com/dessant/lock-threads

# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 200
daysUntilLock: 90

# Issues and pull requests with these labels will not be locked. Set to `[]` to disable
exemptLabels: []
@@ -11,9 +11,15 @@ lockLabel: false

# Comment to post before locking. Set to `false` to disable
lockComment: >
This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.
🤖This thread has been automatically locked 🔒 since there has not been
any recent activity after it was closed.
We lock tickets after 90 days with the idea to encourage you to open a ticket with new fresh data
and to provide you better feedback 🤝and better visibility 👀.
If you consider, can attach this ticket 📨to the new one as a reference for better context.
Thanks for being a part of the Verdaccio community! 💘
# Limit to only `issues` or `pulls`
# only: issues
@@ -25,4 +31,4 @@ issues:
lockLabel: outdated

pulls:
daysUntilLock: 90
daysUntilLock: 10
16 changes: 11 additions & 5 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
daysUntilStale: 15
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 5
daysUntilClose: 10
# Issues with these labels will never be considered stale
exemptLabels:
- dev: high priority
@@ -13,8 +13,14 @@ exemptLabels:
staleLabel: issue: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
Hi pal 👋🏼!
This issue has gone quiet 😶.
We get a lot of issues, so we currently close issues after 25 days of inactivity. It’s been at least 15 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add/suggest the label "discuss" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out [https://github.com/verdaccio/contributing](https://github.com/verdaccio/contributing) for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Verdaccio community! 💘
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ build/
### Test

test/unit/partials/store/test-*-storage/*
test/unit/partials/store/*-storage/*
test/unit/partials/store/storage_default_storage/*
.verdaccio-db.json
.sinopia-db.json
27 changes: 26 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
# Change Log
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [4.1.0](https://github.com/verdaccio/verdaccio/compare/v4.0.4...v4.1.0) (2019-07-08)


### Features

* parse YAML/JSON/JS config file ([#1258](https://github.com/verdaccio/verdaccio/issues/1258)) ([95d134b](https://github.com/verdaccio/verdaccio/commit/95d134b))
* plugin support to filter packages ([b9ffac5](https://github.com/verdaccio/verdaccio/commit/b9ffac5)), closes [#818](https://github.com/verdaccio/verdaccio/issues/818)
* **chore:** Included provision to show up local environment information ([#1365](https://github.com/verdaccio/verdaccio/issues/1365)) ([eb6bf51](https://github.com/verdaccio/verdaccio/commit/eb6bf51)), closes [#1364](https://github.com/verdaccio/verdaccio/issues/1364)


### Tests

* increase usage of constants ([2f3ec2c](https://github.com/verdaccio/verdaccio/commit/2f3ec2c))
* fix broken test for validate parameters ([4bf6b3b](https://github.com/verdaccio/verdaccio/commit/4bf6b3b))
* relocate api spec test ([8786a37](https://github.com/verdaccio/verdaccio/commit/8786a37))
* relocate helpers ([d052bce](https://github.com/verdaccio/verdaccio/commit/d052bce))
* relocate notification test ([596c727](https://github.com/verdaccio/verdaccio/commit/596c727))
* relocate plugin storage ([e7400ce](https://github.com/verdaccio/verdaccio/commit/e7400ce))
* relocate spec test ([b4c42c1](https://github.com/verdaccio/verdaccio/commit/b4c42c1))
* relocate test ([3929633](https://github.com/verdaccio/verdaccio/commit/3929633))
* relocate unit test ([ca2e23c](https://github.com/verdaccio/verdaccio/commit/ca2e23c))
* relocate unit test cli, proxy, utils ([b1eb7c6](https://github.com/verdaccio/verdaccio/commit/b1eb7c6))



## [4.0.4](https://github.com/verdaccio/verdaccio/compare/v4.0.3...v4.0.4) (2019-06-20)


3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ If you want to report a security vulnerability, please follow the steps which we

## Core Team

The core team is the responsable for drive this project, team is ordered by antiquity and areas of responsability.
The core team is responsible for driving this project ahead, team is ordered by antiquity and areas of responsibility.

| [Juan Picado](https://github.com/juanpicado) | [Ayush Sharma](https://github.com/ayusharma) | [Sergio Hg](https://github.com/sergiohgz) | [Priscila Oliveria](https://github.com/priscilawebdev) |
|---|---|---|---|
@@ -185,6 +185,7 @@ You can find and chat with then over Discord, click [here](http://chat.verdaccio
* [create-react-app](https://github.com/facebook/create-react-app/blob/master/CONTRIBUTING.md#contributing-to-e2e-end-to-end-tests) *(+67k ⭐️)*
* [Storybook](https://github.com/storybooks/storybook) *(+37k ⭐️)*
* [Gatsby](https://github.com/gatsbyjs/gatsby) *(+34k ⭐️)*
* [Angular CLI](https://github.com/angular/angular-cli) *(+21k ⭐️)*
* [Uppy](https://github.com/transloadit/uppy) *(+19k ⭐️)*
* [Aurelia Framework](https://github.com/aurelia) *(+11k ⭐️)*
* [bit](https://github.com/teambit/bit) *(+6k ⭐️)*
31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "verdaccio",
"version": "4.0.4",
"version": "4.1.0",
"description": "A lightweight private npm proxy registry",
"author": {
"name": "Verdaccio Maintainers",
@@ -15,44 +15,45 @@
"verdaccio": "./bin/verdaccio"
},
"dependencies": {
"@verdaccio/local-storage": "2.1.0",
"@verdaccio/readme": "1.0.3",
"@verdaccio/local-storage": "2.2.1",
"@verdaccio/readme": "1.0.4",
"@verdaccio/streams": "2.0.0",
"@verdaccio/ui-theme": "0.1.11",
"JSONStream": "1.3.5",
"async": "3.0.1",
"async": "3.1.0",
"body-parser": "1.19.0",
"bunyan": "1.8.12",
"commander": "2.20.0",
"compression": "1.7.4",
"cookies": "0.7.3",
"cors": "2.8.5",
"dayjs": "1.8.14",
"envinfo": "7.3.1",
"express": "4.16.4",
"handlebars": "4.1.2",
"http-errors": "1.7.2",
"http-errors": "1.7.3",
"js-yaml": "3.13.1",
"jsonwebtoken": "8.5.1",
"kleur": "3.0.3",
"lodash": "4.17.11",
"lunr-mutable-indexes": "2.3.2",
"marked": "0.6.2",
"marked": "0.7.0",
"mime": "2.4.4",
"minimatch": "3.0.4",
"mkdirp": "0.5.1",
"mv": "2.1.1",
"pkginfo": "0.4.1",
"request": "2.87.0",
"semver": "6.1.1",
"semver": "6.2.0",
"verdaccio-audit": "1.2.0",
"verdaccio-htpasswd": "2.0.0"
},
"devDependencies": {
"@commitlint/cli": "7.5.2",
"@commitlint/config-conventional": "7.5.0",
"@octokit/rest": "16.25.0",
"@verdaccio/babel-preset": "0.1.0",
"@verdaccio/types": "5.0.0-beta.4",
"@commitlint/cli": "8.0.0",
"@commitlint/config-conventional": "8.0.0",
"@octokit/rest": "16.28.2",
"@verdaccio/babel-preset": "0.2.1",
"@verdaccio/types": "5.0.2",
"codecov": "3.3.0",
"cross-env": "5.2.0",
"eslint": "5.16.0",
@@ -70,14 +71,14 @@
"get-stdin": "7.0.0",
"husky": "2.1.0",
"in-publish": "2.0.0",
"jest": "24.7.1",
"jest-environment-node": "24.7.1",
"jest": "24.8.0",
"jest-environment-node": "24.8.0",
"lint-staged": "8.1.5",
"nock": "10.0.6",
"prettier": "1.17.0",
"puppeteer": "1.8.0",
"rimraf": "2.6.3",
"standard-version": "5.0.2",
"standard-version": "6.0.1",
"supertest": "4.0.2",
"verdaccio-auth-memory": "0.0.4",
"verdaccio-memory": "2.0.0"
10 changes: 8 additions & 2 deletions src/api/index.js
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ import web from './web';

import type { $Application } from 'express';
import type { $ResponseExtend, $RequestExtend, $NextFunctionVer, IStorageHandler, IAuth } from '../../types';
import type { Config as IConfig, IPluginMiddleware } from '@verdaccio/types';
import type { Config as IConfig, IPluginMiddleware, IPluginStorageFilter } from '@verdaccio/types';
import { setup, logger } from '../lib/logger';
import { log, final, errorReportingMiddleware } from './middleware';

@@ -107,8 +107,14 @@ const defineAPI = function(config: IConfig, storage: IStorageHandler) {
export default (async function(configHash: any) {
setup(configHash.logs);
const config: IConfig = new AppConfig(_.cloneDeep(configHash));
// register middleware plugins
const plugin_params = {
config: config,
logger: logger,
};
const filters = loadPlugin(config, config.filters || {}, plugin_params, (plugin: IPluginStorageFilter) => plugin.filter_metadata);
const storage: IStorageHandler = new Storage(config);
// waits until init calls have been initialized
await storage.init(config);
await storage.init(config, filters);
return defineAPI(config, storage);
});
77 changes: 49 additions & 28 deletions src/lib/cli.js
Original file line number Diff line number Diff line change
@@ -31,46 +31,67 @@ process.title = 'verdaccio';
const logger = require('./logger');
logger.setup(); // default setup

const envinfo = require('envinfo');
const commander = require('commander');
const pkgVersion = module.exports.version;
const pkgName = module.exports.name;

commander
.option('-i, --info', 'prints debugging information about the local environment')
.option('-l, --listen <[host:]port>', 'host:port number to listen on (default: localhost:4873)')
.option('-c, --config <config.yaml>', 'use this configuration file (default: ./config.yaml)')
.version(pkgVersion)
.parse(process.argv);

if (commander.args.length == 1 && !commander.config) {
// handling "verdaccio [config]" case if "-c" is missing in command line
commander.config = commander.args.pop();
function init() {
let verdaccioConfiguration;
let configPathLocation;
const cliListener = commander.listen;

try {
configPathLocation = findConfigFile(commander.config);
verdaccioConfiguration = parseConfigFile(configPathLocation);
process.title = verdaccioConfiguration.web && verdaccioConfiguration.web.title || 'verdaccio';

if (!verdaccioConfiguration.self_path) {
verdaccioConfiguration.self_path = path.resolve(configPathLocation);
}
if (!verdaccioConfiguration.https) {
verdaccioConfiguration.https = {enable: false};
}

logger.logger.warn({file: configPathLocation}, 'config file - @{file}');

startVerdaccio(verdaccioConfiguration, cliListener, configPathLocation, pkgVersion, pkgName, listenDefaultCallback);
} catch (err) {
logger.logger.fatal({file: configPathLocation, err: err}, 'cannot open config file @{file}: @{!err.message}');
process.exit(1);
}
}

if (commander.args.length !== 0) {
if (commander.info) {
// eslint-disable-next-line no-console
console.log('\nEnvironment Info:');
(async () => {
const data = await envinfo.run({
System: ['OS', 'CPU'],
Binaries: ['Node', 'Yarn', 'npm'],
Virtualization: ['Docker'],
Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'],
npmGlobalPackages: ['verdaccio'],
});
// eslint-disable-next-line no-console
console.log(data);
process.exit(1);
})();
} else if (commander.args.length == 1 && !commander.config) {
// handling "verdaccio [config]" case if "-c" is missing in command line
commander.config = commander.args.pop();
init();
} else if (commander.args.length !== 0) {
commander.help();
}
let verdaccioConfiguration;
let configPathLocation;
const cliListener = commander.listen;

try {
configPathLocation = findConfigFile(commander.config);
verdaccioConfiguration = parseConfigFile(configPathLocation);
process.title = verdaccioConfiguration.web && verdaccioConfiguration.web.title || 'verdaccio';

if (!verdaccioConfiguration.self_path) {
verdaccioConfiguration.self_path = path.resolve(configPathLocation);
}
if (!verdaccioConfiguration.https) {
verdaccioConfiguration.https = {enable: false};
}

logger.logger.warn({file: configPathLocation}, 'config file - @{file}');

startVerdaccio(verdaccioConfiguration, cliListener, configPathLocation, pkgVersion, pkgName, listenDefaultCallback);
} catch (err) {
logger.logger.fatal({file: configPathLocation, err: err}, 'cannot open config file @{file}: @{!err.message}');
process.exit(1);
} else {
init();
}

process.on('uncaughtException', function(err) {
@@ -79,4 +100,4 @@ process.on('uncaughtException', function(err) {
},
'uncaught exception, please report this\n@{err.stack}' );
process.exit(255);
});
});
5 changes: 5 additions & 0 deletions src/lib/constants.js
Original file line number Diff line number Diff line change
@@ -19,10 +19,15 @@ export const certPem = 'verdaccio-cert.pem';
export const csrPem = 'verdaccio-csr.pem';

export const HEADERS = {
ACCEPT: 'Accept',
ACCEPT_ENCODING: 'Accept-Encoding',
USER_AGENT: 'User-Agent',
JSON: 'application/json',
CONTENT_TYPE: 'Content-type',
CONTENT_LENGTH: 'content-length',
TEXT_PLAIN: 'text/plain',
TEXT_HTML: 'text/html',
AUTHORIZATION: 'authorization',
FORWARDED_PROTO: 'X-Forwarded-Proto',
FRAMES_OPTIONS: 'X-Frame-Options',
CSP: 'Content-Security-Policy',
Loading