• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

apollographql/apollo-tooling: ✏️ Tooling for development and production Apollo ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

apollographql/apollo-tooling

开源软件地址(OpenSource Url):

https://github.com/apollographql/apollo-tooling

开源编程语言(OpenSource Language):

TypeScript 99.8%

开源软件介绍(OpenSource Introduction):

Apollo CLI

GitHub license npm Get on Slack


[2022-01-21] Note - Upcoming Deprecation Plans: We (Apollo) are working towards fully deprecating this repository and its related projects. Most of the functionality in this repository has been replaced by newer projects and the rest will be soon. We'll share detailed migration documentation when everything here is ready to be officially deprecated, but just a heads up in case you're planning on adopting anything here for a new project (which you still can of course if the tooling here works for you - support for this tooling will be minimal however).


[2021-07-23] Note - Housekeeping: Apollo's GraphQL VSCode extension is no longer housed in this repository. It is now maintained separately in this repo.


Apollo CLI brings together your GraphQL clients and servers with tools for validating your schema, linting your operations for compatibility with your server, and generating static types for improved client-side type safety.

Usage

Disclaimer: The following API documentation is only for the latest version released on NPM, and may not be accurate for previous or future versions.

$ npm install -g apollo
$ apollo COMMAND
running command...
$ apollo (-v|--version|version)
apollo/2.33.11 darwin-arm64 node-v16.14.2
$ apollo --help [COMMAND]
USAGE
  $ apollo COMMAND
...

Commands

apollo client:check

Check a client project against a pushed service

USAGE
  $ apollo client:check

OPTIONS
  -c, --config=config
      Path to your Apollo config file

  -g, --graph=graph
      The ID for the graph in Apollo to operate client commands with.
      Overrides config file if set.

  -v, --variant=variant
      The variant of the graph in Apollo to associate this client to

  --clientName=clientName
      Name of the client that the queries will be attached to

  --clientReferenceId=clientReferenceId
      Reference id for the client which will match ids from client traces,
      will use clientName if not provided

  --clientVersion=clientVersion
      The version of the client that the queries will be attached to

  --endpoint=endpoint
      The URL for the CLI use to introspect your service

  --excludes=excludes
      Glob of files to exclude for GraphQL operations. Caveat: this doesn't
      currently work in watch mode

  --header=header
      Additional header to send during introspection. May be used multiple
      times to add multiple headers. NOTE: The `--endpoint` flag is REQUIRED
      if using the `--header` flag.

  --includes=includes
      Glob of files to search for GraphQL operations. This should be used to
      find queries *and* any client schema extensions

  --key=key
      The API key to use for authentication to Apollo

  --queries=queries
      Deprecated in favor of the includes flag

  --tagName=tagName
      Name of the template literal tag used to identify template literals
      containing GraphQL queries in Javascript/Typescript code

See code: src/commands/client/check.ts

apollo client:codegen [OUTPUT]

Generate static types for GraphQL queries. Can use the published schema in the Apollo registry or a downloaded schema.

USAGE
  $ apollo client:codegen [OUTPUT]

ARGUMENTS
  OUTPUT
      Directory to which generated files will be written.
      - For TypeScript/Flow generators, this specifies a directory relative
      to each source file by default.
      - For TypeScript/Flow generators with the "outputFlat" flag is set,
      and for the Swift generator, this specifies a file or directory
      (absolute or relative to the current working directory) to which:
      - a file will be written for each query (if "output" is a directory)
      - all generated types will be written
      - For all other types, this defines a file (absolute or relative to
      the current working directory) to which all generated types are
      written.

