Gulp-octo 忽略了我选择的输出目录

Gulp-octo is ignoring my choice of output directory

我正在尝试使用 Gulp 和 Gulp-Octo:

为 angular-cli 项目构建 Octopus Deploy 包
const gulp = require("gulp"),
    octopus = require("@octopusdeploy/gulp-octo"),
    version = require("./package.json").version;

gulp.task("octopack",
    ["build-prod"],
    () => gulp.src("dist/*")
        .pipe(octopus.pack(
            "zip", // octopackjs does not support nupkg format yet
            {
                id: "myprojectid",
                version: `${version}.${commandLineOptions.buildnumber}`
            }))
        .pipe(gulp.dest('./octopus'))
);

这会创建一个包含正确内容和版本号的包,但是 它总是进入当前目录(与 gulpfile.js 一起)而不是我在 [=13= 中指定的目录].

我在 gulp.dest 的调用中尝试了以下所有变体,结果相同:

是我误解了 gulp.dest() 的工作原理,还是 octopus.pack() 做了一些奇怪的事情?

(注意:如果我完全省略 gulp.dest(),则不会创建 zip 文件。)

这是 gulp-octo 中的错误。在this line they set the path of the generated archive. Unfortunately they just use the filename of the archive instead of a full path (which is what they're supposed to do)中,所以文件总是相对于当前工作目录写入的。

如果有机会,我可能会向他们发送拉取请求,因为这是一个简单的修复方法。

在此期间,您可以使用以下解决方法:

var path = require('path');

gulp.task("default",
    () => gulp.src("dist/*")
        .pipe(octopus.pack(
            "zip", // octopackjs does not support nupkg format yet
            {
                id: "myprojectid",
                version: `${version}.${commandLineOptions.buildnumber}`
            }))
        .on('data', (f) => { f.path = path.join(f.base, f.path) })
        .pipe(gulp.dest('./octopus'))
);