feat: support embedded import map in deno.json (#1188)

One can now inline the `imports` and `scopes` from the import map directly into deno.json.

For new projects, `import_map.json` is not generated anymore.

Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
Asher Gomez
2023-06-03 10:46:40 +02:00
committed by GitHub
co-authored by Luca Casonato
parent 3857a49f1c
commit 1b6678951a
34 changed files with 149 additions and 197 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ ENV DENO_DEPLOYMENT_ID=${GIT_REVISION}
WORKDIR /app
COPY . .
RUN deno cache main.ts --import-map=import_map.json
RUN deno cache main.ts
EXPOSE 8000
+8 -9
View File
@@ -28,14 +28,14 @@ below.
To update your dependencies, you have two options:
- Run the fresh updater to update your project dependencies.
- Manually update the dependency versions in your `import_map.json` file.
- Manually update the dependency versions in your `deno.json` file.
### Auto updater
The auto updater is a command line tool that will update your project's
`import_map.json` file to the latest versions of Fresh and its dependencies. It
may also contain code mods for your project that will update your code to the
latest recommended patterns for Fresh projects.
`deno.json` file to the latest versions of Fresh and its dependencies. It may
also contain code mods for your project that will update your code to the latest
recommended patterns for Fresh projects.
To run the auto updater, run the following command from the root of your
project:
@@ -48,11 +48,10 @@ You will be prompted to confirm the changes that will be made to your project.
### Manual update
To manually update your project's dependencies, you can edit the
`import_map.json` file in the root of your projects directory. Dependency
versions are encoded into the URLs in this file. For example, here is how to
update a project from Fresh 1.0.2 to 1.1.3, and update Preact to the latest
version:
To manually update your project's dependencies, you can edit the `deno.json`
file in the root of your projects directory. Dependency versions are encoded
into the URLs in this file. For example, here is how to update a project from
Fresh 1.0.2 to 1.1.3, and update Preact to the latest version:
```diff
{
+3 -5
View File
@@ -30,15 +30,13 @@ files that are strictly necessary to run a fresh project:
- **`fresh.gen.ts`**: This is the manifest file that contains information about
your routes and islands. This file is automatically generated in development
based on your `routes/` and `islands/` folders.
- **`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.
A **`deno.json`** file is also created in the project directory. This file does
two things:
- It tells Deno about the location of the import map, so that it can be loaded
automatically.
- It defines the "imports" field. 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.
- It registers a "start" [task][task-runner] to run the project without having
to type a long `deno run` command.