0.0.0-dev.3 • Published 3 months ago

yo-generator2 v0.0.0-dev.3

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

yo-generator

为您的应用程序提供脚手架的代码生成器

Usage

const { Generator } = require("yo-generator");

module.exports = class extends Generator {
  constructor(options) {
    super(options);
    this.settings = {};
  }

  async prompting() {
    const questions = [
      {
        type: "input",
        name: "name",
        message: "请输入项目名称",
        default: "my-project",
        store: true,
      },
    ];
    return this.prompt(questions).then((result) =>
      Object.assign(this.settings, result)
    );
  }

  writing() {
    const settings = this.settings;
    this.renderTemplate("./", "./", {
      name: settings.name,
    });
  }

  end() {
    console.log(`end.`);
  }
};