在 Ember-CLI 中防止目录清理

Prevent directory clean in Ember-CLI

我在 Java 项目中使用 ember-cli。我正在尝试构建到 dist/ 以外的目录中。我在 .ember-cli 中使用 "output-path": "../src/main/resources" 设置路径。该项目正在构建并输出到正确的目录中。问题是当我执行 ember 构建时,该目录中还有其他内容正在被清理。

有没有办法停止清理,或者更好的是,将一些文件和目录列入白名单?

根据CLI代码,似乎是不可能的。

https://github.com/ember-cli/ember-cli/blob/master/lib/models/builder.js#L50

  /**
    This is used to ensure that the output path is emptied, but not deleted
    itself. If we simply used `remove(this.outputPath)`, any symlinks would
    now be broken. This iterates the direct children of the output path,
    and calls `remove` on each (this preserving any symlinks).
  */
  clearOutputPath: function() {
    var outputPath = this.outputPath;
    if (!fs.existsSync(outputPath)) { return Promise.resolve();}

    if(!this.canDeleteOutputPath(outputPath)) {
      return Promise.reject(new SilentError('Using a build destination path of `' + outputPath + '` is not supported.'));
    }

    var promises = [];
    var entries = fs.readdirSync(outputPath);

    for (var i = 0, l = entries.length; i < l; i++) {
      promises.push(remove(path.join(outputPath, entries[i])));
    }

    return Promise.all(promises);
  }