Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

spm 2, 3 共存方案

偏右 edited this page Jun 4, 2014 · 17 revisions

背景

由于 2 和 3 将会共存一段时间,而直接通过 $ npm install spm@ninja 安装 3 会覆盖原来的 2,所以这里提供一个方案,在不影响 2 使用的基础上安装 3 。

安装脚本

git clone https://github.com/spmjs/spm ~/.spm3
cd ~/.spm3
cnpm install
ln -sf `pwd`/bin/spm /usr/local/bin/spm3

至此,spm -V 应该是 2,spm3 -V 应该是 3 。

插件使用

原有的其他插件和子命令可以保持原来的用法。比如 init:

  • 在 spm2 模块中使用。

    $ spm init
    
  • 在 spm3 模块中使用。

    $ spm3 init
    

另外两个兼容的插件

npm install spm-deploy
npm install spm-status

以上两个插件同时兼容 spm2 和 spm3 的模块。

  • 在 spm2 模块中使用。

    $ spm deploy
    
  • 在 spm2 或 spm3 模块中使用。

    $ spm-deploy