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.0-beta.8
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.0.0-beta.9
Choose a head ref
  • 5 commits
  • 12 files changed
  • 2 contributors

Commits on May 9, 2019

  1. chore: fix #1292 add missing dependencies

    remove non required dependencies
    juanpicado committed May 9, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b4bc6ff View commit details

Commits on May 11, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8e48eea View commit details

Commits on May 12, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    a588588 View commit details

Commits on May 17, 2019

  1. feat: update readme v4 (#1312)

    * feat: update readme v4
    
    * chore: update @verdaccio/ui-theme@0.1.9
    
    * chore: update @verdaccio/ui-theme@0.1.10
    juanpicado authored May 17, 2019
    2
    Copy the full SHA
    7686417 View commit details

Commits on May 20, 2019

  1. Copy the full SHA
    cc7bd99 View commit details
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,20 @@

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.0.0-beta.9](https://github.com/verdaccio/verdaccio/compare/v4.0.0-beta.8...v4.0.0-beta.9) (2019-05-20)


### Bug Fixes

* update @verdaccio/ui-theme:0.1.7 ([8e48eea](https://github.com/verdaccio/verdaccio/commit/8e48eea))


### Features

* update readme v4 ([#1312](https://github.com/verdaccio/verdaccio/issues/1312)) ([7686417](https://github.com/verdaccio/verdaccio/commit/7686417))



# [4.0.0-beta.8](https://github.com/verdaccio/verdaccio/compare/v4.0.0-beta.7...v4.0.0-beta.8) (2019-05-07)


8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "verdaccio",
"version": "4.0.0-beta.8",
"version": "4.0.0-beta.9",
"description": "A lightweight private npm proxy registry",
"author": {
"name": "Verdaccio Maintainers",
@@ -17,7 +17,8 @@
"dependencies": {
"@verdaccio/local-storage": "2.1.0",
"@verdaccio/streams": "2.0.0",
"@verdaccio/ui-theme": "0.1.6",
"@verdaccio/readme": "1.0.3",
"@verdaccio/ui-theme": "0.1.10",
"JSONStream": "1.3.5",
"async": "3.0.1-0",
"body-parser": "1.19.0",
@@ -41,7 +42,7 @@
"mkdirp": "0.5.1",
"mv": "2.1.1",
"pkginfo": "0.4.1",
"request": "2.88.0",
"request": "2.87.0",
"semver": "6.0.0",
"verdaccio-audit": "1.2.0",
"verdaccio-htpasswd": "2.0.0"
@@ -66,6 +67,7 @@
"eslint-plugin-verdaccio": "0.0.5",
"flow-bin": "0.81.0",
"flow-runtime": "0.17.0",
"get-stdin": "7.0.0",
"husky": "2.1.0",
"in-publish": "2.0.0",
"jest": "24.7.1",
7 changes: 0 additions & 7 deletions src/lib/cli.js
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ import semver from 'semver';
import { bgYellow, bgRed } from 'kleur';
import {startVerdaccio, listenDefaultCallback} from './bootstrap';
import findConfigFile from './config-path';
import {verdaccioUpdateBanner} from './update-banner';
import { parseConfigFile } from './utils';

if (process.getuid && process.getuid() === 0) {
@@ -31,15 +30,9 @@ const logger = require('./logger');
logger.setup(); // default setup

const commander = require('commander');
const pkginfo = require('pkginfo')(module); // eslint-disable-line no-unused-vars
const pkgVersion = module.exports.version;
const pkgName = module.exports.name;

/**
* Checking verdaccio version on NPM
*/
verdaccioUpdateBanner(pkgVersion);

commander
.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)')
9 changes: 5 additions & 4 deletions src/lib/utils.js
Original file line number Diff line number Diff line change
@@ -10,7 +10,8 @@ import semver from 'semver';
import YAML from 'js-yaml';
import URL from 'url';
import createError from 'http-errors';
import marked from 'marked';
// $FlowFixMe
import sanitizyReadme from '@verdaccio/readme';

import { HTTP_STATUS, API_ERROR, DEFAULT_PORT, DEFAULT_DOMAIN, DEFAULT_PROTOCOL, CHARACTER_ENCODING, HEADERS, DIST_TAGS, DEFAULT_USER } from './constants';
import { generateGravatarUrl, GENERIC_AVATAR } from '../utils/user';
@@ -487,14 +488,14 @@ export function addGravatarSupport(pkgInfo: Object, online: boolean = true): Obj
* @return {String} converted html template
*/
export function parseReadme(packageName: string, readme: string): string {
if (readme) {
return marked(readme);
if (_.isEmpty(readme) === false) {
return sanitizyReadme(readme);
}

// logs readme not found error
Logger.logger.error({ packageName }, '@{packageName}: No readme found');

return marked('ERROR: No README data found!');
return sanitizyReadme('ERROR: No README data found!');
}

export function buildToken(type: string, token: string): string {
10 changes: 6 additions & 4 deletions test/functional/readme/readme.js
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ export default function (server, server2) {
describe('should test readme', () => {
const README_PKG1 = 'readme-test';
const README_PKG2 = 'readme-test-no-readme';
const README_MESSAGE = 'this is a readme';

beforeAll(async function() {
await server.putPackage('readme-test', require('./pkg-readme.json'))
@@ -16,20 +17,21 @@ export default function (server, server2) {
test('add pkg', () => {});

describe('should check readme file', () => {
const matchReadme = (serverRef, pkgName = README_PKG1, readmeMessage = 'this is a readme') => {
const matchReadme = (serverRef, pkgName = README_PKG1, readmeMessage = README_MESSAGE) => {
return serverRef.request({
uri: `/-/verdaccio/package/readme/${pkgName}`
}).status(HTTP_STATUS.OK).then(function(body) {
expect(body).toEqual(`<p>${readmeMessage}</p>\n`);

expect(body).toEqual(`<p>${readmeMessage}</p>`);
});
};

test('should fetch server2 over uplink server1', () => {
return matchReadme(server, README_PKG1, 'this is a readme');
return matchReadme(server, README_PKG1, README_MESSAGE);
});

test('should fetch package on local server1', () => {
return matchReadme(server2, README_PKG1, 'this is a readme');
return matchReadme(server2, README_PKG1, README_MESSAGE);
});

test('should fetch not found readme server2 over uplink server1', () => {
1 change: 0 additions & 1 deletion test/lib/helper/register.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require('babel-polyfill');
require('@babel/register')({
sourceMap: 'inline',
});
117 changes: 0 additions & 117 deletions test/unit/api/__snapshots__/update-banner.spec.js.snap

This file was deleted.

3 changes: 1 addition & 2 deletions test/unit/api/__snapshots__/utils.spec.js.snap
Original file line number Diff line number Diff line change
@@ -37,6 +37,5 @@ exports[`Utilities parseReadme should parse makrdown text to html template 1`] =
<li>Hat tip to anyone whose code was used</li>
<li>Inspiration</li>
<li>etc</li>
</ul>
"
</ul>"
`;
87 changes: 0 additions & 87 deletions test/unit/api/update-banner.spec.js

This file was deleted.

10 changes: 5 additions & 5 deletions test/unit/api/utils.spec.js
Original file line number Diff line number Diff line change
@@ -374,7 +374,7 @@ describe('Utilities', () => {
test('should parse makrdown text to html template', () => {
const markdown = '# markdown';
expect(parseReadme('testPackage', markdown)).toEqual(
'<h1 id="markdown">markdown</h1>\n'
'<h1 id="markdown">markdown</h1>'
);
expect(
parseReadme('testPackage', String(readmeFile('markdown.md')))
@@ -387,21 +387,21 @@ describe('Utilities', () => {
const randomTextMarkdown = 'simple text \n # markdown';

expect(parseReadme('testPackage', randomText)).toEqual(
'<p>%%%%%**##==</p>\n'
'<p>%%%%%**##==</p>'
);
expect(parseReadme('testPackage', simpleText)).toEqual(
'<p>simple text</p>\n'
'<p>simple text</p>'
);
expect(parseReadme('testPackage', randomTextMarkdown)).toEqual(
'<p>simple text </p>\n<h1 id="markdown">markdown</h1>\n'
'<p>simple text </p>\n<h1 id="markdown">markdown</h1>'
);
});

test('should show error for no readme data', () => {
const noData = '';
const spy = jest.spyOn(Logger.logger, 'error');
expect(parseReadme('testPackage', noData)).toEqual(
'<p>ERROR: No README data found!</p>\n'
'<p>ERROR: No README data found!</p>'
);
expect(spy).toHaveBeenCalledWith(
{ packageName: 'testPackage' },
Loading