0x80/isolate-package

Having some problems isolating a package

Eufranio opened this issue · 5 comments

I have a project with the following file structure:

cdljovemaju
└─ package.json

pagarme_sinapse
└─ functions
   └─ package.json

firebase.json
isolate.config.json

My isolate.config.json file, which is in the root folder, has this content:

{
  "targetPackagePath": "./cdljovemaju",
  "logLevel": "debug"
}

When I run isolate from the root package, I get:

Failed to infer the build output directory from either the isolate config buildDirName or a Typescript config file. See the documentation on how to configure one of these options.

If I add "buildDirName": "./cdljovemaju" to isolate.config.json, I get this error:

Failed to find build output path at C:\Users\frani\IdeaProjects\cdljovemaju\cdljovemaju\cdljovemaju. Please make sure you build the source before isolating it.

Is there something I am doing wrong?
My root project is not a node/js project, so I could not follow the monorepo instructions exactly, but it is very similar, as in: I have a root non-node project with one node subproject, and an package I would like to deploy along with the one subproject.

0x80 commented

Hi @Eufranio only flat packages folders are supported. Some monorepo tools (like turborepo) also do not support nested structures AFAIK.

I think there is no real benefit to using nested structures, because if packages are truly self-contained, one package depends on another via its name, and not its relative location.

It is mentioned under prerequisites

0x80 commented

I like to give each firebase related package its own firebase.json file, to make the packages self-contained. Then you also do not need the configuration. Just devote one of the packages to deploying things like db rules and indexes. You can look at mono-ts for an example.

0x80 commented

Also, you talk about "the root package", but in a monorepo there should be no such thing.

You have the root of your monorepo containing directories (one or multiple) which contain packages. Then every package has its own manifest (package.json)

The root of the monorepo also has a manifest file, but is technically not considered a package. The root only defines where the packages are located.

Hi @Eufranio only flat packages folders are supported. Some monorepo tools (like turborepo) also do not support nested structures AFAIK.

I think there is no real benefit to using nested structures, because if packages are truly self-contained, one package depends on another via its name, and not its relative location.

It is mentioned under prerequisites

Also, you talk about "the root package", but in a monorepo there should be no such thing.

You have the root of your monorepo containing directories (one or multiple) which contain packages. Then every package has its own manifest (package.json)

The root of the monorepo also has a manifest file, but is technically not considered a package. The root only defines where the packages are located.

The file structure I mentioned is inside the project folder, this is what I meant for "root package". Maybe root folder? It's not really a package, it's just my project directory.

And, the package folders themselves (cdljovemaju, functions) are flat. They should work then?

0x80 commented

If cdljovemaju is a package, it needs to be in some packages folder, not the root of your monorepo.

pagarme_sinapse could be considered a packages folder, because it contains functions. Either move cdljovemaju there, or create some other packages folder next to pagarme_sinapse.

Depending on your package manager you also need to configure your workspaces.

I'm going to close this issue now, because this is not an isolate-package issue.