Skip to content

Commit 3f1ecca

Browse files
committed
fix: plop generator custom action causing error
Fixed invalid custom action format in plopfile.js. Custom actions in Plop should be plain functions, not objects with type/name properties. BEFORE: ```js actions.push({ type: 'custom', name: 'success', action: () => { ... } }); ``` AFTER: ```js actions.push(() => { ... }); ``` This fixes the "Invalid action (#14)" error when generating services. All files were created successfully - only the success message failed.
1 parent 8dca76b commit 3f1ecca

1 file changed

Lines changed: 20 additions & 24 deletions

File tree

plopfile.js

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -174,30 +174,26 @@ export default function (plop) {
174174
}
175175

176176
// 8. Success message
177-
actions.push({
178-
type: 'custom',
179-
name: 'success',
180-
action: () => {
181-
console.log('\n✨ Service created successfully!\n');
182-
console.log(`📁 Service location: src/services/${serviceName.toLowerCase()}/`);
183-
if (data.includeRoute) {
184-
console.log(`🛣️ Route location: src/routes/${serviceName.toLowerCase()}/`);
185-
}
186-
if (data.includeTests) {
187-
console.log(`🧪 Tests location: src/services/${serviceName.toLowerCase()}/__tests__/`);
188-
}
189-
console.log('\n📝 Next steps:');
190-
console.log(` 1. Implement business logic in operations/`);
191-
console.log(` 2. Update types in types/index.ts`);
192-
if (data.includePrisma) {
193-
console.log(` 3. Run: npm run db:migrate`);
194-
}
195-
if (data.includeRoute) {
196-
console.log(` 4. Register route in src/app.ts`);
197-
}
198-
console.log(` 5. Run tests: npm test ${serviceName.toLowerCase()}`);
199-
return 'Generator completed!';
200-
},
177+
actions.push(() => {
178+
console.log('\n✨ Service created successfully!\n');
179+
console.log(`📁 Service location: src/services/${serviceName.toLowerCase()}/`);
180+
if (data.includeRoute) {
181+
console.log(`🛣️ Route location: src/routes/${serviceName.toLowerCase()}/`);
182+
}
183+
if (data.includeTests) {
184+
console.log(`🧪 Tests location: src/services/${serviceName.toLowerCase()}/__tests__/`);
185+
}
186+
console.log('\n📝 Next steps:');
187+
console.log(` 1. Implement business logic in operations/`);
188+
console.log(` 2. Update types in types/index.ts`);
189+
if (data.includePrisma) {
190+
console.log(` 3. Run: npm run db:migrate`);
191+
}
192+
if (data.includeRoute) {
193+
console.log(` 4. Register route in src/app.ts`);
194+
}
195+
console.log(` 5. Run tests: npm test ${serviceName.toLowerCase()}`);
196+
return 'Generator completed!';
201197
});
202198

203199
return actions;

0 commit comments

Comments
 (0)