refactor: convert absolute imports to relative ones (#5438)

This commit is contained in:
Vladislav Shkodin 2021-05-30 18:49:33 +02:00 committed by GitHub
parent 1b78edadf0
commit 3a826b43a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 136 additions and 203 deletions

View File

@ -1,3 +1,10 @@
const fs = require('fs');
const packages = fs
.readdirSync(`${__dirname}/packages`, { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name);
module.exports = {
parser: 'babel-eslint',
extends: [
@ -5,6 +12,7 @@ module.exports = {
'plugin:react/recommended',
'plugin:cypress/recommended',
'prettier',
'plugin:import/recommended',
],
env: {
es6: true,
@ -22,6 +30,7 @@ module.exports = {
rules: {
'no-console': [0],
'react/prop-types': [0],
'import/no-named-as-default': 0,
'no-duplicate-imports': 'error',
'@emotion/no-vanilla': 'error',
'@emotion/import-from-emotion': 'error',
@ -41,6 +50,12 @@ module.exports = {
react: {
version: 'detect',
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
'import/core-modules': [...packages, 'netlify-cms-app/dist/esm'],
},
overrides: [
{
@ -52,8 +67,7 @@ module.exports = {
'plugin:cypress/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/recommended',
'plugin:import/typescript',
],
parserOptions: {
@ -65,7 +79,7 @@ module.exports = {
},
rules: {
'require-atomic-updates': [0],
'import/no-unresolved': [0],
'import/no-named-as-default': 0,
'@typescript-eslint/no-non-null-assertion': [0],
'@typescript-eslint/camelcase': [0],
'@typescript-eslint/explicit-function-return-type': [0],
@ -75,5 +89,11 @@ module.exports = {
],
},
},
{
files: ['website/**/*'],
rules: {
'import/no-unresolved': [0],
},
},
],
};

View File

@ -25,55 +25,6 @@ const defaultPlugins = [
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-syntax-dynamic-import',
'babel-plugin-inline-json-import',
[
'module-resolver',
isESM
? {
root: ['./src'],
alias: {
coreSrc: './src',
Actions: './src/actions',
App: './src/components/App',
Collection: './src/components/Collection',
Constants: './src/constants',
Editor: './src/components/Editor',
EditorWidgets: './src/components/EditorWidgets',
Formats: './src/formats',
Integrations: './src/integrations',
Lib: './src/lib',
MediaLibrary: './src/components/MediaLibrary',
Reducers: './src/reducers',
Selectors: './src/selectors',
ReduxStore: './src/redux',
Routing: './src/routing',
UI: './src/components/UI',
Workflow: './src/components/Workflow',
ValueObjects: './src/valueObjects',
localforage: 'localforage',
redux: 'redux',
},
extensions: ['.js', '.jsx', '.es', '.es6', '.mjs', '.ts', '.tsx'],
}
: {
root: path.join(__dirname, 'packages/netlify-cms-core/src/components'),
alias: {
coreSrc: path.join(__dirname, 'packages/netlify-cms-core/src'),
Actions: path.join(__dirname, 'packages/netlify-cms-core/src/actions/'),
Constants: path.join(__dirname, 'packages/netlify-cms-core/src/constants/'),
Formats: path.join(__dirname, 'packages/netlify-cms-core/src/formats/'),
Integrations: path.join(__dirname, 'packages/netlify-cms-core/src/integrations/'),
Lib: path.join(__dirname, 'packages/netlify-cms-core/src/lib/'),
Reducers: path.join(__dirname, 'packages/netlify-cms-core/src/reducers/'),
Selectors: path.join(__dirname, 'packages/netlify-cms-core/src/selectors/'),
ReduxStore: path.join(__dirname, 'packages/netlify-cms-core/src/redux/'),
Routing: path.join(__dirname, 'packages/netlify-cms-core/src/routing/'),
ValueObjects: path.join(__dirname, 'packages/netlify-cms-core/src/valueObjects/'),
localforage: 'localforage',
redux: 'redux',
},
extensions: ['.js', '.jsx', '.es', '.es6', '.mjs', '.ts', '.tsx'],
},
],
];
const svgo = {

View File

@ -112,7 +112,6 @@
"babel-plugin-inline-json-import": "^0.3.2",
"babel-plugin-inline-react-svg": "^2.0.0",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-module-resolver": "^4.0.0",
"babel-plugin-transform-builtin-extend": "^1.1.2",
"babel-plugin-transform-define": "2.0.0",
"babel-plugin-transform-export-extensions": "^6.22.0",

View File

@ -6,7 +6,7 @@ import {
expandSearchEntries,
mergeExpandedEntries,
} from '../backend';
import registry from '../lib/registry';
import { getBackend } from '../lib/registry';
import { FOLDER, FILES } from '../constants/collectionTypes';
jest.mock('../lib/registry');
@ -18,7 +18,7 @@ describe('Backend', () => {
let backend;
beforeEach(() => {
registry.getBackend.mockReturnValue({
getBackend.mockReturnValue({
init: jest.fn(),
});
backend = resolveBackend({

View File

@ -4,7 +4,7 @@ import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { fromJS } from 'immutable';
jest.mock('coreSrc/backend');
jest.mock('../../backend');
jest.mock('../../valueObjects/AssetProxy');
jest.mock('netlify-cms-lib-util');
jest.mock('uuid/v4', () => {
@ -33,8 +33,8 @@ describe('editorialWorkflow actions', () => {
describe('loadUnpublishedEntry', () => {
it('should load unpublished entry', () => {
const { currentBackend } = require('coreSrc/backend');
const { createAssetProxy } = require('ValueObjects/AssetProxy');
const { currentBackend } = require('../../backend');
const { createAssetProxy } = require('../../valueObjects/AssetProxy');
const assetProxy = { name: 'name', path: 'path' };
const entry = { mediaFiles: [{ file: { name: 'name' }, id: '1', draft: true }] };
@ -91,7 +91,7 @@ describe('editorialWorkflow actions', () => {
describe('publishUnpublishedEntry', () => {
it('should publish unpublished entry and report success', () => {
const { currentBackend } = require('coreSrc/backend');
const { currentBackend } = require('../../backend');
const entry = {};
const backend = {
@ -176,7 +176,7 @@ describe('editorialWorkflow actions', () => {
});
it('should publish unpublished entry and report error', () => {
const { currentBackend } = require('coreSrc/backend');
const { currentBackend } = require('../../backend');
const error = new Error('failed to publish entry');
const backend = {

View File

@ -11,7 +11,7 @@ import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import AssetProxy from '../../valueObjects/AssetProxy';
jest.mock('coreSrc/backend');
jest.mock('../../backend');
jest.mock('netlify-cms-lib-util');
jest.mock('../mediaLibrary');
jest.mock('../../reducers/entries');
@ -22,7 +22,7 @@ const mockStore = configureMockStore(middlewares);
describe('entries', () => {
describe('createEmptyDraft', () => {
const { currentBackend } = require('coreSrc/backend');
const { currentBackend } = require('../../backend');
const backend = {
processEntry: jest.fn((_state, _collection, entry) => Promise.resolve(entry)),
};
@ -319,7 +319,7 @@ describe('entries', () => {
});
it('should persist local backup with media files', () => {
const { currentBackend } = require('coreSrc/backend');
const { currentBackend } = require('../../backend');
const backend = {
persistLocalDraftBackup: jest.fn(() => Promise.resolve()),
@ -351,7 +351,7 @@ describe('entries', () => {
});
it('should retrieve media files with local backup', () => {
const { currentBackend } = require('coreSrc/backend');
const { currentBackend } = require('../../backend');
const { createAssetProxy } = require('../../valueObjects/AssetProxy');
const backend = {

View File

@ -59,7 +59,7 @@ describe('mediaLibrary', () => {
});
});
const { currentBackend } = require('coreSrc/backend');
const { currentBackend } = require('../../backend');
const backend = {
persistMedia: jest.fn(() => ({ id: 'id' })),

View File

@ -1,4 +1,4 @@
import history from '../routing/history';
import { history } from '../routing/history';
import { getCollectionUrl, getNewEntryUrl } from '../lib/urlHelper';
export function searchCollections(query: string, collection: string) {

View File

@ -2,18 +2,18 @@ import React from 'react';
import { render } from 'react-dom';
import { Provider, connect } from 'react-redux';
import { Route, Router } from 'react-router-dom';
import store from 'ReduxStore';
import history from 'Routing/history';
import { loadConfig } from 'Actions/config';
import { authenticateUser } from 'Actions/auth';
import { getPhrases } from 'Lib/phrases';
import { selectLocale } from 'Reducers/config';
import { I18n } from 'react-polyglot';
import { GlobalStyles } from 'netlify-cms-ui-default';
import { ErrorBoundary } from 'UI';
import App from 'App/App';
import 'EditorWidgets';
import 'coreSrc/mediaLibrary';
import { I18n } from 'react-polyglot';
import { store } from './redux';
import { history } from './routing/history';
import { loadConfig } from './actions/config';
import { authenticateUser } from './actions/auth';
import { getPhrases } from './lib/phrases';
import { selectLocale } from './reducers/config';
import { ErrorBoundary } from './components/UI';
import App from './components/App/App';
import './components/EditorWidgets';
import './mediaLibrary';
import 'what-input';
const ROOT_ID = 'nc-root';

View File

@ -8,18 +8,18 @@ import { connect } from 'react-redux';
import { Route, Switch, Redirect } from 'react-router-dom';
import { Notifs } from 'redux-notifications';
import TopBarProgress from 'react-topbar-progress-indicator';
import { loginUser, logoutUser } from 'Actions/auth';
import { currentBackend } from 'coreSrc/backend';
import { createNewEntry } from 'Actions/collections';
import { openMediaLibrary } from 'Actions/mediaLibrary';
import MediaLibrary from 'MediaLibrary/MediaLibrary';
import { Toast } from 'UI';
import { loginUser, logoutUser } from '../../actions/auth';
import { currentBackend } from '../../backend';
import { createNewEntry } from '../../actions/collections';
import { openMediaLibrary } from '../../actions/mediaLibrary';
import MediaLibrary from '../MediaLibrary/MediaLibrary';
import { Toast } from '../UI';
import { Loader, colors } from 'netlify-cms-ui-default';
import history from 'Routing/history';
import { SIMPLE, EDITORIAL_WORKFLOW } from 'Constants/publishModes';
import Collection from 'Collection/Collection';
import Workflow from 'Workflow/Workflow';
import Editor from 'Editor/Editor';
import { history } from '../../routing/history';
import { SIMPLE, EDITORIAL_WORKFLOW } from '../../constants/publishModes';
import Collection from '../Collection/Collection';
import Workflow from '../Workflow/Workflow';
import Editor from '../Editor/Editor';
import NotFoundPage from './NotFoundPage';
import Header from './Header';

View File

@ -16,7 +16,7 @@ import {
buttons,
zIndex,
} from 'netlify-cms-ui-default';
import SettingsDropdown from 'UI/SettingsDropdown';
import { SettingsDropdown } from '../UI';
import { connect } from 'react-redux';
import { checkBackendStatus } from '../../actions/status';

View File

@ -5,7 +5,7 @@ import styled from '@emotion/styled';
import { connect } from 'react-redux';
import { translate } from 'react-polyglot';
import { lengths, components } from 'netlify-cms-ui-default';
import { getNewEntryUrl } from 'Lib/urlHelper';
import { getNewEntryUrl } from '../../lib/urlHelper';
import Sidebar from './Sidebar';
import CollectionTop from './CollectionTop';
import EntriesCollection from './Entries/EntriesCollection';

View File

@ -10,14 +10,14 @@ import { colors } from 'netlify-cms-ui-default';
import {
loadEntries as actionLoadEntries,
traverseCollectionCursor as actionTraverseCollectionCursor,
} from 'Actions/entries';
} from '../../../actions/entries';
import {
selectEntries,
selectEntriesLoaded,
selectIsFetching,
selectGroups,
} from '../../../reducers/entries';
import { selectCollectionEntriesCursor } from 'Reducers/cursors';
import { selectCollectionEntriesCursor } from '../../../reducers/cursors';
import Entries from './Entries';
const GroupHeading = styled.h2`

View File

@ -4,11 +4,11 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import { isEqual } from 'lodash';
import { Cursor } from 'netlify-cms-lib-util';
import { selectSearchedEntries } from 'Reducers';
import { selectSearchedEntries } from '../../../reducers';
import {
searchEntries as actionSearchEntries,
clearSearch as actionClearSearch,
} from 'Actions/search';
} from '../../../actions/search';
import Entries from './Entries';
class EntriesSearch extends React.Component {

View File

@ -1,12 +1,12 @@
import React from 'react';
import styled from '@emotion/styled';
import { connect } from 'react-redux';
import { boundGetAsset } from 'Actions/media';
import { boundGetAsset } from '../../../actions/media';
import { Link } from 'react-router-dom';
import { colors, colorsRaw, components, lengths, zIndex } from 'netlify-cms-ui-default';
import { VIEW_STYLE_LIST, VIEW_STYLE_GRID } from 'Constants/collectionViews';
import { selectIsLoadingAsset } from 'Reducers/medias';
import { selectEntryCollectionTitle } from 'Reducers/collections';
import { VIEW_STYLE_LIST, VIEW_STYLE_GRID } from '../../../constants/collectionViews';
import { selectIsLoadingAsset } from '../../../reducers/medias';
import { selectEntryCollectionTitle } from '../../../reducers/collections';
const ListCard = styled.li`
${components.card};

View File

@ -4,7 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import styled from '@emotion/styled';
import { Waypoint } from 'react-waypoint';
import { Map } from 'immutable';
import { selectFields, selectInferedField } from 'Reducers/collections';
import { selectFields, selectInferedField } from '../../../reducers/collections';
import EntryCard from './EntryCard';
const CardsGrid = styled.ul`

View File

@ -6,7 +6,7 @@ import { css } from '@emotion/core';
import { translate } from 'react-polyglot';
import { NavLink } from 'react-router-dom';
import { Icon, components, colors } from 'netlify-cms-ui-default';
import { searchCollections } from 'Actions/collections';
import { searchCollections } from '../../actions/collections';
import CollectionSearch from './CollectionSearch';
import NestedCollection from './NestedCollection';

View File

@ -1,7 +1,7 @@
import React from 'react';
import styled from '@emotion/styled';
import { Icon, buttons, colors } from 'netlify-cms-ui-default';
import { VIEW_STYLE_LIST, VIEW_STYLE_GRID } from 'Constants/collectionViews';
import { VIEW_STYLE_LIST, VIEW_STYLE_GRID } from '../../constants/collectionViews';
const ViewControlsSection = styled.div`
display: flex;

View File

@ -14,7 +14,7 @@ jest.mock('netlify-cms-ui-default', () => {
jest.mock('../NestedCollection', () => 'nested-collection');
jest.mock('../CollectionSearch', () => 'collection-search');
jest.mock('Actions/collections');
jest.mock('../../../actions/collections');
describe('Sidebar', () => {
const props = {

View File

@ -5,8 +5,8 @@ import { connect } from 'react-redux';
import { Loader } from 'netlify-cms-ui-default';
import { translate } from 'react-polyglot';
import { debounce } from 'lodash';
import history from 'Routing/history';
import { logoutUser } from 'Actions/auth';
import { history, navigateToCollection, navigateToNewEntry } from '../../routing/history';
import { logoutUser } from '../../actions/auth';
import {
loadEntry,
loadEntries,
@ -21,20 +21,19 @@ import {
loadLocalBackup,
retrieveLocalBackup,
deleteLocalBackup,
} from 'Actions/entries';
} from '../../actions/entries';
import {
updateUnpublishedEntryStatus,
publishUnpublishedEntry,
unpublishPublishedEntry,
deleteUnpublishedEntry,
} from 'Actions/editorialWorkflow';
import { loadDeployPreview } from 'Actions/deploys';
import { selectEntry, selectUnpublishedEntry, selectDeployPreview } from 'Reducers';
import { selectFields } from 'Reducers/collections';
import { status, EDITORIAL_WORKFLOW } from 'Constants/publishModes';
} from '../../actions/editorialWorkflow';
import { loadDeployPreview } from '../../actions/deploys';
import { selectEntry, selectUnpublishedEntry, selectDeployPreview } from '../../reducers';
import { selectFields } from '../../reducers/collections';
import { status, EDITORIAL_WORKFLOW } from '../../constants/publishModes';
import EditorInterface from './EditorInterface';
import withWorkflow from './withWorkflow';
import { navigateToCollection, navigateToNewEntry } from '../../routing/history';
export class Editor extends React.Component {
static propTypes = {

View File

@ -8,20 +8,19 @@ import styled from '@emotion/styled';
import { partial, uniqueId } from 'lodash';
import { connect } from 'react-redux';
import { FieldLabel, colors, transitions, lengths, borders } from 'netlify-cms-ui-default';
import { resolveWidget, getEditorComponents } from 'Lib/registry';
import { clearFieldErrors, tryLoadEntry } from 'Actions/entries';
import { addAsset, boundGetAsset } from 'Actions/media';
import { selectIsLoadingAsset } from 'Reducers/medias';
import { query, clearSearch } from 'Actions/search';
import { resolveWidget, getEditorComponents } from '../../../lib/registry';
import { clearFieldErrors, tryLoadEntry, validateMetaField } from '../../../actions/entries';
import { addAsset, boundGetAsset } from '../../../actions/media';
import { selectIsLoadingAsset } from '../../../reducers/medias';
import { query, clearSearch } from '../../../actions/search';
import {
openMediaLibrary,
removeInsertedMedia,
clearMediaControl,
removeMediaControl,
persistMedia,
} from 'Actions/mediaLibrary';
} from '../../../actions/mediaLibrary';
import Widget from './Widget';
import { validateMetaField } from '../../../actions/entries';
/**
* This is a necessary bridge as we are still passing classnames to widgets

View File

@ -3,7 +3,7 @@ import React, { Component } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { Map, List } from 'immutable';
import { oneLine } from 'common-tags';
import ValidationErrorTypes from 'Constants/validationErrorTypes';
import ValidationErrorTypes from '../../../constants/validationErrorTypes';
function truthy() {
return { error: false };

View File

@ -5,13 +5,13 @@ import { List, Map } from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Frame, { FrameContextConsumer } from 'react-frame-component';
import { lengths } from 'netlify-cms-ui-default';
import { resolveWidget, getPreviewTemplate, getPreviewStyles } from 'Lib/registry';
import { ErrorBoundary } from 'UI';
import { selectTemplateName, selectInferedField, selectField } from 'Reducers/collections';
import { resolveWidget, getPreviewTemplate, getPreviewStyles } from '../../../lib/registry';
import { ErrorBoundary } from '../../UI';
import { selectTemplateName, selectInferedField, selectField } from '../../../reducers/collections';
import { connect } from 'react-redux';
import { boundGetAsset } from 'Actions/media';
import { selectIsLoadingAsset } from 'Reducers/medias';
import { INFERABLE_FIELDS } from 'Constants/fieldInference';
import { boundGetAsset } from '../../../actions/media';
import { selectIsLoadingAsset } from '../../../reducers/medias';
import { INFERABLE_FIELDS } from '../../../constants/fieldInference';
import EditorPreviewContent from './EditorPreviewContent.js';
import PreviewHOC from './PreviewHOC';
import EditorPreview from './EditorPreview';

View File

@ -16,8 +16,8 @@ import {
buttons,
zIndex,
} from 'netlify-cms-ui-default';
import { status } from 'Constants/publishModes';
import SettingsDropdown from 'UI/SettingsDropdown';
import { status } from '../../constants/publishModes';
import { SettingsDropdown } from '../UI';
const styles = {
noOverflow: css`

View File

@ -18,7 +18,7 @@ jest.mock('netlify-cms-ui-default', () => {
Loader: props => <mock-loader {...props} />,
};
});
jest.mock('Routing/history');
jest.mock('../../../routing/history');
describe('Editor', () => {
const props = {

View File

@ -1,9 +1,9 @@
import React from 'react';
import { connect } from 'react-redux';
import { EDITORIAL_WORKFLOW } from 'Constants/publishModes';
import { selectUnpublishedEntry } from 'Reducers';
import { selectAllowDeletion } from 'Reducers/collections';
import { loadUnpublishedEntry, persistUnpublishedEntry } from 'Actions/editorialWorkflow';
import { EDITORIAL_WORKFLOW } from '../../constants/publishModes';
import { selectUnpublishedEntry } from '../../reducers';
import { selectAllowDeletion } from '../../reducers/collections';
import { loadUnpublishedEntry, persistUnpublishedEntry } from '../../actions/editorialWorkflow';
function mapStateToProps(state, ownProps) {
const { collections } = state;

View File

@ -1,4 +1,4 @@
import { registerWidget } from 'Lib/registry';
import { registerWidget } from '../../lib/registry';
import UnknownControl from './Unknown/UnknownControl';
import UnknownPreview from './Unknown/UnknownPreview';

View File

@ -13,8 +13,8 @@ import {
insertMedia as insertMediaAction,
loadMediaDisplayURL as loadMediaDisplayURLAction,
closeMediaLibrary as closeMediaLibraryAction,
} from 'Actions/mediaLibrary';
import { selectMediaFiles } from 'Reducers/mediaLibrary';
} from '../../actions/mediaLibrary';
import { selectMediaFiles } from '../../reducers/mediaLibrary';
import MediaLibraryModal, { fileShape } from './MediaLibraryModal';
/**

View File

@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@emotion/core';
import styled from '@emotion/styled';
import { FileUploadButton } from 'UI';
import { FileUploadButton } from '../UI';
import copyToClipboard from 'copy-text-to-clipboard';
import { isAbsolutePath } from 'netlify-cms-lib-util';
import { buttons, shadows, zIndex } from 'netlify-cms-ui-default';

View File

@ -4,7 +4,7 @@ import styled from '@emotion/styled';
import { Map } from 'immutable';
import { isEmpty } from 'lodash';
import { translate } from 'react-polyglot';
import { Modal } from 'UI';
import { Modal } from '../UI';
import MediaLibraryTop from './MediaLibraryTop';
import MediaLibraryCardGrid from './MediaLibraryCardGrid';
import EmptyMessage from './EmptyMessage';

View File

@ -4,7 +4,7 @@ import { css } from '@emotion/core';
import styled from '@emotion/styled';
import { translate } from 'react-polyglot';
import { Icon, Dropdown, DropdownItem, DropdownButton, colors } from 'netlify-cms-ui-default';
import { stripProtocol } from 'Lib/urlHelper';
import { stripProtocol } from '../../lib/urlHelper';
const styles = {
avatarImage: css`

View File

@ -3,3 +3,4 @@ export { default as ErrorBoundary } from './ErrorBoundary';
export { FileUploadButton } from './FileUploadButton';
export { Modal } from './Modal';
export { default as Toast } from './Toast';
export { default as SettingsDropdown } from './SettingsDropdown';

View File

@ -14,15 +14,15 @@ import {
components,
shadows,
} from 'netlify-cms-ui-default';
import { createNewEntry } from 'Actions/collections';
import { createNewEntry } from '../../actions/collections';
import {
loadUnpublishedEntries,
updateUnpublishedEntryStatus,
publishUnpublishedEntry,
deleteUnpublishedEntry,
} from 'Actions/editorialWorkflow';
import { selectUnpublishedEntriesByStatus } from 'Reducers';
import { EDITORIAL_WORKFLOW, status } from 'Constants/publishModes';
} from '../../actions/editorialWorkflow';
import { selectUnpublishedEntriesByStatus } from '../../reducers';
import { EDITORIAL_WORKFLOW, status } from '../../constants/publishModes';
import WorkflowList from './WorkflowList';
const WorkflowContainer = styled.div`

View File

@ -6,10 +6,10 @@ import styled from '@emotion/styled';
import moment from 'moment';
import { translate } from 'react-polyglot';
import { colors, lengths } from 'netlify-cms-ui-default';
import { status } from 'Constants/publishModes';
import { DragSource, DropTarget, HTML5DragDrop } from 'UI';
import { status } from '../../constants/publishModes';
import { DragSource, DropTarget, HTML5DragDrop } from '../UI';
import WorkflowCard from './WorkflowCard';
import { selectEntryCollectionTitle } from 'Reducers/collections';
import { selectEntryCollectionTitle } from '../../reducers/collections';
const WorkflowListContainer = styled.div`
min-height: 60%;

View File

@ -6,8 +6,8 @@ import {
prohibited,
} from 'ajv-keywords/dist/keywords';
import ajvErrors from 'ajv-errors';
import { formatExtensions, frontmatterFormats, extensionFormatters } from 'Formats/formats';
import { getWidgets } from 'Lib/registry';
import { formatExtensions, frontmatterFormats, extensionFormatters } from '../formats/formats';
import { getWidgets } from '../lib/registry';
import uuid from 'uuid/v4';
import { I18N_STRUCTURE, I18N_FIELD } from '../lib/i18n';

View File

@ -1,5 +1,5 @@
import bootstrap from './bootstrap';
import Registry from 'Lib/registry';
import Registry from './lib/registry';
export const NetlifyCmsCore = {
...Registry,

View File

@ -1,6 +1,6 @@
import _ from 'lodash';
import { createEntry } from 'ValueObjects/Entry';
import { selectEntrySlug } from 'Reducers/collections';
import { createEntry } from '../../../valueObjects/Entry';
import { selectEntrySlug } from '../../../reducers/collections';
import { unsentRequest } from 'netlify-cms-lib-util';
const { fetchWithTimeout: fetch } = unsentRequest;

View File

@ -1,5 +1,5 @@
import { pickBy, trimEnd } from 'lodash';
import { addParams } from 'Lib/urlHelper';
import { addParams } from '../../../lib/urlHelper';
import { unsentRequest } from 'netlify-cms-lib-util';
const { fetchWithTimeout: fetch } = unsentRequest;

View File

@ -1,7 +1,7 @@
import { Map } from 'immutable';
import produce from 'immer';
import { oneLine } from 'common-tags';
import EditorComponent from 'ValueObjects/EditorComponent';
import EditorComponent from '../valueObjects/EditorComponent';
const allowedEvents = [
'prePublish',

View File

@ -4,7 +4,7 @@
*/
import { once } from 'lodash';
import { getMediaLibrary } from './lib/registry';
import store from './redux';
import { store } from './redux';
import { configFailed } from './actions/config';
import { createMediaLibrary, insertMedia } from './actions/mediaLibrary';
import { MediaLibraryInstance } from './types/redux';

View File

@ -1,5 +1,5 @@
import { Map, fromJS } from 'immutable';
import * as actions from 'Actions/entries';
import * as actions from '../../actions/entries';
import reducer from '../entryDraft';
jest.mock('uuid/v4', () => jest.fn(() => '1'));

View File

@ -1,5 +1,5 @@
import { Map, fromJS } from 'immutable';
import { mediaDeleted } from 'Actions/mediaLibrary';
import { mediaDeleted } from '../../actions/mediaLibrary';
import mediaLibrary, {
selectMediaFiles,
selectMediaFileByPath,
@ -7,8 +7,8 @@ import mediaLibrary, {
} from '../mediaLibrary';
jest.mock('uuid/v4');
jest.mock('Reducers/entries');
jest.mock('Reducers');
jest.mock('../entries');
jest.mock('../');
describe('mediaLibrary', () => {
it('should remove media file by key', () => {
@ -44,7 +44,7 @@ describe('mediaLibrary', () => {
});
it('should select draft media files from field when editing a draft', () => {
const { selectEditingDraft, selectMediaFolder } = require('Reducers/entries');
const { selectEditingDraft, selectMediaFolder } = require('../../reducers/entries');
selectEditingDraft.mockReturnValue(true);
selectMediaFolder.mockReturnValue('/static/images/posts/logos');
@ -76,7 +76,7 @@ describe('mediaLibrary', () => {
});
it('should select draft media files from collection when editing a draft', () => {
const { selectEditingDraft, selectMediaFolder } = require('Reducers/entries');
const { selectEditingDraft, selectMediaFolder } = require('../../reducers/entries');
selectEditingDraft.mockReturnValue(true);
selectMediaFolder.mockReturnValue('/static/images/posts');
@ -108,7 +108,7 @@ describe('mediaLibrary', () => {
});
it('should select global media files when not editing a draft', () => {
const { selectEditingDraft } = require('Reducers/entries');
const { selectEditingDraft } = require('../../reducers/entries');
selectEditingDraft.mockReturnValue(false);
@ -120,7 +120,7 @@ describe('mediaLibrary', () => {
});
it('should select global media files when not using asset store integration', () => {
const { selectIntegration } = require('Reducers');
const { selectIntegration } = require('../../reducers');
selectIntegration.mockReturnValue({});
@ -132,7 +132,7 @@ describe('mediaLibrary', () => {
});
it('should return media file by path', () => {
const { selectEditingDraft } = require('Reducers/entries');
const { selectEditingDraft } = require('../../reducers/entries');
selectEditingDraft.mockReturnValue(false);

View File

@ -5,7 +5,7 @@ import {
SORT_ENTRIES_SUCCESS,
FILTER_ENTRIES_SUCCESS,
GROUP_ENTRIES_SUCCESS,
} from 'Actions/entries';
} from '../actions/entries';
// Since pagination can be used for a variety of views (collections
// and searches are the most common examples), we namespace cursors by

View File

@ -16,12 +16,12 @@ import {
ENTRY_DELETE_SUCCESS,
ADD_DRAFT_ENTRY_MEDIA_FILE,
REMOVE_DRAFT_ENTRY_MEDIA_FILE,
} from 'Actions/entries';
} from '../actions/entries';
import {
UNPUBLISHED_ENTRY_PERSIST_REQUEST,
UNPUBLISHED_ENTRY_PERSIST_SUCCESS,
UNPUBLISHED_ENTRY_PERSIST_FAILURE,
} from 'Actions/editorialWorkflow';
} from '../actions/editorialWorkflow';
import { get } from 'lodash';
import { selectFolderEntryExtension, selectHasMetaPath } from './collections';
import { join } from 'path';

View File

@ -11,4 +11,4 @@ const store = createStore<State | undefined, AnyAction, unknown, unknown>(
composeWithDevTools(applyMiddleware(thunkMiddleware as ThunkMiddleware<State>, waitUntilAction)),
);
export default store;
export { store };

View File

@ -14,4 +14,4 @@ export function navigateToEntry(collectionName: string, slug: string) {
return history.replace(`/collections/${collectionName}/entries/${slug}`);
}
export default history;
export { history };

View File

@ -4916,17 +4916,6 @@ babel-plugin-minify-type-constructors@^0.4.3:
dependencies:
babel-helper-is-void-0 "^0.4.3"
babel-plugin-module-resolver@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-4.1.0.tgz#22a4f32f7441727ec1fbf4967b863e1e3e9f33e2"
integrity sha512-MlX10UDheRr3lb3P0WcaIdtCSRlxdQsB1sBqL7W0raF070bGl1HQQq5K3T2vf2XAYie+ww+5AKC/WrkjRO2knA==
dependencies:
find-babel-config "^1.2.0"
glob "^7.1.6"
pkg-up "^3.1.0"
reselect "^4.0.0"
resolve "^1.13.1"
babel-plugin-named-asset-import@^0.3.1:
version "0.3.7"
resolved "https://registry.yarnpkg.com/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.7.tgz#156cd55d3f1228a5765774340937afc8398067dd"
@ -8609,14 +8598,6 @@ finalhandler@~1.1.2:
statuses "~1.5.0"
unpipe "~1.0.0"
find-babel-config@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/find-babel-config/-/find-babel-config-1.2.0.tgz#a9b7b317eb5b9860cda9d54740a8c8337a2283a2"
integrity sha512-jB2CHJeqy6a820ssiqwrKMeyC6nNdmrcgkKWJWmpoxpE8RKciYJXCcXRq1h2AzCo5I5BJeN2tkGEO3hLTuePRA==
dependencies:
json5 "^0.5.1"
path-exists "^3.0.0"
find-cache-dir@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7"
@ -11487,11 +11468,6 @@ json5@2.x, json5@^2.1.1, json5@^2.1.2:
dependencies:
minimist "^1.2.5"
json5@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=
json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
@ -14080,13 +14056,6 @@ pkg-up@2.0.0, pkg-up@^2.0.0:
dependencies:
find-up "^2.1.0"
pkg-up@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-3.1.0.tgz#100ec235cc150e4fd42519412596a28512a0def5"
integrity sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==
dependencies:
find-up "^3.0.0"
platform@1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.3.tgz#646c77011899870b6a0903e75e997e8e51da7461"
@ -15716,11 +15685,6 @@ requires-port@^1.0.0:
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=
reselect@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.0.0.tgz#f2529830e5d3d0e021408b246a206ef4ea4437f7"
integrity sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA==
resize-observer-polyfill@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464"