diff --git a/src/cli/init.ts b/src/cli/init.ts index dad6a3d6..2fa6680f 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -159,7 +159,10 @@ export const handler = (_req: Request, _ctx: HandlerContext): Response => { ROUTES_API_JOKE_TS, ); - const MAIN_TS = `/// + const MAIN_TS = + `#!/usr/bin/env -S deno run --allow-read --allow-net --allow-env --allow-run --allow-hrtime --no-check --watch + +/// /// /// /// @@ -170,10 +173,14 @@ import manifest from "./fresh.gen.ts"; await start(manifest); `; - await Deno.writeTextFile( - join(directory, "main.ts"), - MAIN_TS, - ); + const MAIN_TS_PATH = join(directory, "main.ts"); + await Deno.writeTextFile(MAIN_TS_PATH, MAIN_TS); + try { + await Deno.chmod(MAIN_TS_PATH, 0o777); + } catch { + // this throws on windows + } + const README_MD = `# fresh project ### Usage