npm

@dtsgenerator/replace-namespace

1.7.0 • Public • Published

@dtsgenerator/replace-namespace

This is the dtsgenerator plugin. Replace matched namespace identifiers by configuration.

Install

npm install @dtsgenerator/replace-namespace

Usage

dtsgen.json

{
    "plugins": {
        "@dtsgenerator/replace-namespace": {
            "map": [
                {
                    "from": ["path1", "path2"],
                    "to": ["replaced"]
                }
            ]
        }
    }
}

Configuration

  • the type of configuration
type Config = {
    map: {
        from: (string | boolean)[];
        to: string[];
    }[];
};
key type description
map Array of object the mapping of replacing.
map.n.from Array<string | boolean> the definition of from name. if this value is true, it treated as wildcard .
map.n.to Array<string | boolean> the definition of to name.

Example

  • Example1
{
  "map": [
    {
      "from": ["Components", "Schemas"],
      "to": ["Test", "PetStore"]
    },
    {
      "from": ["Paths"],
      "to": ["Test", "PetStore"]
    }
  ]
}
  • Example2
{
  "map": [
    {
      "from": [true, "Schemas"],
      "to": ["Test"]
    }
  ]
}
  • Example3 Remove nested namespaces.
{
  "map": [
    {
      "from": [true, true, true],
      "to": []
    }
  ]
}

Package Sidebar

Install

npm i @dtsgenerator/replace-namespace

Weekly Downloads

6,364

Version

1.7.0

License

MIT

Unpacked Size

34.5 kB

Total Files

10

Last publish

Collaborators

  • horiuchi