fix(tools): update helper scripts (#41923)

This commit is contained in:
Oliver Eyton-Williams
2021-04-27 20:29:49 +02:00
committed by GitHub
parent 300ff756ce
commit 17a7a84b48
4 changed files with 13 additions and 18 deletions

View File

@ -14,25 +14,17 @@ const allStepsExist = (steps, stepsToFind) =>
const projectPath = getProjectPath();
const args = getArgValues(process.argv);
let { start, end } = args;
start = parseInt(start, 10);
end = parseInt(end, 10);
const start = parseInt(args.start, 10);
if (
!Number.isInteger(start) ||
!Number.isInteger(end) ||
start < 1 ||
start !== end - 1
) {
throw (
'Step not created. Steps specified must be' +
' consecutive numbers and start step must be greater than 0.'
);
if (!Number.isInteger(start) || start < 1) {
throw 'Step not created. Start step must be greater than 0.';
}
const end = start + 1;
const existingSteps = getExistingStepNums(projectPath);
if (!allStepsExist(existingSteps, [start, end])) {
throw 'Step not created. At least one of the steps specified does not exist.';
throw `Step not created. Both start step, ${start}, and end step, ${end}, must exist`;
}
const challengeSeeds = getChallengeSeeds(