Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Override Generators

Open
#104 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, node.js
Domain
cli

Research direction

Start by reviewing lib/cli/cmd-add.js and the related donejs/generator-donejs#140 issue about .donejs generator customization. Compare the proposed custom generator path and existing add/generate flow, then clarify how custom prompts and validation should be selected. Done means a project can override a generator and use those customized prompts when running the relevant command.

Written by the indexing model from the issue text.

Description

enhancement

What

A related issue (donejs/generator-donejs#140) outlines the method of using the .donejs folder to customize a generator's templates. It would be nice to have the ability to custom the generator itself.

Why

For a react-view-model project. Since a custom element tag name that the component prompt collects doesn't translate well to a react component so I'd like to change the prompt and it's validation.

You could also do things like making a component generator that prompts you for a type and builds one of several predefined types.

How

My immediate thought would be to modify the add command to do something like:

var path = require('path');
var utils = require('../utils');
var generate = require('./cmd-generate');
var debug = require('debug')('donejs-cli:add');  

module.exports = function(root, name, params) {
  var generators = require(path.join(root, 'node_modules', 'generator-donejs'));
  var customGeneratorPath = path.join(process.cwd(), '.donejs', 'name', 'index.js');

  // Use the custom generator here!
  if (fs.exists(customGeneratorPath)) {
    return utils.generate(root, '.donejs', [name].concat(params))
  }

  if (generators[name]) {
    debug('add called but running generate instead', name, params);
    return generate(root, name, params);
  }

  debug('add', name, params);
  return utils.add(path.join(root, 'node_modules'), name, params);
};

Comments Please 😃

I am happy to implement this in my spare time because I'd like to see it done ASAP. I just would like a little input first so I know if I am heading down the wrong path before I start.

Dominant language
JavaScript
Stars
6
Forks
7
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from donejs/cli

All issues in donejs/cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.