Giter VIP home page Giter VIP logo

Comments (12)

yyfrankyy avatar yyfrankyy commented on July 19, 2024

现在的实现,buildall,仅仅是将所有模块build在了modules目录。

如果实现spm install (或其他名字),是期望像npm那样,先去请求spm服务器,然后读取特定模块的transport.js,进而打包进去modules?

from spm.

lifesinger avatar lifesinger commented on July 19, 2024

npm 里,默认模块安装目录是 ~/node_modules
spm 里,我们可以仿照,比如默认安装目录是 ~/sea_modules

当 npm install underscore 时,会请求 npm 服务器,获取 underscore 的包信息,下载下来,安装在 node_modules/underscore 里

对于 spm 来说,我最初的设想和 npm 一样,也是:
当 spm install underscore 时,会请求 spm 服务器(目前就是 github),获取 underscore 的包信息(transport.json),下载下来,安装在 node_modules/underscore 里

有以下几点值得考虑:

  1. 在 github 里,spm 仅存储 transport 信息还是将打包好的模块也都存储好?预先打包好的话,spm install xxx 就是纯下载了,呵呵。预先打包后,还有个好处是,web 页面版的下载包不用动态生成,直接用静态页面就搞定。

  2. 用户的使用场景。最初设想中,是让 spm 成为 node 的一个模块,用户只要如下使用就好:

    npm install spm
    spm install underscore
    spm install seajs
    ...

这样用户就获取了自己想要的 underscore 和 seajs 两个模块。当模块有版本更新时,提供类似 spm update all 的命令,就可以获取到模块的最新版本。同样,也可以 spm uninstall xxx 移除某个模块。

用户区分成了两类:

一类是通过 web 版,手动下载。
另一类是通过 spm,命令行方式下载。

文河在想想,总之我们的目的是方便用户,看怎么样能让用户方便,我们就怎么做。

from spm.

lifesinger avatar lifesinger commented on July 19, 2024

transport.js 自身可以考虑:

Usage:
cd seajs/spm
node transport module-name
node transport module-name --force
node transport module-name --all

from spm.

lifesinger avatar lifesinger commented on July 19, 2024

晚上 review 了下 annotation.js 和 transport.js, 重构了部分代码:

https://github.com/seajs/spm/commit/6b80972ba1800b0309e81c618f1bd30ecf101b29

annotation 我调整了输出值,如果是单项,保持为字符串,如果是多项,value 才为数组。

test/spm 下,少了 spec.js? 我补充了一个 spec.json. 测试:

node path/to/annotation

lib 下的所有文件,我用 gjslint --strict *.js 检查了下,目前还有 transport.js 不符合,文河看看能否调整下,尽量都遵守 google 的 js 代码规范。seajs 项目里,我的习惯是在 build.xml 里:

<target name="gjslint">
    <exec executable="/usr/local/bin/gjslint" os="Mac OS X" failonerror="true">
      <arg line="--strict *.js"/>
    </exec>
</target>

这样,不通过 strict 检查,不允许构建,感觉遵守 gjslint 后,协作起来舒适了很多。

继续努力,一起加油!

from spm.

yyfrankyy avatar yyfrankyy commented on July 19, 2024

已调整~第一版本实现的时候直接quick and dirty,下周继续改进,spec下周也继续补全。

gjslint我是写了个vim插件辅助校验https://github.com/yyfrankyy/vimfiles/blob/master/plugin/gjslint.vim ,不过默认没有开启strict模式。。已经修改~

from spm.

lifesinger avatar lifesinger commented on July 19, 2024

不急,慢慢来。一起努力就好!

from spm.

yyfrankyy avatar yyfrankyy commented on July 19, 2024

目前入口已经集中到spm,将bin放到全局path,即可执行以下命令。

spm help

spm transport [module] [module] ...

不提供module默认打包全部。Module支持多个。

from spm.

lifesinger avatar lifesinger commented on July 19, 2024

有无强制覆盖当前版本的参数:

spm transport --override [module]

类似这种?

transport 比较学术化,是否可以考虑用更通俗的单词,比如:

spm install [module-name]

文河有兴趣研究下 npm 的命令名称?

from spm.

yyfrankyy avatar yyfrankyy commented on July 19, 2024

嗯,目前仅仅把命令开始集中到spm下,至于如何设计命令名称,慢慢借鉴一些已有的程序。

而且现在都是command模式,好改~

不用install的原因是我们好像真的没install啥东西…

from spm.

lifesinger avatar lifesinger commented on July 19, 2024

npm install 的主要工作也仅仅是往 node_modules 目录写文件,呵呵

关键是 install 比 transport 更能让用户理解,尽量沿袭一些用户熟悉的惯例

from spm.

yyfrankyy avatar yyfrankyy commented on July 19, 2024

install有点误导的嫌疑哦。目前加多了一个build 功能等同于transport,在spm代码里加上了commands映射,做alias命令中转,为提供丰富的同等API做准备。

https://github.com/seajs/spm/commit/be7cfa65d1ec236060de9208eca93b087f9c96e4#L1R52

接下来继续调研enternpm的命令,逐步丰富spm的功能点。

from spm.

skyblue avatar skyblue commented on July 19, 2024

还是比较期望build / deploy方面的功能更强一些

from spm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.