Skip to content

Commit a90f204

Browse files
committed
feat: custom project commands
Enable defining custom cli commands in project, not just plugins.
1 parent 2dc0d2b commit a90f204

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

packages/cli/src/commands/userDefined.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ const existsMerkurConfig = fs
2929
.includes('merkur.config.mjs');
3030

3131
if (existsMerkurConfig) {
32+
const projectCommandsDir = path.resolve(process.cwd(), 'commands');
33+
if (fs.existsSync(projectCommandsDir)) {
34+
await extendCommandsFromDir(projectCommandsDir);
35+
}
3236
const merkurDir = path.resolve(process.cwd(), 'node_modules/@merkur');
3337
if (fs.existsSync(merkurDir)) {
3438
let dirs = fs.readdirSync(merkurDir);

website/docs/register-custom-element.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The default Merkur template is prepared for SSR. In the following sections, we w
2222

2323
### Server part
2424

25-
After creating a new Merkur widget, update your playground template by creating the `/server/playground/templates/body.ejs` and `/server/playground/templates/footer.ejs` files. You can also run `merkur custom playground:body` and `merkur custom playground:footer` to generate these files. Then, modify the files as follows:
25+
After creating a new Merkur widget, run `merkur custom playground:body` and `merkur custom playground:footer` to make local copies of the playground files and modify them as follows:
2626

2727
```javascript
2828
// body.ejs

0 commit comments

Comments
 (0)