Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Workspace: Ignore empty npm workspace modules #614

Merged
merged 2 commits into from
May 23, 2023

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
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.

4 participants