我发现自己需要分叉可蜘蛛化的包,但我很难找到任何关于如何使用最新版本的Meteor(0.9.4)的好资源。有人能给我指明正确的方向吗?
我已经做到了——将http
包分叉为http-more
(不幸的是,Meteor团队一再拒绝实现我提交的允许指定代理的简单补丁)。
查看http了解更多实际实现。当上游包发生变化时,它可以方便地更新您的包。从本质上讲,这个过程是这样的:
-
meteor create --package user:your-package
-
cd
user:yuor-package/
-
git submodule add https://github.com/meteor/meteor.git
此时,您将整个Meteor repo作为包的子模块,位于
meteor
目录中。您可以删除除meteor/packages/the-one-you-fork
之外的所有其他目录。 -
将上游包中的文件复制到其他位置,然后应用您的更改。
-
通过对已更改的文件运行
diff old_file new_file
生成修补程序文件。 -
创建一个构建脚本,更新Meteor子模块,并通过将补丁应用于源文件来生成最终文件。这是我的
build.sh
:git submodule update --init # This fetches the submodule repo at the commit... cd meteor # ...it was when the parent (we) committed. git fetch; git checkout master # Actually update the submodule. cd - cp meteor/packages/http/{httpcall_server.js,httpcall_tests.js} . patch httpcall_server.js httpcall_server.patch patch httpcall_tests.js httpcall_tests.patch
-
将上游
package.js
合并到meteor create --package
生成的样板中。您需要上游的一组依赖项和包文件,并且应该添加/替换您自己的GitHub URL、包描述和修补文件。Package.describe({ name: 'dandv:http-more', summary: 'Make ninja guru rockstar HTTP calls to remote servers', version: '1.0.7_1', // wrapped package version number - see https://github.com/meteor/meteor/blob/devel/History.md#more-package-version-number-flexibility git: 'https://github.com/dandv/meteor-http-more.git' }); // any Npm.depends the upstream has Package.onUse(function (api) { api.versionsFrom('0.9.0'); // I had to add this api.use('underscore'); api.use('url@1.0.1'); // also had to specify some version of the url package api.export('HTTP'); // original upstream package files api.addFiles('meteor/packages/http/httpcall_common.js', ['client', 'server']); api.addFiles('meteor/packages/http/httpcall_client.js', 'client'); api.addFiles('meteor/packages/http/deprecated.js', ['client', 'server']); // patched files api.addFiles('httpcall_server.js', 'server'); // patched }); Package.on_test(function (api) { // ... api.use('dandv:http-more', ['client', 'server']); // your own package // same mix of original + patched files // ... });
-
通过转到父目录并运行
来测试包meteor test-packages user:your-package/
。 -
如果测试通过,请再次更改到您的目录并运行
meteor publish
,然后
CCD_ 14和CCD_。