tangled
alpha
login
or
join now
ovyerus.com
/
astro-shortlinks
1
fork
atom
Automatically create shortlinks for your Astro site
1
fork
atom
overview
issues
pulls
pipelines
feat: multi shortlinker
ovyerus.com
2 months ago
159a485f
c103f38b
verified
This commit was signed with the committer's
known signature
.
ovyerus.com
SSH Key Fingerprint:
SHA256:mXbp9WNBIT0nRNe28t2hrxfSwnSX7UBeW2DVlIyf0uw=
+31
1 changed file
expand all
collapse all
unified
split
src
multi-shortlinker.ts
+31
src/multi-shortlinker.ts
···
1
1
+
import type { Shortlinker } from "./types.js";
2
2
+
3
3
+
export const multiShortlinker = (shortlinkers: Shortlinker[]): Shortlinker => {
4
4
+
return {
5
5
+
name: "multi-shortlinker",
6
6
+
async run(mappings, logger) {
7
7
+
logger.info(`Creating shortlinks on ${shortlinkers.length} services`);
8
8
+
9
9
+
for (const shortlinker of shortlinkers) {
10
10
+
logger.info(`Running ${shortlinker.name}`);
11
11
+
const shortlinkerLogger = logger.fork(
12
12
+
`astro-shortlinks/${shortlinker.name}`
13
13
+
);
14
14
+
15
15
+
try {
16
16
+
const succeeded = await shortlinker.run(mappings, shortlinkerLogger);
17
17
+
18
18
+
if (succeeded !== false) {
19
19
+
logger.info(
20
20
+
`Successfully created shortlinks with ${shortlinker.name}`
21
21
+
);
22
22
+
}
23
23
+
} catch (err) {
24
24
+
logger.error(
25
25
+
`Error while creating shortlinks with ${shortlinker.name}: ${err}`
26
26
+
);
27
27
+
}
28
28
+
}
29
29
+
},
30
30
+
};
31
31
+
};