plopjs / plop

Consistency Made Simple
http://plopjs.com
MIT License
7.12k stars 277 forks source link

fix: Show generator description from external plopfiles #402

Open rosen-kanev opened 12 months ago

rosen-kanev commented 12 months ago

When loading generators from external plop files with plop.load(path) their description was being lost. The root cause is that the proxy object that we're passing to setGenerator() doesn't have a description property, which judging by the rest of the code is by design.

I did contemplate an alternative fix - to add the description in the setGenerator function like so:

// add the generator to this context
generators[name] = Object.assign(
  {},
  config.proxy ? { description: config.proxy.getGenerator(name) } : {},
  config,
  {
    name: name,
    basePath: plopfilePath,
  },
);

but IMO the patch should be where the external plop file is loaded.

This PR fixes the missing description logged in #247.


Aside: @piersolenski observed that setWelcomeMessage() also is being lost, but I don't think it's a good design to allow the loaded files to change it.

crutchcorn commented 10 months ago

Potentially weird Q: Is there overlap with this PR and this one? #394

rosen-kanev commented 10 months ago

When I stumbled upon the missing description I looked around the existing issues and PRs and did try #394 locally. The description is missing there too (though it would've been a very elegant bugfix if it was just a shallow copy 😅 )

tobiashochguertel commented 9 months ago

The fix in the commit #b89944ea8c4e9709c33491a87f80c81f7d378aeb works so far. Would it be possible to get this quick merged and released?

Can I do something?

rosen-kanev commented 9 months ago

@crutchcorn I don't like generating extra noise unless necessary, but in case you have your notifications turned on only for mentions.

kemalsecer commented 6 months ago

Are there plans to merge this fix in the near future?

d-es-ign commented 3 months ago

Any update on this?