feat: add deno task config in fresh init bootstrapped projects (#143)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"tasks": {
|
||||
"start": "deno run -A --watch main.ts"
|
||||
}
|
||||
}
|
||||
+9
-1
@@ -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,
|
||||
|
||||
@@ -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{" "}
|
||||
|
||||
Reference in New Issue
Block a user