Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wicked-needles-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"node-plop": patch
---

Fix passing configuration to loaded plopfiles.
2 changes: 2 additions & 0 deletions packages/node-plop/src/node-plop.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ async function nodePlop(plopfilePath = "", plopCfg = {}) {
targets = [targets];
}
const config = Object.assign(
{}, // forces shallow copy of plopCfg
plopCfg,
{
destBasePath: getDestBasePath(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,15 @@ describe("load-assets-from-plopfile", function () {
expect(plop.getPartialList().length).toBe(1);
expect(plop.getPartialList()[0]).toBe("p1");
});

test.todo("plop.load loaded plopfile inherits config", async function () {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

const plop = await nodePlop("", {
force: true,
});

await plop.load(plopfilePath, null, {});

// not a working test
expect(plop.config.force).toBe(true);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a TODO test, let's add an e2e test using Plop CLI :)

Copy link
Author

@moltar moltar Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e2e test using Plop CLI

Is there a prior art for this?

Can't find anything like that in the repo.

});