From 8115d1c6034efd7a8f7d84e32eabb9dc2dea56b4 Mon Sep 17 00:00:00 2001 From: purple Date: Tue, 30 Jan 2024 23:29:21 +0100 Subject: [PATCH] feat `core` `routes`: Working version of Blueprint route support. --- blueprint.sh | 20 ++++++++++--------- .../blueprint/extends/routers/routes.ts | 12 ----------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/blueprint.sh b/blueprint.sh index 9f81960..08fd254 100644 --- a/blueprint.sh +++ b/blueprint.sh @@ -562,14 +562,12 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) ]]; then VCMD="y" sed -i "s/\/\* ${identifier^}ImportStart \*\/.*\/\* ${identifier^}ImportEnd \*\///" "resources/scripts/blueprint/extends/routers/routes.ts" sed -i "s~/\* ${identifier^}ImportStart \*/~~g" "resources/scripts/blueprint/extends/routers/routes.ts" sed -i "s~/\* ${identifier^}ImportEnd \*/~~g" "resources/scripts/blueprint/extends/routers/routes.ts" - # Account routes - sed -i "/{\/\* ${identifier^}AccountRouteStart \*\/}/,/{\/\* ${identifier^}AccountRouteEnd \*\/}/d" "resources/scripts/blueprint/extends/routers/routes.ts" + sed -i "s/{\/\* ${identifier^}AccountRouteStart \*\/}.*{\/\* ${identifier^}AccountRouteEnd \*\/}//" "resources/scripts/blueprint/extends/routers/routes.ts" sed -i "s~{/\* ${identifier^}AccountRouteStart \*/}~~g" "resources/scripts/blueprint/extends/routers/routes.ts" sed -i "s~{/\* ${identifier^}AccountRouteEnd \*/}~~g" "resources/scripts/blueprint/extends/routers/routes.ts" - # Server routes - sed -i "/{\/\* ${identifier^}ServerRouteStart \*\/}/,/{\/\* ${identifier^}ServerRouteEnd \*\/}/d" "resources/scripts/blueprint/extends/routers/routes.ts" + sed -i "s/{\/\* ${identifier^}ServerRouteStart \*\/}.*{\/\* ${identifier^}ServerRouteEnd \*\/}//" "resources/scripts/blueprint/extends/routers/routes.ts" sed -i "s~{/\* ${identifier^}ServerRouteStart \*/}~~g" "resources/scripts/blueprint/extends/routers/routes.ts" sed -i "s~{/\* ${identifier^}ServerRouteEnd \*/}~~g" "resources/scripts/blueprint/extends/routers/routes.ts" fi @@ -1241,8 +1239,6 @@ if [[ ( $2 == "-r" ) || ( $2 == "-remove" ) ]]; then VCMD="y" # Remove dashboard components if [[ $dashboard_components != "" ]]; then PRINT INFO "Removing and unlinking dashboard components.." - rm -r $FOLDER/.blueprint/extensions/"$identifier"/components - rm -r $FOLDER/resources/scripts/blueprint/extensions/"$identifier" # fetch component config eval "$(parse_yaml .blueprint/extensions/"$identifier"/components/Components.yml Components_)" @@ -1326,21 +1322,23 @@ if [[ ( $2 == "-r" ) || ( $2 == "-remove" ) ]]; then VCMD="y" REMOVE_REACT "$Components_Account_SSH_BeforeContent" "Account/SSH/BeforeContent.tsx" REMOVE_REACT "$Components_Account_SSH_AfterContent" "Account/SSH/AfterContent.tsx" + rm -r $FOLDER/.blueprint/extensions/"$identifier"/components + rm -r $FOLDER/resources/scripts/blueprint/extensions/"$identifier" YARN="y" fi # Remove custom routes PRINT INFO "Unlinking navigation routes.." # Route import - sed -n -i "/\/\* ${identifier^}ImportStart \*\//{p; :a; N; /\/\* ${identifier^}ImportEnd \*\//!ba; s/.*\n//}; p" "resources/scripts/blueprint/extends/routers/routes.ts" + sed -i "s/\/\* ${identifier^}ImportStart \*\/.*\/\* ${identifier^}ImportEnd \*\///" "resources/scripts/blueprint/extends/routers/routes.ts" sed -i "s~/\* ${identifier^}ImportStart \*/~~g" "resources/scripts/blueprint/extends/routers/routes.ts" sed -i "s~/\* ${identifier^}ImportEnd \*/~~g" "resources/scripts/blueprint/extends/routers/routes.ts" # Account routes - sed -n -i "/\{\/\* ${identifier^}AccountRouteStart \*\/\}/{p; :a; N; /\{\/\* ${identifier^}AccountRouteEnd \*\/\}/!ba; s/.*\n//}; p" "resources/scripts/blueprint/extends/routers/routes.ts" + sed -i "s/{\/\* ${identifier^}AccountRouteStart \*\/}.*{\/\* ${identifier^}AccountRouteEnd \*\/}//" "resources/scripts/blueprint/extends/routers/routes.ts" sed -i "s~{/\* ${identifier^}AccountRouteStart \*/}~~g" "resources/scripts/blueprint/extends/routers/routes.ts" sed -i "s~{/\* ${identifier^}AccountRouteEnd \*/}~~g" "resources/scripts/blueprint/extends/routers/routes.ts" # Server routes - sed -n -i "/\{\/\* ${identifier^}ServerRouteStart \*\/\}/{p; :a; N; /\{\/\* ${identifier^}ServerRouteEnd \*\/\}/!ba; s/.*\n//}; p" "resources/scripts/blueprint/extends/routers/routes.ts" + sed -i "s/{\/\* ${identifier^}ServerRouteStart \*\/}.*{\/\* ${identifier^}ServerRouteEnd \*\/}//" "resources/scripts/blueprint/extends/routers/routes.ts" sed -i "s~{/\* ${identifier^}ServerRouteStart \*/}~~g" "resources/scripts/blueprint/extends/routers/routes.ts" sed -i "s~{/\* ${identifier^}ServerRouteEnd \*/}~~g" "resources/scripts/blueprint/extends/routers/routes.ts" @@ -1360,6 +1358,10 @@ if [[ ( $2 == "-r" ) || ( $2 == "-remove" ) ]]; then VCMD="y" rm -R ".blueprint/extensions/$identifier/assets" rm -R "public/assets/extensions/$identifier" + # Remove extension directory + PRINT INFO "Removing extension folder.." + rm -R ".blueprint/extensions/$identifier" + # Rebuild panel if [[ $YARN == "y" ]]; then PRINT INFO "Rebuilding panel assets.." diff --git a/resources/scripts/blueprint/extends/routers/routes.ts b/resources/scripts/blueprint/extends/routers/routes.ts index acacd3a..a6f4a09 100644 --- a/resources/scripts/blueprint/extends/routers/routes.ts +++ b/resources/scripts/blueprint/extends/routers/routes.ts @@ -1,7 +1,6 @@ import React from 'react'; /* blueprint/import */ -import ExampleContainer from './ExampleComponent'; interface ExtendedRouteDefinition { path: string; @@ -19,20 +18,9 @@ interface Routes { export default { account: [ - { - path: '/example', - name: 'Example', - component: ExampleContainer, - }, {/* routes/account */} ], server: [ - { - path: '/example', - permission: null, - name: 'Example', - component: ExampleContainer, - }, {/* routes/server */} ], } as Routes;