OPTIONS
  -c, --config=config
      Path to your Apollo config file

  -g, --graph=graph
      The ID for the graph in Apollo to operate client commands with.
      Overrides config file if set.

  -v, --variant=variant
      The variant of the graph in Apollo to associate this client to

  --[no-]addTypename
      [default: true] Automatically add __typename to your queries, can be
      unset with --no-addTypename

  --clientName=clientName
      Name of the client that the queries will be attached to

  --clientReferenceId=clientReferenceId
      Reference id for the client which will match ids from client traces,
      will use clientName if not provided

  --clientVersion=clientVersion
      The version of the client that the queries will be attached to

  --customScalarsPrefix=customScalarsPrefix
      Include a prefix when using provided types for custom scalars

  --endpoint=endpoint
      The URL for the CLI use to introspect your service

  --excludes=excludes
      Glob of files to exclude for GraphQL operations. Caveat: this doesn't
      currently work in watch mode

  --globalTypesFile=globalTypesFile
      By default, TypeScript will put a file named "globalTypes.ts" inside
      the "output" directory. Set "globalTypesFile" to specify a different
      path. Alternatively, set "tsFileExtension" to modify the extension of
      the file, for example "d.ts" will output "globalTypes.d.ts"

  --header=header
      Additional header to send during introspection. May be used multiple
      times to add multiple headers. NOTE: The `--endpoint` flag is REQUIRED
      if using the `--header` flag.

  --includes=includes
      Glob of files to search for GraphQL operations. This should be used to
      find queries *and* any client schema extensions

  --key=key
      The API key to use for authentication to Apollo

  --localSchemaFile=localSchemaFile
      Path to one or more local GraphQL schema file(s), as introspection
      result or SDL. Supports comma-separated list of paths (ex.
      `--localSchemaFile=schema.graphql,extensions.graphql`)

  --mergeInFieldsFromFragmentSpreads
      Merge fragment fields onto its enclosing type

  --namespace=namespace
      The namespace to emit generated code into.

  --omitDeprecatedEnumCases
      Omit deprecated enum cases from generated code [Swift only]

  --only=only
      Parse all input files, but only output generated code for the
      specified file [Swift only]

  --operationIdsPath=operationIdsPath
      Path to an operation id JSON map file. If specified, also stores the
      operation ids (hashes) as properties on operation types [currently
      Swift-only]

  --outputFlat
      By default, TypeScript/Flow will put each generated file in a
      directory next to its source file using the value of the "output" as
      the directory name. Set "outputFlat" to put all generated files in the
      directory relative to the current working directory defined by
      "output".

  --passthroughCustomScalars
      Use your own types for custom scalars

  --queries=queries
      Deprecated in favor of the includes flag

  --suppressSwiftMultilineStringLiterals
      Prevents operations from being rendered as multiline strings [Swift
      only]

  --tagName=tagName
      Name of the template literal tag used to identify template literals
      containing GraphQL queries in Javascript/Typescript code

  --target=target
      (required) Type of code generator to use (swift | typescript | flow |
      scala | json | json-modern (exposes raw json types))

  --tsFileExtension=tsFileExtension
      By default, TypeScript will output "ts" files. Set "tsFileExtension"
      to specify a different file extension, for example "d.ts"

  --useFlowExactObjects
      Use Flow exact objects for generated types [flow only]

  --useFlowReadOnlyTypes
      Use read only types for generated types [flow only]. **Deprecated in
      favor of `useReadOnlyTypes`.**

  --useReadOnlyTypes
      Use read only types for generated types [flow | typescript]

  --watch
      Watch for file changes and reload codegen

ALIASES
  $ apollo codegen:generate

See code: src/commands/client/codegen.ts

apollo client:download-schema OUTPUT

Download a schema from Apollo or a GraphQL endpoint in JSON or SDL format

USAGE
  $ apollo client:download-schema OUTPUT

ARGUMENTS
  OUTPUT  [default: schema.json] Path to write the introspection result
          to. Can be `.graphql`, `.gql`, `.graphqls`, or `.json`

