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

febd

v1.1.3

Published

fe build

Downloads

3

Readme

fe build

整个程序是依赖于 webpack , gulp 做模块管理之外的事

/data 以及 /src 两个文件夹与本项目无关,只是例子

如何安装

npm install febd --save-dev

如何使用
var Febd = require('febd');
var febd = new Febd(/*config*/); // config 在后面会讲到, 当然这个配置项是必须的
febd 提供的接口
// 启动 mock 服务
febd.mock(opts);

// 启动调试服务
// callback(makerWebpackConfig, webpack) makeWebpackConfig.get() 之前对 makeWebpack 进行其他操作
// 这个栗子 #A 会在后面讲到
febd.devSatart(callback);

// 启动模拟线上的前端打包环境
febd.build(gulpCallback, callback);

// 启动前端服务 - 这个仅用在 .build 情况下
febd.connect();
makerWebpackConfig 提供的接口 (有一些我就略过了)
  • .set(webpackConfig) - 直接传入一个 webpackConfig.js - 如果你很熟悉 webpack 的配置项了,就直接用这个吧
  • .setAlias(aliasObject) - 设置 alias
  • .addLoaders(loaders) {Array|Object} - ([{loader}, {loader}]) | {loader}
  • .clearLoaders()
  • .addPlugins(plugins) {Array}
  • ... 还有一些就看源码吧,注释都加上了
有两个必须的文件
  • config.js - 至于名字你随意,这是一个很重要的文件,他作为整个程序的基础配置项
  • gulpfile.js - 这个是作为启动本地服务、模拟线上环境、打包用的

上面2个文件你可以在 node_modules/febd 中拷贝样例

config.js

直接看 node_modules/febd 中的例子哇,主要是做了一些基础配置项

gulpfile.js
var path = require('path');
var srcDir = path.resolve(process.cwd(), 'src');

var setMaker = function (maker, webpack) {
    maker.setAlias({
        zepto: srcDir + '/static/js/common/zepto',
        ui: './ui/'
    });

    maker.addPlugins([
        new webpack.ProvidePlugin({
            $: 'zepto'
        })
    ]);
};

/** 
 * DEV
 */
gulp.task('dev-webpack', function (callback) {
    // 这里就是上面要说的栗子 #A 
    febd.devStart(function (maker, webpack) {
        setMaker(maker, webpack);
    });
});

/** 
 * Release
 */
gulp.task('release-webpack', function (gulpCallback) {

    febd.build(gulpCallback, function (maker, webpack) {
        setMaker(maker, webpack);
    });
});

上面是栗子

ME: deo - [email protected]