Feature Request Checklist
Overview
Over in changesets/changesets#1639, @bluwy noted:
One caveat I notice is that since it calls a child process, it can take around 300-800ms after confirming the changeset in the CLI.
That is an unfortunate performance penalty to add - especially for a project that was previously importing from Prettier in-memory / in the same process. The way Prettier's runner is defined right now is just as a process exec string:
|
runner: "npx prettier --write", |
Proposal: how we change Prettier's runner to:
- Try to
await import('prettier') and format that way
- If that fails to resolve (e.g. from a global Prettier installation) then fall back to the string exec
cc @Andarist @bluwy does that seem right to you as a strategy that would help?
Additional Info
Filing this issue for just Prettier at the moment since I think it's probably the easiest to do (doesn't need a Deno runtime, etc.). But if this works I don't see any reason not to try to add support for the other formatters.
https://github.com/JoshuaKGoldberg/formatly/issues
Feature Request Checklist
mainbranch of the repository.Overview
Over in changesets/changesets#1639, @bluwy noted:
That is an unfortunate performance penalty to add - especially for a project that was previously importing from Prettier in-memory / in the same process. The way Prettier's
runneris defined right now is just as a process exec string:formatly/src/formatters.ts
Line 40 in c96058b
Proposal: how we change Prettier's runner to:
await import('prettier')and format that waycc @Andarist @bluwy does that seem right to you as a strategy that would help?
Additional Info
Filing this issue for just Prettier at the moment since I think it's probably the easiest to do (doesn't need a Deno runtime, etc.). But if this works I don't see any reason not to try to add support for the other formatters.
https://github.com/JoshuaKGoldberg/formatly/issues