OPTIONS
  -c, --config=config
      Path to your Apollo config file

  -g, --graph=graph
      The ID for the graph in Apollo to operate client commands with.
      Overrides config file if set.

  -v, --variant=variant
      The variant of the graph in Apollo to associate this client to

  --clientName=clientName
      Name of the client that the queries will be attached to

  --clientReferenceId=clientReferenceId
      Reference id for the client which will match ids from client traces,
      will use clientName if not provided

  --clientVersion=clientVersion
      The version of the client that the queries will be attached to

  --endpoint=endpoint
      The URL for the CLI use to introspect your service

  --excludes=excludes
      Glob of files to exclude for GraphQL operations. Caveat: this doesn't
      currently work in watch mode

  --header=header
      Additional header to send during introspection. May be used multiple
      times to add multiple headers. NOTE: The `--endpoint` flag is REQUIRED
      if using the `--header` flag.

  --includes=includes
      Glob of files to search for GraphQL operations. This should be used to
      find queries *and* any client schema extensions

  --key=key
      The API key to use for authentication to Apollo

  --queries=queries
      Deprecated in favor of the includes flag

  --tagName=tagName
      Name of the template literal tag used to identify template literals
      containing GraphQL queries in Javascript/Typescript code

See code: src/commands/client/download-schema.ts

apollo client:extract OUTPUT

Extract queries from a client

USAGE
  $ apollo client:extract OUTPUT

ARGUMENTS
  OUTPUT  [default: manifest.json] Path to write the extracted queries to

OPTIONS
  -c, --config=config
      Path to your Apollo config file

  -g, --graph=graph
      The ID for the graph in Apollo to operate client commands with.
      Overrides config file if set.

  -v, --variant=variant
      The variant of the graph in Apollo to associate this client to

  --clientName=clientName
      Name of the client that the queries will be attached to

  --clientReferenceId=clientReferenceId
      Reference id for the client which will match ids from client traces,
      will use clientName if not provided

  --clientVersion=clientVersion
      The version of the client that the queries will be attached to

  --endpoint=endpoint
      The URL for the CLI use to introspect your service

  --excludes=excludes
      Glob of files to exclude for GraphQL operations. Caveat: this doesn't
      currently work in watch mode

  --header=header
      Additional header to send during introspection. May be used multiple
      times to add multiple headers. NOTE: The `--endpoint` flag is REQUIRED
      if using the `--header` flag.

  --includes=includes
      Glob of files to search for GraphQL operations. This should be used to
      find queries *and* any client schema extensions

  --key=key
      The API key to use for authentication to Apollo

  --preserveStringAndNumericLiterals
      Disable redaction of string and numerical literals.  Without this
      flag, these values will be replaced with empty strings (`''`) and
      zeroes (`0`) respectively.  This redaction is intended to avoid
      inadvertently outputting potentially personally identifiable
      information (e.g. embedded passwords  or API keys) into operation
      manifests

  --queries=queries
      Deprecated in favor of the includes flag

  --tagName=tagName
      Name of the template literal tag used to identify template literals
      containing GraphQL queries in Javascript/Typescript code

See code: src/commands/client/extract.ts

apollo client:push

Register operations with Apollo, adding them to the safelist

USAGE
  $ apollo client:push

OPTIONS
  -c, --config=config
      Path to your Apollo config file

  -g, --graph=graph
      The ID for the graph in Apollo to operate client commands with.
      Overrides config file if set.

  -v, --variant=variant
      The variant of the graph in Apollo to associate this client to

  --clientName=clientName
      Name of the client that the queries will be attached to

  --clientReferenceId=clientReferenceId
      Reference id for the client which will match ids from client traces,
      will use clientName if not provided

  --clientVersion=clientVersion
      The version of the client that the queries will be attached to

  --endpoint=endpoint
      The URL for the CLI use to introspect your service

  --excludes=excludes
      Glob of files to exclude for GraphQL operations. Caveat: this doesn't
      currently work in watch mode

  --header=header
      Additional header to send during introspection. May be used multiple
      times to add multiple headers. NOTE: The `--endpoint` flag is REQUIRED
      if using the `--header` flag.

  --includes=includes
      Glob of files to search for GraphQL operations. This should be used to
      find queries *and* any client schema extensions

  --key=key
      The API key to use for authentication to Apollo

  --queries=queries
      Deprecated in favor of the includes flag

  --tagName=tagName
      Name of the template literal tag used to identify template literals
      containing GraphQL queries in Javascript/Typescript code

See code: src/commands/client/push.ts

