feat: enable tscTask promise interaction so it can fail gracefully
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- build-system
Research direction
Start by locating tscTask and the exec implementation, then trace how rejected promises are handled by task execution. Compare this with the requested callback interaction and the watcher use case. Done means a TypeScript compiler failure can be handled without preventing the following watcher step, with behavior covered by the project's relevant tests.
Written by the indexing model from the issue text.
Description
Hi there, I recently tried to fix an issue in my watcher task but found it's not possible with the current setup.
My watcher task starts by compiling with Just's tscTask, then to our own watcher function. If the typescript compiler encounters an error then ideally the task would move onto the watcher step. As it is right now, the uncaught error stops the task. There's no way to interact with the promise returned by exec. I would love to be able to pass in Promise callbacks or something similar as below:
export function tscTask(options: TscTaskOptions = {}, execCallbacks): TaskFunction {
const tscCmd = resolve('typescript/lib/tsc.js');
const { thenCallback, catchFallback, finallyCallback } = execCallbacks;
if (!tscCmd) {
throw new Error('cannot find tsc');
}
return function tsc() {
// Read from options argument, if not there try the tsConfigFile found in root, if not then skip and use no config
options = { ...options, ...getProjectOrBuildOptions(options) };
if (isValidProject(options)) {
logger.info(`Running ${tscCmd} with ${options.project || options.build}`);
const args = argsFromOptions(tscCmd, options);
const cmd = encodeArgs([process.execPath, ...args]).join(' ');
logger.info(`Executing: ${cmd}`);
return exec(cmd).then(thenCallback).catch(catchCallback).finally(finallyCallback);
}
return Promise.resolve();
};
}
Specific implementation doesn't matter too much, but it would be very nice to delete the copy of tscTask and supporting methods I brought into my repo
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/just
-
v3
-
v3
-
v3
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Dependency Dashboard Openrenovate
Difficulty 5/5 Over a week Newbie friendliness 15/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·