Skip to content

Commit 6f10837

Browse files
committed
fix: takes the app version from verdaccio
1 parent f9da057 commit 6f10837

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

src/webui/components/Footer/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import React from 'react';
77
import type { Element } from 'react';
88

9-
import { version } from '../../../../package.json';
109
import { Wrapper, Left, Right, Earth, Flags, Love, Flag, Logo, Inner, ToolTip } from './styles';
1110
import { goToVerdaccioWebsite } from '../../utils/windows.js';
1211

@@ -28,7 +27,7 @@ const MADEWITH_LABEL = ' Made with';
2827
const ON_LABEL = 'on';
2928
const HEARTH_EMOJI = '♥';
3029

31-
const renderRight = () => (
30+
const renderRight = (version = window.VERDACCIO_VERSION) => (
3231
<Right>
3332
{POWERED_LABEL}
3433
<Logo img={true} name={'verdaccio'} onClick={goToVerdaccioWebsite} pointer={true} size={'md'} />

src/webui/template/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
window.VERDACCIO_API_URL = '<%= htmlWebpackPlugin.options.verdaccioURL %>/-/verdaccio/';
1313
window.VERDACCIO_SCOPE = '<%= htmlWebpackPlugin.options.scope %>';
1414
window.VERDACCIO_LOGO = '<%= htmlWebpackPlugin.options.logo %>';
15+
window.VERDACCIO_VERSION = '<%= htmlWebpackPlugin.options.version_app %>';
1516
</script>
1617
</head>
1718

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
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>"`;
3+
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>"`;

test/unit/webui/components/footer.spec.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import Footer from '../../../../src/webui/components/Footer/index';
66

77
jest.mock('../../../../package.json', () => ({
88
version: '4.0.0-alpha.3'
9-
}))
9+
}));
1010

1111
describe('<Footer /> component', () => {
1212
let wrapper;
1313
beforeEach(() => {
14+
window.VERDACCIO_VERSION = 'v.1.0.0';
1415
wrapper = mount(<Footer />);
16+
delete window.VERDACCIO_VERSION;
1517
});
1618

1719
test('should load the initial state of Footer component', () => {

tools/webpack.prod.config.babel.js

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const prodConf = {
5050
filename: 'index.html',
5151
favicon: `${env.SRC_ROOT}/webui/template/favicon.ico`,
5252
verdaccioURL: 'ToReplaceByVerdaccio',
53+
version_app: 'ToReplaceByVersion',
5354
template: `${env.SRC_ROOT}/webui/template/index.html`,
5455
debug: false,
5556
inject: true,

0 commit comments

Comments
 (0)