首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Yeoman任务不复制目录

Yeoman任务不复制目录
EN

Stack Overflow用户
提问于 2017-06-12 22:01:46
回答 1查看 30关注 0票数 0

我正在尝试构建一个简单的yeoman任务,该任务将模板目录复制到用户运行命令的目标目录。prompt方法正在工作,但没有写入或复制任何内容。你知道我哪里错了吗?

代码语言:javascript
复制
'use strict';
//Require dependencies
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');

module.exports = class extends yeoman {
    //Ask for user input
    prompting() {
        var done = this.async();
        this.prompt({
            type: 'input',
            name: 'name',
            message: 'Your project name',
            //Defaults to the project's folder name if the input is skipped
            default: this.appname
        }, function(answers) {
            this.props = answers
            this.log(answers.name);
            done();
        }.bind(this));
    }

    //Writing Logic here
    writing() {
        this.fs.copyTpl(
            this.templatePath('testfile'),
            this.destinationPath('testfile')
        );
    }
};
EN

回答 1

Stack Overflow用户

发布于 2017-06-13 13:26:46

从1.0版本开始,prompt方法不再接受回调

相反,您想要this.prompt([...]).then(callback)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44501357

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档