Skip to content

Proposal(Interested in Collaborating): Add support to create a dynamic nsprc #103

@pyymenta

Description

@pyymenta

Hi team,

First off, great work on this library—it’s been really helpful!

I’d like to suggest a new feature: Enable clients to create the .nsprc object dynamically via JavaScript. This could be especially useful for those who want to generate the object by consuming external APIs.

Proposed Feature Outline

  1. Config file setup: Clients would add a config.{js,ts} file to their project.
  2. Exported method: This file exports an object with a method named requestNsprcFile.
  3. Method functionality: The requestNsprcFile method generates and returns an object with the same structure as the .nsprc file.
  4. Library behavior:
    • The library will call requestNsprcFile when:
      1. The --config or -c option is passed to the audit command (e.g., better-npm-audit audit -c configFile.js).
      2. requestNsprcFile is defined in the config file.
      3. If neither condition is met, the .nsprc file will be used as usual.
  5. Future extensions: This config file can potentially support additional features.

I took the liberty of forking the project to work on this (WIP).

A quick demo:

demo-audit.mp4

What do you think—is this a good approach? Any suggestions or feedback on the feature design?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions