mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 01:20:24 +03:00
Remove default exports
This commit is contained in:
parent
1f41f8da23
commit
5e9ec071dc
19 changed files with 32 additions and 53 deletions
|
@ -1,8 +1,6 @@
|
||||||
import type Bottle from 'bottlejs';
|
import type Bottle from 'bottlejs';
|
||||||
import { buildShlinkApiClient } from './ShlinkApiClientBuilder';
|
import { buildShlinkApiClient } from './ShlinkApiClientBuilder';
|
||||||
|
|
||||||
const provideServices = (bottle: Bottle) => {
|
export const provideServices = (bottle: Bottle) => {
|
||||||
bottle.serviceFactory('buildShlinkApiClient', buildShlinkApiClient, 'HttpClient');
|
bottle.serviceFactory('buildShlinkApiClient', buildShlinkApiClient, 'HttpClient');
|
||||||
};
|
};
|
||||||
|
|
||||||
export default provideServices;
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { ConnectDecorator } from '../../container/types';
|
||||||
import { App } from '../App';
|
import { App } from '../App';
|
||||||
import { appUpdateAvailable, resetAppUpdate } from '../reducers/appUpdates';
|
import { appUpdateAvailable, resetAppUpdate } from '../reducers/appUpdates';
|
||||||
|
|
||||||
const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
// Components
|
// Components
|
||||||
bottle.serviceFactory(
|
bottle.serviceFactory(
|
||||||
'App',
|
'App',
|
||||||
|
@ -23,5 +23,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
bottle.serviceFactory('appUpdateAvailable', () => appUpdateAvailable);
|
bottle.serviceFactory('appUpdateAvailable', () => appUpdateAvailable);
|
||||||
bottle.serviceFactory('resetAppUpdate', () => resetAppUpdate);
|
bottle.serviceFactory('resetAppUpdate', () => resetAppUpdate);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default provideServices;
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { HttpClient } from './HttpClient';
|
||||||
import { ImageDownloader } from './ImageDownloader';
|
import { ImageDownloader } from './ImageDownloader';
|
||||||
import { ReportExporter } from './ReportExporter';
|
import { ReportExporter } from './ReportExporter';
|
||||||
|
|
||||||
const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
// Services
|
// Services
|
||||||
bottle.constant('window', window);
|
bottle.constant('window', window);
|
||||||
bottle.constant('console', console);
|
bottle.constant('console', console);
|
||||||
|
@ -62,5 +62,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
bottle.serviceFactory('sidebarPresent', () => sidebarPresent);
|
bottle.serviceFactory('sidebarPresent', () => sidebarPresent);
|
||||||
bottle.serviceFactory('sidebarNotPresent', () => sidebarNotPresent);
|
bottle.serviceFactory('sidebarNotPresent', () => sidebarNotPresent);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default provideServices;
|
|
||||||
|
|
|
@ -2,17 +2,17 @@ import type { IContainer } from 'bottlejs';
|
||||||
import Bottle from 'bottlejs';
|
import Bottle from 'bottlejs';
|
||||||
import { pick } from 'ramda';
|
import { pick } from 'ramda';
|
||||||
import { connect as reduxConnect } from 'react-redux';
|
import { connect as reduxConnect } from 'react-redux';
|
||||||
import provideApiServices from '../api/services/provideServices';
|
import { provideServices as provideApiServices } from '../api/services/provideServices';
|
||||||
import provideAppServices from '../app/services/provideServices';
|
import { provideServices as provideAppServices } from '../app/services/provideServices';
|
||||||
import provideCommonServices from '../common/services/provideServices';
|
import { provideServices as provideCommonServices } from '../common/services/provideServices';
|
||||||
import provideDomainsServices from '../domains/services/provideServices';
|
import { provideServices as provideDomainsServices } from '../domains/services/provideServices';
|
||||||
import provideMercureServices from '../mercure/services/provideServices';
|
import { provideServices as provideMercureServices } from '../mercure/services/provideServices';
|
||||||
import provideServersServices from '../servers/services/provideServices';
|
import { provideServices as provideServersServices } from '../servers/services/provideServices';
|
||||||
import provideSettingsServices from '../settings/services/provideServices';
|
import { provideServices as provideSettingsServices } from '../settings/services/provideServices';
|
||||||
import provideShortUrlsServices from '../short-urls/services/provideServices';
|
import { provideServices as provideShortUrlsServices } from '../short-urls/services/provideServices';
|
||||||
import provideTagsServices from '../tags/services/provideServices';
|
import { provideServices as provideTagsServices } from '../tags/services/provideServices';
|
||||||
import provideUtilsServices from '../utils/services/provideServices';
|
import { provideServices as provideUtilsServices } from '../utils/services/provideServices';
|
||||||
import provideVisitsServices from '../visits/services/provideServices';
|
import { provideServices as provideVisitsServices } from '../visits/services/provideServices';
|
||||||
import type { ConnectDecorator } from './types';
|
import type { ConnectDecorator } from './types';
|
||||||
|
|
||||||
type LazyActionMap = Record<string, Function>;
|
type LazyActionMap = Record<string, Function>;
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { configureStore } from '@reduxjs/toolkit';
|
||||||
import type { IContainer } from 'bottlejs';
|
import type { IContainer } from 'bottlejs';
|
||||||
import type { RLSOptions } from 'redux-localstorage-simple';
|
import type { RLSOptions } from 'redux-localstorage-simple';
|
||||||
import { load, save } from 'redux-localstorage-simple';
|
import { load, save } from 'redux-localstorage-simple';
|
||||||
import reducer from '../reducers';
|
import { initReducers } from '../reducers';
|
||||||
import { migrateDeprecatedSettings } from '../settings/helpers';
|
import { migrateDeprecatedSettings } from '../settings/helpers';
|
||||||
import type { ShlinkState } from './types';
|
import type { ShlinkState } from './types';
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ const preloadedState = migrateDeprecatedSettings(load(localStorageConfig) as Shl
|
||||||
|
|
||||||
export const setUpStore = (container: IContainer) => configureStore({
|
export const setUpStore = (container: IContainer) => configureStore({
|
||||||
devTools: !isProduction,
|
devTools: !isProduction,
|
||||||
reducer: reducer(container),
|
reducer: initReducers(container),
|
||||||
preloadedState,
|
preloadedState,
|
||||||
middleware: (defaultMiddlewaresIncludingReduxThunk) =>
|
middleware: (defaultMiddlewaresIncludingReduxThunk) =>
|
||||||
defaultMiddlewaresIncludingReduxThunk({ immutableCheck: false, serializableCheck: false }) // State is too big for these
|
defaultMiddlewaresIncludingReduxThunk({ immutableCheck: false, serializableCheck: false }) // State is too big for these
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { ManageDomains } from '../ManageDomains';
|
||||||
import { editDomainRedirects } from '../reducers/domainRedirects';
|
import { editDomainRedirects } from '../reducers/domainRedirects';
|
||||||
import { domainsListReducerCreator } from '../reducers/domainsList';
|
import { domainsListReducerCreator } from '../reducers/domainsList';
|
||||||
|
|
||||||
const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
// Components
|
// Components
|
||||||
bottle.serviceFactory('DomainSelector', () => DomainSelector);
|
bottle.serviceFactory('DomainSelector', () => DomainSelector);
|
||||||
bottle.decorator('DomainSelector', connect(['domainsList'], ['listDomains']));
|
bottle.decorator('DomainSelector', connect(['domainsList'], ['listDomains']));
|
||||||
|
@ -32,5 +32,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
bottle.serviceFactory('editDomainRedirects', editDomainRedirects, 'buildShlinkApiClient');
|
bottle.serviceFactory('editDomainRedirects', editDomainRedirects, 'buildShlinkApiClient');
|
||||||
bottle.serviceFactory('checkDomainHealth', prop('checkDomainHealth'), 'domainsListReducerCreator');
|
bottle.serviceFactory('checkDomainHealth', prop('checkDomainHealth'), 'domainsListReducerCreator');
|
||||||
};
|
};
|
||||||
|
|
||||||
export default provideServices;
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import type Bottle from 'bottlejs';
|
||||||
import { prop } from 'ramda';
|
import { prop } from 'ramda';
|
||||||
import { mercureInfoReducerCreator } from '../reducers/mercureInfo';
|
import { mercureInfoReducerCreator } from '../reducers/mercureInfo';
|
||||||
|
|
||||||
const provideServices = (bottle: Bottle) => {
|
export const provideServices = (bottle: Bottle) => {
|
||||||
// Reducer
|
// Reducer
|
||||||
bottle.serviceFactory('mercureInfoReducerCreator', mercureInfoReducerCreator, 'buildShlinkApiClient');
|
bottle.serviceFactory('mercureInfoReducerCreator', mercureInfoReducerCreator, 'buildShlinkApiClient');
|
||||||
bottle.serviceFactory('mercureInfoReducer', prop('reducer'), 'mercureInfoReducerCreator');
|
bottle.serviceFactory('mercureInfoReducer', prop('reducer'), 'mercureInfoReducerCreator');
|
||||||
|
@ -10,5 +10,3 @@ const provideServices = (bottle: Bottle) => {
|
||||||
// Actions
|
// Actions
|
||||||
bottle.serviceFactory('loadMercureInfo', prop('loadMercureInfo'), 'mercureInfoReducerCreator');
|
bottle.serviceFactory('loadMercureInfo', prop('loadMercureInfo'), 'mercureInfoReducerCreator');
|
||||||
};
|
};
|
||||||
|
|
||||||
export default provideServices;
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import type { ShlinkState } from '../container/types';
|
||||||
import { serversReducer } from '../servers/reducers/servers';
|
import { serversReducer } from '../servers/reducers/servers';
|
||||||
import { settingsReducer } from '../settings/reducers/settings';
|
import { settingsReducer } from '../settings/reducers/settings';
|
||||||
|
|
||||||
export default (container: IContainer) => combineReducers<ShlinkState>({
|
export const initReducers = (container: IContainer) => combineReducers<ShlinkState>({
|
||||||
servers: serversReducer,
|
servers: serversReducer,
|
||||||
selectedServer: container.selectedServerReducer,
|
selectedServer: container.selectedServerReducer,
|
||||||
shortUrlsList: container.shortUrlsListReducer,
|
shortUrlsList: container.shortUrlsListReducer,
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { SimpleCard } from '../utils/SimpleCard';
|
||||||
import type { ServersMap } from './data';
|
import type { ServersMap } from './data';
|
||||||
import type { ImportServersBtnProps } from './helpers/ImportServersBtn';
|
import type { ImportServersBtnProps } from './helpers/ImportServersBtn';
|
||||||
import type { ManageServersRowProps } from './ManageServersRow';
|
import type { ManageServersRowProps } from './ManageServersRow';
|
||||||
import type ServersExporter from './services/ServersExporter';
|
import type { ServersExporter } from './services/ServersExporter';
|
||||||
|
|
||||||
interface ManageServersProps {
|
interface ManageServersProps {
|
||||||
servers: ServersMap;
|
servers: ServersMap;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { serverWithIdToServerData } from '../data';
|
||||||
|
|
||||||
const SERVERS_FILENAME = 'shlink-servers.csv';
|
const SERVERS_FILENAME = 'shlink-servers.csv';
|
||||||
|
|
||||||
export default class ServersExporter {
|
export class ServersExporter {
|
||||||
public constructor(
|
public constructor(
|
||||||
private readonly storage: LocalStorage,
|
private readonly storage: LocalStorage,
|
||||||
private readonly window: Window,
|
private readonly window: Window,
|
||||||
|
|
|
@ -21,10 +21,10 @@ import {
|
||||||
} from '../reducers/selectedServer';
|
} from '../reducers/selectedServer';
|
||||||
import { createServers, deleteServer, editServer, setAutoConnect } from '../reducers/servers';
|
import { createServers, deleteServer, editServer, setAutoConnect } from '../reducers/servers';
|
||||||
import { ServersDropdown } from '../ServersDropdown';
|
import { ServersDropdown } from '../ServersDropdown';
|
||||||
import ServersExporter from './ServersExporter';
|
import { ServersExporter } from './ServersExporter';
|
||||||
import { ServersImporter } from './ServersImporter';
|
import { ServersImporter } from './ServersImporter';
|
||||||
|
|
||||||
const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
// Components
|
// Components
|
||||||
bottle.serviceFactory(
|
bottle.serviceFactory(
|
||||||
'ManageServers',
|
'ManageServers',
|
||||||
|
@ -89,5 +89,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
bottle.serviceFactory('selectedServerReducerCreator', selectedServerReducerCreator, 'selectServer');
|
bottle.serviceFactory('selectedServerReducerCreator', selectedServerReducerCreator, 'selectServer');
|
||||||
bottle.serviceFactory('selectedServerReducer', prop('reducer'), 'selectedServerReducerCreator');
|
bottle.serviceFactory('selectedServerReducer', prop('reducer'), 'selectedServerReducerCreator');
|
||||||
};
|
};
|
||||||
|
|
||||||
export default provideServices;
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { TagsSettings } from '../TagsSettings';
|
||||||
import { UserInterfaceSettings } from '../UserInterfaceSettings';
|
import { UserInterfaceSettings } from '../UserInterfaceSettings';
|
||||||
import { VisitsSettings } from '../VisitsSettings';
|
import { VisitsSettings } from '../VisitsSettings';
|
||||||
|
|
||||||
const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
// Components
|
// Components
|
||||||
bottle.serviceFactory(
|
bottle.serviceFactory(
|
||||||
'Settings',
|
'Settings',
|
||||||
|
@ -63,5 +63,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
bottle.serviceFactory('setVisitsSettings', () => setVisitsSettings);
|
bottle.serviceFactory('setVisitsSettings', () => setVisitsSettings);
|
||||||
bottle.serviceFactory('setTagsSettings', () => setTagsSettings);
|
bottle.serviceFactory('setTagsSettings', () => setTagsSettings);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default provideServices;
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { ShortUrlsFilteringBar } from '../ShortUrlsFilteringBar';
|
||||||
import { ShortUrlsList } from '../ShortUrlsList';
|
import { ShortUrlsList } from '../ShortUrlsList';
|
||||||
import { ShortUrlsTable } from '../ShortUrlsTable';
|
import { ShortUrlsTable } from '../ShortUrlsTable';
|
||||||
|
|
||||||
const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
// Components
|
// Components
|
||||||
bottle.serviceFactory('ShortUrlsList', ShortUrlsList, 'ShortUrlsTable', 'ShortUrlsFilteringBar');
|
bottle.serviceFactory('ShortUrlsList', ShortUrlsList, 'ShortUrlsTable', 'ShortUrlsFilteringBar');
|
||||||
bottle.decorator('ShortUrlsList', connect(
|
bottle.decorator('ShortUrlsList', connect(
|
||||||
|
@ -98,5 +98,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
|
|
||||||
bottle.serviceFactory('editShortUrl', editShortUrl, 'buildShlinkApiClient');
|
bottle.serviceFactory('editShortUrl', editShortUrl, 'buildShlinkApiClient');
|
||||||
};
|
};
|
||||||
|
|
||||||
export default provideServices;
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { TagsList } from '../TagsList';
|
||||||
import { TagsTable } from '../TagsTable';
|
import { TagsTable } from '../TagsTable';
|
||||||
import { TagsTableRow } from '../TagsTableRow';
|
import { TagsTableRow } from '../TagsTableRow';
|
||||||
|
|
||||||
const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
// Components
|
// Components
|
||||||
bottle.serviceFactory('TagsSelector', TagsSelector, 'ColorGenerator');
|
bottle.serviceFactory('TagsSelector', TagsSelector, 'ColorGenerator');
|
||||||
bottle.decorator('TagsSelector', connect(['tagsList', 'settings'], ['listTags']));
|
bottle.decorator('TagsSelector', connect(['tagsList', 'settings'], ['listTags']));
|
||||||
|
@ -57,5 +57,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
bottle.serviceFactory('editTag', editTag, 'buildShlinkApiClient', 'ColorGenerator');
|
bottle.serviceFactory('editTag', editTag, 'buildShlinkApiClient', 'ColorGenerator');
|
||||||
bottle.serviceFactory('tagEdited', () => tagEdited);
|
bottle.serviceFactory('tagEdited', () => tagEdited);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default provideServices;
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useTimeoutToggle } from '../helpers/hooks';
|
||||||
import { ColorGenerator } from './ColorGenerator';
|
import { ColorGenerator } from './ColorGenerator';
|
||||||
import { LocalStorage } from './LocalStorage';
|
import { LocalStorage } from './LocalStorage';
|
||||||
|
|
||||||
const provideServices = (bottle: Bottle) => {
|
export const provideServices = (bottle: Bottle) => {
|
||||||
bottle.constant('localStorage', window.localStorage);
|
bottle.constant('localStorage', window.localStorage);
|
||||||
bottle.service('Storage', LocalStorage, 'localStorage');
|
bottle.service('Storage', LocalStorage, 'localStorage');
|
||||||
bottle.service('ColorGenerator', ColorGenerator, 'Storage');
|
bottle.service('ColorGenerator', ColorGenerator, 'Storage');
|
||||||
|
@ -16,5 +16,3 @@ const provideServices = (bottle: Bottle) => {
|
||||||
bottle.constant('clearTimeout', window.clearTimeout);
|
bottle.constant('clearTimeout', window.clearTimeout);
|
||||||
bottle.serviceFactory('useTimeoutToggle', useTimeoutToggle, 'setTimeout', 'clearTimeout');
|
bottle.serviceFactory('useTimeoutToggle', useTimeoutToggle, 'setTimeout', 'clearTimeout');
|
||||||
};
|
};
|
||||||
|
|
||||||
export default provideServices;
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { ShortUrlVisits } from '../ShortUrlVisits';
|
||||||
import { TagVisits } from '../TagVisits';
|
import { TagVisits } from '../TagVisits';
|
||||||
import * as visitsParser from './VisitsParser';
|
import * as visitsParser from './VisitsParser';
|
||||||
|
|
||||||
const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
export const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
// Components
|
// Components
|
||||||
bottle.serviceFactory('MapModal', () => MapModal);
|
bottle.serviceFactory('MapModal', () => MapModal);
|
||||||
|
|
||||||
|
@ -91,5 +91,3 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
||||||
bottle.serviceFactory('tagVisitsReducerCreator', tagVisitsReducerCreator, 'getTagVisits');
|
bottle.serviceFactory('tagVisitsReducerCreator', tagVisitsReducerCreator, 'getTagVisits');
|
||||||
bottle.serviceFactory('tagVisitsReducer', prop('reducer'), 'tagVisitsReducerCreator');
|
bottle.serviceFactory('tagVisitsReducer', prop('reducer'), 'tagVisitsReducerCreator');
|
||||||
};
|
};
|
||||||
|
|
||||||
export default provideServices;
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { MemoryRouter } from 'react-router-dom';
|
||||||
import { Mock } from 'ts-mockery';
|
import { Mock } from 'ts-mockery';
|
||||||
import type { ServersMap, ServerWithId } from '../../src/servers/data';
|
import type { ServersMap, ServerWithId } from '../../src/servers/data';
|
||||||
import { ManageServers as createManageServers } from '../../src/servers/ManageServers';
|
import { ManageServers as createManageServers } from '../../src/servers/ManageServers';
|
||||||
import type ServersExporter from '../../src/servers/services/ServersExporter';
|
import type { ServersExporter } from '../../src/servers/services/ServersExporter';
|
||||||
import { renderWithEvents } from '../__helpers__/setUpTest';
|
import { renderWithEvents } from '../__helpers__/setUpTest';
|
||||||
|
|
||||||
describe('<ManageServers />', () => {
|
describe('<ManageServers />', () => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Mock } from 'ts-mockery';
|
import { Mock } from 'ts-mockery';
|
||||||
import ServersExporter from '../../../src/servers/services/ServersExporter';
|
import { ServersExporter } from '../../../src/servers/services/ServersExporter';
|
||||||
import type { LocalStorage } from '../../../src/utils/services/LocalStorage';
|
import type { LocalStorage } from '../../../src/utils/services/LocalStorage';
|
||||||
import { appendChild, removeChild, windowMock } from '../../__mocks__/Window.mock';
|
import { appendChild, removeChild, windowMock } from '../../__mocks__/Window.mock';
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import { defineConfig } from 'vite';
|
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
|
import { defineConfig } from 'vite';
|
||||||
import { VitePWA } from 'vite-plugin-pwa';
|
import { VitePWA } from 'vite-plugin-pwa';
|
||||||
import { manifest } from './manifest';
|
import { manifest } from './manifest';
|
||||||
import pack from './package.json';
|
import pack from './package.json';
|
||||||
|
|
||||||
const homepage = pack.homepage?.trim();
|
const homepage = pack.homepage?.trim();
|
||||||
|
|
||||||
|
/* eslint-disable-next-line no-restricted-exports */
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react(), VitePWA({
|
plugins: [react(), VitePWA({
|
||||||
mode: process.env.NODE_ENV === 'development' ? 'development' : 'production',
|
mode: process.env.NODE_ENV === 'development' ? 'development' : 'production',
|
||||||
|
|
Loading…
Reference in a new issue