chore: introduce imports ordering (#5463)

This commit is contained in:
Vladislav Shkodin 2021-05-31 16:46:41 +02:00 committed by GitHub
parent 30f0e7b031
commit dbf2920254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
212 changed files with 570 additions and 342 deletions

View File

@ -31,6 +31,13 @@ module.exports = {
'no-console': [0],
'react/prop-types': [0],
'import/no-named-as-default': 0,
'import/order': [
'error',
{
'newlines-between': 'always',
groups: [['builtin', 'external'], ['internal', 'parent', 'sibling', 'index'], ['type']],
},
],
'no-duplicate-imports': 'error',
'@emotion/no-vanilla': 'error',
'@emotion/import-from-emotion': 'error',

View File

@ -1,6 +1,5 @@
// Core
import { NetlifyCmsCore as CMS } from 'netlify-cms-core';
// Backends
import { AzureBackend } from 'netlify-cms-backend-azure';
import { GitHubBackend } from 'netlify-cms-backend-github';
@ -9,7 +8,6 @@ import { GitGatewayBackend } from 'netlify-cms-backend-git-gateway';
import { BitbucketBackend } from 'netlify-cms-backend-bitbucket';
import { TestBackend } from 'netlify-cms-backend-test';
import { ProxyBackend } from 'netlify-cms-backend-proxy';
// Widgets
import NetlifyCmsWidgetString from 'netlify-cms-widget-string';
import NetlifyCmsWidgetNumber from 'netlify-cms-widget-number';
@ -27,10 +25,8 @@ import NetlifyCmsWidgetDate from 'netlify-cms-widget-date';
import NetlifyCmsWidgetDatetime from 'netlify-cms-widget-datetime';
import NetlifyCmsWidgetCode from 'netlify-cms-widget-code';
import NetlifyCmsWidgetColorString from 'netlify-cms-widget-colorstring';
// Editor Components
import image from 'netlify-cms-editor-component-image';
// Locales
import * as locales from 'netlify-cms-locales';

View File

@ -1,4 +1,5 @@
const webpack = require('webpack');
const pkg = require('./package.json');
const { getConfig, plugins } = require('../../scripts/webpack');
const baseWebpackConfig = getConfig({ baseOnly: true });

View File

@ -1,6 +1,5 @@
import { Base64 } from 'js-base64';
import { partial, result, trim, trimStart } from 'lodash';
import type { ApiRequest, AssetProxy, PersistOptions, DataFile } from 'netlify-cms-lib-util';
import {
localForage,
APIError,
@ -20,9 +19,11 @@ import {
readFileMetadata,
branchFromContentKey,
} from 'netlify-cms-lib-util';
import type { Map } from 'immutable';
import { dirname, basename } from 'path';
import type { ApiRequest, AssetProxy, PersistOptions, DataFile } from 'netlify-cms-lib-util';
import type { Map } from 'immutable';
export const API_NAME = 'Azure DevOps';
const API_VERSION = 'api-version';

View File

@ -1,22 +1,5 @@
import { trimStart, trim } from 'lodash';
import type { Semaphore } from 'semaphore';
import semaphore from 'semaphore';
import AuthenticationPage from './AuthenticationPage';
import API, { API_NAME } from './API';
import type {
Credentials,
Implementation,
ImplementationFile,
ImplementationMediaFile,
DisplayURL,
Entry,
AssetProxy,
PersistOptions,
Config,
AsyncLock,
User,
UnpublishedEntryMediaFile,
} from 'netlify-cms-lib-util';
import {
basename,
getMediaDisplayURL,
@ -34,6 +17,25 @@ import {
getBlobSHA,
} from 'netlify-cms-lib-util';
import AuthenticationPage from './AuthenticationPage';
import API, { API_NAME } from './API';
import type { Semaphore } from 'semaphore';
import type {
Credentials,
Implementation,
ImplementationFile,
ImplementationMediaFile,
DisplayURL,
Entry,
AssetProxy,
PersistOptions,
Config,
AsyncLock,
User,
UnpublishedEntryMediaFile,
} from 'netlify-cms-lib-util';
const MAX_CONCURRENT_DOWNLOADS = 10;
function parseAzureRepo(config: Config) {

View File

@ -1,11 +1,4 @@
import { flow, get } from 'lodash';
import type {
ApiRequest,
AssetProxy,
PersistOptions,
FetchError,
DataFile,
} from 'netlify-cms-lib-util';
import {
localForage,
unsentRequest,
@ -34,6 +27,14 @@ import { dirname } from 'path';
import { oneLine } from 'common-tags';
import { parse } from 'what-the-diff';
import type {
ApiRequest,
AssetProxy,
PersistOptions,
FetchError,
DataFile,
} from 'netlify-cms-lib-util';
interface Config {
apiRoot?: string;
token?: string;

View File

@ -1,7 +1,8 @@
import minimatch from 'minimatch';
import type { ApiRequest, PointerFile } from 'netlify-cms-lib-util';
import { unsentRequest } from 'netlify-cms-lib-util';
import type { ApiRequest, PointerFile } from 'netlify-cms-lib-util';
type MakeAuthorizedRequest = (req: ApiRequest) => Promise<Response>;
interface LfsBatchAction {

View File

@ -1,22 +1,6 @@
import type { Semaphore } from 'semaphore';
import semaphore from 'semaphore';
import { trimStart } from 'lodash';
import { stripIndent } from 'common-tags';
import type {
Entry,
ApiRequest,
Cursor,
AssetProxy,
PersistOptions,
DisplayURL,
Implementation,
User,
Credentials,
Config,
ImplementationFile,
AsyncLock,
FetchError,
} from 'netlify-cms-lib-util';
import {
CURSOR_COMPATIBILITY_SYMBOL,
filterByExtension,
@ -43,10 +27,28 @@ import {
branchFromContentKey,
} from 'netlify-cms-lib-util';
import { NetlifyAuthenticator } from 'netlify-cms-lib-auth';
import AuthenticationPage from './AuthenticationPage';
import API, { API_NAME } from './API';
import { GitLfsClient } from './git-lfs-client';
import type {
Entry,
ApiRequest,
Cursor,
AssetProxy,
PersistOptions,
DisplayURL,
Implementation,
User,
Credentials,
Config,
ImplementationFile,
AsyncLock,
FetchError,
} from 'netlify-cms-lib-util';
import type { Semaphore } from 'semaphore';
const MAX_CONCURRENT_DOWNLOADS = 10;
const STATUS_PAGE = 'https://bitbucket.status.atlassian.com';

View File

@ -1,7 +1,8 @@
import { API as GithubAPI } from 'netlify-cms-backend-github';
import { APIError } from 'netlify-cms-lib-util';
import type { Config as GitHubConfig, Diff } from 'netlify-cms-backend-github/src/API';
import type { FetchError } from 'netlify-cms-lib-util';
import { APIError } from 'netlify-cms-lib-util';
import type { Octokit } from '@octokit/rest';
type Config = GitHubConfig & {

View File

@ -1,7 +1,8 @@
import { API as GitlabAPI } from 'netlify-cms-backend-gitlab';
import { unsentRequest } from 'netlify-cms-lib-util';
import type { Config as GitHubConfig, CommitAuthor } from 'netlify-cms-backend-gitlab/src/API';
import type { ApiRequest } from 'netlify-cms-lib-util';
import { unsentRequest } from 'netlify-cms-lib-util';
type Config = GitHubConfig & { tokenPromise: () => Promise<string>; commitAuthor: CommitAuthor };

View File

@ -2,20 +2,6 @@ import GoTrue from 'gotrue-js';
import jwtDecode from 'jwt-decode';
import { get, pick, intersection } from 'lodash';
import ini from 'ini';
import type {
ApiRequest,
AssetProxy,
PersistOptions,
Entry,
Cursor,
Implementation,
DisplayURL,
User,
Credentials,
Config,
ImplementationFile,
DisplayURLObject,
} from 'netlify-cms-lib-util';
import {
APIError,
unsentRequest,
@ -31,12 +17,28 @@ import {
import { GitHubBackend } from 'netlify-cms-backend-github';
import { GitLabBackend } from 'netlify-cms-backend-gitlab';
import { BitbucketBackend, API as BitBucketAPI } from 'netlify-cms-backend-bitbucket';
import GitHubAPI from './GitHubAPI';
import GitLabAPI from './GitLabAPI';
import AuthenticationPage from './AuthenticationPage';
import type { Client } from './netlify-lfs-client';
import { getClient } from './netlify-lfs-client';
import type { Client } from './netlify-lfs-client';
import type {
ApiRequest,
AssetProxy,
PersistOptions,
Entry,
Cursor,
Implementation,
DisplayURL,
User,
Credentials,
Config,
ImplementationFile,
DisplayURLObject,
} from 'netlify-cms-lib-util';
const STATUS_PAGE = 'https://www.netlifystatus.com';
const GIT_GATEWAY_STATUS_ENDPOINT = `${STATUS_PAGE}/api/v2/components.json`;
const GIT_GATEWAY_OPERATIONAL_UNITS = ['Git Gateway'];

View File

@ -1,9 +1,10 @@
import { flow, fromPairs, map } from 'lodash/fp';
import { isPlainObject, isEmpty } from 'lodash';
import minimatch from 'minimatch';
import type { ApiRequest, PointerFile } from 'netlify-cms-lib-util';
import { unsentRequest } from 'netlify-cms-lib-util';
import type { ApiRequest, PointerFile } from 'netlify-cms-lib-util';
type MakeAuthorizedRequest = (req: ApiRequest) => Promise<Response>;
type ImageTransformations = { nf_resize: string; w: number; h: number };

View File

@ -1,15 +1,7 @@
import { Base64 } from 'js-base64';
import type { Semaphore } from 'semaphore';
import semaphore from 'semaphore';
import { initial, last, partial, result, trimStart, trim } from 'lodash';
import { oneLine } from 'common-tags';
import type {
AssetProxy,
DataFile,
PersistOptions,
FetchError,
ApiRequest,
} from 'netlify-cms-lib-util';
import {
getAllResponses,
APIError,
@ -33,6 +25,15 @@ import {
throwOnConflictingBranches,
} from 'netlify-cms-lib-util';
import { dirname } from 'path';
import type {
AssetProxy,
DataFile,
PersistOptions,
FetchError,
ApiRequest,
} from 'netlify-cms-lib-util';
import type { Semaphore } from 'semaphore';
import type { Octokit } from '@octokit/rest';
type GitHubUser = Octokit.UsersGetAuthenticatedResponse;

View File

@ -1,6 +1,4 @@
import type { QueryOptions, MutationOptions, OperationVariables } from 'apollo-client';
import { ApolloClient } from 'apollo-client';
import type { NormalizedCacheObject } from 'apollo-cache-inmemory';
import {
InMemoryCache,
defaultDataIdFromObject,
@ -18,11 +16,15 @@ import {
throwOnConflictingBranches,
} from 'netlify-cms-lib-util';
import { trim, trimStart } from 'lodash';
import introspectionQueryResultData from './fragmentTypes';
import type { Config, BlobArgs } from './API';
import API, { API_NAME, PullRequestState, MOCK_PULL_REQUEST } from './API';
import * as queries from './queries';
import * as mutations from './mutations';
import type { Config, BlobArgs } from './API';
import type { NormalizedCacheObject } from 'apollo-cache-inmemory';
import type { QueryOptions, MutationOptions, OperationVariables } from 'apollo-client';
import type { GraphQLError } from 'graphql';
import type { Octokit } from '@octokit/rest';

View File

@ -1,4 +1,5 @@
import { Base64 } from 'js-base64';
import API from '../API';
global.fetch = jest.fn().mockRejectedValue(new Error('should not call fetch inside tests'));

View File

@ -1,6 +1,7 @@
import GitHubImplementation from '../implementation';
import { Cursor, CURSOR_COMPATIBILITY_SYMBOL } from 'netlify-cms-lib-util';
import GitHubImplementation from '../implementation';
jest.spyOn(console, 'error').mockImplementation(() => {});
describe('github backend implementation', () => {

View File

@ -1,21 +1,7 @@
import * as React from 'react';
import type { Semaphore } from 'semaphore';
import semaphore from 'semaphore';
import trimStart from 'lodash/trimStart';
import { stripIndent } from 'common-tags';
import type {
AsyncLock,
Implementation,
AssetProxy,
PersistOptions,
DisplayURL,
User,
Credentials,
Config,
ImplementationFile,
UnpublishedEntryMediaFile,
Entry,
} from 'netlify-cms-lib-util';
import {
CURSOR_COMPATIBILITY_SYMBOL,
Cursor,
@ -35,11 +21,27 @@ import {
unsentRequest,
branchFromContentKey,
} from 'netlify-cms-lib-util';
import AuthenticationPage from './AuthenticationPage';
import type { Octokit } from '@octokit/rest';
import API, { API_NAME } from './API';
import GraphQLAPI from './GraphQLAPI';
import type { Octokit } from '@octokit/rest';
import type {
AsyncLock,
Implementation,
AssetProxy,
PersistOptions,
DisplayURL,
User,
Credentials,
Config,
ImplementationFile,
UnpublishedEntryMediaFile,
Entry,
} from 'netlify-cms-lib-util';
import type { Semaphore } from 'semaphore';
type GitHubUser = Octokit.UsersGetAuthenticatedResponse;
const MAX_CONCURRENT_DOWNLOADS = 10;

View File

@ -1,4 +1,5 @@
import { gql } from 'graphql-tag';
import * as fragments from './fragments';
// updateRef only works for branches at the moment

View File

@ -1,5 +1,6 @@
import { gql } from 'graphql-tag';
import { oneLine } from 'common-tags';
import * as fragments from './fragments';
export const repoPermission = gql`

View File

@ -1,10 +1,3 @@
import type {
ApiRequest,
DataFile,
AssetProxy,
PersistOptions,
FetchError,
} from 'netlify-cms-lib-util';
import {
localForage,
parseLinkHeader,
@ -34,6 +27,14 @@ import { Map } from 'immutable';
import { flow, partial, result, trimStart } from 'lodash';
import { dirname } from 'path';
import type {
ApiRequest,
DataFile,
AssetProxy,
PersistOptions,
FetchError,
} from 'netlify-cms-lib-util';
export const API_NAME = 'GitLab';
export interface Config {

View File

@ -3,6 +3,7 @@ import { fromJS } from 'immutable';
import { oneLine, stripIndent } from 'common-tags';
import nock from 'nock';
import { Cursor } from 'netlify-cms-lib-util';
import Gitlab from '../implementation';
import AuthenticationPage from '../AuthenticationPage';

View File

@ -1,22 +1,7 @@
import trimStart from 'lodash/trimStart';
import type { Semaphore } from 'semaphore';
import semaphore from 'semaphore';
import { trim } from 'lodash';
import { stripIndent } from 'common-tags';
import type {
Entry,
AssetProxy,
PersistOptions,
Cursor,
Implementation,
DisplayURL,
User,
Credentials,
Config,
ImplementationFile,
UnpublishedEntryMediaFile,
AsyncLock,
} from 'netlify-cms-lib-util';
import {
CURSOR_COMPATIBILITY_SYMBOL,
basename,
@ -37,9 +22,26 @@ import {
filterByExtension,
branchFromContentKey,
} from 'netlify-cms-lib-util';
import AuthenticationPage from './AuthenticationPage';
import API, { API_NAME } from './API';
import type {
Entry,
AssetProxy,
PersistOptions,
Cursor,
Implementation,
DisplayURL,
User,
Credentials,
Config,
ImplementationFile,
UnpublishedEntryMediaFile,
AsyncLock,
} from 'netlify-cms-lib-util';
import type { Semaphore } from 'semaphore';
const MAX_CONCURRENT_DOWNLOADS = 10;
export default class GitLab implements Implementation {

View File

@ -1,3 +1,12 @@
import {
EditorialWorkflowError,
APIError,
unsentRequest,
blobToFileObj,
} from 'netlify-cms-lib-util';
import AuthenticationPage from './AuthenticationPage';
import type {
Entry,
AssetProxy,
@ -8,13 +17,6 @@ import type {
ImplementationFile,
UnpublishedEntry,
} from 'netlify-cms-lib-util';
import {
EditorialWorkflowError,
APIError,
unsentRequest,
blobToFileObj,
} from 'netlify-cms-lib-util';
import AuthenticationPage from './AuthenticationPage';
async function serializeAsset(assetProxy: AssetProxy) {
const base64content = await assetProxy.toBase64!();

View File

@ -1,5 +1,15 @@
import { attempt, isError, take, unset, isEmpty } from 'lodash';
import uuid from 'uuid/v4';
import {
EditorialWorkflowError,
Cursor,
CURSOR_COMPATIBILITY_SYMBOL,
basename,
} from 'netlify-cms-lib-util';
import { extname, dirname } from 'path';
import AuthenticationPage from './AuthenticationPage';
import type {
Implementation,
Entry,
@ -11,14 +21,6 @@ import type {
ImplementationFile,
DataFile,
} from 'netlify-cms-lib-util';
import {
EditorialWorkflowError,
Cursor,
CURSOR_COMPATIBILITY_SYMBOL,
basename,
} from 'netlify-cms-lib-util';
import { extname, dirname } from 'path';
import AuthenticationPage from './AuthenticationPage';
type RepoFile = { path: string; content: string | AssetProxy };
type RepoTree = { [key: string]: RepoFile | RepoTree };

View File

@ -1,4 +1,5 @@
import { Map, List, fromJS } from 'immutable';
import {
resolveBackend,
Backend,

View File

@ -1,4 +1,6 @@
import { stripIndent } from 'common-tags';
import yaml from 'js-yaml';
import {
loadConfig,
parseConfig,
@ -8,8 +10,6 @@ import {
handleLocalBackend,
} from '../config';
import yaml from 'js-yaml';
jest.spyOn(console, 'log').mockImplementation(() => {});
jest.spyOn(console, 'warn').mockImplementation(() => {});
jest.mock('../../backend', () => {

View File

@ -1,9 +1,10 @@
import * as actions from '../editorialWorkflow';
import { addAssets } from '../media';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { fromJS } from 'immutable';
import { addAssets } from '../media';
import * as actions from '../editorialWorkflow';
jest.mock('../../backend');
jest.mock('../../valueObjects/AssetProxy');
jest.mock('netlify-cms-lib-util');

View File

@ -1,4 +1,7 @@
import { fromJS, Map } from 'immutable';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import {
createEmptyDraft,
createEmptyDraftData,
@ -7,8 +10,6 @@ import {
getMediaAssets,
validateMetaField,
} from '../entries';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import AssetProxy from '../../valueObjects/AssetProxy';
jest.mock('../../backend');

View File

@ -1,14 +1,16 @@
import { Map } from 'immutable';
import configureMockStore from 'redux-mock-store';
import type { ThunkDispatch } from 'redux-thunk';
import thunk from 'redux-thunk';
import type { AnyAction } from 'redux';
import { mocked } from 'ts-jest/utils';
import { getAsset, ADD_ASSET, LOAD_ASSET_REQUEST } from '../media';
import { selectMediaFilePath } from '../../reducers/entries';
import type { State } from '../../types/redux';
import AssetProxy from '../../valueObjects/AssetProxy';
import type { State } from '../../types/redux';
import type { AnyAction } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
const middlewares = [thunk];
const mockStore =
configureMockStore<Partial<State>, ThunkDispatch<State, {}, AnyAction>>(middlewares);

View File

@ -1,6 +1,7 @@
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { List, Map } from 'immutable';
import { insertMedia, persistMedia, deleteMedia } from '../mediaLibrary';
jest.mock('../../backend');

View File

@ -1,8 +1,9 @@
import { fromJS } from 'immutable';
import { searchEntries } from '../search';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { searchEntries } from '../search';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);

View File

@ -1,8 +1,10 @@
import { actions as notifActions } from 'redux-notifications';
import { currentBackend } from '../backend';
import type { Credentials, User } from 'netlify-cms-lib-util';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import { currentBackend } from '../backend';
import type { State } from '../types/redux';
const { notifSend, notifClear } = notifActions;

View File

@ -3,8 +3,7 @@ import { fromJS } from 'immutable';
import deepmerge from 'deepmerge';
import { produce } from 'immer';
import { trimStart, trim, isEmpty } from 'lodash';
import type { AnyAction } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
import { SIMPLE as SIMPLE_PUBLISH_MODE } from '../constants/publishModes';
import { validateConfig } from '../constants/configSchema';
import { selectDefaultSortableFields } from '../reducers/collections';
@ -12,6 +11,9 @@ import { getIntegrations, selectIntegration } from '../reducers/integrations';
import { resolveBackend } from '../backend';
import { I18N, I18N_FIELD, I18N_STRUCTURE } from '../lib/i18n';
import { FILES, FOLDER } from '../constants/collectionTypes';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import type {
CmsCollection,
CmsConfig,

View File

@ -1,8 +1,10 @@
import { actions as notifActions } from 'redux-notifications';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import { currentBackend } from '../backend';
import { selectDeployPreview } from '../reducers';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import type { Collection, Entry, State } from '../types/redux';
const { notifSend } = notifActions;

View File

@ -1,7 +1,8 @@
import { get } from 'lodash';
import { actions as notifActions } from 'redux-notifications';
import type { ThunkDispatch } from 'redux-thunk';
import { Map, List } from 'immutable';
import { EDITORIAL_WORKFLOW_ERROR } from 'netlify-cms-lib-util';
import { currentBackend, slugFromCustomPath } from '../backend';
import {
selectPublishedSlugs,
@ -10,9 +11,7 @@ import {
selectUnpublishedEntry,
} from '../reducers';
import { selectEditingDraft } from '../reducers/entries';
import type { Status } from '../constants/publishModes';
import { EDITORIAL_WORKFLOW, status } from '../constants/publishModes';
import { EDITORIAL_WORKFLOW_ERROR } from 'netlify-cms-lib-util';
import {
loadEntry,
entryDeleted,
@ -25,6 +24,8 @@ import { createAssetProxy } from '../valueObjects/AssetProxy';
import { addAssets } from './media';
import { loadMedia } from './mediaLibrary';
import ValidationErrorTypes from '../constants/validationErrorTypes';
import { navigateToEntry } from '../routing/history';
import type {
Collection,
EntryMap,
@ -35,7 +36,8 @@ import type {
} from '../types/redux';
import type { AnyAction } from 'redux';
import type { EntryValue } from '../valueObjects/Entry';
import { navigateToEntry } from '../routing/history';
import type { Status } from '../constants/publishModes';
import type { ThunkDispatch } from 'redux-thunk';
const { notifSend } = notifActions;

View File

@ -1,22 +1,30 @@
import type { Set } from 'immutable';
import { fromJS, List, Map } from 'immutable';
import { isEqual } from 'lodash';
import { actions as notifActions } from 'redux-notifications';
import { serializeValues } from '../lib/serializeEntryValues';
import type { Backend } from '../backend';
import { currentBackend } from '../backend';
import { getIntegrationProvider } from '../integrations';
import { selectIntegration, selectPublishedSlugs } from '../reducers';
import { selectFields, updateFieldByKey } from '../reducers/collections';
import { selectCollectionEntriesCursor } from '../reducers/cursors';
import type { ImplementationMediaFile } from 'netlify-cms-lib-util';
import { Cursor } from 'netlify-cms-lib-util';
import type { EntryValue } from '../valueObjects/Entry';
import { selectCollectionEntriesCursor } from '../reducers/cursors';
import { selectFields, updateFieldByKey } from '../reducers/collections';
import { selectIntegration, selectPublishedSlugs } from '../reducers';
import { getIntegrationProvider } from '../integrations';
import { currentBackend } from '../backend';
import { serializeValues } from '../lib/serializeEntryValues';
import { createEntry } from '../valueObjects/Entry';
import type AssetProxy from '../valueObjects/AssetProxy';
import { createAssetProxy } from '../valueObjects/AssetProxy';
import ValidationErrorTypes from '../constants/validationErrorTypes';
import { addAssets, getAsset } from './media';
import { SortDirection } from '../types/redux';
import { waitForMediaLibraryToLoad, loadMedia } from './mediaLibrary';
import { waitUntil } from './waitUntil';
import { selectIsFetching, selectEntriesSortFields, selectEntryByPath } from '../reducers/entries';
import { selectCustomPath } from '../reducers/entryDraft';
import { navigateToEntry } from '../routing/history';
import { getProcessSegment } from '../lib/formatters';
import { hasI18n, duplicateDefaultI18nFields, serializeI18n, I18N, I18N_FIELD } from '../lib/i18n';
import type { ImplementationMediaFile } from 'netlify-cms-lib-util';
import type { AnyAction } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
import type {
Collection,
EntryMap,
@ -27,17 +35,10 @@ import type {
ViewGroup,
Entry,
} from '../types/redux';
import { SortDirection } from '../types/redux';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import { waitForMediaLibraryToLoad, loadMedia } from './mediaLibrary';
import { waitUntil } from './waitUntil';
import { selectIsFetching, selectEntriesSortFields, selectEntryByPath } from '../reducers/entries';
import { selectCustomPath } from '../reducers/entryDraft';
import { navigateToEntry } from '../routing/history';
import { getProcessSegment } from '../lib/formatters';
import { hasI18n, duplicateDefaultI18nFields, serializeI18n, I18N, I18N_FIELD } from '../lib/i18n';
import type { EntryValue } from '../valueObjects/Entry';
import type { Backend } from '../backend';
import type AssetProxy from '../valueObjects/AssetProxy';
import type { Set } from 'immutable';
const { notifSend } = notifActions;

View File

@ -1,13 +1,15 @@
import type AssetProxy from '../valueObjects/AssetProxy';
import { createAssetProxy } from '../valueObjects/AssetProxy';
import type { Collection, State, EntryMap, EntryField } from '../types/redux';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import { isAbsolutePath } from 'netlify-cms-lib-util';
import { createAssetProxy } from '../valueObjects/AssetProxy';
import { selectMediaFilePath } from '../reducers/entries';
import { selectMediaFileByPath } from '../reducers/mediaLibrary';
import { getMediaFile, waitForMediaLibraryToLoad, getMediaDisplayURL } from './mediaLibrary';
import type AssetProxy from '../valueObjects/AssetProxy';
import type { Collection, State, EntryMap, EntryField } from '../types/redux';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
export const ADD_ASSETS = 'ADD_ASSETS';
export const ADD_ASSET = 'ADD_ASSET';
export const REMOVE_ASSET = 'REMOVE_ASSET';

View File

@ -1,9 +1,8 @@
import { Map } from 'immutable';
import { actions as notifActions } from 'redux-notifications';
import type { ImplementationMediaFile } from 'netlify-cms-lib-util';
import { basename, getBlobSHA } from 'netlify-cms-lib-util';
import { currentBackend } from '../backend';
import type AssetProxy from '../valueObjects/AssetProxy';
import { createAssetProxy } from '../valueObjects/AssetProxy';
import { selectIntegration } from '../reducers';
import {
@ -16,6 +15,8 @@ import { getIntegrationProvider } from '../integrations';
import { addAsset, removeAsset } from './media';
import { addDraftEntryMediaFile, removeDraftEntryMediaFile } from './entries';
import { sanitizeSlug } from '../lib/urlHelper';
import { waitUntilWithTimeout } from './waitUntil';
import type {
State,
MediaFile,
@ -25,7 +26,8 @@ import type {
} from '../types/redux';
import type { AnyAction } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
import { waitUntilWithTimeout } from './waitUntil';
import type AssetProxy from '../valueObjects/AssetProxy';
import type { ImplementationMediaFile } from 'netlify-cms-lib-util';
const { notifSend } = notifActions;

View File

@ -1,10 +1,12 @@
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import { isEqual } from 'lodash';
import type { State } from '../types/redux';
import { currentBackend } from '../backend';
import { getIntegrationProvider } from '../integrations';
import { selectIntegration } from '../reducers';
import type { State } from '../types/redux';
import type { AnyAction } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
import type { EntryValue } from '../valueObjects/Entry';
/*

View File

@ -1,8 +1,10 @@
import { actions as notifActions } from 'redux-notifications';
import { currentBackend } from '../backend';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import { actions as notifActions } from 'redux-notifications';
import type { State } from '../types/redux';
import { currentBackend } from '../backend';
const { notifSend, notifDismiss } = notifActions;

View File

@ -1,5 +1,6 @@
import type { WaitActionArgs } from '../redux/middleware/waitUntilAction';
import { WAIT_UNTIL_ACTION } from '../redux/middleware/waitUntilAction';
import type { WaitActionArgs } from '../redux/middleware/waitUntilAction';
import type { ThunkDispatch } from 'redux-thunk';
import type { AnyAction } from 'redux';
import type { State } from '../types/redux';

View File

@ -1,18 +1,6 @@
import { attempt, flatten, isError, uniq, trim, sortBy, get, set } from 'lodash';
import type { Map } from 'immutable';
import { List, fromJS, Set } from 'immutable';
import * as fuzzy from 'fuzzy';
import type {
Implementation as BackendImplementation,
DisplayURL,
ImplementationEntry,
Credentials,
User,
AsyncLock,
UnpublishedEntry,
DataFile,
UnpublishedEntryDiff,
} from 'netlify-cms-lib-util';
import {
localForage,
Cursor,
@ -24,6 +12,7 @@ import {
} from 'netlify-cms-lib-util';
import { basename, join, extname, dirname } from 'path';
import { stringTemplate } from 'netlify-cms-lib-widgets';
import { resolveFormat } from './formats/formats';
import { selectUseWorkflow } from './reducers/config';
import { selectMediaFilePath, selectEntry } from './reducers/entries';
@ -40,24 +29,11 @@ import {
selectFieldsComments,
selectHasMetaPath,
} from './reducers/collections';
import type { EntryValue } from './valueObjects/Entry';
import { createEntry } from './valueObjects/Entry';
import { sanitizeChar } from './lib/urlHelper';
import { getBackend, invokeEvent } from './lib/registry';
import { commitMessageFormatter, slugFormatter, previewUrlFormatter } from './lib/formatters';
import { status } from './constants/publishModes';
import type {
CmsConfig,
EntryMap,
FilterRule,
EntryDraft,
Collection,
Collections,
CollectionFile,
State,
EntryField,
} from './types/redux';
import type AssetProxy from './valueObjects/AssetProxy';
import { FOLDER, FILES } from './constants/collectionTypes';
import { selectCustomPath } from './reducers/entryDraft';
import {
@ -72,6 +48,32 @@ import {
formatI18nBackup,
} from './lib/i18n';
import type AssetProxy from './valueObjects/AssetProxy';
import type {
CmsConfig,
EntryMap,
FilterRule,
EntryDraft,
Collection,
Collections,
CollectionFile,
State,
EntryField,
} from './types/redux';
import type { EntryValue } from './valueObjects/Entry';
import type {
Implementation as BackendImplementation,
DisplayURL,
ImplementationEntry,
Credentials,
User,
AsyncLock,
UnpublishedEntry,
DataFile,
UnpublishedEntryDiff,
} from 'netlify-cms-lib-util';
import type { Map } from 'immutable';
const { extractTemplateVars, dateParsers, expandPath } = stringTemplate;
function updateAssetProxies(

View File

@ -4,6 +4,7 @@ import { Provider, connect } from 'react-redux';
import { Route, Router } from 'react-router-dom';
import { GlobalStyles } from 'netlify-cms-ui-default';
import { I18n } from 'react-polyglot';
import { store } from './redux';
import { history } from './routing/history';
import { loadConfig } from './actions/config';

View File

@ -8,13 +8,14 @@ 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 { Loader, colors } from 'netlify-cms-ui-default';
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';

View File

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

View File

@ -5,6 +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 Sidebar from './Sidebar';
import CollectionTop from './CollectionTop';

View File

@ -1,9 +1,10 @@
import React from 'react';
import styled from '@emotion/styled';
import { lengths } from 'netlify-cms-ui-default';
import ViewStyleControl from './ViewStyleControl';
import SortControl from './SortControl';
import FilterControl from './FilterControl';
import { lengths } from 'netlify-cms-ui-default';
import GroupControl from './GroupControl';
const CollectionControlsContainer = styled.div`

View File

@ -4,6 +4,7 @@ import styled from '@emotion/styled';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { translate } from 'react-polyglot';
import { Loader, lengths } from 'netlify-cms-ui-default';
import EntryListing from './EntryListing';
const PaginationMessage = styled.div`

View File

@ -7,6 +7,7 @@ import { translate } from 'react-polyglot';
import { partial } from 'lodash';
import { Cursor } from 'netlify-cms-lib-util';
import { colors } from 'netlify-cms-ui-default';
import {
loadEntries as actionLoadEntries,
traverseCollectionCursor as actionTraverseCollectionCursor,

View File

@ -4,6 +4,7 @@ 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 {
searchEntries as actionSearchEntries,

View File

@ -1,9 +1,10 @@
import React from 'react';
import styled from '@emotion/styled';
import { connect } from 'react-redux';
import { boundGetAsset } from '../../../actions/media';
import { Link } from 'react-router-dom';
import { colors, colorsRaw, components, lengths, zIndex } from 'netlify-cms-ui-default';
import { boundGetAsset } from '../../../actions/media';
import { VIEW_STYLE_LIST, VIEW_STYLE_GRID } from '../../../constants/collectionViews';
import { selectIsLoadingAsset } from '../../../reducers/medias';
import { selectEntryCollectionTitle } from '../../../reducers/collections';

View File

@ -4,6 +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 EntryCard from './EntryCard';

View File

@ -1,13 +1,14 @@
import React from 'react';
import ConnectedEntriesCollection, {
EntriesCollection,
filterNestedEntries,
} from '../EntriesCollection';
import { render } from '@testing-library/react';
import { fromJS } from 'immutable';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-redux';
import ConnectedEntriesCollection, {
EntriesCollection,
filterNestedEntries,
} from '../EntriesCollection';
jest.mock('../Entries', () => 'mock-entries');
const middlewares = [];

View File

@ -1,6 +1,7 @@
import React from 'react';
import { translate } from 'react-polyglot';
import { Dropdown, DropdownCheckedItem } from 'netlify-cms-ui-default';
import { ControlButton } from './ControlButton';
function FilterControl({ viewFilters, t, onFilterClick, filter }) {

View File

@ -1,6 +1,7 @@
import React from 'react';
import { translate } from 'react-polyglot';
import { Dropdown, DropdownItem } from 'netlify-cms-ui-default';
import { ControlButton } from './ControlButton';
function GroupControl({ viewGroups, t, onGroupClick, group }) {

View File

@ -6,13 +6,14 @@ import { connect } from 'react-redux';
import { NavLink } from 'react-router-dom';
import { dirname, sep } from 'path';
import { stringTemplate } from 'netlify-cms-lib-widgets';
import { selectEntryCollectionTitle } from '../../reducers/collections';
import { selectEntries } from '../../reducers/entries';
import { Icon, colors, components } from 'netlify-cms-ui-default';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { sortBy } from 'lodash';
import { selectEntries } from '../../reducers/entries';
import { selectEntryCollectionTitle } from '../../reducers/collections';
const { addFileTemplateFields } = stringTemplate;
const NodeTitleContainer = styled.div`

View File

@ -6,6 +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 CollectionSearch from './CollectionSearch';
import NestedCollection from './NestedCollection';

View File

@ -1,6 +1,7 @@
import React from 'react';
import { translate } from 'react-polyglot';
import { Dropdown, DropdownItem } from 'netlify-cms-ui-default';
import { SortDirection } from '../../types/redux';
import { ControlButton } from './ControlButton';

View File

@ -1,6 +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';
const ViewControlsSection = styled.div`

View File

@ -1,10 +1,11 @@
import React from 'react';
import ConnectedCollection, { Collection } from '../Collection';
import { render } from '@testing-library/react';
import { fromJS } from 'immutable';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-redux';
import ConnectedCollection, { Collection } from '../Collection';
jest.mock('../Entries/EntriesCollection', () => 'mock-entries-collection');
jest.mock('../CollectionTop', () => 'mock-collection-top');
jest.mock('../CollectionControls', () => 'mock-collection-controls');

View File

@ -1,15 +1,16 @@
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { render, fireEvent } from '@testing-library/react';
import { fromJS } from 'immutable';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-redux';
import ConnectedNestedCollection, {
NestedCollection,
getTreeData,
walk,
updateNode,
} from '../NestedCollection';
import { render, fireEvent } from '@testing-library/react';
import { fromJS } from 'immutable';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-redux';
jest.mock('netlify-cms-ui-default', () => {
const actual = jest.requireActual('netlify-cms-ui-default');

View File

@ -1,9 +1,10 @@
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { Sidebar } from '../Sidebar';
import { render } from '@testing-library/react';
import { fromJS } from 'immutable';
import { Sidebar } from '../Sidebar';
jest.mock('netlify-cms-ui-default', () => {
const actual = jest.requireActual('netlify-cms-ui-default');
return {

View File

@ -5,6 +5,7 @@ import { connect } from 'react-redux';
import { Loader } from 'netlify-cms-ui-default';
import { translate } from 'react-polyglot';
import { debounce } from 'lodash';
import { history, navigateToCollection, navigateToNewEntry } from '../../routing/history';
import { logoutUser } from '../../actions/auth';
import {

View File

@ -8,6 +8,7 @@ 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, validateMetaField } from '../../../actions/entries';
import { addAsset, boundGetAsset } from '../../../actions/media';

View File

@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { css } from '@emotion/core';
import styled from '@emotion/styled';
import EditorControl from './EditorControl';
import {
colors,
Dropdown,
@ -12,6 +11,8 @@ import {
buttons,
text,
} from 'netlify-cms-ui-default';
import EditorControl from './EditorControl';
import {
getI18nInfo,
isFieldTranslatable,

View File

@ -3,6 +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';
function truthy() {

View File

@ -13,6 +13,7 @@ import {
zIndex,
} from 'netlify-cms-ui-default';
import { ScrollSync, ScrollSyncPane } from 'react-scroll-sync';
import EditorControlPane from './EditorControlPane/EditorControlPane';
import EditorPreviewPane from './EditorPreviewPane/EditorPreviewPane';
import EditorToolbar from './EditorToolbar';

View File

@ -5,10 +5,11 @@ 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 { connect } from 'react-redux';
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';

View File

@ -16,6 +16,7 @@ import {
buttons,
zIndex,
} from 'netlify-cms-ui-default';
import { status } from '../../constants/publishModes';
import { SettingsDropdown } from '../UI';

View File

@ -1,8 +1,9 @@
import React from 'react';
import { Editor } from '../Editor';
import { render } from '@testing-library/react';
import { fromJS } from 'immutable';
import { Editor } from '../Editor';
jest.mock('lodash/debounce', () => {
const flush = jest.fn();
return func => {

View File

@ -1,5 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
import { EDITORIAL_WORKFLOW } from '../../constants/publishModes';
import { selectUnpublishedEntry } from '../../reducers';
import { selectAllowDeletion } from '../../reducers/collections';

View File

@ -6,6 +6,7 @@ import { orderBy, map } from 'lodash';
import { translate } from 'react-polyglot';
import fuzzy from 'fuzzy';
import { fileExtension } from 'netlify-cms-lib-util';
import {
loadMedia as loadMediaAction,
persistMedia as persistMediaAction,

View File

@ -2,11 +2,12 @@ import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@emotion/core';
import styled from '@emotion/styled';
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';
import { FileUploadButton } from '../UI';
const styles = {
button: css`
${buttons.button};

View File

@ -2,12 +2,13 @@ import React from 'react';
import PropTypes from 'prop-types';
import styled from '@emotion/styled';
import { Waypoint } from 'react-waypoint';
import MediaLibraryCard from './MediaLibraryCard';
import { Map } from 'immutable';
import { colors } from 'netlify-cms-ui-default';
import { FixedSizeGrid as Grid } from 'react-window';
import AutoSizer from 'react-virtualized-auto-sizer';
import MediaLibraryCard from './MediaLibraryCard';
function CardWrapper(props) {
const {
rowIndex,

View File

@ -4,11 +4,12 @@ import styled from '@emotion/styled';
import { Map } from 'immutable';
import { isEmpty } from 'lodash';
import { translate } from 'react-polyglot';
import { colors } from 'netlify-cms-ui-default';
import { Modal } from '../UI';
import MediaLibraryTop from './MediaLibraryTop';
import MediaLibraryCardGrid from './MediaLibraryCardGrid';
import EmptyMessage from './EmptyMessage';
import { colors } from 'netlify-cms-ui-default';
/**
* Responsive styling needs to be overhauled. Current setup requires specifying

View File

@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import styled from '@emotion/styled';
import MediaLibrarySearch from './MediaLibrarySearch';
import MediaLibraryHeader from './MediaLibraryHeader';
import {

View File

@ -1,7 +1,8 @@
import React from 'react';
import { CopyToClipBoardButton } from '../MediaLibraryButtons';
import { render } from '@testing-library/react';
import { CopyToClipBoardButton } from '../MediaLibraryButtons';
describe('CopyToClipBoardButton', () => {
const props = {
disabled: false,

View File

@ -1,8 +1,9 @@
import React from 'react';
import { Map } from 'immutable';
import MediaLibraryCard from '../MediaLibraryCard';
import { render } from '@testing-library/react';
import MediaLibraryCard from '../MediaLibraryCard';
describe('MediaLibraryCard', () => {
const props = {
displayURL: Map({ url: 'url' }),

View File

@ -4,6 +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';
const styles = {

View File

@ -1,8 +1,9 @@
import React from 'react';
import { ErrorBoundary } from '../ErrorBoundary';
import { render } from '@testing-library/react';
import { oneLineTrim } from 'common-tags';
import { ErrorBoundary } from '../ErrorBoundary';
function WithError() {
throw new Error('Some unknown error');
}

View File

@ -14,6 +14,7 @@ import {
components,
shadows,
} from 'netlify-cms-ui-default';
import { createNewEntry } from '../../actions/collections';
import {
loadUnpublishedEntries,

View File

@ -6,6 +6,7 @@ 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 WorkflowCard from './WorkflowCard';

View File

@ -1,4 +1,5 @@
import { merge } from 'lodash';
import { validateConfig } from '../configSchema';
jest.mock('../../lib/registry');

View File

@ -6,9 +6,10 @@ import {
prohibited,
} from 'ajv-keywords/dist/keywords';
import ajvErrors from 'ajv-errors';
import uuid from 'uuid/v4';
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';
const localeType = { type: 'string', minLength: 2, maxLength: 10, pattern: '^[a-zA-Z-_]+$' };

View File

@ -1,6 +1,7 @@
import yaml from '../yaml';
import { stripIndent } from 'common-tags';
import yaml from '../yaml';
describe('yaml', () => {
describe('fromFile', () => {
test('loads valid yaml', () => {

View File

@ -1,10 +1,12 @@
import { List } from 'immutable';
import { get } from 'lodash';
import yamlFormatter from './yaml';
import tomlFormatter from './toml';
import jsonFormatter from './json';
import type { Delimiter } from './frontmatter';
import { FrontmatterInfer, frontmatterJSON, frontmatterTOML, frontmatterYAML } from './frontmatter';
import type { Delimiter } from './frontmatter';
import type { Collection, EntryObject, Format } from '../types/redux';
import type { EntryValue } from '../valueObjects/Entry';

View File

@ -1,4 +1,5 @@
import matter from 'gray-matter';
import tomlFormatter from './toml';
import yamlFormatter from './yaml';
import jsonFormatter from './json';

View File

@ -1,6 +1,7 @@
import toml from '@iarna/toml';
import tomlify from 'tomlify-j0.4';
import moment from 'moment';
import AssetProxy from '../valueObjects/AssetProxy';
import { sortKeys } from './helpers';

View File

@ -1,5 +1,7 @@
import yaml from 'yaml';
import { sortKeys } from './helpers';
import type { YAMLMap, YAMLSeq, Pair, Node } from 'yaml/types';
function addComments(items: Array<Pair>, comments: Record<string, string>, prefix = '') {

View File

@ -1,6 +1,7 @@
import { Map } from 'immutable';
import Algolia from './providers/algolia/implementation';
import AssetStore from './providers/assetStore/implementation';
import { Map } from 'immutable';
export function resolveIntegrations(interationsConfig, getToken) {
let integrationInstances = Map({});

View File

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

View File

@ -1,7 +1,8 @@
import { pickBy, trimEnd } from 'lodash';
import { addParams } from '../../../lib/urlHelper';
import { unsentRequest } from 'netlify-cms-lib-util';
import { addParams } from '../../../lib/urlHelper';
const { fetchWithTimeout: fetch } = unsentRequest;
export default class AssetStore {

View File

@ -1,4 +1,5 @@
import { List, Map, fromJS } from 'immutable';
import {
commitMessageFormatter,
prepareSlug,

View File

@ -1,4 +1,5 @@
import { fromJS } from 'immutable';
import * as i18n from '../i18n';
jest.mock('../../reducers/collections', () => {

View File

@ -1,6 +1,7 @@
import { serializeValues, deserializeValues } from '../serializeEntryValues';
import { fromJS } from 'immutable';
import { serializeValues, deserializeValues } from '../serializeEntryValues';
const values = fromJS({ title: 'New Post', unknown: 'Unknown Field' });
const fields = fromJS([{ name: 'title', widget: 'string' }]);

View File

@ -1,18 +1,20 @@
import type { Map } from 'immutable';
import { flow, partialRight, trimEnd, trimStart } from 'lodash';
import { sanitizeSlug } from './urlHelper';
import { stringTemplate } from 'netlify-cms-lib-widgets';
import { stripIndent } from 'common-tags';
import {
selectIdentifier,
selectField,
selectInferedField,
getFileFromSlug,
} from '../reducers/collections';
import type { Collection, CmsConfig, CmsSlug, EntryMap } from '../types/redux';
import { stripIndent } from 'common-tags';
import { sanitizeSlug } from './urlHelper';
import { FILES } from '../constants/collectionTypes';
import { COMMIT_AUTHOR, COMMIT_DATE } from '../constants/commitProps';
import type { Collection, CmsConfig, CmsSlug, EntryMap } from '../types/redux';
import type { Map } from 'immutable';
const {
compileStringTemplate,
parseDateFromEntry,

View File

@ -1,7 +1,9 @@
import { Map, List } from 'immutable';
import { set, trimEnd, groupBy, escapeRegExp } from 'lodash';
import type { Collection, Entry, EntryDraft, EntryField, EntryMap } from '../types/redux';
import { selectEntrySlug } from '../reducers/collections';
import type { Collection, Entry, EntryDraft, EntryField, EntryMap } from '../types/redux';
import type { EntryValue } from '../valueObjects/Entry';
export const I18N = 'i18n';

View File

@ -1,4 +1,5 @@
import { merge } from 'lodash';
import { getLocale } from './registry';
export function getPhrases(locale) {

View File

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

View File

@ -1,5 +1,6 @@
import { isNil } from 'lodash';
import { Map, List } from 'immutable';
import { getWidgetValueSerializer } from './registry';
/**

Some files were not shown because too many files have changed in this diff Show More