AlexPshul / nxazure

MIT License
16 stars 7 forks source link

Issue with multilevel folder structure #33

Closed krejcit closed 7 months ago

krejcit commented 7 months ago

Hi @AlexPshul,

I have encountered an issue when using a multilevel folder structure in the nx monorepo.

The problem arises when I import shared-service-a to core-service-a. In this scenario, my tsconfig.build.json is overwritten from:

{
  ...
  "paths": {
      "@monorepo/shared-service-a": ["../../../libs/shared-service-a/index.ts"]
    }
}

To:

{
  ...
  "paths": {
      "@monorepo/shared-service-a": ["../../libs/shared-service-a/index.ts"]
    }
}

As can be seen, the path depth always "defaults" to ../../. This unfortunately results in an error when building.

Here's an example of the structure for reference:

.
├── libs/
│   ├── shared-ui
│   ├── shared-service-a/
│   │   └── index.ts
│   └── shared-service-b/
│       └── index.ts
├── packages/
│   ├── core/
│   │   └── core-service-a/
│   │       ├── tsconfig.json
│   │       └── tsconfig.build.json
│   └── client-name/
│       ├── client-application-a
│       └── client-application-b
└── tsconfig.base.json

I suspect that this issue may be caused by this line: https://github.com/AlexPshul/nxazure/blob/9edb1bfcccb7969e4779b265208c10865e827074/packages/func/src/executors/common/prepare-build.ts#L17

Do you have any suggestions on how to work around this issue?

AlexPshul commented 7 months ago

Ah! I completely missed that scenario while implementing. I can't think of a workaround at the moment, but it will be easy enough to just fix. I'll try to make it happen by the end of this week.

AlexPshul commented 7 months ago

@krejcit I've fixed the code to support the scenario you've mentioned. Please try updating the NPM package to version 1.1.3 and rebuild your app.

Let me know if it worked or not.

krejcit commented 7 months ago

@AlexPshul Just tested the version 1.1.3 and everything works as expected!

Thank you for the fix!