Skip to content

Commit e972619

Browse files
committed
Feat: Add typedoc
1 parent 7dbcb1d commit e972619

File tree

16 files changed

+80
-12
lines changed

16 files changed

+80
-12
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,7 @@ Thumbs.db
4646
!email/mailmerge-cli/assets/template-workspace/.env
4747

4848
# legacy code that has secrets
49-
legacy
49+
legacy
50+
51+
# docs
52+
docs

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ You should use `build-local` when working on just the TypeScript code
3434
npx nx run-many -t build
3535
```
3636

37+
### Documentation
38+
39+
You can get API documentation for everything in the repo by running:
40+
41+
```
42+
npm run docs
43+
```
44+
45+
This will output the documentation to `./docs/` in the repo root.
46+
3747
### Linting
3848

3949
```bash

common/util/src/logger.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import winston from "winston";
44
const { combine, colorize, printf, timestamp } = winston.format;
55

66
/**
7-
* Create a logger with the given module name
7+
* Create a logger with the given module name.
8+
*
9+
* The logger is an instance of `winston.Logger` with a single `Console` transport, which logs to the console in this format:
10+
* ```
11+
* 2024-07-31T20:08:14.697Z my-module info Hello, world!
12+
* ```
813
* @param moduleName Name of the module to log
914
* @returns Logger instance
1015
*
@@ -21,9 +26,9 @@ export default function createLogger(moduleName: string) {
2126
colorize(),
2227
timestamp(),
2328
printf((info) => {
24-
return `${chalk.grey(info["timestamp"])} ${chalk.magenta(moduleName)} ${info.level} ${
25-
info.message
26-
}`;
29+
return `${chalk.grey(info["timestamp"])} ${chalk.magenta(moduleName)} ${
30+
info.level
31+
} ${info.message}`;
2732
}),
2833
),
2934
level: "debug",

common/util/src/move.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import fs from "fs/promises";
22
import { join, basename } from "path";
33

4+
/**
5+
* Move a file to a directory, maintaing the same name.
6+
*/
47
export const move = (file: string, directory: string) => {
58
return fs.rename(file, join(directory, basename(file)));
69
};

common/util/typedoc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": [
3+
"../../typedoc.base.jsonc"
4+
],
5+
"entryPoints": [
6+
"src/index.ts"
7+
]
8+
}

email/mailmerge-cli/typedoc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": [
3+
"../../typedoc.base.jsonc"
4+
],
5+
"entryPoints": [
6+
"src/index.ts"
7+
]
8+
}

email/mailmerge/src/engines/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* @packageDocumentation
44
*/
55
import { MappedRecord } from "../util/types";
6+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
7+
import NunjucksMarkdownEngine from "./nunjucks-md/index.js";
68

79
/**
810
* Generic "any" type for template engine options: essentially a dictionary.

email/mailmerge/src/pipelines/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface GenerateOptions {
2323
*
2424
* Using this you can overridee mappings of attachments from the records with a list of attachments for every email.
2525
*
26-
* This will result in {@link GenerateOptions.mappings.keysForAttachments} being ignored.
26+
* This will result in {@link GenerateOptions["mappings"].keysForAttachments} being ignored.
2727
*
2828
* As a result, every email will have the same attachments.
2929
*/

email/mailmerge/src/pipelines/loaders/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { RawRecord } from "../../util";
1+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2+
import { DEFAULT_FIELD_NAMES, RawRecord } from "../../util/index.js";
3+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
4+
import { CSVBackend } from "./csv.js";
25

36
/**
47
* Generic way of loading data in to do a data merge on.

email/mailmerge/src/pipelines/storage/sidecar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { MappedRecord } from "../../util/index.js";
1717
import { StorageBackend, MergeResultWithMetadata, MergeResult } from "./types";
1818

1919
/** Metadata the JSON backend passes on {@link MergeResultWithMetadata.storageBackendMetadata} - bsically the original sidecar file with the path it came from */
20-
interface JSONSidecarsBackendMetadata {
20+
export interface JSONSidecarsBackendMetadata {
2121
sideCar: SidecarData & {
2222
/** Path to the original sidecar file */
2323
$originalFilepath: string;

0 commit comments

Comments
 (0)