npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

seajs-packager

v0.0.2

Published

Spm plugin for building seajs business modules.

Downloads

2

Readme

seajs-packager

A spm2 plugin for building the seajs business modules


Get start

该spm2插件采用自定义的方式来打包业务模块。 基本的思想与chaos-build一致,就是将业务模块经过transport以及concat后,将文件使用md5值进行重命名,并通过seajs-config配置map,从而达到在使用时做require的映射转换。不过增加了一些自己的想法,即开发人员要对每个模块的暴露出来的对象以及它下面的子模块划分有一个清晰的认识,这个配置通过每个模块目录下的package.json文件来配置。

dev环境开发时,我们希望页面上的js文件是原始的文件,即没有经过concat和minify过的,这时只要讲seajs.config的seajs.production = false即可。我们保持build出来的目录层级关系与开发时一致,从而可以轻松切换dev和production环境。

其模块组织方式类似与java的包管理,每个模块为单独一个目录,每个目录下面可以有一个package.json文件,定义该目录下需要暴露出的模块有哪些,并可以定义其下级子模块(使用modules配置)。比如有如下目录结构:

-- js\
    -- app\
        -- userCenter\
            -- base \
            -- blogs \
            -- users \
            auth.js
            package.json

package.json 如下:

{   
    "spm" : {
        "modules": [ "base", "blogs", "users" ],
        "output": {
            "relative": [ "auth.js" ]
        }
    }
}

上面的配置表明在目录下有base blogs users 3个子模块(每个模块下面可以在使用package.json进行配置), 并且该目录有auth.js需要编译,采用relative方式进行。

Install

确保已经安装了最新版本的Node.js

$ npm install spm -g
$ npm install seajs-packager -g

Usage

$ seajs-packager [dir] [options]

Options

  • -C Sea.js的配置文件,默认为./seajs-config.js
  • -O build输出目录, 默认为sea-modules
  • -D 指定默认Sea.js的配置文件路径(.json), 比如一些alias, preload选项

0.0.1

  • 初步实现功能