nanachi-cli
cli tool for nanachi
Last updated 20 days ago by yangtao_blue .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install nanachi-cli 
SYNC missed versions from official npm registry.

娜娜奇脚手架

以React方式高效开发小程序

这只是anu的一个扩展,通过实现不同的render,以支持在微信小程序,百度小程序,支付宝小程,快应用,H5, hybird上运行。

安装

npm

npm install nanachi-cli -g

yarn

yarn global add nanachi-cli

使用方式

  1. nanachi init <project-name> 创建工程
  2. cd <project-name> && npm i 安装依赖
  3. nanachi watch:[wx|bu|ali|quick] 监听构建小程序
  4. nanachi build:[wx|bu|ali|quick] 构建小程序
  5. 用微信开发工具打开当中的dist目录,自己在source目录中进行开发

注意:快应用下构建结束后,需要执行以下三步骤

  1. npm install
  2. npm run build
  3. npm run server
    详情请见快应用文档

详见 https://rubylouvre.github.io/nanachi/index.htmlhttps://github.com/RubyLouvre/anu/tree/master/packages/render/miniapp

image

nanachi api

const nanachi = require('nanachi-cli');
nanachi({
    /**
     * @Boolean
     * 是否使用watch模式,默认值:false
     */
    watch,
    /**
     * @Enum ['wx', 'ali', 'bu', 'tt', 'quick']
     * 平台,默认值:wx
     */
    platform,
    /**
     * @Boolean
     * 是否使用线上beta核心库,默认值:false
     */
    beta,
    /**
     * @Boolean
     * 是否使用最新schnee-ui,默认值:false
     */
    betaUi,
    /**
     * @Boolean
     * 是否使用压缩模式,默认值:false
     */
    compress,
    /**
     * @Object
     * 压缩图片参数(压缩率等)
     */
    compressOption,
    /**
     * @Boolean
     * 是否是huawei平台,默认值:false
     */
    huawei,
    /**
     * @Array
     * 自定义预处理loaders,默认值:[]
     */
    prevLoaders,
    /**
     * @Array
     * 自定义后处理loaders,默认值:[]
     */
    postloaders,
    /**
     * @Array
     * 自定义添加webpack module.rules规则,默认值:[]
     */
    rules,
    /**
     * @Array
     * 自定义webpack插件,默认值:[]
     */
    plugins,
    /**
     * @function complete
     * 解析完成回调
     * (err, result) => { }
     * err: 错误
     * result: webpack打包信息
     */ 
    complete
});
/**
 * compressOption:
 * {
 *  jpg: {} // 具体参考 https://github.com/imagemin/imagemin-mozjpeg/blob/master/readme.md
 *  png: {} // 具体参考 https://github.com/imagemin/imagemin-optipng/blob/master/readme.md
 *  gif: {} // 具体参考 https://github.com/imagemin/imagemin-gifsicle/blob/master/readme.md
 *  svg: {} // 具体参考 https://github.com/imagemin/imagemin-svgo/blob/master/readme.md
 * }
 */

自定义loader

用户可以使用nanachi api编译nanachi应用,同时支持自定义预处理loader和后处理loader。

compress压缩模式就是使用后处理loader实现的,链接:https://www.npmjs.com/package/nanachi-compress-loader

我们规定了loader的输入和输出格式

{
    queues: // 需要生成的文件数组,如nanachi中的js文件在微信转义中会同时生成wxml和js文件还有可能生成json文件
        [{
            code, // 生成文件内容
            type, // 生成文件类型
            path // 生成文件相对路径
        }],
    exportCode // 标准js代码,包含了文件的依赖信息,用于webpack解析文件依赖
}

nanachi config

自定义loader应用到项目中,有两种方式供选择:

  1. 在项目根目录下创建nanachi配置文件,nanachi.config.js
// nanachi.config.js
module.exports = {
    postLoaders: ['nanachi-compress-loader']
}

正常运行nanachi命令,即可将自定义配置应用到项目中

npm install nanachi-compress-loader --save-dev
nanachi build
  1. 使用nanachi api,自定义编译脚本
// build.js
const nanachi = require('nanachi-cli');

nanachi({
    platform: 'ali',
    postLoaders: ['nanachi-compress-loader']
});
node build.js

开发者交流群

411547729622_ pic

