Skip to main content

Connector file structure

Attached is a file tree to demonstrate how are connectors' files organized as a TypeScript project.

Files whose name ends up with ^ refer to an optional file, otherwise are required.

ConnectorRootDir/
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ logo.svg
โ”œโ”€โ”€ logo-dark.svg^
โ””โ”€โ”€ src/
โ”œโ”€โ”€ index.ts
โ”œโ”€โ”€ index.test.ts
โ”œโ”€โ”€ types.ts
โ”œโ”€โ”€ constant.ts
โ”œโ”€โ”€ mock.ts^
โ”œโ”€โ”€ utils.ts^
โ”œโ”€โ”€ utils.test.ts^
โ””โ”€โ”€ ...

Based on the connector file structure, let's go through each file and figure out how they work together as a whole system.

package.jsonโ€‹

package.json contains configurations of this connector repo. It will be merged with a sharing package.json, which contains common dependencies and attributes.

README.mdโ€‹

README.md is an elaborated guide for setting up the connector's config.

logo.svgโ€‹

logo.svg is a file that stores the connector's logo in vector image format.

logo-dark.svgโ€‹

logo-dark.svg file contains vector graphic of connector's dark mode logo.

note

See connector logo to know more about the relationship between logo.svg and logo-dark.svg.

index.tsโ€‹

index.ts is the file for connector class implementation.

index.test.tsโ€‹

index.test.ts is a file containing corresponding unit tests (UTs) for implementations in index.ts.

types.tsโ€‹

types.ts is where you should define variables' types.

constant.tsโ€‹

constant.ts is where you should put constants related to the connector, including endpoints, connector metadata, etc.

mock.tsโ€‹

mock.ts is the file you may put mocked values for testing purposes.

utils.tsโ€‹

utils.ts is the file where developers put utility functions, and utils.test.ts should contain relating UTs.