leohxj
V2EX  ›  Node.js

如何打包 commander 写的命名,使得在 windows,mac 通过命名行直接运行?

  •  
  •   leohxj · Jul 1, 2014 · 2663 views
    This topic created in 4333 days ago, the information mentioned may be changed or developed.
    最近使用了`commander`这个工具,可以很方便的写命名行工具。

    但是写完的命名,现在是通过`node xxx.js`形式运行,如何打包成windows下的命名,直接使用?

    我发现express这样的命名,在系统中都是有`express`和`express.cmd`这两个文件,方便windows, mac用户使用。

    那么这两个文件,是用什么生成的?
    1 replies    2014-07-01 11:48:00 +08:00
    yangg
        1
    yangg  
       Jul 1, 2014
    cmd就是一个bat 批处理文件
    如果目录及路径,环境变量没问题的话,
    新建一个bat或者cmd文件叫youcmd.bat 里面放个
    node xxx.js就行了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5569 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 09:06 · PVG 17:06 · LAX 02:06 · JFK 05:06
    ♥ Do have faith in what you're doing.