question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: `displayName` as config to prefix display Name

See original GitHub issue

The problem

We can’t default prefix/suffix/mutate the displayName without setting @displayName for each component, which is kinda useless (i guess) if using <script setup>. In some scenarios my file is named Test.vue but later it’s used like <my-lib-test>.

Proposed solution

e.g. extend DocGenOptions with:

options:  DocGenOptions= {
  displayName: (fileName, name, __name)=> `MyLib${name}`
}

Alternative solutions

Additional context

Current example setup:

-| src
--| components
----- Foo.vue
----- Bar.vue
----- index.ts
// index.ts
export {default as MyLibFoo} from './Foo.vue'
export {default as MyLibBar} from './Bar.vue'
// Library install function used like app.use(myLib)
function install(
    app: App,
    name: string,
    component: ComponentType,
  ): void {
  app.component('MyLib'+ name, component)
}

Components are registered and exported with prefix.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
elevatebartcommented, Nov 21, 2022

Sorry to hear that. I hope it clears out soon.

1reaction
elevatebartcommented, Sep 22, 2022

I would reverse the order of the 2 arguments but I like this API a lot.

// docgen.config.js
module.exports = {
  displayName(filePath, usualName){
     //maybe some checks here (multiword, casing, etc)
     return `My${usualName}`
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Displayname issue #836 - Zrips/CMI - GitHub
Description of issue or feature request: Hello, i have added a plugin named : Powertags to be able to give player prefixes/suffixes. but...
Read more >
CMake preset: use displayName in "Configuration" and "Build ...
This request is to use the displayName (when provided and not an empty string) in the drop down for “Configuration” and “Build Preset”...
Read more >
directoryObject: validateProperties - Microsoft Graph v1.0
Validate that a Microsoft 365 group's display name or mail nickname complies with naming policies.
Read more >
Display Name - Sitecore Idiosyncrasies
This blog post contains information about the concept of item display names in the Sitecore ASP.NET web Content Management System (CMS).
Read more >
Tooling - styled-components
By default, the displayName of a component will be prefixed with the filename in order to make the component name as unique as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found