Yeoman 复制目录不起作用

Yeoman copy directory not working

我正在尝试复制整个目录作为 Yeoman 生成器的一部分。我有多个调用 this.fs.copy 的函数,除了 fontsassetsdev 外,它按预期工作(大部分)。我不明白为什么 assetsdev 任务将源文件夹复制到字体目录中,而不是复制到我指定的根目录中。这是我批发复制目录的三个功能:

    this.props.dotDest = './';
    this.props.srcPath = './assets-dev';
    this.props.destPath = './public/assets';

    dotfiles: function () { // Works as expected. Copies to the root.
        this.fs.copy(
            this.templatePath('dot_files/.*'),
            this.destinationRoot(this.props.dotDest)
        );
    },

    fonts: function () { // Works as expected. Copies to the bootstrap directory.
        var done = this.async();

        this.log( chalk.magenta.bold('Copying /fonts') );
        this.fs.copy(
            this.templatePath('fonts'),
            this.destinationRoot(this.props.destPath + '/fonts/bootstrap')
        )

        done();
    },

    assetsdev: function () { // Does NOT work. Copies to the Bootstrap directory rather than the root.
        var done = this.async();

        this.log( chalk.magenta.bold('Copy assets-dev') );
        this.fs.copy(
            this.templatePath('assets-dev'),
            this.destinationRoot(this.props.srcPath)
        );

        done();
    },

我希望生成的文件夹结构是

    -assets-dev
    -public
        -assets
            -fonts
                -bootstrap
                    -fontfile
                    -fontfile
                    -fontfile

但它正在生成...

    -public
        -assets
            -fonts
                -bootstrap
                    -assets-dev
                    -fontfile
                    -fontfile
                    -fontfile

...我不明白为什么。我什至尝试使用 async() 方法,以防它是 运行 异步并且在 assetsdev 函数运行时恰好在该目录中。

有人知道为什么 assetsdev 复制到错误的文件夹吗?我希望我已经解释清楚了。提前致谢!

显然我不能使用 destinationRoot()。相反,我必须使用 destinationPath()。我不确定为什么,但现在使用 destinationPath() 可以正确复制。