1.0.7 • Published 2 years ago

codegen-yaml-rewrite v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

codegen-yaml-rewrite

A simple package to rewrite the schema URL in graphql codegen.yaml file

requires Node 16+

Installation

Use the package manager npm or yarn to install codegen-yaml-rewrite.

npm install codegen-yaml-rewrite
yarn add codegen-yaml-rewrite

Requirement

A JSON config file should be created in the root folder named codegen-rewrite-config.json with the following keys and values

{
  "envPath": "./.env", // path to env file
  "targetYamlKey": "schema", // key to be replaced in the yaml
  "targetEnvKey": "NEXT_PUBLIC_GRAPHQL_ENDPOINT", // key to be used from env file
  "yamlPath": "./codegen.yaml" // path for codegen.yaml file
}

Example of codegen.yaml

schema: https://example.com/dev/graphql_api
generates:
  apps/exampleapp/graphql/generated.ts:
    plugins:
      - typescript
      - typescript-operations

Usage

in the package.json use this with prestart

  "scripts": {
    "prestart": "yarn codegen-yaml-rewrite && yarn generate",
  },

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago