minapp

Redefine the development of wechat applets

Liverpoolfc.tv: qiu8310. Making. IO/minapp /

Author: Mora

minapp

Redefine the development of wechat applets

use

  1. Install command line tools with NPM:npm install -g @minapp/cli --registry "https://registry.npmjs.org/"(Avoid installation from Taobao mirror, it is still the old version, has given them oneissue)
  2. Initialization project:Minapp init < folder where you want to create the project >(Support for creating JS and TS projects)
  3. Install two vscode plug-ins: minapp and dot-template (optional, but recommended)

Feature overview (under vscode editor)

Wx has intelligent reminders for all interfaces, including interface parameters, and return values

Provide a Promise version of the WX interface WXP, just like WX, except that it promises all wX functions that require success/fail/complete parameters

  • The SUCCESS callback is also supported in WXP
  • WXP adds a finally method to Promise; For example, you can use it like thiswxp.getUserInfo().finally(() => { /* do something */ })

Integrated with Mobx, you can easily modify global data and automatically update the current page state

  • To inject a Store, you simply add a Store object to the Appify function
  • Both Page and Component inject Store objects by default, which you can usethis.storeTo obtain

The WXML template language supports syntax highlighting, component intelligence hints, and component property intelligence hints (vsCode plug-in required)minapp)

Json files support automatic prompt

When you create a page folder, the related files are automatically generated (vscode plug-in is required)dot-template)

  • Automatically create related files with the same name for you, including js/json/ WXML/SCSS, and these template files can be modified at any time in the.dtpl folder
  • The newly created page path is automatically injected into the app.json folder

Applet Page support function automatic prompt

Similarly, when creating a component folder, associated files are also created. The lifecycle functions in the component are also automatically prompted

About this warehouse description

This is not a single project, but a combination of several projects using lerna development tools. The other projects are in the Packages directory. Here is a brief overview of some of the major projects

  • Minapp-generator: This module is responsible for parsing wechat official documents and generating structured data for use by other modules
  • Minapp-core: TypeScript definitions for all wechat native apis, plus a Promise version of the WX interface
  • Minapp-mobx: Development framework, integrated with Mobx
  • Minapp-compiler: a small program compiler that integrates Webpack and Webpack-dev-server
  • Minapp-webpack-utils: Webpack-related plug-ins that need to be used in the compiler
  • Minapp-cli: Command line tool provided to users, integrated with minapp-compiler, and can quickly create a new project
  • Minapp-vs code: vscode plugin for WXML syntax highlighting, tag and attribute auto-completion

TODO

  • Static resources in the applet automatically upload to seven cow (complete my file-uploader component)
  • Implement vUe-like functionality to write all files on a single page
  • Webpack was upgraded to 4.0
  • Write an automated test framework for a small program

Next: The author’s kiss, redefine wechat small program development — part 1


In 2019, iKcamp’s original new book Koa and Node.js Development Actual Combat has been sold on JD.com, Tmall, Amazon and Dangdang!