forked from sombochea/verdaccio-ui
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e514ec95a6 | ||
|
|
6b322ad553 |
@@ -2,6 +2,13 @@
|
||||
|
||||
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.
|
||||
|
||||
### [0.3.12](https://github.com/verdaccio/ui/compare/v0.3.11...v0.3.12) (2020-01-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* generate correct registry URL ([#413](https://github.com/verdaccio/ui/issues/413)) ([6b322ad](https://github.com/verdaccio/ui/commit/6b322ad553e9fb3ee65b2968dcfe856ba42a0bfb)), closes [#300](https://github.com/verdaccio/ui/issues/300) [#311](https://github.com/verdaccio/ui/issues/311)
|
||||
|
||||
### [0.3.11](https://github.com/verdaccio/ui/compare/v0.3.10...v0.3.11) (2020-01-08)
|
||||
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
require.requireActual('babel/polyfill');
|
||||
jest.requireActual('babel/polyfill');
|
||||
|
||||
@@ -8,14 +8,13 @@ import Adapter from 'enzyme-adapter-react-16';
|
||||
import { GlobalWithFetchMock } from 'jest-fetch-mock';
|
||||
import 'mutationobserver-shim';
|
||||
|
||||
// @ts-ignore : Only a void function can be called with the 'new' keyword
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
// @ts-ignore : Property '__APP_VERSION__' does not exist on type 'Global'.
|
||||
global.__APP_VERSION__ = '1.0.0';
|
||||
// @ts-ignore : Property '__VERDACCIO_BASENAME_UI_OPTIONS' does not exist on type 'Global'.
|
||||
global.__VERDACCIO_BASENAME_UI_OPTIONS = {};
|
||||
|
||||
global.__VERDACCIO_BASENAME_UI_OPTIONS = { base: 'http://localhost' };
|
||||
// @ts-ignore : Property 'VERDACCIO_API_URL' does not exist on type 'Global'.
|
||||
global.VERDACCIO_API_URL = 'https://verdaccio.tld';
|
||||
|
||||
const customGlobal: GlobalWithFetchMock = global as GlobalWithFetchMock;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@verdaccio/ui-theme",
|
||||
"version": "0.3.11",
|
||||
"version": "0.3.12",
|
||||
"description": "Verdaccio User Interface",
|
||||
"author": {
|
||||
"name": "Verdaccio Core Team",
|
||||
|
||||
@@ -17,14 +17,18 @@ describe('utils', () => {
|
||||
expect(isEmail('')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('getRegistryURL() - should keep slash if location is a sub directory', () => {
|
||||
test('getRegistryURL() - should not change when location change', () => {
|
||||
expect(getRegistryURL()).toBe('http://localhost');
|
||||
history.pushState({}, 'page title', '/-/web/detail');
|
||||
expect(getRegistryURL()).toBe('http://localhost/-/web/detail');
|
||||
expect(getRegistryURL()).toBe('http://localhost');
|
||||
history.pushState({}, 'page title', '/');
|
||||
});
|
||||
|
||||
test('getRegistryURL() - should not add slash if location is not a sub directory', () => {
|
||||
test('getRegistryURL() - should change when UI options change', () => {
|
||||
expect(getRegistryURL()).toBe('http://localhost');
|
||||
window.__VERDACCIO_BASENAME_UI_OPTIONS.base = 'http://localhost/test';
|
||||
expect(getRegistryURL()).toBe('http://localhost/test');
|
||||
window.__VERDACCIO_BASENAME_UI_OPTIONS.base = 'http://localhost';
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@ export function isEmail(email: string): boolean {
|
||||
}
|
||||
|
||||
export function getRegistryURL(): string {
|
||||
// Don't add slash if it's not a sub directory
|
||||
return `${location.origin}${location.pathname === '/' ? '' : location.pathname}`;
|
||||
return window.__VERDACCIO_BASENAME_UI_OPTIONS.base;
|
||||
}
|
||||
|
||||
export function extractFileName(url: string): string {
|
||||
|
||||
@@ -37,7 +37,7 @@ export default {
|
||||
}),
|
||||
new HTMLWebpackPlugin({
|
||||
__UI_OPTIONS: JSON.stringify({
|
||||
base: '/',
|
||||
base: new URL('/', 'https://localhost:4872'),
|
||||
}),
|
||||
title: 'Verdaccio Dev UI',
|
||||
scope: '',
|
||||
|
||||
Reference in New Issue
Block a user