简体   繁体   English

Gemfury在.gitignore中时会从包中删除文件夹

[英]Gemfury omits folder from package when it is in .gitignore

The company I work for hosts packages on Gemfury. 我为Gemfury托管主机的公司。 I've recently joined development on a JavaScript repository. 我最近加入了JavaScript库上的开发。 Everything seems pretty standard, but I noticed quickly the build artifacts were being checked into source control. 一切似乎都很标准,但是我很快注意到构建工件已被检查到源代码管理中。 So without thinking twice, I added the dist-folder to .gitignore . 因此,我三思而后行,将dist文件夹添加到.gitignore

However, since then, the package hosted on Gemfury no longer contain this folder when we do a release. 但是,此后,发布时,托管在Gemfury上的软件包不再包含此文件夹。 I've encountered this problem before with NPM packages, and was always able to solve it by adding an .npmignore file where the dist folder is not mentioned. 我以前在NPM软件包中遇到过此问题,并且始终能够通过添加.npmignore文件(未提及dist文件夹)来解决此问题。 This however doesn't help in this case, and neither does adding a "files" area in package.json (all files mentioned there show up in the package, except the dist folder). 但是,这在这种情况下无济于事,也没有在package.json中添加“文件”区域(其中提到的所有文件都显示在程序包中,除了dist文件夹)。

I'm not entirely sure how Gemfury creates the package. 我不太确定Gemfury是如何创建包裹的。 The way use Gemfury is to push source to it (add Gemfury as remote, and git push fury master ), and Gemfury supposedly picks up that it needs to do a build, and claims to be successful in this task: 使用Gemfury的方式是向其推送源(将Gemfury添加为remote,以及git push fury master ),据推测Gemfury意识到需要进行构建,并声称在此任务中成功:

Initializing build: done.
-----> Building package...
       npm package build detected
       Packing my-project-1.0.0.tgz
-----> Pushing to "my-company" account
       my-project-1.0.0.tgz ... ok
-----> Done!

That's all I've been able to find out, and I have no idea how I can make the dist-folder reappear. 这就是我所能找到的全部信息,而且我不知道如何使dist文件夹重新出现。 Adding it back to source control is not something I want to do, for obvious reasons. 出于显而易见的原因,我不想将其重新添加到源代码管理中。

The repository uses yarn and contains the following build script in package.json : 该存储库使用yarn并在package.json包含以下构建脚本:

"build": "babel src -d dist -D"

If the method of transferring files to Gemfury is git push, and if Gemfury needs to see the dist folder, then git must know about the the dist folder. 如果将文件传输到Gemfury的方法是git push,并且如果Gemfury需要查看dist文件夹,则git必须知道dist文件夹。

To keep dist folder .gitignored from source control, create a temporary branch that includes the dist folder at build time and push this branch. 要使dist文件夹.gitignore不受源代码控制,请在构建时创建一个包含dist文件夹的临时分支,然后推送分支。

#create new branch
git checkout -b Gemfury

#force tracking of dist folder even though it is .gitignored
git add -f dist
git commit -m "included dist folder for Gemfury"

*I'm not familiar with Gemfury *我对Gemfury不熟悉

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM