mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-25 09:16:15 -04:00
feat(app): tools management base
This commit is contained in:
parent
202896fa95
commit
b22173681c
29 changed files with 1372 additions and 45 deletions
18
packages/app/src/modules/tools/tools.models.ts
Normal file
18
packages/app/src/modules/tools/tools.models.ts
Normal 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,
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue