mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-23 16:26:15 -04:00
18 lines
527 B
TypeScript
18 lines
527 B
TypeScript
export function defineTool(toolDefinition: {
|
|
slug: string;
|
|
entryFile: string;
|
|
currentDirUrl: string;
|
|
icon: string;
|
|
createdAt: Date;
|
|
}) {
|
|
const entryFile = new URL(toolDefinition.entryFile, toolDefinition.currentDirUrl).pathname;
|
|
const baseGithubUrlPath = entryFile.match(/(\/tools\/.*)$/)?.[1];
|
|
const entryFileGithubUrl = `https://github.com/CorentinTh/crucials-tools/blob/main${baseGithubUrlPath}`;
|
|
|
|
return {
|
|
...toolDefinition,
|
|
key: toolDefinition.slug,
|
|
entryFile,
|
|
entryFileGithubUrl,
|
|
};
|
|
}
|