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
3 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
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
import type { Shortlinker } from "./types.js";
2
+
3
+
export const multiShortlinker = (shortlinkers: Shortlinker[]): Shortlinker => {
4
+
return {
5
+
name: "multi-shortlinker",
6
+
async run(mappings, logger) {
7
+
logger.info(`Creating shortlinks on ${shortlinkers.length} services`);
8
+
9
+
for (const shortlinker of shortlinkers) {
10
+
logger.info(`Running ${shortlinker.name}`);
11
+
const shortlinkerLogger = logger.fork(
12
+
`astro-shortlinks/${shortlinker.name}`
13
+
);
14
+
15
+
try {
16
+
const succeeded = await shortlinker.run(mappings, shortlinkerLogger);
17
+
18
+
if (succeeded !== false) {
19
+
logger.info(
20
+
`Successfully created shortlinks with ${shortlinker.name}`
21
+
);
22
+
}
23
+
} catch (err) {
24
+
logger.error(
25
+
`Error while creating shortlinks with ${shortlinker.name}: ${err}`
26
+
);
27
+
}
28
+
}
29
+
},
30
+
};
31
+
};