Skip to content

Conversation

@RandomByte
Copy link
Member

If a dynamic npm workspaces[1] configuration resolves to a directory
lacking a package.json file, ignore that module silently.

This can happen when using a pattern like "packages/*" in the workspaces
configuration, and then deleting a package. In case files on .gitignore
remain in the directory for some users, the physical directory is not
removed by git. This lead to issues for UI5 Tooling, trying to use the
empty directory and throwing because of the lacking package.json.

With this change, an error is only thrown if the module path is
explicitly configured (no pattern).

[1] https://docs.npmjs.com/cli/v9/using-npm/workspaces?v=true

If a dynamic npm workspaces[1] configuration resolves to a directory
lacking a package.json file, ignore that module silently.

This can happen when using a pattern like "packages/*" in the workspaces
configuration, and then deleting a package. In case files on .gitignore
remain in the directory for some users, the physical directory is not
removed by git. This lead to issues for UI5 Tooling, trying to use the
empty directory and throwing because of the lacking package.json.

With this change, an error is only thrown if the module path is
explicitly configured (no pattern).

[1] https://docs.npmjs.com/cli/v9/using-npm/workspaces?v=true
@RandomByte RandomByte requested a review from a team May 22, 2023 16:43
@coveralls
Copy link

coveralls commented May 22, 2023

Coverage Status

Coverage: 95.77% (+0.008%) from 95.762% when pulling 61ee202 on npm-workspaces-ignore-empty-modules into 65496ea on main.

flovogt
flovogt previously approved these changes May 23, 2023
@RandomByte RandomByte merged commit 66e82a3 into main May 23, 2023
@RandomByte RandomByte deleted the npm-workspaces-ignore-empty-modules branch May 23, 2023 08:38
d3xter666 pushed a commit to UI5/cli that referenced this pull request Sep 25, 2025
…-project#614)

If a dynamic npm workspaces[1] configuration resolves to a directory
lacking a package.json file, ignore that module silently.

This can happen when using a pattern like "packages/*" in the workspaces
configuration, and then deleting a package. In case files on .gitignore
remain in the directory for some users, the physical directory is not
removed by git. This lead to issues for UI5 Tooling, trying to use the
empty directory and throwing because of the lacking package.json.

With this change, an error is only thrown if the module path is
explicitly configured (no pattern).

[1] https://docs.npmjs.com/cli/v9/using-npm/workspaces?v=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants