feat: use import maps instead of deps files (#209)
This commit updates fresh to use import maps instead of deps files in generated projects.
This commit is contained in:
@@ -14,8 +14,8 @@ $ fresh init my-project
|
||||
Manifest generated and written to ./my-project/fresh.gen.ts
|
||||
```
|
||||
|
||||
This will create a directory containing a bunch of files. Out of all of the
|
||||
files, only two are strictly necessary for a fresh project:
|
||||
This will create a directory containing some files and directories. There are 3
|
||||
files that are strictly necessary to run a fresh project:
|
||||
|
||||
- **`main.ts`**: This is the entrypoint for your project. It is the file that
|
||||
will you run to start your fresh application. This file doesn't actually need
|
||||
@@ -25,19 +25,17 @@ files, only two are strictly necessary for a fresh project:
|
||||
your routes and islands. This file is automatically generated based on your
|
||||
`routes/` and `islands/` folder by the `fresh` CLI when running the
|
||||
`fresh manifest` command.
|
||||
- **`import_map.json`**: This is an [import map][import-map] that is used to
|
||||
manage dependencies for the project. This allows for easy importing and
|
||||
updating of dependencies.
|
||||
|
||||
In addition to these two files, two other files are created that manage
|
||||
dependencies:
|
||||
A **`deno.json`** file is also created in the project directory. This file does
|
||||
two things:
|
||||
|
||||
- **`deps.client.ts`**: This file contains dependencies that you need on the
|
||||
client, and possibly also on the server. It should be assumed that all of the
|
||||
dependencies referenced by this file will be shipped to the client. By
|
||||
default, it just re-exports the `fresh` runtime.
|
||||
- **`deps.server.ts`**: This file contains dependencies that are only used on
|
||||
the server. These are often things like database drivers, API clients, or
|
||||
other code that should only be executed on the server. This file should never
|
||||
be referenced by modules that might be shipped to the client. By default this
|
||||
just re-exports the `fresh` server libraries.
|
||||
- It tells Deno about the location of the import map, so that it can be loaded
|
||||
automatically.
|
||||
- It registers a "start" [task][task-runner] to run the project without having
|
||||
to type a long `deno run` command.
|
||||
|
||||
Two important folders are also created that contain your routes and islands
|
||||
respectively:
|
||||
@@ -54,4 +52,6 @@ respectively:
|
||||
Finally a **`static/`** folder is created that contains static files that are
|
||||
automatically served "as is". [Learn more about static files][static-files].
|
||||
|
||||
[import-map]: https://deno.land/manual/linking_to_external_code/import_maps
|
||||
[task-runner]: https://deno.land/manual/tools/task_runner
|
||||
[static-files]: ../concepts/static-files
|
||||
|
||||
Reference in New Issue
Block a user