Current Tags

  • 1.3.6-beta.2                                ...           beta (7 days ago)
  • 1.3.5                                ...           latest (20 days ago)
  • 1.2.3-beta.0                                ...           nanachi-cli-webpack-base@1.2.3 (5 months ago)
  • 1.1.5-beta.0                                ...           nanachi-cli@1.1.5-beta.0 (6 months ago)
  • 1.1.6-beta.0                                ...           nanachi-cli@1.1.6-beta.0 (6 months ago)
  • 1.1.7-beta.0                                ...           nanachi-cli@1.1.7-beta.0 (6 months ago)
  • 1.1.7-beta.1                                ...           nanachi-cli@1.1.7-beta.1 (6 months ago)
  • 1.1.7-beta.2                                ...           nanachi-cli@1.1.7-beta.2 (6 months ago)
  • 1.1.7-beta.3                                ...           nanachi-cli@1.1.7-beta.3 (6 months ago)
  • 1.1.8-beta.0                                ...           nanachi-cli@1.1.8-beta.0 (6 months ago)
  • 1.1.8-beta.1                                ...           nanachi-cli@1.1.8-beta.1 (6 months ago)
  • 1.1.8-beta.2                                ...           nanachi-cli@1.1.8-beta.2 (6 months ago)
  • 1.1.9-beta.0                                ...           nanachi-cli@1.1.9-beta.0 (6 months ago)
  • 1.1.9-beta.1                                ...           nanachi-cli@1.1.9-beta.1 (6 months ago)
  • 1.1.9-beta.2                                ...           nanachi-cli@1.1.9-beta.2 (6 months ago)
  • 1.1.9-beta.3                                ...           nanachi-cli@1.1.9-beta.3 (6 months ago)
  • 1.2.0-beta.0                                ...           nanachi-cli@1.2.0-beta.0 (6 months ago)
  • 1.2.0-beta.1                                ...           nanachi-cli@1.2.0-beta.1 (5 months ago)
  • 1.2.0-beta.2                                ...           nanachi-cli@1.2.0-beta.2 (5 months ago)
  • 1.2.0-beta.3                                ...           nanachi-cli@1.2.0-beta.3 (5 months ago)
  • 1.2.0-beta.4                                ...           nanachi-cli@1.2.0-beta.4 (5 months ago)
  • 1.2.1-beta.0                                ...           nanachi-cli@1.2.1-beta.0 (5 months ago)
  • 1.2.1-beta.1                                ...           nanachi-cli@1.2.1-beta.1 (5 months ago)
  • 1.2.1-beta.2                                ...           nanachi-cli@1.2.1-beta.2 (5 months ago)
  • 1.2.1-beta.3                                ...           nanachi-cli@1.2.1-beta.3 (5 months ago)
  • 1.2.1-beta.4                                ...           nanachi-cli@1.2.1-beta.4 (5 months ago)
  • 1.2.3-beta.1                                ...           nanachi-cli@1.2.3-beta.1 (4 months ago)
  • 1.2.3-beta.7                                ...           nanachi-cli@1.2.3-beta.7 (4 months ago)
  • 1.2.7-beta.0                                ...           nanachi-cli@1.2.7-beta.0 (4 months ago)
  • 1.3.2-beta.0                                ...           nanachi-cli@1.3.2-beta.0 (3 months ago)