apollo help [COMMAND]

display help for apollo

USAGE
  $ apollo help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

apollo plugins

List installed plugins.

USAGE
  $ apollo plugins

OPTIONS
  --core  Show core plugins.

EXAMPLE
  $ apollo plugins

See code: @oclif/plugin-plugins

apollo plugins:inspect PLUGIN...

Displays installation properties of a plugin.

USAGE
  $ apollo plugins:inspect PLUGIN...

ARGUMENTS
  PLUGIN  [default: .] Plugin to inspect.

OPTIONS
  -h, --help     Show CLI help.
  -v, --verbose

EXAMPLE
  $ apollo plugins:inspect myplugin

See code: @oclif/plugin-plugins

apollo plugins:install PLUGIN...

Installs a plugin into the CLI.

USAGE
  $ apollo plugins:install PLUGIN...

ARGUMENTS
  PLUGIN  Plugin to install.

OPTIONS
  -f, --force    Run yarn install with force flag.
  -h, --help     Show CLI help.
  -v, --verbose

DESCRIPTION
  Can be installed from npm or a git url.

  Installation of a user-installed plugin will override a core plugin.

  e.g. If you have a core plugin that has a 'hello' command, installing a
  user-installed plugin with a 'hello' command will override the core
  plugin implementation. This is useful if a user needs to update core
  plugin functionality in the CLI without the need to patch and update the
   whole CLI.

ALIASES
  $ apollo plugins:add

EXAMPLES
  $ apollo plugins:install myplugin
  $ apollo plugins:install https://github.com/someuser/someplugin
  $ apollo plugins:install someuser/someplugin

See code: @oclif/plugin-plugins

apollo plugins:link PLUGIN

Links a plugin into the CLI for development.

USAGE
  $ apollo plugins:link PLUGIN

ARGUMENTS
  PATH  [default: .] path to plugin

OPTIONS
  -h, --help     Show CLI help.
  -v, --verbose

DESCRIPTION
  Installation of a linked plugin will override a user-installed or core
  plugin.

  e.g. If you have a user-installed or core plugin that has a 'hello'
  command, installing a linked plugin with a 'hello' command will override
   the user-installed or core plugin implementation. This is useful for
  development work.

EXAMPLE
  $ apollo plugins:link myplugin

See code: @oclif/plugin-plugins

apollo plugins:uninstall PLUGIN...

Removes a plugin from the CLI.

USAGE
  $ apollo plugins:uninstall PLUGIN...

ARGUMENTS
  PLUGIN  plugin to uninstall

OPTIONS
  -h, --help     Show CLI help.
  -v, --verbose

ALIASES
  $ apollo plugins:unlink
  $ apollo plugins:remove

See code: @oclif/plugin-plugins

apollo plugins:update

Update installed plugins.

USAGE
  $ apollo plugins:update

OPTIONS
  -h, --help     Show CLI help.
  -v, --verbose

See code: @oclif/plugin-plugins

apollo service:check

[DEPRECATED] Check a service against known operation workloads to find breaking changes

USAGE
  $ apollo service:check

