Skip to content

Commit

Permalink
Replace deno cache with deno install (#875)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju authored Sep 23, 2024
1 parent 4f9a7f2 commit 3cb20ea
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 230 deletions.
4 changes: 0 additions & 4 deletions runtime/_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ export const sidebar = [
label: "deno completions",
id: "/runtime/reference/cli/completions/",
},
{
label: "deno cache",
id: "/runtime/reference/cli/cache/",
},
{
label: "deno check",
id: "/runtime/reference/cli/check/",
Expand Down
7 changes: 4 additions & 3 deletions runtime/fundamentals/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,11 @@ Deno offers this functionality through a setting in your `deno.json` file:

Add the above snippet to your `deno.json` file and Deno will cache all
dependencies locally in a `vendor` directory when the project is run, or you can
optionally run the `deno cache` command to cache the dependencies immediately:
optionally run the `deno install --entrypoint` command to cache the dependencies
immediately:

```bash
deno cache main.ts
deno install --entrypoint main.ts
```

You can then run the application as usual with `deno run`:
Expand All @@ -321,7 +322,7 @@ Imagine your module relies on a remote module located at https://some.url/a.ts.
When you compile your module for the first time, `a.ts` is fetched, compiled,
and cached. This cached version will be used until you either run your module on
a different machine (such as in a production environment) or manually reload the
cache (using a command like `deno cache --reload`).
cache (using a command like `deno install --reload`).

But what if the content at `https://some.url/a.ts` changes? This could result in
your production module running with different dependency code than your local
Expand Down
15 changes: 7 additions & 8 deletions runtime/getting_started/command_line_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ addEventListener("hmr", (e) => {

### Integrity flags (lock files)

Affect commands which can download resources to the cache: `deno cache`,
Affect commands which can download resources to the cache: `deno install`,
`deno run`, `deno test`, `deno doc`, and `deno compile`.

```sh
Expand All @@ -167,7 +167,7 @@ Find out more about these
### Cache and compilation flags
Affect commands which can populate the cache: `deno cache`, `deno run`,
Affect commands which can populate the cache: `deno install`, `deno run`,
`deno test`, `deno doc`, and `deno compile`. As well as the flags above, this
includes those which affect module resolution, compilation configuration etc.
Expand Down Expand Up @@ -199,16 +199,15 @@ argument to deno run:
> deno run --check main.ts
```
This flag affects `deno run`, `deno eval`, `deno repl` and `deno cache`. The
following table describes the type-checking behavior of various subcommands.
Here "Local" means that only errors from local code will induce type-errors,
modules imported from https URLs (remote) may have type errors that are not
reported. (To turn on type-checking for all modules, use `--check=all`.)
This flag affects `deno run`, `deno eval`, `deno repl`. The following table
describes the type-checking behavior of various subcommands. Here "Local" means
that only errors from local code will induce type-errors, modules imported from
https URLs (remote) may have type errors that are not reported. (To turn on
type-checking for all modules, use `--check=all`.)
| Subcommand | Type checking mode |
| -------------- | ------------------ |
| `deno bench` | 📁 Local |
| `deno cache` | ❌ None |
| `deno check` | 📁 Local |
| `deno compile` | 📁 Local |
| `deno eval` | ❌ None |
Expand Down
1 change: 0 additions & 1 deletion runtime/reference/cli/all_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ of subcommands that can be used to perform different tasks, check the links
below for more information on each subcommand.

- [deno bench](/runtime/reference/cli/benchmarker/) - benchmarking tool
- [deno cache](/runtime/reference/cli/cache/) - cache and compile dependencies
- [deno check](/runtime/reference/cli/check/) - type check your program without
running it
- [deno compile](/runtime/reference/cli/compiler/) - compile a program into a
Expand Down
193 changes: 0 additions & 193 deletions runtime/reference/cli/cache.md

This file was deleted.

5 changes: 4 additions & 1 deletion runtime/reference/cli/script_installer.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: "`deno install`, script installer"
oldUrl: /runtime/manual/tools/script_installer/
oldUrl:
- /runtime/manual/tools/script_installer/
- /runtime/manual/tools/cache/
- /runtime/reference/cli/cache/
---

<!-- TODO: this needs to be updated for Deno 2 -->
Expand Down
2 changes: 1 addition & 1 deletion runtime/reference/cli/task_runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,4 +418,4 @@ way on Mac or Linux, then you may do so by running it through `sh`:
file if it is discovered. Note that Deno does not respect or support any npm
life cycle events like `preinstall` or `postinstall`—you must explicitly run the
script entries you want to run (ex.
`deno cache main.ts && deno task postinstall`).
`deno install --entrypoint main.ts && deno task postinstall`).
2 changes: 1 addition & 1 deletion runtime/reference/continuous_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ In order to increment this version, you can update the `import` statement and
then reload the cache and update the lockfile locally:

```console
deno cache --reload --lock=deno.lock --frozen=false deps.ts
deno install --reload --lock=deno.lock --frozen=false --entrypoint deps.ts
```

You should see changes in the lockfile's contents after running this. When this
Expand Down
16 changes: 8 additions & 8 deletions runtime/reference/npm.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ $ deno run --allow-read npm:cowsay@1.5.0/cowthink What to eat?

npm specifiers resolve npm packages to a central global npm cache. This works
well in most cases and is ideal since it uses less space and doesn't require a
node_modules directory. That said, you may find cases where an npm package
`node_modules` directory. That said, you may find cases where an npm package
expects itself to be executing from a `node_modules` directory. To improve
compatibility and support those packages, you can use the `--node-modules-dir`
flag.
Expand All @@ -158,22 +158,22 @@ to npm:

![](./images/node_modules_dir.png)

This is done automatically when calling deno run, no separate install command
This is done automatically when calling `deno run`, no separate install command
necessary.

Alternatively, if you wish to disable the creation of a `node_modules` directory
entirely, you can set this flag to false (ex. `--node-modules-dir=false`) or add
a `"nodeModulesDir": false` entry to your deno.json configuration file to make
the setting apply to the entire directory tree.
entirely, you can set this flag to `"none"` (ex. `--node-modules-dir=none`) or
add a `"nodeModulesDir": "none"` entry to your deno.json configuration file to
make the setting apply to the entire directory tree.

In the case where you want to modify the contents of the `node_modules`
directory before execution, you can run `deno cache` with `--node-modules-dir`,
modify the contents, then run the script.
directory before execution, you can run `deno install` with
`--node-modules-dir`, modify the contents, then run the script.

For example:

```sh
deno cache --node-modules-dir main.ts
deno install --node-modules-dir --entrypoint main.ts
deno run --allow-read=. --allow-write=. scripts/your_script_to_modify_node_modules_dir.ts
deno run --node-modules-dir main.ts
```
Expand Down
6 changes: 1 addition & 5 deletions runtime/reference/ts_config_migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ sure to tell Deno to use this file by specifying `--config=path/to/file` flag.

When Deno loads a TypeScript module in a web worker, it will automatically type
check the module and its dependencies against the Deno web worker library. This
can present a challenge in other contexts like `deno cache` or in editors. There
can present a challenge in other contexts like `deno check` or in editors. There
are a couple of ways to instruct Deno to use the worker libraries instead of the
standard Deno libraries.

Expand All @@ -405,10 +405,6 @@ to apply the standard Deno library as well. The second instructs Deno to apply
the built-in Deno worker type definitions plus dependent libraries (like
`"esnext"`).

When you run a `deno cache` or `deno bundle` command or use an IDE which uses
the Deno language server, Deno should automatically detect these directives and
apply the correct libraries when type checking.

The one disadvantage of this, is that it makes the code less portable to other
non-Deno platforms like `tsc`, as it is only Deno which has the `"deno.worker"`
library built into it.
Expand Down
4 changes: 2 additions & 2 deletions runtime/reference/vscode.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ appropriate `settings.json`.

Deno supports remote modules and will fetch remote modules and store them
locally in a cache. When you do something like `deno run`, `deno test`,
`deno info` or `deno cache` on the command line, the Deno CLI will go and try to
fetch any remote modules and their dependencies and populate the cache.
`deno info` or `deno install` on the command line, the Deno CLI will go and try
to fetch any remote modules and their dependencies and populate the cache.

While developing code in the editor, if the module is not in the cache, you will
get a diagnostic such as
Expand Down
2 changes: 1 addition & 1 deletion runtime/tutorials/aws_lightsail.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ WORKDIR /app

ADD . /app

RUN deno cache main.ts
RUN deno install --entrypoint main.ts

CMD ["run", "--allow-net", "main.ts"]
```
Expand Down
2 changes: 1 addition & 1 deletion runtime/tutorials/digital_ocean.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ WORKDIR /app

ADD . /app

RUN deno cache main.ts
RUN deno install --entrypoint main.ts

CMD ["run", "--allow-net", "main.ts"]
```
Expand Down
2 changes: 1 addition & 1 deletion runtime/tutorials/google_cloud_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ WORKDIR /app

ADD . /app

RUN deno cache main.ts
RUN deno install --entrypoint main.ts

CMD ["run", "--allow-net", "main.ts"]
```
Expand Down

0 comments on commit 3cb20ea

Please sign in to comment.