forked from sombochea/verdaccio-ui
fix: takes the app version from verdaccio
This commit is contained in:
parent
f9da05744b
commit
6f108370ce
@ -6,7 +6,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import type { Element } from 'react';
|
import type { Element } from 'react';
|
||||||
|
|
||||||
import { version } from '../../../../package.json';
|
|
||||||
import { Wrapper, Left, Right, Earth, Flags, Love, Flag, Logo, Inner, ToolTip } from './styles';
|
import { Wrapper, Left, Right, Earth, Flags, Love, Flag, Logo, Inner, ToolTip } from './styles';
|
||||||
import { goToVerdaccioWebsite } from '../../utils/windows.js';
|
import { goToVerdaccioWebsite } from '../../utils/windows.js';
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ const MADEWITH_LABEL = ' Made with';
|
|||||||
const ON_LABEL = 'on';
|
const ON_LABEL = 'on';
|
||||||
const HEARTH_EMOJI = '♥';
|
const HEARTH_EMOJI = '♥';
|
||||||
|
|
||||||
const renderRight = () => (
|
const renderRight = (version = window.VERDACCIO_VERSION) => (
|
||||||
<Right>
|
<Right>
|
||||||
{POWERED_LABEL}
|
{POWERED_LABEL}
|
||||||
<Logo img={true} name={'verdaccio'} onClick={goToVerdaccioWebsite} pointer={true} size={'md'} />
|
<Logo img={true} name={'verdaccio'} onClick={goToVerdaccioWebsite} pointer={true} size={'md'} />
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
window.VERDACCIO_API_URL = '<%= htmlWebpackPlugin.options.verdaccioURL %>/-/verdaccio/';
|
window.VERDACCIO_API_URL = '<%= htmlWebpackPlugin.options.verdaccioURL %>/-/verdaccio/';
|
||||||
window.VERDACCIO_SCOPE = '<%= htmlWebpackPlugin.options.scope %>';
|
window.VERDACCIO_SCOPE = '<%= htmlWebpackPlugin.options.scope %>';
|
||||||
window.VERDACCIO_LOGO = '<%= htmlWebpackPlugin.options.logo %>';
|
window.VERDACCIO_LOGO = '<%= htmlWebpackPlugin.options.logo %>';
|
||||||
|
window.VERDACCIO_VERSION = '<%= htmlWebpackPlugin.options.version_app %>';
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<Footer /> component should load the initial state of Footer component 1`] = `"<div class=\\"css-i0nj2g e19gp4r80\\"><div class=\\"css-hzfs9b e19gp4r81\\"><div class=\\"css-d8nsp7 e19gp4r82\\"> Made with<span class=\\"css-1so4oe0 e19gp4r87\\">♥</span>on<span class=\\"css-1ie354y e19gp4r84\\"><svg class=\\"e19gp4r85 css-1kgp95j e9byyw50\\"><title>Earth</title><use xlink:href=\\"[object Object]#earth\\"></use></svg><span class=\\"css-1v4n0q4 e19gp4r86\\"><svg class=\\"e19gp4r88 css-f1ndto e9byyw50\\"><title>Spain</title><use xlink:href=\\"[object Object]#spain\\"></use></svg><svg class=\\"e19gp4r88 css-f1ndto e9byyw50\\"><title>Nicaragua</title><use xlink:href=\\"[object Object]#nicaragua\\"></use></svg><svg class=\\"e19gp4r88 css-f1ndto e9byyw50\\"><title>India</title><use xlink:href=\\"[object Object]#india\\"></use></svg><svg class=\\"e19gp4r88 css-f1ndto e9byyw50\\"><title>Brazil</title><use xlink:href=\\"[object Object]#brazil\\"></use></svg><svg class=\\"e19gp4r88 css-f1ndto e9byyw50\\"><title>China</title><use xlink:href=\\"[object Object]#china\\"></use></svg><svg class=\\"e19gp4r88 css-f1ndto e9byyw50\\"><title>Austria</title><use xlink:href=\\"[object Object]#austria\\"></use></svg></span></span></div><div class=\\"css-1wbzdyy e19gp4r83\\">Powered by<span class=\\"e19gp4r88 css-i15wza e9byyw51\\" title=\\"Verdaccio\\"><img alt=\\"Verdaccio\\" src=\\"[object Object]\\" class=\\"css-1ncdhax e9byyw52\\"></span>/ 4.0.0-alpha.3</div></div></div>"`;
|
exports[`<Footer /> component should load the initial state of Footer component 1`] = `"<div class=\\"css-i0nj2g e19gp4r80\\"><div class=\\"css-hzfs9b e19gp4r81\\"><div class=\\"css-d8nsp7 e19gp4r82\\"> Made with<span class=\\"css-1so4oe0 e19gp4r87\\">♥</span>on<span class=\\"css-1ie354y e19gp4r84\\"><svg class=\\"e19gp4r85 css-1kgp95j e9byyw50\\"><title>Earth</title><use xlink:href=\\"[object Object]#earth\\"></use></svg><span class=\\"css-1v4n0q4 e19gp4r86\\"><svg class=\\"e19gp4r88 css-f1ndto e9byyw50\\"><title>Spain</title><use xlink:href=\\"[object Object]#spain\\"></use></svg><svg class=\\"e19gp4r88 css-f1ndto e9byyw50\\"><title>Nicaragua</title><use xlink:href=\\"[object Object]#nicaragua\\"></use></svg><svg class=\\"e19gp4r88 css-f1ndto e9byyw50\\"><title>India</title><use xlink:href=\\"[object Object]#india\\"></use></svg><svg class=\\"e19gp4r88 css-f1ndto e9byyw50\\"><title>Brazil</title><use xlink:href=\\"[object Object]#brazil\\"></use></svg><svg class=\\"e19gp4r88 css-f1ndto e9byyw50\\"><title>China</title><use xlink:href=\\"[object Object]#china\\"></use></svg><svg class=\\"e19gp4r88 css-f1ndto e9byyw50\\"><title>Austria</title><use xlink:href=\\"[object Object]#austria\\"></use></svg></span></span></div><div class=\\"css-1wbzdyy e19gp4r83\\">Powered by<span class=\\"e19gp4r88 css-i15wza e9byyw51\\" title=\\"Verdaccio\\"><img alt=\\"Verdaccio\\" src=\\"[object Object]\\" class=\\"css-1ncdhax e9byyw52\\"></span>/ v.1.0.0</div></div></div>"`;
|
||||||
|
@ -6,12 +6,14 @@ import Footer from '../../../../src/webui/components/Footer/index';
|
|||||||
|
|
||||||
jest.mock('../../../../package.json', () => ({
|
jest.mock('../../../../package.json', () => ({
|
||||||
version: '4.0.0-alpha.3'
|
version: '4.0.0-alpha.3'
|
||||||
}))
|
}));
|
||||||
|
|
||||||
describe('<Footer /> component', () => {
|
describe('<Footer /> component', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
window.VERDACCIO_VERSION = 'v.1.0.0';
|
||||||
wrapper = mount(<Footer />);
|
wrapper = mount(<Footer />);
|
||||||
|
delete window.VERDACCIO_VERSION;
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should load the initial state of Footer component', () => {
|
test('should load the initial state of Footer component', () => {
|
||||||
|
@ -50,6 +50,7 @@ const prodConf = {
|
|||||||
filename: 'index.html',
|
filename: 'index.html',
|
||||||
favicon: `${env.SRC_ROOT}/webui/template/favicon.ico`,
|
favicon: `${env.SRC_ROOT}/webui/template/favicon.ico`,
|
||||||
verdaccioURL: 'ToReplaceByVerdaccio',
|
verdaccioURL: 'ToReplaceByVerdaccio',
|
||||||
|
version_app: 'ToReplaceByVersion',
|
||||||
template: `${env.SRC_ROOT}/webui/template/index.html`,
|
template: `${env.SRC_ROOT}/webui/template/index.html`,
|
||||||
debug: false,
|
debug: false,
|
||||||
inject: true,
|
inject: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user