NatdmN
Denoβ€’9mo agoβ€’
5 replies
Natdm

Deno Monorepo with nested applications and packages

I'm trying to move a node monorepo from NPM to Deno. It's got a set of applications in a directory called services, and set of libraries used by said services in packages. These are all independent, and are registered to the apps workspace (@example) for now. eg: if a service myapp registered as @example/myapp wanted packages/utils, it'd import @example/utils and it'd find it within packages.

I'm trying to do the same in NPM but it seems like everything has to be flat, at the root. Am I not able to register workspaces that are deeper than the root directory?

I've got /packages/foo/deno.json and packages/foo/mod.ts with a funciton exported. the deno.js has the following contents:

{
  "name": "@example/foo",
  "exports": "./mod.ts",
  "version": "1.0.0"
}


The root project has this deno.json:
{
  "workspace": [
    "./services/api",
    "./packages/foo"
  ]
}


I'm unable to import @example/foo in API, as it says ..

error: Relative import path "@example/foo" not prefixed with / or ./ or ../ and not in import map from "file:///app/mod.ts"


The goal is to run these in docker containers in skaffold.
Was this page helpful?