Skip to content
This repository was archived by the owner on Feb 19, 2022. It is now read-only.
This repository was archived by the owner on Feb 19, 2022. It is now read-only.

Extract abstract template engine out. #37

@ryan-roemer

Description

@ryan-roemer

We have a generic templating tool here that's not builder specific, so let's move that to it's own project

  • Move all of lib/ to new project.
  • Move the bin/builder-init.js logic to a lib/ library and leave a very small shell.
  • Take default prompts values as an argument to executor in new project.
  • Proposal: Make all tool-provided automatic values prefaced with an _. So, e.g., instead of eslint, npmignore, etc. we'd have _eslint, _npmignore, etc. in new tool
    • Deprecate eslint, npmignore, etc. in builder-init and provide transition aliases and documentation.
  • Open Question: Make destination into _destination and just another normal field that if empty blows up?

New list of proposed default fields:

/**
 * Default prompts values added to all prompt calls.
 */
var DEFAULTS = {
  destination: {
    message: "Destination directory to write",
    validate: function (val) { /* existing stuff */ }
  },
  derived: {
    // Existing renamed file name helpers.
    _npmignore: function (data, cb) { cb(null, ".npmignore"); },
    _gitignore: function (data, cb) { cb(null, ".gitignore"); },
    _eslintrc: function (data, cb) { cb(null, ".eslintrc"); },
    _npmrc: function (data, cb) { cb(null, ".npmrc"); }

    // New stuff
    //
    // Location of templates directory to use.
    // Default to `init` for `builder-init`. Could be anything for new project.
    // https://github.com/FormidableLabs/builder-init/issues/36
    _templatesDir: /* snipped */
  }
};

/cc @kenwheeler

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions