templord
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

templord

Tool to generate code from ejs templates from a convention-based structure.

Table of contents

  1. Getting Started

  2. Usage

Getting Started

npm i templord enquirer -D

Usage

How to use

  1. Create directory matching pattern _template_${name} in project.
  2. Create _decree.ts file inside that directory.
  3. Drop any files you want into directory prefixed with _template. Suffix them with .ejs if you wish to use data returned by getDecree method.
  4. By default templord will always ask you for directoryName to generate from template which can be used in ejs templates via <%- directoryName %>.
  5. Run npx templord.

Example _decree.ts

import type * as Enquirer from 'enquirer';

const getDecree = async (enquirer: Enquirer) => {
    const responses = await enquirer.prompt([
        {
            message: `Name:`,
            name: `name`,
            type: `input`,
        },
    ]);

    return responses;
};

export default getDecree;

Readme

Keywords

none

Package Sidebar

Install

npm i templord

Weekly Downloads

8

Version

1.0.4

License

MIT

Unpacked Size

16.6 kB

Total Files

39

Last publish

Collaborators

  • radarsu