我在哪里可以看到 deno 下载的包?
Where can I see deno downloaded packages?
我是 deno 的新手,目前正在探索 deno 中的最小可行项目。我想喜欢 npm,它将 npm 包下载到文件夹 node_modules
中,同样我想在目录中看到 deno 包 。在我当前的项目中,我没有看到任何下载的包。请建议我在哪里寻找 deno 包。如果我写 dep.ts
文件来提及所有 deno 包,我可以将相同的 deno 包用于其他一些项目吗?我的问题有点类似于 java 中 Maven
或 Gradle
处理的问题。这意味着我想知道 deno 是否在 OS 中维护一个文件夹,以便在许多项目中下载和使用所有包。我想检查 windows 10.
中包含 deno 包的目录
导入缓存在 $DENO_DIR
来自docs:
Deno caches remote imports in a special directory specified by the
$DENO_DIR
environmental variable. It defaults to the system's cache
directory if $DENO_DIR
is not specified. The next time you run the
program, no downloads will be made. If the program hasn't changed, it
won't be recompiled either. The default directory is:
- On Linux/Redox:
$XDG_CACHE_HOME/deno
or $HOME/.cache/deno
- On Windows:
%LOCALAPPDATA%/deno
(%LOCALAPPDATA% = FOLDERID_LocalAppData
)
- On macOS:
$HOME/Library/Caches/deno
If something fails, it falls back to
$HOME/.deno
Relying on external servers is convenient for development but brittle
in production. Production software should always bundle its
dependencies. In Deno this is done by checking the $DENO_DIR into your
source control system, and specifying that path as the $DENO_DIR
environmental variable at runtime.
what is the deno command to install all the dependencies mentioned in
dep.ts file
只安装 import dep.ts
在你的一个文件中 运行:
deno run index.js
您可以使用deno info
获取远程模块的缓存目录。
样本输出(Windows 10):
> deno info
DENO_DIR location: "C:\Users\ford\AppData\Local\deno"
Remote modules cache: "C:\Users\ford\AppData\Local\deno\deps"
TypeScript compiler cache: "C:\Users\ford\AppData\Local\deno\gen"
要获取有关单个(远程)模块的信息:
deno info --unstable https://deno.land/std/fs/mod.ts # --unstable needed as of 1.0.3
示例输出:
local: C:\Users\ford\AppData\Local\deno\deps\https\deno.land4fe4a7...8f300799a073e0
type: TypeScript
compiled: C:\Users\ford\AppData\Local\deno\gen\https\deno.land\std\fs\mod.ts.js
map: C:\Users\ford\AppData\Local\deno\gen\https\deno.land\std\fs\mod.ts.js.map
deps:
https://deno.land/std/fs/mod.ts
├─┬ https://deno.land/std/fs/empty_dir.ts
...
local
:源文件本地路径(TS或JS)
compiled
:编译源码的本地路径(.js
,for TS only)
map
:source map的本地路径(仅限TS)
deps
: 源文件的依赖树
我是 deno 的新手,目前正在探索 deno 中的最小可行项目。我想喜欢 npm,它将 npm 包下载到文件夹 node_modules
中,同样我想在目录中看到 deno 包 。在我当前的项目中,我没有看到任何下载的包。请建议我在哪里寻找 deno 包。如果我写 dep.ts
文件来提及所有 deno 包,我可以将相同的 deno 包用于其他一些项目吗?我的问题有点类似于 java 中 Maven
或 Gradle
处理的问题。这意味着我想知道 deno 是否在 OS 中维护一个文件夹,以便在许多项目中下载和使用所有包。我想检查 windows 10.
导入缓存在 $DENO_DIR
来自docs:
Deno caches remote imports in a special directory specified by the
$DENO_DIR
environmental variable. It defaults to the system's cache directory if$DENO_DIR
is not specified. The next time you run the program, no downloads will be made. If the program hasn't changed, it won't be recompiled either. The default directory is:
- On Linux/Redox:
$XDG_CACHE_HOME/deno
or$HOME/.cache/deno
- On Windows:
%LOCALAPPDATA%/deno
(%LOCALAPPDATA% = FOLDERID_LocalAppData
)- On macOS:
$HOME/Library/Caches/deno
If something fails, it falls back to$HOME/.deno
Relying on external servers is convenient for development but brittle in production. Production software should always bundle its dependencies. In Deno this is done by checking the $DENO_DIR into your source control system, and specifying that path as the $DENO_DIR environmental variable at runtime.
what is the deno command to install all the dependencies mentioned in dep.ts file
只安装 import dep.ts
在你的一个文件中 运行:
deno run index.js
您可以使用deno info
获取远程模块的缓存目录。
> deno info
DENO_DIR location: "C:\Users\ford\AppData\Local\deno"
Remote modules cache: "C:\Users\ford\AppData\Local\deno\deps"
TypeScript compiler cache: "C:\Users\ford\AppData\Local\deno\gen"
要获取有关单个(远程)模块的信息:
deno info --unstable https://deno.land/std/fs/mod.ts # --unstable needed as of 1.0.3
示例输出:
local: C:\Users\ford\AppData\Local\deno\deps\https\deno.land4fe4a7...8f300799a073e0
type: TypeScript
compiled: C:\Users\ford\AppData\Local\deno\gen\https\deno.land\std\fs\mod.ts.js
map: C:\Users\ford\AppData\Local\deno\gen\https\deno.land\std\fs\mod.ts.js.map
deps:
https://deno.land/std/fs/mod.ts
├─┬ https://deno.land/std/fs/empty_dir.ts
...
local
:源文件本地路径(TS或JS)
compiled
:编译源码的本地路径(.js
,for TS only)
map
:source map的本地路径(仅限TS)
deps
: 源文件的依赖树