OPTIONS
  -c, --config=config
      Path to your Apollo config file

  -g, --graph=graph
      The ID of the graph in Apollo to check your proposed schema changes
      against. Overrides config file if set.

  -v, --variant=variant
      The variant to check the proposed schema against

  --author=author
      The author to associate with this proposed schema

  --branch=branch
      The branch name to associate with this check

  --commitId=commitId
      The SHA-1 hash of the commit to associate with this check

  --endpoint=endpoint
      The URL for the CLI use to introspect your service

  --header=header
      Additional header to send during introspection. May be used multiple
      times to add multiple headers. NOTE: The `--endpoint` flag is REQUIRED
      if using the `--header` flag.

  --ignoreFailures
      Exit with status 0 when the check completes, even if errors are found

  --json
      Output result in json, which can then be parsed by CLI tools such as
      jq.

  --key=key
      The API key to use for authentication to Apollo

  --localSchemaFile=localSchemaFile
      Path to one or more local GraphQL schema file(s), as introspection
      result or SDL. Supports comma-separated list of paths (ex.
      `--localSchemaFile=schema.graphql,extensions.graphql`)

  --markdown
      Output result in markdown.

  --queryCountThreshold=queryCountThreshold
      Minimum number of requests within the requested time window for a
      query to be considered.

  --queryCountThresholdPercentage=queryCountThresholdPercentage
      Number of requests within the requested time window for a query to be
      considered, relative to total request count. Expected values are
      between 0 and 0.05 (minimum 5% of total request volume)

  --serviceName=serviceName
      Provides the name of the implementing service for a federated graph.
      This flag will indicate that the schema is a partial schema from a
      federated service

  --validationPeriod=validationPeriod
      The size of the time window with which to validate the schema against.
      You may provide a number (in seconds), or an ISO8601 format duration
      for more granularity (see:
      https://en.wikipedia.org/wiki/ISO_8601#Durations)

DESCRIPTION
  -----------------------------------------------------------------
  DEPRECATED: This command will be removed from the `apollo` CLI in
  its next major version. Replacement functionality is available in
  the new Apollo Rover CLI: https://go.apollo.dev/t/migration
  -----------------------------------------------------------------

ALIASES
  $ apollo schema:check

See code: src/commands/service/check.ts

apollo service:delete

[DEPRECATED] Delete a federated service from Apollo and recompose remaining services

USAGE
  $ apollo service:delete

OPTIONS
  -c, --config=config        Path to your Apollo config file

  -g, --graph=graph          The ID of the graph in Apollo for which to
                             delete an implementing service. Overrides
                             config file if set.

  -v, --variant=variant      The variant to delete the implementing
                             service from

  -y, --yes                  Bypass confirmation when deleting a service

  --endpoint=endpoint        The URL for the CLI use to introspect your
                             service

  --header=header            Additional header to send during
                             introspection. May be used multiple times to
                             add multiple headers. NOTE: The `--endpoint`
                             flag is REQUIRED if using the `--header`
                             flag.

  --key=key                  The API key to use for authentication to
                             Apollo

  --serviceName=serviceName  (required) Provides the name of the
                             implementing service for a federated graph

DESCRIPTION
  -----------------------------------------------------------------
  DEPRECATED: This command will be removed from the `apollo` CLI in
  its next major version. Replacement functionality is available in
  the new Apollo Rover CLI: https://go.apollo.dev/t/migration
  -----------------------------------------------------------------

See code: src/commands/service/delete.ts

apollo service:download OUTPUT

[DEPRECATED] Download the schema from your GraphQL endpoint.

USAGE
  $ apollo service:download OUTPUT

ARGUMENTS
  OUTPUT  [default: schema.json] Path to write the introspection result
          to. Supports .json output only.

OPTIONS
  -c, --config=config      Path to your Apollo config file

  -g, --graph=graph        The ID of the graph in the Apollo registry for
                           which to download the schema for. Overrides
                           config file if provided.

  -k, --skipSSLValidation  Allow connections to an SSL site without certs

  -v, --variant=variant    The variant to download the schema of

  --endpoint=endpoint      The URL for the CLI use to introspect your
                           service

  --header=header          Additional header to send during introspection.
                           May be used multiple times to add multiple
                           headers. NOTE: The `--endpoint` flag is
                           REQUIRED if using the `--header` flag.

  --key=key                The API key to use for authentication to Apollo

DESCRIPTION
  -----------------------------------------------------------------
  DEPRECATED: This command will be removed from the `apollo` CLI in
  its next major version. Replacement functionality is available in
  the new Apollo Rover CLI: https://go.apollo.dev/t/migration
  -----------------------------------------------------------------

ALIASES
  $ apollo schema:download

See code: src/commands/service/download.ts

apollo service:list

[DEPRECATED] List the services in a graph

USAGE
  $ apollo service:list

OPTIONS
  -c, --config=config    Path to your Apollo config file

  -g, --graph=graph      The ID of the graph in the Apollo registry for
                         which to list implementing services. Overrides
                         config file if set.

  - 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap