2016-12-05 109 views
1

這裏的gulp-octo版本是0.0.10,它不再是當前版本。這可能會或可能不會適用於新版本當有子文件夾時,Octopack不會打包ng build輸出

角度-CLI命令ng-build建立我的角度應用到/DIST文件夾中。

我最終得到一個平坦的dist文件夾,包含我的js,html等文件。

/dist 
    index.html 
    inline.js 
    [etc] 

然後我可以用gulp-octo我的包發佈到我的章魚部署主機,像這樣:

// You need to bump version in package.json and ng build before running this 
gulp.task("publish", function() { 
    return gulp.src(["dist/**"]) 
     .pipe(octo.pack()) 
     .pipe(octo.push(octoConfig)); 
}); 

其中一期工程。

然後,我將一個文件assetFile.png添加到資產文件中。這改變了/dist的外觀。它不再完全平坦:

/dist 
    /assets 
     assetFile.png 
    index.html 
    inline.js 
    [etc] 

突然,gulp publish失敗,此錯誤:

λ gulp publish 
[11:14:58] Using gulpfile C:\Source\blank-angular-cli-app\gulpfile.js 
[11:14:58] Starting 'publish'... 
[11:14:58] Packed 'foo.0.0.0.2.tar.gz' with 10 files 
C:\Source\blank-angular-cli-app\node_modules\@octopusdeploy\octopackjs\lib\pack.js:26 
    throw err; 
    ^

Error: ENOENT: no such file or directory, stat 'C:\Source\blank-angular-cli-app\assets' 
    at Error (native) 

這與/DIST包含子文件夾顯然不高興(我得到同樣的錯誤,如果構建後我將文件夾添加到dist)。但我不確定爲什麼,以及如何處理。

這是怎麼回事?我如何修復此部署?

發生了什麼事情的最小例子是Github,這是我使用ng init(角-CLI)中創建空白應用程序,然後加入吞和章魚。

+0

解決了這個問題,將很快回答。我認爲,在吞噬八溴的錯誤。 –

回答

1

因此,修正是在頂層添加一個assets/文件夾。

- assets 
    unrelatedDoesntMatter.png 
- dist 
    - assets 
    assetFile.png 
[etc] 

這裏是commit that fixes my example app。這個文件夾沒有關係,也沒有打包。它只是需要存在。奇怪,看起來像一個吞噬八爪魚的bug。

0

如果您更改gulp.js線20個文件

return gulp.src(["dist/**"]) 

return gulp.src(["dist/**"], { "base" : "." }) 

它會奏效。 gulp.src的第二個參數告訴它獲取所有的目錄。看到這篇文章的更多信息:How do I copy directories recursively with gulp?

+0

感謝您的幫助。它雖然不起作用 –

相關問題