Skip to content

Refuse to load npm package.json files #3118

Description

@vpanteleev-sym

For historic reasons, Dub may attempt to load package.json files (older name for dub.json). However, npm uses this file name too.

When Dub can't find a dub.json file but finds a package.json file belonging to npm, it will still attempt to load it. Because Dub ignores unknown fields in the file, and there is sufficient overlap between the two formats that Dub may try to make sense of the declarations therein, it can lead to very confusing messages.

Proposal: when Dub detects top-level keys which are used by npm but not Dub, raise a hard error and refuse to parse the file completely. Some keys we can use for this are packageManager, scripts, devDependencies, and workspaces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions