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.
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.