tweak(xod-project): make listPatchWithoutBuiltIns more robust (and slower), add convertToLocalPath function that converts any PathPath into local PatchPath

This commit is contained in:
Kirill Shumilov
2017-11-20 16:03:01 +03:00
parent bcb70b5fad
commit ab299eac82
2 changed files with 18 additions and 2 deletions

View File

@@ -72,6 +72,15 @@ export const getLibraryName = R.ifElse(
R.always('@')
);
/**
* Converts `xod/core/something` into `@/something`,
* `@/another-one` will be unchanged.
*/
export const convertToLocalPath = R.compose(
getLocalPath,
getBaseName
);
//
// Utils for terminal patches
//

View File

@@ -1,6 +1,6 @@
import R from 'ramda';
import { Either, Maybe } from 'ramda-fantasy';
import { explodeMaybe, notEmpty } from 'xod-func-tools';
import { explodeMaybe, notEmpty, isAmong } from 'xod-func-tools';
import { BUILT_IN_PATCH_PATHS } from './builtInPatches';
import * as CONST from './constants';
@@ -197,7 +197,14 @@ export const listPatches = def(
*/
export const listPatchesWithoutBuiltIns = def(
'listPatches :: Project -> [Patch]',
R.compose(R.values, R.prop('patches'))
R.compose(
R.reject(R.compose(
isAmong(BUILT_IN_PATCH_PATHS),
Patch.getPatchPath
)),
R.values,
R.prop('patches')
)
);
/**