From cd22efaa930824e673ae47ebb72866a9bdf14ce4 Mon Sep 17 00:00:00 2001 From: Octo8080 Date: Sun, 7 Jan 2024 14:03:05 +0900 Subject: [PATCH] Update --- cli.ts | 19 +++++++++++-------- deps.ts | 4 +--- routesTemplate/logout.tsx | 3 +-- src/routes/logout.tsx | 10 ++-------- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/cli.ts b/cli.ts index 0829861..8a55c87 100644 --- a/cli.ts +++ b/cli.ts @@ -3,8 +3,10 @@ import { ensureDirSync } from "https://deno.land/std@0.210.0/fs/ensure_dir.ts"; import { existsSync } from "https://deno.land/std@0.210.0/fs/exists.ts"; const parsedArgs = parseArgs(Deno.args); -if(!parsedArgs["_"][0]) { - console.error("\u001b[31m[ERROR]:Please input resource name. ex cli.ts user\u001b[0m"); +if (!parsedArgs["_"][0]) { + console.error( + "\u001b[31m[ERROR]:Please input resource name. ex cli.ts user\u001b[0m", + ); Deno.exit(1); } @@ -13,7 +15,7 @@ ensureDirSync(`./plantation/${parsedArgs["_"][0]}`); // ./plantation/extra_load.tsx が存在しなければ作成する if (!existsSync(`./plantation/extra_load.tsx`)) { - const souceText = "console.log('Load ./plantation!');\n" + const souceText = "console.log('Load ./plantation!');\n"; Deno.writeTextFileSync( `./plantation/extra_load.ts`, @@ -22,7 +24,6 @@ if (!existsSync(`./plantation/extra_load.tsx`)) { console.info(`✅ Create File: ./plantation/extra_load.ts`); } - const create = await fetch( "https://deno.land/x/plantation@0.0.1/routesTemplate/create.tsx?source=", ); @@ -35,7 +36,7 @@ console.info(`✅ Create File: ${createFilePath}`); Deno.writeTextFileSync( `./plantation/extra_load.ts`, `(async () => await import('.${createFilePath}'));\n`, - {append: true} + { append: true }, ); const login = await fetch( @@ -51,7 +52,7 @@ console.info(`✅ Create File: ${loginFilePath}`); Deno.writeTextFileSync( `./plantation/extra_load.ts`, `(async () => await import('.${loginFilePath}'));\n`, - {append: true} + { append: true }, ); const logout = await fetch( "https://raw.githubusercontent.com/Octo8080X/plantation/main/routesTemplate/logout.tsx", @@ -66,7 +67,9 @@ console.info(`✅ Create File: ${logoutFilePath}`); Deno.writeTextFileSync( `./plantation/extra_load.ts`, `(async () => await import('.${logoutFilePath}'));\n`, - {append: true} + { append: true }, ); -console.info(`Please add \`(async () => await import('./plantation/extra_loader.ts'));\` to your main.ts.`); \ No newline at end of file +console.info( + `Please add \`(async () => await import('./plantation/extra_loader.ts'));\` to your main.ts.`, +); diff --git a/deps.ts b/deps.ts index 22e3e8c..02f1eba 100644 --- a/deps.ts +++ b/deps.ts @@ -22,6 +22,4 @@ export { type WithCsrf, } from "https://deno.land/x/fresh_csrf@0.1.2/mod.ts"; export { h, type JSX } from "https://esm.sh/preact@10.19.2"; -export { - setCookie, -} from "https://deno.land/std@0.211.0/http/cookie.ts"; +export { setCookie } from "https://deno.land/std@0.211.0/http/cookie.ts"; diff --git a/routesTemplate/logout.tsx b/routesTemplate/logout.tsx index 7cb8bd3..a2cf4de 100644 --- a/routesTemplate/logout.tsx +++ b/routesTemplate/logout.tsx @@ -6,8 +6,7 @@ import { } from "https://deno.land/x/plantation/templateDeps.ts"; export function getLogoutHandler( - { auth, logoutAfterPath }: - PlantationInnerParams, + { auth, logoutAfterPath }: PlantationInnerParams, ): Handlers { return { async POST(req: Request, ctx: FreshContext) { diff --git a/src/routes/logout.tsx b/src/routes/logout.tsx index 66378de..bb51e7b 100644 --- a/src/routes/logout.tsx +++ b/src/routes/logout.tsx @@ -1,14 +1,8 @@ -import { - FreshContext, - Handlers, - setCookie, - WithCsrf, -} from "../../deps.ts"; +import { FreshContext, Handlers, setCookie, WithCsrf } from "../../deps.ts"; import { PlantationInnerParams } from "../../types.ts"; export function getLogoutHandler( - { auth, logoutAfterPath }: - PlantationInnerParams, + { auth, logoutAfterPath }: PlantationInnerParams, ): Handlers { return { async POST(req: Request, ctx: FreshContext) {