Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

feat(sync): enable none syncModel proxy all public packages #590

Merged
merged 6 commits into from
Feb 3, 2015

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Feb 2, 2015

Fixes #589 #581

  • admin can not publish non scoped package on "none" sync model
  • make enablePrivate = false by default
  • make syncModel = "none" by default

@fengmk2
Copy link
Member Author

fengmk2 commented Feb 2, 2015

"none" 同步模式下,非 scoped 模块的读请求,全部302跳转到 npm 源上去

@fengmk2
Copy link
Member Author

fengmk2 commented Feb 2, 2015

这应该是默认模式,这样搭建私有 npm 的成本最低,一个 sqlite3和本地文件存储就 ok 了。

var debug = require('debug')('cnpmjs.org:middleware:proxy_to_npm');
var config = require('../config');

var proxyUrls = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

兼容一下支持配置一个私有模块列表?

可能有需求是需要发布一个私有版本的包来覆盖官方的

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

或者还是检查一下这个包是否是私有的

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯,我再改改。
国内就让他们使用淘宝npm,
国外就让他们使用官方npm

Sent from my iPhone

On Feb 3, 2015, at 1:11 AM, Yiyu He [email protected] wrote:

In middleware/proxy_to_npm.js:

  • * Copyright(c) Alibaba Group Holding Limited.
  • * Authors:
  • * 苏千 [email protected] (http://fengmk2.com)
  • /
    +
    +'use strict';
    +
    +/
    *
  • * Module dependencies.
  • */
    +
    +var debug = require('debug')('cnpmjs.org:middleware:proxy_to_npm');
    +var config = require('../config');
    +
    +var proxyUrls = [
    或者还是检查一下这个包是否是私有的


Reply to this email directly or view it on GitHub.

@dead-horse
Copy link
Member

其实这个模式下确实就和 https://github.com/rlidwka/sinopia 有点像了

@dead-horse
Copy link
Member

在国内跑的前提是.. 有镜像扛着

@fengmk2
Copy link
Member Author

fengmk2 commented Feb 3, 2015

  • make enablePrivate = false by default
  • make syncModel = "none" by default

@@ -146,6 +146,10 @@ SyncModuleWorker.prototype.start = function () {
return;
}

if (config.syncModel === 'none') {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果是 none 的话,不做任何同步,只触发上游源站同步

@fengmk2 fengmk2 force-pushed the sync-none-proxy-to-npm branch 3 times, most recently from 9ae6bbe to 249cd23 Compare February 3, 2015 10:05
@fengmk2 fengmk2 force-pushed the sync-none-proxy-to-npm branch from 249cd23 to af8ae63 Compare February 3, 2015 10:09
@dead-horse
Copy link
Member

👍 🚢

dead-horse added a commit that referenced this pull request Feb 3, 2015
feat(sync): enable none syncModel proxy all public packages
@dead-horse dead-horse merged commit 261c97f into master Feb 3, 2015
@dead-horse dead-horse deleted the sync-none-proxy-to-npm branch February 3, 2015 10:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

proxy mode like kappa
2 participants