Git Product home page Git Product logo

wxtoalipay's Introduction

wxToAlipay

微信小程序支付宝小程序

命令行打包

npm install wx-alipay -g

wxToalipay --src={{小程序源码目录}} --dest={{支付宝小程序目录,可缺省}}

// 排除部分资源
wxToalipay --src=/weixin/min --filter="!lizard/package/*,!lizard/Gruntfile.js"

// 定制回调, 在框架处理好后,在对每个文件进行处理
wxToalipay --src=/weixin/min --callback="wxToAlipay.js"

wxToAlipay.js定制

module.exports = function (contents, relative) {
  return contents
}

模块化打包

npm install wx-alipay --save
const wxToalipay = require('wx-alipay')

wxToalipay({
  src: '/Users/liaowei/Documents/code/weixin/all',
  // 可缺省
  dest: '/Users/liaowei/Documents/code/weixin/all_alipay',
  // 可缺省,数组, 排除资源
  filter: [
    '!lizard/package/**/*',
  ],
  // 可缺省, 可在框架处理好后,在对每个文件进行处理
  callback (contents, relative) {
    return contents
  }
})

filter参数详细说明

注意事项

  1. 微信小程序源码必须能在微信环境运行,转化是基于微信小程序源码
  2. 转化现在只测试了乐车邦微信小程序, 如有bug,请提issue
  3. 部分不能转化的问题,需要源码里面做处理,主要表现在js文件
  4. 打包之前,会对源码进行代码校验,校验通过才能打包
  5. 部分微信小程序特性没法转化, 需自行处理

语法转化规则

  1. js
  2. json
  3. wxml
  4. wxss
  5. wxs
  6. svg
  7. 自定义组件

插件

  1. 主要使用bable插件完成Js语法替换,参考babel-types, babel-template, babel-generator, babel-traverse
  2. htmldom完成wxml语法替换
  3. file-system操作文件

乐车邦微信小程序

微信小程序

乐车邦支付宝小程序

wxtoalipay's People

Contributors

douzi8 avatar

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.