Merge pull request #163 from acelaya-forks/feature/update-deps

Feature/update deps
This commit is contained in:
Alejandro Celaya 2019-10-05 20:09:22 +02:00 committed by GitHub
commit d9a8243d36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 6849 additions and 6744 deletions

View file

@ -1,6 +1,6 @@
build: build:
environment: environment:
node: v10.15.3 node: v12.11.0
tools: tools:
external_code_coverage: external_code_coverage:
timeout: 1200 timeout: 1200

View file

@ -1,7 +1,7 @@
language: node_js language: node_js
node_js: node_js:
- "10.16.3" - "12.11.0"
cache: cache:
directories: directories:

View file

@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org).
## [Unreleased] ## 2.2.0 - 2019-10-05
#### Added #### Added
@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
#### Changed #### Changed
* *Nothing* * [#140](https://github.com/shlinkio/shlink-web-client/issues/140) Updated project dependencies.
#### Deprecated #### Deprecated

View file

@ -1,8 +1,8 @@
FROM node:10.16.3-alpine as node FROM node:12.11.0-alpine as node
COPY . /shlink-web-client COPY . /shlink-web-client
RUN cd /shlink-web-client && npm install && npm run build RUN cd /shlink-web-client && npm install && npm run build
FROM nginx:1.17.3-alpine FROM nginx:1.17.4-alpine
LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>" LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>"
RUN rm -r /usr/share/nginx/html && rm /etc/nginx/conf.d/default.conf RUN rm -r /usr/share/nginx/html && rm /etc/nginx/conf.d/default.conf
COPY config/docker/nginx.conf /etc/nginx/conf.d/default.conf COPY config/docker/nginx.conf /etc/nginx/conf.d/default.conf

View file

@ -3,7 +3,7 @@ version: '3'
services: services:
shlink_web_client_node: shlink_web_client_node:
container_name: shlink_web_client_node container_name: shlink_web_client_node
image: node:10.16.3-alpine image: node:12.11.0-alpine
command: /bin/sh -c "cd /home/shlink/www && npm install && npm run start" command: /bin/sh -c "cd /home/shlink/www && npm install && npm run start"
volumes: volumes:
- ./:/home/shlink/www - ./:/home/shlink/www

13317
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
{ {
"name": "shlink-web-client-react", "name": "shlink-web-client",
"description": "A React-based progressive web application for shlink", "description": "A React-based progressive web application for shlink",
"version": "1.0.0", "version": "2.3.0",
"private": false, "private": false,
"homepage": "", "homepage": "",
"repository": "https://github.com/shlinkio/shlink-web-client", "repository": "https://github.com/shlinkio/shlink-web-client",
@ -22,123 +22,123 @@
"mutate:ci": "npm run mutate -- --mutate=$MUTATION_FILES" "mutate:ci": "npm run mutate -- --mutate=$MUTATION_FILES"
}, },
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^5.6.3", "@fortawesome/fontawesome-free": "^5.11.2",
"@fortawesome/fontawesome-svg-core": "^1.2.0", "@fortawesome/fontawesome-svg-core": "^1.2.25",
"@fortawesome/free-regular-svg-icons": "^5.6.3", "@fortawesome/free-regular-svg-icons": "^5.11.2",
"@fortawesome/free-solid-svg-icons": "^5.6.3", "@fortawesome/free-solid-svg-icons": "^5.11.2",
"@fortawesome/react-fontawesome": "^0.1.3", "@fortawesome/react-fontawesome": "^0.1.5",
"array-filter": "^1.0.0", "array-filter": "^1.0.0",
"array-map": "^0.0.0", "array-map": "^0.0.0",
"array-reduce": "^0.0.0", "array-reduce": "^0.0.0",
"axios": "^0.18.0", "axios": "^0.19.0",
"bootstrap": "^4.3.1", "bootstrap": "^4.3.1",
"bottlejs": "^1.7.1", "bottlejs": "^1.7.2",
"chart.js": "^2.7.2", "chart.js": "^2.8.0",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"compare-versions": "^3.5.1", "compare-versions": "^3.5.1",
"csvjson": "^5.1.0", "csvjson": "^5.1.0",
"leaflet": "^1.4.0", "leaflet": "^1.5.1",
"moment": "^2.22.2", "moment": "^2.24.0",
"promise": "^8.0.1", "promise": "^8.0.3",
"prop-types": "^15.6.2", "prop-types": "^15.7.2",
"qs": "^6.5.2", "qs": "^6.9.0",
"ramda": "^0.26.1", "ramda": "^0.26.1",
"react": "^16.8.0", "react": "^16.10.2",
"react-autosuggest": "^9.4.0", "react-autosuggest": "^9.4.3",
"react-chartjs-2": "^2.7.4", "react-chartjs-2": "^2.8.0",
"react-color": "^2.14.1", "react-color": "^2.17.3",
"react-copy-to-clipboard": "^5.0.1", "react-copy-to-clipboard": "^5.0.1",
"react-datepicker": "~1.5.0", "react-datepicker": "~1.5.0",
"react-dom": "^16.8.0", "react-dom": "^16.10.2",
"react-external-link": "^1.0.0", "react-external-link": "^1.0.0",
"react-leaflet": "^2.2.1", "react-leaflet": "^2.4.0",
"react-moment": "^0.7.6", "react-moment": "^0.9.5",
"react-redux": "^5.0.7", "react-redux": "^7.1.1",
"react-router-dom": "^4.2.2", "react-router-dom": "^5.1.2",
"react-swipeable": "^4.3.0", "react-swipeable": "^5.4.0",
"react-tagsinput": "^3.19.0", "react-tagsinput": "^3.19.0",
"reactstrap": "^7.1.0", "reactstrap": "^8.0.1",
"redux": "^4.0.0", "redux": "^4.0.4",
"redux-actions": "^2.6.5", "redux-actions": "^2.6.5",
"redux-thunk": "^2.3.0", "redux-thunk": "^2.3.0",
"uuid": "^3.3.2" "uuid": "^3.3.3"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.1.6", "@babel/core": "^7.6.2",
"@stryker-mutator/core": "^1.2.0", "@stryker-mutator/core": "^2.1.0",
"@stryker-mutator/html-reporter": "^1.2.0", "@stryker-mutator/html-reporter": "^2.1.0",
"@stryker-mutator/javascript-mutator": "^1.2.0", "@stryker-mutator/javascript-mutator": "^2.1.0",
"@stryker-mutator/jest-runner": "^1.2.0", "@stryker-mutator/jest-runner": "^2.1.0",
"@svgr/webpack": "^2.4.1", "@svgr/webpack": "^4.3.3",
"adm-zip": "0.4.11", "adm-zip": "^0.4.13",
"autoprefixer": "^7.1.6", "autoprefixer": "^9.6.3",
"babel-core": "7.0.0-bridge.0", "babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.3",
"babel-jest": "^23.6.0", "babel-jest": "^24.9.0",
"babel-loader": "^8.0.4", "babel-loader": "^8.0.6",
"babel-plugin-named-asset-import": "^0.3.0", "babel-plugin-named-asset-import": "^0.3.4",
"babel-preset-react-app": "^7.0.0", "babel-preset-react-app": "^9.0.2",
"babel-runtime": "^6.26.0", "babel-runtime": "^6.26.0",
"bfj": "^6.1.1", "bfj": "^7.0.1",
"case-sensitive-paths-webpack-plugin": "^2.1.2", "case-sensitive-paths-webpack-plugin": "^2.2.0",
"chalk": "^2.4.1", "chalk": "^2.4.2",
"css-loader": "^1.0.0", "css-loader": "^3.2.0",
"dotenv": "^6.0.0", "dotenv": "^8.1.0",
"dotenv-expand": "^4.2.0", "dotenv-expand": "^5.1.0",
"enzyme": "^3.3.0", "enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.1.1", "enzyme-adapter-react-16": "^1.14.0",
"eslint": "^5.11.1", "eslint": "^5.11.1",
"eslint-config-adidas-babel": "^1.1.0", "eslint-config-adidas-babel": "^1.1.0",
"eslint-config-adidas-env": "^1.1.0", "eslint-config-adidas-env": "^1.1.0",
"eslint-config-adidas-es6": "^1.2.0", "eslint-config-adidas-es6": "^1.2.0",
"eslint-config-adidas-react": "^1.1.1", "eslint-config-adidas-react": "^1.1.1",
"eslint-loader": "^2.1.1", "eslint-loader": "^3.0.2",
"eslint-plugin-import": "^2.14.0", "eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^21.22.0", "eslint-plugin-jest": "^22.17.0",
"eslint-plugin-jsx-a11y": "^6.1.2", "eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-promise": "^4.0.1", "eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.11.1", "eslint-plugin-react": "^7.16.0",
"file-loader": "^2.0.0", "file-loader": "^4.2.0",
"fork-ts-checker-webpack-plugin-alt": "^0.4.14", "fork-ts-checker-webpack-plugin-alt": "^0.4.14",
"fs-extra": "^7.0.0", "fs-extra": "^8.1.0",
"html-webpack-plugin": "^4.0.0-alpha.2", "html-webpack-plugin": "^4.0.0-beta.8",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"jest": "^23.6.0", "jest": "^24.9.0",
"jest-each": "^24.9.0", "jest-each": "^24.9.0",
"jest-pnp-resolver": "^1.0.1", "jest-pnp-resolver": "^1.2.1",
"jest-resolve": "^23.6.0", "jest-resolve": "^24.9.0",
"mini-css-extract-plugin": "^0.4.3", "mini-css-extract-plugin": "^0.8.0",
"node-sass": "^4.9.0", "node-sass": "^4.12.0",
"object-assign": "^4.1.1", "object-assign": "^4.1.1",
"ocular.js": "^0.1.0", "ocular.js": "^0.1.0",
"optimize-css-assets-webpack-plugin": "^5.0.1", "optimize-css-assets-webpack-plugin": "^5.0.3",
"pnp-webpack-plugin": "^1.1.0", "pnp-webpack-plugin": "^1.5.0",
"postcss": "^7.0.7", "postcss": "^7.0.18",
"postcss-flexbugs-fixes": "^4.1.0", "postcss-flexbugs-fixes": "^4.1.0",
"postcss-loader": "^3.0.0", "postcss-loader": "^3.0.0",
"postcss-preset-env": "^6.3.1", "postcss-preset-env": "^6.7.0",
"postcss-safe-parser": "^4.0.1", "postcss-safe-parser": "^4.0.1",
"raf": "^3.4.0", "raf": "^3.4.1",
"react-app-polyfill": "^0.2.0", "react-app-polyfill": "^1.0.4",
"react-dev-utils": "^7.0.1", "react-dev-utils": "^9.1.0",
"resolve": "^1.8.1", "resolve": "^1.12.0",
"sass-loader": "^7.1.0", "sass-loader": "^8.0.0",
"serve": "^10.0.0", "serve": "^11.2.0",
"stryker-cli": "^1.0.0", "stryker-cli": "^1.0.0",
"style-loader": "^0.23.0", "style-loader": "^1.0.0",
"stylelint": "^9.9.0", "stylelint": "^9.10.1",
"stylelint-config-adidas": "^1.2.1", "stylelint-config-adidas": "^1.2.1",
"stylelint-config-adidas-bem": "^1.2.0", "stylelint-config-adidas-bem": "^1.2.0",
"stylelint-config-recommended-scss": "^3.2.0", "stylelint-config-recommended-scss": "^4.0.0",
"stylelint-scss": "^3.3.0", "stylelint-scss": "^3.11.1",
"sw-precache-webpack-plugin": "^0.11.4", "sw-precache-webpack-plugin": "^0.11.5",
"terser-webpack-plugin": "^1.1.0", "terser-webpack-plugin": "^2.1.2",
"url-loader": "^1.1.1", "url-loader": "^2.2.0",
"webpack": "^4.19.1", "webpack": "^4.41.0",
"webpack-dev-server": "^3.1.14", "webpack-dev-server": "^3.8.2",
"webpack-manifest-plugin": "^2.0.4", "webpack-manifest-plugin": "^2.2.0",
"whatwg-fetch": "^2.0.3", "whatwg-fetch": "^3.0.0",
"workbox-webpack-plugin": "^3.6.3" "workbox-webpack-plugin": "^4.3.1"
}, },
"babel": { "babel": {
"presets": [ "presets": [

View file

@ -81,7 +81,7 @@ checkBrowsers(paths.appPath, isInteractive)
const urls = prepareUrls(protocol, HOST, port); const urls = prepareUrls(protocol, HOST, port);
// Create a webpack compiler that is configured with custom messages. // Create a webpack compiler that is configured with custom messages.
const compiler = createCompiler(webpack, config, appName, urls, useYarn); const compiler = createCompiler({ webpack, config, appName, urls, useYarn });
// Load proxy config // Load proxy config
const proxySetting = require(paths.appPackageJson).proxy; const proxySetting = require(paths.appPackageJson).proxy;

View file

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { Route, Switch } from 'react-router-dom'; import { Route, Switch } from 'react-router-dom';
import Swipeable from 'react-swipeable'; import { Swipeable } from 'react-swipeable';
import { faBars as burgerIcon } from '@fortawesome/free-solid-svg-icons'; import { faBars as burgerIcon } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import classnames from 'classnames'; import classnames from 'classnames';

View file

@ -1,6 +1,5 @@
import { isEmpty, values } from 'ramda'; import { isEmpty, values } from 'ramda';
import React from 'react'; import React from 'react';
import { Link } from 'react-router-dom';
import { DropdownItem, DropdownMenu, DropdownToggle, UncontrolledDropdown } from 'reactstrap'; import { DropdownItem, DropdownMenu, DropdownToggle, UncontrolledDropdown } from 'reactstrap';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { serverType } from './prop-types'; import { serverType } from './prop-types';
@ -11,11 +10,20 @@ const ServersDropdown = (serversExporter) => class ServersDropdown extends React
selectedServer: serverType, selectedServer: serverType,
selectServer: PropTypes.func, selectServer: PropTypes.func,
listServers: PropTypes.func, listServers: PropTypes.func,
history: PropTypes.shape({
push: PropTypes.func,
}),
}; };
renderServers = () => { renderServers = () => {
const { servers: { list, loading }, selectedServer, selectServer } = this.props; const { servers: { list, loading }, selectedServer, selectServer } = this.props;
const servers = values(list); const servers = values(list);
const { push } = this.props.history;
const loadServer = (id) => {
selectServer(id)
.then(() => push(`/server/${id}/list-short-urls/1`))
.catch(() => {});
};
if (loading) { if (loading) {
return <DropdownItem disabled><i>Trying to load servers...</i></DropdownItem>; return <DropdownItem disabled><i>Trying to load servers...</i></DropdownItem>;
@ -28,15 +36,7 @@ const ServersDropdown = (serversExporter) => class ServersDropdown extends React
return ( return (
<React.Fragment> <React.Fragment>
{servers.map(({ name, id }) => ( {servers.map(({ name, id }) => (
<DropdownItem <DropdownItem key={id} active={selectedServer && selectedServer.id === id} onClick={() => loadServer(id)}>
key={id}
tag={Link}
to={`/server/${id}/list-short-urls/1`}
active={selectedServer && selectedServer.id === id}
// FIXME This should be implicit
onClick={() => selectServer(id)}
>
{name} {name}
</DropdownItem> </DropdownItem>
))} ))}

View file

@ -15,7 +15,7 @@ export const selectServer = ({ findServerById }, buildShlinkApiClient) => (serve
const selectedServer = findServerById(serverId); const selectedServer = findServerById(serverId);
const { health } = await buildShlinkApiClient(selectedServer); const { health } = await buildShlinkApiClient(selectedServer);
const { version } = await health(); const { version } = await health().catch(() => ({ version: '1.0.0' }));
dispatch({ dispatch({
type: SELECT_SERVER, type: SELECT_SERVER,

View file

@ -16,6 +16,7 @@ const provideServices = (bottle, connect, withRouter) => {
bottle.decorator('CreateServer', connect([ 'selectedServer' ], [ 'createServer', 'resetSelectedServer' ])); bottle.decorator('CreateServer', connect([ 'selectedServer' ], [ 'createServer', 'resetSelectedServer' ]));
bottle.serviceFactory('ServersDropdown', ServersDropdown, 'ServersExporter'); bottle.serviceFactory('ServersDropdown', ServersDropdown, 'ServersExporter');
bottle.decorator('ServersDropdown', withRouter);
bottle.decorator('ServersDropdown', connect([ 'servers', 'selectedServer' ], [ 'listServers', 'selectServer' ])); bottle.decorator('ServersDropdown', connect([ 'servers', 'selectedServer' ], [ 'listServers', 'selectServer' ]));
bottle.serviceFactory('DeleteServerModal', () => DeleteServerModal); bottle.serviceFactory('DeleteServerModal', () => DeleteServerModal);

View file

@ -15,15 +15,18 @@ describe('<ServersDropdown />', () => {
}, },
loading: false, loading: false,
}; };
const history = {
push: jest.fn(),
};
beforeEach(() => { beforeEach(() => {
ServersDropdown = serversDropdownCreator({}); ServersDropdown = serversDropdownCreator({});
wrapped = shallow(<ServersDropdown servers={servers} listServers={identity} />); wrapped = shallow(<ServersDropdown servers={servers} listServers={identity} history={history} />);
}); });
afterEach(() => wrapped.unmount()); afterEach(() => wrapped.unmount());
it('contains the list of servers', () => it('contains the list of servers, the divider and the export button', () =>
expect(wrapped.find(DropdownItem).filter('[to]')).toHaveLength(values(servers.list).length)); expect(wrapped.find(DropdownItem)).toHaveLength(values(servers.list).length + 2));
it('contains a toggle with proper title', () => it('contains a toggle with proper title', () =>
expect(wrapped.find(DropdownToggle)).toHaveLength(1)); expect(wrapped.find(DropdownToggle)).toHaveLength(1));
@ -36,7 +39,9 @@ describe('<ServersDropdown />', () => {
}); });
it('shows a message when no servers exist yet', () => { it('shows a message when no servers exist yet', () => {
wrapped = shallow(<ServersDropdown servers={{ loading: false, list: {} }} listServers={identity} />); wrapped = shallow(
<ServersDropdown servers={{ loading: false, list: {} }} listServers={identity} history={history} />
);
const item = wrapped.find(DropdownItem); const item = wrapped.find(DropdownItem);
expect(item).toHaveLength(1); expect(item).toHaveLength(1);
@ -45,7 +50,9 @@ describe('<ServersDropdown />', () => {
}); });
it('shows a message when loading', () => { it('shows a message when loading', () => {
wrapped = shallow(<ServersDropdown servers={{ loading: true, list: {} }} listServers={identity} />); wrapped = shallow(
<ServersDropdown servers={{ loading: true, list: {} }} listServers={identity} history={history} />
);
const item = wrapped.find(DropdownItem); const item = wrapped.find(DropdownItem);
expect(item).toHaveLength(1); expect(item).toHaveLength(1);

View file

@ -36,6 +36,12 @@ describe('selectedServerReducer', () => {
const apiClientMock = { const apiClientMock = {
health: jest.fn().mockResolvedValue({ version }), health: jest.fn().mockResolvedValue({ version }),
}; };
const buildApiClient = jest.fn().mockResolvedValue(apiClientMock);
beforeEach(() => {
apiClientMock.health.mockClear();
buildApiClient.mockClear();
});
afterEach(() => { afterEach(() => {
ServersServiceMock.findServerById.mockClear(); ServersServiceMock.findServerById.mockClear();
@ -48,17 +54,18 @@ describe('selectedServerReducer', () => {
version, version,
}; };
await selectServer(ServersServiceMock, async () => apiClientMock)(serverId)(dispatch); await selectServer(ServersServiceMock, buildApiClient)(serverId)(dispatch);
expect(dispatch).toHaveBeenCalledTimes(2); expect(dispatch).toHaveBeenCalledTimes(2);
expect(dispatch).toHaveBeenNthCalledWith(1, { type: RESET_SHORT_URL_PARAMS }); expect(dispatch).toHaveBeenNthCalledWith(1, { type: RESET_SHORT_URL_PARAMS });
expect(dispatch).toHaveBeenNthCalledWith(2, { type: SELECT_SERVER, selectedServer: expectedSelectedServer }); expect(dispatch).toHaveBeenNthCalledWith(2, { type: SELECT_SERVER, selectedServer: expectedSelectedServer });
}); });
it('invokes dependencies', () => { it('invokes dependencies', async () => {
selectServer(ServersServiceMock)(serverId)(() => {}); await selectServer(ServersServiceMock, buildApiClient)(serverId)(() => {});
expect(ServersServiceMock.findServerById).toHaveBeenCalledTimes(1); expect(ServersServiceMock.findServerById).toHaveBeenCalledTimes(1);
expect(buildApiClient).toHaveBeenCalledTimes(1);
}); });
}); });
}); });

View file

@ -46,15 +46,17 @@ describe('shortUrlTagsReducer', () => {
}); });
}); });
describe('resetShortUrlsTags', () => describe('resetShortUrlsTags', () => {
it('creates expected action', () => expect(resetShortUrlsTags()).toEqual({ type: RESET_EDIT_SHORT_URL_TAGS }))); it('creates expected action', () => expect(resetShortUrlsTags()).toEqual({ type: RESET_EDIT_SHORT_URL_TAGS }));
});
describe('shortUrlTagsEdited', () => describe('shortUrlTagsEdited', () => {
it('creates expected action', () => expect(shortUrlTagsEdited(shortCode, tags)).toEqual({ it('creates expected action', () => expect(shortUrlTagsEdited(shortCode, tags)).toEqual({
tags, tags,
shortCode, shortCode,
type: SHORT_URL_TAGS_EDITED, type: SHORT_URL_TAGS_EDITED,
}))); }));
});
describe('editShortUrlTags', () => { describe('editShortUrlTags', () => {
const updateShortUrlTags = jest.fn(); const updateShortUrlTags = jest.fn();

View file

@ -70,8 +70,9 @@ describe('tagsListReducer', () => {
}); });
}); });
describe('filterTags', () => describe('filterTags', () => {
it('creates expected action', () => expect(filterTags('foo')).toEqual({ type: FILTER_TAGS, searchTerm: 'foo' }))); it('creates expected action', () => expect(filterTags('foo')).toEqual({ type: FILTER_TAGS, searchTerm: 'foo' }));
});
describe('listTags', () => { describe('listTags', () => {
const dispatch = jest.fn(); const dispatch = jest.fn();