119 Versions

  • 1.3.6-beta.2                                ...           7 days ago
  • 1.3.6-beta.1                                ...           9 days ago
  • 1.3.6-beta.0                                ...           13 days ago
  • 1.3.5                                ...           20 days ago
  • 1.3.4                                ...           22 days ago
  • 1.3.4-beta.5                                ...           22 days ago
  • 1.3.4-beta.4                                ...           22 days ago
  • 1.3.4-beta.3                                ...           23 days ago
  • 1.3.4-beta.2                                ...           a month ago
  • 1.3.4-beta.1                                ...           a month ago
  • 1.3.4-beta.0                                ...           a month ago
  • 1.3.3                                ...           2 months ago
  • 1.3.3-beta.8                                ...           2 months ago
  • 1.3.3-beta.7                                ...           2 months ago
  • 1.3.3-beta.6                                ...           2 months ago
  • 1.3.3-beta.5                                ...           2 months ago
  • 1.3.3-beta.4                                ...           2 months ago
  • 1.3.3-beta.3                                ...           2 months ago
  • 1.3.3-beta.2                                ...           3 months ago
  • 1.3.3-beta.1                                ...           3 months ago
  • 1.3.3-beta.0                                ...           3 months ago
  • 1.3.2                                ...           3 months ago
  • 1.3.2-beta.3                                ...           3 months ago
  • 1.3.2-beta.2                                ...           3 months ago
  • 1.3.2-beta.1                                ...           3 months ago
  • 1.3.2-beta.0                                ...           3 months ago
  • 1.3.1                                ...           3 months ago
  • 1.3.1-beta.5                                ...           3 months ago
  • 1.3.1-beta.4                                ...           3 months ago
  • 1.3.1-beta.3                                ...           3 months ago
  • 1.3.1-beta.2                                ...           3 months ago
  • 1.3.1-beta.1                                ...           3 months ago
  • 1.3.1-beta.0                                ...           3 months ago
  • 1.3.0                                ...           3 months ago
  • 1.3.0-beta.0                                ...           3 months ago
  • 1.2.9-beta.0                                ...           3 months ago
  • 1.2.8                                ...           3 months ago
  • 1.2.8-beta.1                                ...           4 months ago
  • 1.2.8-beta.0                                ...           4 months ago
  • 1.2.7                                ...           4 months ago
  • 1.2.7-beta.2                                ...           4 months ago
  • 1.2.7-beta.1                                ...           4 months ago
  • 1.2.7-beta.0                                ...           4 months ago
  • 1.2.3-beta.8                                ...           4 months ago
  • 1.2.3-beta.7                                ...           4 months ago
  • 1.2.6                                ...           4 months ago
  • 1.2.5                                ...           4 months ago
  • 1.2.3-beta.6                                ...           4 months ago
  • 1.2.3-beta.5                                ...           4 months ago
  • 1.2.3-beta.4                                ...           4 months ago
  • 1.2.4                                ...           4 months ago
  • 1.2.3-beta.3                                ...           4 months ago
  • 1.2.3-beta.2                                ...           4 months ago
  • 1.2.3-beta.1                                ...           4 months ago
  • 1.2.3                                ...           4 months ago
  • 1.2.3-beta.0                                ...           5 months ago
  • 1.2.2                                ...           5 months ago
  • 1.2.1                                ...           5 months ago
  • 1.2.1-beta.4                                ...           5 months ago
  • 1.2.1-beta.3                                ...           5 months ago
  • 1.2.1-beta.2                                ...           5 months ago
  • 1.2.1-beta.1                                ...           5 months ago
  • 1.2.1-beta.0                                ...           5 months ago
  • 1.2.0                                ...           5 months ago
  • 1.2.0-beta.4                                ...           5 months ago
  • 1.2.0-beta.3                                ...           5 months ago
  • 1.2.0-beta.2                                ...           5 months ago
  • 1.2.0-beta.1                                ...           5 months ago
  • 1.2.0-beta.0                                ...           6 months ago
  • 1.1.9                                ...           6 months ago
  • 1.1.9-beta.3                                ...           6 months ago
  • 1.1.9-beta.2                                ...           6 months ago
  • 1.1.9-beta.1                                ...           6 months ago
  • 1.1.9-beta.0                                ...           6 months ago
  • 1.1.8                                ...           6 months ago
  • 1.1.8-beta.2                                ...           6 months ago
  • 1.1.8-beta.1                                ...           6 months ago
  • 1.1.8-beta.0                                ...           6 months ago
  • 1.1.7                                ...           6 months ago
  • 1.1.7-beta.3                                ...           6 months ago
  • 1.1.7-beta.2                                ...           6 months ago
  • 1.1.7-beta.1                                ...           6 months ago
  • 1.1.7-beta.0                                ...           6 months ago
  • 1.1.6                                ...           6 months ago
  • 1.1.6-beta.0                                ...           6 months ago
  • 1.1.5                                ...           6 months ago
  • 1.1.5-beta.0                                ...           6 months ago
  • 1.1.4                                ...           7 months ago
  • 1.1.3                                ...           7 months ago
  • 1.1.2                                ...           7 months ago
  • 1.1.1                                ...           8 months ago
  • 1.1.0                                ...           8 months ago
  • 1.0.9                                ...           8 months ago
  • 1.0.8                                ...           8 months ago
  • 1.0.7                                ...           8 months ago
  • 1.0.7-beta.0                                ...           8 months ago
  • 1.0.6                                ...           8 months ago
  • 1.0.5                                ...           8 months ago
  • 1.0.4                                ...           9 months ago
  • 1.0.3                                ...           9 months ago
  • 1.0.2                                ...           9 months ago
  • 1.0.1                                ...           9 months ago
  • 1.0.0                                ...           9 months ago
  • 0.0.2-beta.15                                ...           a year ago
  • 0.0.2-beta.14                                ...           a year ago
  • 0.0.2-beta.13                                ...           a year ago
  • 0.0.2-beta.12                                ...           a year ago
  • 0.0.2-beta.11                                ...           a year ago
  • 0.0.2-beta.10                                ...           a year ago
  • 0.0.2-beta.9                                ...           a year ago
  • 0.0.2-beta.8                                ...           a year ago
  • 0.0.2-beta.7                                ...           a year ago
  • 0.0.2-beta.6                                ...           a year ago
  • 0.0.2-beta.5                                ...           a year ago
  • 0.0.2-beta.3                                ...           a year ago
  • 0.0.2-beta.2                                ...           a year ago
  • 0.0.2-beta.1                                ...           a year ago
  • 0.0.2-beta.0                                ...           a year ago
  • 0.0.1                                ...           a year ago
Downloads
Today 0
This Week 4
This Month 121
Last Day 2
Last Week 78
Last Month 460
Dependencies (89)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |