Giter Club home page Giter Club logo

antmove's Introduction

注意:该仓库已停止维护







指南

Antmove - 小程序转换器,基于支付宝/微信小程序转换为多端小程序,让小程序跨平台开发变得简单。

一键实现小程序转换迁徙,不再为重复开发而烦恼。

antmove structure

特性

  • 简单易使用,一键转换
  • 配套详细的编译时日志/运行时日志工具
  • 编译生成代码可读性强,可二次编程
  • 二次编译支持
  • 组件转换支持

文档

安装

VsCode 扩展安装

在 vscode 扩展中搜索 Antmove 下载安装 Antmove vscode 转换插件实现一键转换。

命令行安装

我们推荐使用 npm 或 yarn 的方式进行开发,不仅可在开发环境轻松调试,也可放心地在生产环境打包部署使用,享受整个生态圈和工具链带来的诸多好处。

  • 全局安装
$ npm install antmove -g

$ yarn global add antmove
  • 本地安装
$ npm install antmove --save

$ yarn add antmove

如果你的网络环境不佳,推荐使用 cnpm

快速开始

VsCode 扩展使用

  • 安装扩展(Antmove - antmove-vscode-plugin)

  • 在 VsCode 中打开要转换的项目

  • 打开 VsCode 命令面板

    • Mac: command + shift + p
    • Windows: ctrl + shift + p
  • 输入 Antmove

  • 运行 Antmove: Run antmove 命令

  • 运行如上命令后会给出一个弹窗,选择转换后生成代码存储目录

  • 转换完成

  • antmove-vscode-plugin

本插件依赖于 vscode 代码编辑器,安装了 vscode 的用户才能使用。

命令行使用

npm i -g antmove

通过 npm 或 yarn 全局安装才能使用如下命令行

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

如上的命令表示将 ./wechat-mini/project 微信小程序项目转换为支付宝小程序项目,转换到 ./dist/alipay-mini/project 目录 如果你不想输入参数,可以体验交互式的命令方式,执行 antmove 即可。

配置参数

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

更多配置项可参考配置参数详情

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();

微信小程序

这里展示的微信小程序为原小程序应用,下面的其它平台小程序为基于这些微信小程序转换得到。

支付宝小程序

高德小程序

如果你的公司和产品使用了 Antmove,欢迎到这里留言。

贡献

欢迎参与 Antmove 项目的开发建设和讨论。

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

协议

GPL

antmove's People

Contributors

iamxiaobo avatar xiaofuzi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

antmove's Issues

未声明的变量

packages/@antmove/utils/src/getAntmoveConfigJs.js
该目录下的变量antmoveConfigDist没有声明

什么都没有

system

  • ubuntu 18.04
  • vscode 1.42.0-insder

test

只提示

欢迎使用蚂蚁搬家工具,您的项目已成功完成转换。

但是,什么都没有产生

转头条小程序 报错 TypeError: Cannot read property 'parent' of null

通过 命令行方式转换的,,,通过 vscode上,输入 Antmove之后会出现Run antmove,点击后出现本项目的目录,确定后让我选择文件夹,请问这一步是什么意思?应该怎么操作,我新建文件夹点击确定后右下角提示我转换成功,但是找不到转换后的项目

支付宝小程序转微信

问题描述

将支付宝小程序转微信,转的时候没有提示 按照步骤操作完没有反应

系统环境

  • 出现问题的antmove版本:1.1.19
  • 没出现问题的antmove版本(如果有):
  • 操作系统:
  • Node.js版本:8.11.1
  • 使用antmove命令行工具/vscode插件:插件
  • 转换类型(微信转支付宝等等):alipay-wx

node命令执行时的报错

运行antmove命令时出现的报错信息

IDE运行时调试窗口报错

在IDE或者真机上调试时出现的报错信息

复现步骤或者可用于复现的代码

编译后出现了页面找不到的问题

问题:Error: page 'pages/my/my' not found!
at r (af-appx.worker.ide.min.js:7)
at z.O [as newPage] (af-appx.worker.ide.min.js:7)
at af-appx.worker.ide.min.js:7
切换编译模式其他页面页出现了这样的问题

node版本限制说明?

看你们貌似在amove中使用了类的公有变量,然而这个feature得node12.4.0才支持吧,在readme或者package中说明下?或者你们使用转换后的版本fix下?

处理 JavaScript class语法 时,抛出错误:UnhandledPromiseRejectionWarning

在执行 微信小程序转支付宝小程序,处理 Javascript class 语法时抛出以下错误:

UnhandledPromiseRejectionWarning: SyntaxError: unknown: Support for the experimental syntax 'classProperties' isn't currently enabled

其中,babel给出提示:

Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.

vscode 插件不能使用

目前我是回退到1.1.0 版本是能够使用的 最新版本我选择生成文件夹之后 没有任何反应 也没有任何文件产生

组件data污染

问题描述

描述下你遇到的问题

组件 created: function () {
this.data=Object.assign(this.data,JSON.parse(JSON.stringify(rawData)) ) ;//rawData 组件原始data
}
this.data 页面跳转后 留存了上一次的信息

系统环境

  • 出现问题的antmove版本:
  • 没出现问题的antmove版本(如果有):
  • 操作系统:
  • Node.js版本:
  • 使用antmove命令行工具/vscode插件:
  • 转换类型(微信转支付宝等等):

