|
| 1 | +# RFC: add documentation page to packaging spec |
| 2 | + |
| 3 | +> [!NOTE] |
| 4 | +> This RFC builds upon the concepts defined in [Native Connector Packaging](./0004-native-packaging.md) |
| 5 | +
|
| 6 | +Connectors that run in the native environment such as typescript have a different getting started workflow for local development compared to connectors that run in docker such as postgres. |
| 7 | + |
| 8 | +Users expect the same steps that they tried with one connector to work with another. |
| 9 | + |
| 10 | +The CLI wishes to link users to the docs page for a specific connector on running `ddn connector init` so that users have clear directions to next steps. |
| 11 | + |
| 12 | +## Solution |
| 13 | + |
| 14 | +Extend the packaging spec definition to include `documentationPage` which points to a connector-specific getting started page. The primary use for this is for the CLI to link to getting started instructions after the user adds the connector to their project. |
| 15 | + |
| 16 | +This should NOT point to the homepage or repository page for the connector, unless that page also contains getting started instructions. This should NOT point to any other reference pages aside from getting started instructions. |
| 17 | + |
| 18 | +The page may be hosted on the Hasura docs, on Hasura hub, or on the repository. Hasura connector authors are encouraged to point to Hasura docs as this serves as the primary channel through which users are otherwise onboarded to ddn. |
| 19 | + |
| 20 | +It is highly recommended that you create a redirection URL to the actual page you want to use (for example, creating https://hasura.info/nodejs-getting-started that redirects to https://hasura.io/docs/3.0/getting-started/build/add-business-logic/?db=TypeScript). This will enable you to update the target of the redirection URL in the future if the documentation ever moves. |
| 21 | + |
| 22 | +**connector-metadata.yaml** |
| 23 | + |
| 24 | +```yaml |
| 25 | +documentationPage: "https://hasura.info/nodejs-getting-started" |
| 26 | +``` |
| 27 | +
|
| 28 | +
|
| 29 | +## `connector-metadata.yaml` types |
| 30 | + |
| 31 | +```typescript |
| 32 | +type ConnectorMetadataDefinition = { |
| 33 | + packagingDefinition: PackagingDefinition |
| 34 | + nativeToolchainDefinition?: NativeToolchainDefinition |
| 35 | + supportedEnvironmentVariables: EnvironmentVariableDefinition[] |
| 36 | + commands: Commands |
| 37 | + cliPlugin?: CliPluginDefinition |
| 38 | + dockerComposeWatch: DockerComposeWatch |
| 39 | + documentationPage: string // NEW |
| 40 | +} |
| 41 | +
|
| 42 | +type PackagingDefinition = PrebuiltDockerImagePackaging | ManagedDockerBuildPackaging |
| 43 | +
|
| 44 | +type PrebuiltDockerImagePackaging = { |
| 45 | + type: "PrebuiltDockerImage" |
| 46 | + dockerImage: string |
| 47 | +} |
| 48 | +
|
| 49 | +type ManagedDockerBuildPackaging = { |
| 50 | + type: "ManagedDockerBuild" |
| 51 | +} |
| 52 | +
|
| 53 | +type NativeToolchainDefinition = { |
| 54 | + commands: NativeToolchainCommands |
| 55 | +} |
| 56 | +
|
| 57 | +type NativeToolchainCommands = { |
| 58 | + start: string | DockerizedCommand | ShellScriptCommand // Compulsory |
| 59 | + update?: string | DockerizedCommand | ShellScriptCommand |
| 60 | + watch: string | DockerizedCommand | ShellScriptCommand // Compulsory |
| 61 | +} |
| 62 | +
|
| 63 | +type EnvironmentVariableDefinition = { |
| 64 | + name: string |
| 65 | + description: string |
| 66 | + defaultValue?: string |
| 67 | +} |
| 68 | +
|
| 69 | +type Commands = { |
| 70 | + update?: string | DockerizedCommand | ShellScriptCommand |
| 71 | + watch?: string | DockerizedCommand | ShellScriptCommand |
| 72 | +} |
| 73 | +
|
| 74 | +// From https://github.com/hasura/ndc-hub/pull/129 (outside of this RFC) |
| 75 | +type DockerizedCommand = { |
| 76 | + type: "Dockerized" |
| 77 | + dockerImage: string |
| 78 | + commandArgs: string[] |
| 79 | +} |
| 80 | +
|
| 81 | +type ShellScriptCommand = { |
| 82 | + type: "ShellScript" |
| 83 | + bash: string |
| 84 | + powershell: string |
| 85 | +} |
| 86 | +
|
| 87 | +type CliPluginDefinition = { |
| 88 | + name: string |
| 89 | + version: string |
| 90 | +} |
| 91 | +
|
| 92 | +// From: https://github.com/compose-spec/compose-spec/blob/1938efd103f8e0817ca90e5f15177ec0317bbaf8/schema/compose-spec.json#L455 |
| 93 | +type DockerComposeWatch = DockerComposeWatchItem[] |
| 94 | +
|
| 95 | +type DockerComposeWatchItem = { |
| 96 | + path: string |
| 97 | + action: "rebuild" | "sync" | "sync+restart" |
| 98 | + target?: string |
| 99 | + ignore?: string[] |
| 100 | +} |
| 101 | +``` |
0 commit comments