diff --git a/.vscode/launch.json b/.vscode/launch.json index c556daff..f21538fc 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -57,6 +57,44 @@ "cwd": "${workspaceRoot}", "protocol": "inspector", "internalConsoleOptions": "openOnSessionStart" + }, + + /** + * seems broken + * + * instead, run: + * ``` + yarn build:core && ./script/postbuild.js + GSR_DEBUG=1 node --inspect-brk ./dist/repair.js + ``` + * + * & open debugger in chrome: + * about://inspect + * + * works better than vscode. + * + * + * can modify options & other stuff, e.g. how questions get answered, + * directly in the file. + * + * + * if don't need proper debugging experience, can just run + * ``` + GSR_DEBUG=1 ./repair.ts + * ``` + * + */ + { + "name": "debug repair.ts (broken, see comment in launch.json how to debug)", + "type": "node", + "request": "launch", + "args": ["repair.ts"], + "runtimeArgs": ["--inspect-brk", "-r", "ts-node/register"], + "cwd": "${workspaceRoot}", + "env": { + "GSR_DEBUG_REPAIR": "1", + }, + "internalConsoleOptions": "openOnSessionStart", } ] } diff --git a/repair.ts b/repair.ts index 94a7d382..8ea7fcb7 100755 --- a/repair.ts +++ b/repair.ts @@ -193,8 +193,22 @@ export function parseChoicesRanges(choices: string[]) { } if (!module.parent) { - gitStackedRebase({ - initialBranch: "origin/master", - repair: true - }) + if (process.env.GSR_DEBUG || process.env.GSR_DEBUG_REPAIR) { + gitStackedRebase({ + initialBranch: "origin/master", + repair: true, + [askQuestion__internal]: (q, ...rest) => { + if (q.includes("Repair all?")) { + return "y" /** can modify easily here */ + } + + return question(q, ...rest) + } + }) + } else { + gitStackedRebase({ + initialBranch: "origin/master", + repair: true, + }) + } }