8000 Output requires formatting pass · Issue #1 · deref/extractgqlts · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Output requires formatting pass #1
Open
@brandonbloom

Description

@brandonbloom

Presently, the each generated type is crammed on to a single line per type. For readability, you can run prettier on the output like this example:

#!/bin/bash

set +e

extractgqlts \
  --schema ./internal/resolvers/schema.gql \
  ./gui/src/**/*.svelte \
  > ./gui/src/lib/graphql/types.generated.ts

exit_code=$?
set -e

(
  cd gui
  node ./node_modules/.bin/prettier \
    --write \
    ./src/lib/graphql/types.generated.ts
)

exit $exit_code

However, compared to extractgqlts, prettier is extremely slow. For a non-trivial project, extractgqlts takes roughly than 0.02 seconds on my machine. Prettier on the one outputted file takes over half a second!

It would be much better if we output code that was already mostly formatted such that it could reasonably be configured for being ignored by prettier. This would require some sort of minimalistic AST for the output with a flattening pass that performs indentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0