electrify 从哪里获取节点?

Where does electrify acquire node from?

当我使用 "electrify" 和 "electrify package" 时,mongo 和节点从某处获取并打包到电气化应用程序中。他们来自哪里?这些是来自流星的 mongo 和节点吗?还是安装在系统上的?以上两个命令是否使用相同的 mongo 和节点?

**TL;DR:您的 ~/.meteor 文件夹是它的来源。


搜索 GitHub Electrify repository, we can see that the MongoDB path and daemon location is referenced in this file 作为 this.meteor.mongothis.meteor.mongod:

this.meteor.mongo  = join(this.meteor.dev_bundle, 'mongodb', 'bin', 'mongo');
this.meteor.mongod = join(this.meteor.dev_bundle, 'mongodb', 'bin', 'mongod');

通过这些变量展开:

// https://github.com/arboleya/electrify/blob/94bb01d72d1cc0cc041836514de628d2c9009c23/lib/env.js#L114
this.meteor.dev_bundle     = join(this.meteor.tools, 'dev_bundle');

// https://github.com/arboleya/electrify/blob/94bb01d72d1cc0cc041836514de628d2c9009c23/lib/env.js#L113
this.meteor.tools          = this.meteor.root.replace(/meteor(\.bat)?$/m, '');

// https://github.com/arboleya/electrify/blob/94bb01d72d1cc0cc041836514de628d2c9009c23/lib/env.js#L112
this.meteor.root           = join(meteor_dir, meteor_symlink);

// https://github.com/arboleya/electrify/blob/94bb01d72d1cc0cc041836514de628d2c9009c23/lib/env.js#L109
meteor_symlink = fs.readlinkSync(join(meteor_dir, 'meteor'));

// https://github.com/arboleya/electrify/blob/94bb01d72d1cc0cc041836514de628d2c9009c23/lib/env.js#L108
meteor_dir    = join(this.os.home, '.meteor');

因此,我们可以看到对于 Linux,它将是:

  • meteor_dir:主路径(~),然后是子文件夹.meteor
    • 对我来说就是 ~/.meteor;
  • meteor_symlink:遵循 meteor 的符号链接,
    • 对我来说,链接到 ./packages/meteor-tool/1.3.5_1/mt-os.linux.x86_64/meteor;
  • meteor_root:以上的组合(例如,~/.meteor/<symlink>),
    • 对我来说就是 ~/.meteor/packages/meteor-tool/1.3.5_1/mt-os.linux.x86_64/meteor;
  • meteor_tools: meteor_root, 减去尾随 "meteor",
    • 对我来说就是 ~/.meteor/packages/meteor-tool/1.3.5_1/mt-os.linux.x86_64/;
  • meteor_dev_bundle: meteor_tools 然后是子文件夹 dev_bundle,
    • 对我来说就是 ~/.meteor/packages/meteor-tool/1.3.5_1/mt-os.linux.x86_64/dev_bundle;
  • this.meteor.mongo: meteor_dev_bundle 然后是子文件夹 mongo 然后是子文件夹 bin 然后是子文件夹 mongo
    • 对我来说就是 ~/.meteor/packages/meteor-tool/1.3.5_1/mt-os.linux.x86_64/dev_bundle/mongodb/bin/mongo;
  • this.meteor.mongod:相当于 this.meteor.mongo 加上 d(即 mongo 变为 mongod),
    • 对我来说就是 ~/.meteor/packages/meteor-tool/1.3.5_1/mt-os.linux.x86_64/dev_bundle/mongodb/bin/mongod