Skip to content

Commit

Permalink
repair: make easier to debug & add info about how to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
kiprasmel committed May 10, 2023
1 parent d6d4889 commit ed803db
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 4 deletions.
38 changes: 38 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
]
}
22 changes: 18 additions & 4 deletions repair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}
}

0 comments on commit ed803db

Please sign in to comment.