feat(app): tools management base

This commit is contained in:
Corentin Thomasset 2024-10-26 10:54:32 +02:00
parent 202896fa95
commit b22173681c
No known key found for this signature in database
GPG key ID: DBD997E935996158
29 changed files with 1372 additions and 45 deletions

View file

@ -0,0 +1,18 @@
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,
};
}