15 September 2015

fepro

fepro 是一个集初始化、server、mock数据、同步服务器、部署的项目构建工具,提供了gulp的项目模板,可以定制自己的项目模板, 通过在 用户目录 如mac “~/.fepro/projecyTemplate”

npm: https://www.npmjs.com/package/fepro
git: https://github.com/shalles/fepro

New Version

version 1.1.6:

  • fepro init
$ fepro -i

//or in gulp project template
$ fepro -i gulp

initialize command read from fepro.config.init

Insatll

$ (sudo) npm install -g fepro

Usage

// xxx is you project folder
$ mkdir xxx
$ cd xxx
$ fepro -b gulp

//or 

$ fepro -b gulp xxx 

// new project please excute

$ bower install && npm install 

//or

$ fepro -i gulp

$ gulp

// at project build/base path same as package.json
// more config in fepro.config

//fepro.config
{
    "init": "bower install && npm install", //ininial command  "$ fepro -i"
    "env": "RE", //Debug 版本号为@dev 代码无压缩 非Debug 版本号为@时间戳 代码压缩
    "version": false,//!DEBUG,
    // 此功能需要安装chrome插件 "https"://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei
    "livereload": true,//DEBUG,
    "minify": true,//!DEBUG,
    // 本地导出目录
    "exports": "src/export",
    "tmp": "src/tmp",
    // 以下对应命令 gulp + ''/server/sync/views/scripts/styles/images
    // 默认gulp 执行所有并watch
    "server":{ //more see servermock "https"://www.npmjs.com/package/servermock or "https"://github.com/shalles/servermock
        "port": 8080,
        "protocol": "http", //https\
        "key": "~/cert/cert.key",
        "cert": "~cert/cert.crt",
        "main": "src/export/pages/app-1.html",
        // mock请求
        "mock":{
            "datapath": "mock/",
            "pagepath": "", //page mock data path, default same as page file with .json or .mjson
            "mockrc": ".mockrc", //相对mock datapath
            "ignore": ["html", "jpg", "png", "gif"],
            "regexurl": { //前面是regex new RegExp()
                "/api/1placesuggestion" : "placesuggestion.js", //走js 遵循cmd
                "/api/1placesuggestion" : "placesuggestion.json", //
                "/api/placesuggestion" : "placesuggestion.mjson" //
            }
        }
    },
    // 需要上传到服务器的时候启用 且值为远程服务器地址 gulp sync
    "sync": {
        "flag": "az", //详细请再命令行rsync -h : shell(value): --rsh=SHELL; delete(): --delete;  progress(): --progress;  archive(): -a;  compress(): -z;  recursive(): -r;  update(): -u;  quiet(): -q;  dirs(): -d;  links(): -l;  dry(): -n;          
        "source": "src/export/*",
        "dest": "192.168.1.15:/home/shalles/workspace/www/src.shalles.org"
    },
    // 视图页面的目录和导出目录
    "views": {
        "src": "src/views/**/*",
        "exp": "src/export/pages"
    },
    // 脚本的目录和导出目录 支持coffee
    "scripts": {
        "src": "src/scripts/",
        "exp": "src/export/js"
    },
    "styles": {
        "scss": true,  //使用scss开发时设为ture
        "src": "src/styles/",
        "exp": "src/export/css"
    },
    "images": {
        "min": false,  //需要压缩图片是设为true
        "src": "src/images/**/*",
        "exp": "src/export/images"
    }
}

不仅提供了一些默认模板 如:$ fepro -b gulp … 也提供了自定义模板的功能
只需要在当前用户目录下添加.fepro目录,然后把你的项目模板放到该目录下,

如:mac/linux下 ~/.fepro/yourProjectFolder
然后执行 $ fepro -b yourProjectFolderName 即可

more info

https://www.npmjs.com/package/servermock
or
https://github.com/shalles/servermock

https://www.npmjs.com/package/gulp-fecmd or fecmd
or
https://github.com/shalles/gulp-fecmd