(targets, loadCfg = {}, includeOverride)
| 99 | }; |
| 100 | |
| 101 | async function load(targets, loadCfg = {}, includeOverride) { |
| 102 | if (typeof targets === "string") { |
| 103 | targets = [targets]; |
| 104 | } |
| 105 | const config = Object.assign( |
| 106 | { |
| 107 | destBasePath: getDestBasePath(), |
| 108 | }, |
| 109 | loadCfg, |
| 110 | ); |
| 111 | |
| 112 | await Promise.all( |
| 113 | targets.map(async function (target) { |
| 114 | const targetPath = resolve.sync(target, { basedir: getPlopfilePath() }); |
| 115 | const proxy = await nodePlop(targetPath, config); |
| 116 | const proxyDefaultInclude = proxy.getDefaultInclude() || {}; |
| 117 | const includeCfg = includeOverride || proxyDefaultInclude; |
| 118 | const include = Object.assign( |
| 119 | { |
| 120 | generators: false, |
| 121 | helpers: false, |
| 122 | partials: false, |
| 123 | actionTypes: false, |
| 124 | }, |
| 125 | includeCfg, |
| 126 | ); |
| 127 | |
| 128 | const genNameList = proxy.getGeneratorList().map((g) => g.name); |
| 129 | loadAsset( |
| 130 | genNameList, |
| 131 | includeCfg === true || include.generators, |
| 132 | setGenerator, |
| 133 | (proxyName) => ({ proxyName, proxy }), |
| 134 | ); |
| 135 | loadAsset( |
| 136 | proxy.getPartialList(), |
| 137 | includeCfg === true || include.partials, |
| 138 | setPartial, |
| 139 | proxy.getPartial, |
| 140 | ); |
| 141 | loadAsset( |
| 142 | proxy.getHelperList(), |
| 143 | includeCfg === true || include.helpers, |
| 144 | setHelper, |
| 145 | proxy.getHelper, |
| 146 | ); |
| 147 | loadAsset( |
| 148 | proxy.getActionTypeList(), |
| 149 | includeCfg === true || include.actionTypes, |
| 150 | setActionType, |
| 151 | proxy.getActionType, |
| 152 | ); |
| 153 | }), |
| 154 | ); |
| 155 | } |
| 156 | |
| 157 | function loadAsset(nameList, include, addFunc, getFunc) { |
| 158 | var incArr; |
nothing calls this directly
no test coverage detected
searching dependent graphs…