mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-24 00:36:14 -04:00
19 lines
527 B
TypeScript
19 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,
|
||
|
};
|
||
|
}
|