Skip to content
/ antmove Public
forked from ant-move/Antmove

蚂蚁搬家工具,让小程序跨平台开发变得简单。

Notifications You must be signed in to change notification settings

e-f-e/antmove

This branch is 15 commits ahead of, 2 commits behind ant-move/Antmove:master.

Folders and files

NameName
Last commit message
Last commit date
Jul 19, 2019
Jul 19, 2019
Jul 19, 2019
Jul 18, 2019
Jul 19, 2019
Jul 16, 2019
Jul 16, 2019
Jul 16, 2019
Jul 16, 2019
Jul 16, 2019
Jul 17, 2019
Jul 18, 2019
Jul 18, 2019
Jul 16, 2019
Jul 16, 2019
Jul 19, 2019
Jul 19, 2019
Jul 18, 2019

Repository files navigation

蚂蚁搬家(antmove)

蚂蚁搬家工具,让小程序跨平台开发变得简单。

安装

  • 全局安装
$ npm install antmove -g
  • 本地安装
$ npm install antmove --save

快速开始

命令行使用

这里提供两种可用的命令行调用方式

  • antmove wx-alipay(使用前请将终端切换到需转换编译的微信小程序项目路径)
antmove wx-alipay ./dist/alipay-app
  • antmove - 该命令更加灵活,可配置输出输出目录/编译模式等
antmove -i ./wechat-mini/project -o ./dist/alipay-mini/project --env development

./wechat-mini/project 微信小程序项目转换为支付宝小程序项目,转换到 ./dist/alipay-mini/project 目录

  • --input,-i
    • 可选,编译源码目录,如果不传则是当前目录
  • --output,-o
    • 必传,编译输出目录
  • --env,-e
    • 可选,编译模式,生产模式代码会压缩,无编译日志及运行时日志

Node.js 使用方式

const path = require('path');
const transformFramework = require('antmove');
const WechatPlugin = require('@antmove/wx-alipay');

let outputPath = path.join(__dirname, '../../dist');
let inputDirPath = path.join(__dirname, '../../examples/miniprogram-demo/miniprogram');

const App = transformFramework();

App.use(
    WechatPlugin, 
    {
        entry: inputDirPath,
        dist: outputPath + '/alipaymini-demo',
        env: 'development'
    })
    .start();

API

transformFramework

工具实例生成函数。

const App = transformFramework();   // 得到的 app 实例即可进行转换处理操作

App

  • use | Function - App.use(plugin, pluginOptions) - 挂载插件到实例上,可挂载多个,按挂载顺序执行
    • plugin: 转换插件
    • pluginOptions: 转换插件配置项
      • entry | String - 转换源码目录
      • dist | String - 转换后代码输出目录
      • env | String - 编译环境设置(env/prod)
        • 默认值为生产环境
      • remote | Boolean - 是否拉去远程差异化抹平代码
        • 默认开启
  • start | Function - 开始编译操作

计划(进行中)

  • 支付宝转百度能力支持
  • 支付宝转微信能力支持
  • 支付宝转头条能力支持
  • 页面/组件维度转换能力支持

贡献

欢迎参与蚂蚁搬家项目的开发建设和讨论。

提交 pull request 之前请先提 Issue 讨论.

协议

GPL

联系

About

蚂蚁搬家工具,让小程序跨平台开发变得简单。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.2%
  • CSS 2.0%
  • HTML 0.8%