mirror of
https://github.com/xodio/xod.git
synced 2026-03-16 21:56:52 +01:00
tweak(xod-project): make listPatchWithoutBuiltIns more robust (and slower), add convertToLocalPath function that converts any PathPath into local PatchPath
This commit is contained in:
@@ -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
|
||||
//
|
||||
|
||||
@@ -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')
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user