Skip to content

Commit

Permalink
feat: Add welcome plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
aXenDeveloper committed Jul 11, 2024
1 parent c4b3226 commit 0ecabbc
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 6 deletions.
8 changes: 4 additions & 4 deletions apps/backend/src/plugins/welcome/config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "Welcome",
"description": "",
"description": "Basic plugin with default page.",
"code": "welcome",
"author": "aXen",
"author_url": "",
"support_url": "https://axendev.net/",
"author": "VitNode",
"author_url": "https://vitnode.com/",
"support_url": "https://github.com/aXenDeveloper/vitnode/issues",
"allow_default": true,
"nav": []
}
4 changes: 3 additions & 1 deletion apps/backend/src/plugins/welcome/versions.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"10000": "1.0.0"
}
3 changes: 3 additions & 0 deletions apps/frontend/plugins/welcome/templates/default-page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function DefaultPage() {
return <div className="container">Default Page for welcome</div>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ export default defineConfig({
`;
};

export const createDefaultPage = ({ code }: { code: string }) => {
return `export default function DefaultPage() {
return <div className="container">Default Page for ${code}</div>;
}
`;
};

export const createInfoJSON = ({
allow_default,
author,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Injectable } from '@nestjs/common';

import {
createConfigForDrizzle,
createDefaultPage,
createFunctionsDatabase,
createInfoJSON,
createModuleAdminSchema,
Expand Down Expand Up @@ -41,6 +42,15 @@ export class CreateFilesAdminPluginsService {
},
],
},
{
path: ABSOLUTE_PATHS_BACKEND.plugin({ code }).frontend.templates,
files: [
{
name: 'default-page.tsx',
content: createDefaultPage({ code }),
},
],
},
{
path: ABSOLUTE_PATHS_BACKEND.plugin({ code }).admin,
files: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const mutationEditApi = async (
variables,
});

revalidatePath('/admin/core/plugins/blog/dev/overview', 'page');
revalidatePath('/', 'layout');

return { data };
} catch (error) {
Expand Down

0 comments on commit 0ecabbc

Please sign in to comment.