node命令执行时的报错

运行antmove命令时出现的报错信息

IDE运行时调试窗口报错

在IDE或者真机上调试时出现的报错信息

复现步骤或者可用于复现的代码

转换不生效

运行 Antmove: Run antmove alipay-wx 命令,然后选择本地目录存储路径后无反馈任何信息?
image

wx:key="unique" 转化后变成 a:key='{{unique}}'

问题描述

描述下你遇到的问题

系统环境

  • 出现问题的antmove版本:1.2.13
  • 没出现问题的antmove版本(如果有):
  • 操作系统:
  • Node.js版本:v14.8.0
  • 使用antmove命令行工具/vscode插件:使用antmove命令行工具
  • 转换类型(微信转支付宝等等):微信转支付宝

node命令执行时的报错

运行antmove命令时出现的报错信息

IDE运行时调试窗口报错

在IDE或者真机上调试时出现的报错信息

复现步骤或者可用于复现的代码

微信小程序转百度小程序报错

命令行安装antmove
npm install antmove -g
切换到微信小程序所在目录
antmove wx-baidu ./dist/baidu-app
然后报错
TypeError: Cannot read property 'forEach' of undefined
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\antmove\node_modules\wx2\src\util\progress.js:15:19
at FSReqCallback.oncomplete (fs.js:171:23)
run error: ENOENT: no such file or directory, stat 'D:\testspace\antmoveMini\dist_antmoveDist'
Error: ENOENT: no such file or directory, stat 'D:\testspace\antmoveMini\dist_antmoveDist'
(node:21120) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir 'D:\testspace\antmoveMini\dist_antmoveDist'
at Object.readdirSync (fs.js:1021:3)
at fileUtils.emptyFiles (C:\Users\Administrator\AppData\Roaming\npm\node_modules\antmove\node_modules@antmove\utils\src\file.js:115:6)
at module.exports (C:\Users\Administrator\AppData\Roaming\npm\node_modules\antmove\node_modules@antmove\wx-baidu\index.js:36:9)
(Use node --trace-warnings ... to show where the warning was created)
(node:21120) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection
id: 1)
(node:21120) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

报错 command 'extension.antmove' not found

问题描述

vscode 装好了插件运行 Antmove: Run antmove wx-alipay ,报错 command 'extension.antmove' not found

系统环境

win10

复现步骤或者可用于复现的代码

Antmove: Run antmove wx-alipay

微信转支付宝小程序 swiper自动转成了自定义导致支付宝小程序页面显示错误

问题描述

描述下你遇到的问题

系统环境

  • 出现问题的antmove版本:1.1.12
  • 操作系统:macos 10.15.7
  • Node.js版本:
  • 使用antmove命令行工具
  • 转换类型(微信转支付宝等等):antmove wx-alipay
    1.我创建了一个很简单的微信小程序,页面里使用了微信原生swiper组件,自动转换后,把swiper给封装了自定义的并且支付宝小程序显示系统错误
    原微信代码

转换后代码

以上代码导致支付宝小程序页面展示系统错误

手动改为









后,支付宝小程序显示正常,请问如何解决?
请问,如何避免antmove 自动的把微信原生swiper 转换成自定义的组件

vscode 装好了插件运行

问题描述

描述下你遇到的问题

系统环境

  • 出现问题的antmove版本:
  • 没出现问题的antmove版本(如果有):
  • 操作系统:
  • Node.js版本:
  • 使用antmove命令行工具/vscode插件:
  • 转换类型(微信转支付宝等等):

node命令执行时的报错

运行antmove命令时出现的报错信息

IDE运行时调试窗口报错

在IDE或者真机上调试时出现的报错信息

复现步骤或者可用于复现的代码

Antmove Users

谁在使用

如果您和您的公司或组织使用了 Antmove ,非常感谢您的支持,欢迎留下公司或产品名,您的回复将成为维护者、社区用户和观望者的信心来源。

在不泄露信息的前提下,建议把截图晒一晒~
无关回复将会定期删除

推荐回复格式:

- 产品:
- 公司或组织:(如果可以)
- 链接:(如果可以)
- 截图:(如果可以)

JSON.parse解析错误的问题

想从微信小程序转百度小程序,但是目前只能通过先转支付宝小程序再转百度。

但是在从支付宝再转百度的时候,出现了JSON.parse解析错误的问题,我debug了一下代码,对于以下代码有点疑问

  //alipay-baidu-plugin/lifeStyle/index.js 342行
  content = fs.readFileSync(fileInfo.path);//这里不是utf8,是不是考虑特殊文件呢
  const appData = JSON.parse(content);

如果是图片的话。返回类型(不管fs.readFileSync的类型是utf8),都不适用于JSON.parse。

(顺便说一下,百度搬家工具的效果好一点😂,所以还是期待wx-baidu-plugin能有好的效果)

lifeCycles is undefined

使用 node.js 的方式进行转换

提示 lifeCycles is undefined

node_modules/antmove/src/transform/index.js:28:24

自定义脚本文件的引用

支付宝小程序转微信小程序,支付宝中,转成微信后,会变成绝对路径,必须手动修改成相对路径,如果引用的地方过多,挺麻烦的
支付宝中
转化后的微信中

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.