feat: add deno task config in fresh init bootstrapped projects (#143)

This commit is contained in:
Yongwook Choi
2022-04-23 15:16:31 +02:00
committed by GitHub
parent bfd5bd3e9f
commit 49d2e54335
7 changed files with 33 additions and 11 deletions
+2 -2
View File
@@ -40,10 +40,10 @@ The `fresh` CLI can scaffold a new project for you. To scaffold a project in the
fresh init my-project
```
To now start the project, call `deno run`:
To now start the project, use `deno task`:
```
deno run -A --watch main.ts
deno task start
```
To deploy the script to [Deno Deploy](https://deno.com/deploy), push your
+5 -4
View File
@@ -4,7 +4,7 @@ Welcome to the `fresh` documentation.
## Requirements
The documentation assumes you have Deno 1.12.0 or later installed.
The documentation assumes you have Deno 1.20.1 or later installed.
To install Deno, follow the installation instructions in the manual:
https://deno.land/manual/getting_started/installation
@@ -45,11 +45,12 @@ To learn more about how projects are structured, take a look at the
You can now run your new project locally using the `deno` CLI:
```
deno run -A --watch main.ts
deno task start
```
The `--watch` option will cause your script to be reloaded on any changes to the
source. If you do not want this you can omit the `--watch` option.
The `--watch` option in `start` task will cause your script to be reloaded on
any changes to the source. If you do not want this you can omit the `--watch`
option in `deno.json`.
After you have started the project, you can view it in your browser at
http://localhost:8000. You will first get served a JIT server rendered page,
+10 -2
View File
@@ -1,6 +1,14 @@
The next step after scaffolding out a new project, is to actually start it. To
do this you can just `deno run` the `main.ts` file with the appropriate flags.
You will need to provide permission flags for:
do this you can just `deno task start`.
```
$ deno task start
Watcher Process started.
Server listening on http://localhost:8000
```
If you want to start manually without Deno task, `deno run` the `main.ts` with
the appropriate flags. You will need to provide permission flags for:
- **`--allow-net`**: This is required to start the HTTP server.
- **`--allow-read`**: This is required to read (static) files from disk.
+1 -1
View File
@@ -5,7 +5,7 @@
Start the project:
```
deno run -A --watch main.ts
deno task start
```
After adding, removing, or moving a page in the `routes` or directory, or
+5
View File
@@ -0,0 +1,5 @@
{
"tasks": {
"start": "deno run -A --watch main.ts"
}
}
+9 -1
View File
@@ -186,6 +186,14 @@ await start(manifest);
// this throws on windows
}
const DENO_CONFIG = `{
"tasks": {
"start": "deno run -A --watch main.ts"
}
}`;
await Deno.writeTextFile(join(directory, "deno.json"), DENO_CONFIG);
const README_MD = `# fresh project
### Usage
@@ -193,7 +201,7 @@ await start(manifest);
Start the project:
\`\`\`
deno run -A --watch main.ts
deno task start
\`\`\`
After adding, removing, or moving a page in the \`routes\` or directory, or adding,
+1 -1
View File
@@ -153,7 +153,7 @@ function GettingStarted() {
to start the development server:
</p>
<pre class={tw`overflow-x-auto py-2 px-4 bg(gray-100)`}>
deno run -A --watch main.ts
deno task start
</pre>
<p class={tw`text-gray-600`}>
You can now open{" "}