From b20be92c30234c0fb991e1c8bb5d84b75d34ed61 Mon Sep 17 00:00:00 2001 From: Segun Adebayo Date: Wed, 13 Apr 2022 20:27:35 +0400 Subject: [PATCH] fix: plop generation --- plopfile.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/plopfile.js b/plopfile.js index cf27d6639e..2c97a6ebbf 100644 --- a/plopfile.js +++ b/plopfile.js @@ -2,11 +2,16 @@ const camelCase = (str) => { return str.replace(/[-_]([a-z])/g, (g) => g[1].toUpperCase()) } +const capitalize = (str) => { + return str.charAt(0).toUpperCase() + str.slice(1) +} + /** * @param {import("plop").NodePlopAPI} plop */ module.exports = function main(plop) { plop.setHelper("camelize", camelCase) + plop.setHelper("capitalize", capitalize) plop.setGenerator("machine", { description: "Generates a new ui machine", @@ -26,9 +31,9 @@ module.exports = function main(plop) { actions.push({ type: "addMany", - templateFiles: "machine/**", - destination: `../packages/machines/{{dashCase machine}}`, - base: "machine/", + templateFiles: "plop/machine/**", + destination: `packages/machines/{{dashCase machine}}`, + base: "plop/machine/", data: { machine, name: machine }, abortOnFail: true, }) @@ -60,9 +65,9 @@ module.exports = function main(plop) { actions.push({ type: "addMany", - templateFiles: "utility/**", - destination: `../packages/utilities/${name}`, - base: "utility/", + templateFiles: "plop/utility/**", + destination: `packages/utilities/{{dashCase name}}`, + base: "plop/utility/", data: { description, name }, abortOnFail: true, })