({
prefix,
suffix,
scope,
ignorePhase,
appendPast,
skipDev,
})
| 140 | } |
| 141 | |
| 142 | function generateScript({ |
| 143 | prefix, |
| 144 | suffix, |
| 145 | scope, |
| 146 | ignorePhase, |
| 147 | appendPast, |
| 148 | skipDev, |
| 149 | }) { |
| 150 | const lines = []; |
| 151 | suffix = suffix || ""; |
| 152 | let lvl = 0; |
| 153 | if (skipDev) { |
| 154 | scope = _.reject(scope, { dev: true }); |
| 155 | } |
| 156 | const left = [...scope]; |
| 157 | let pushed = []; |
| 158 | if (ignorePhase) { |
| 159 | lines.push(scope); |
| 160 | } else { |
| 161 | while (!_.isEmpty(left)) { |
| 162 | const current = _.remove(left, { phase: lvl }); |
| 163 | pushed = pushed.concat(current); |
| 164 | lvl += 1; |
| 165 | if (appendPast) { |
| 166 | lines.push(current.concat(pushed)); |
| 167 | } else { |
| 168 | lines.push(current); |
| 169 | } |
| 170 | // _.remove(left, ent => current.includes(ent)); |
| 171 | } |
| 172 | } |
| 173 | console.log(lines); |
| 174 | const scripts = ` |
| 175 | #!/usr/bin/env sh |
| 176 | ${lines |
| 177 | .map( |
| 178 | // eslint-disable-next-line prefer-template |
| 179 | (l) => prefix + l.map((ent) => ent.name).join(" --scope ") + ` ${suffix}` |
| 180 | ) |
| 181 | .join("\n")} |
| 182 | `; |
| 183 | return scripts; |
| 184 | } |
| 185 | |
| 186 | function generateWatchScript({ scope, group }) { |
| 187 | const script = ` |
no test coverage detected