typescriptcachingdeno

Where can I see deno downloaded packages?


I am new to deno and currently exploring for a minimum viable project in deno. I want to like npm which downloads the npm packages inside the folder node_modules, similarly I want to see the deno packages in a directory. In my current project I do not see any downloaded packages. Please suggest me where to look for deno packages. If I write dep.ts file to mention all the deno packages, can I use the same deno packages for some other projects. My question is bit similar to what Maven or Gradle in java handles. It means I want to know whether deno maintains a single folder in OS so that all the packages are downloaded and used in many projects. I want to check the directory containing the deno packages in windows 10.


Solution

  • The imports are cached in $DENO_DIR

    From the 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

    You can see the information by running: deno info


    what is the deno command to install all the dependencies mentioned in dep.ts file

    To install just import dep.ts in one of your files and run:

    deno run index.js