preface

What is a quick app? Taro: What is Taro?

If we have already learned about Koaiko and Taro, we will jump right into the topic “How to use Koaiko apps?” . First of all, we must clarify our goal, not just to write fast applications using the Taro syntax, but “use the Taro syntax to solve multiterminal application development.” In short, we use the familiar Taro syntax, and compile and package them into different languages. Such as wechat/JINGdong/Baidu/Alipay/Bytedance mini programs, kuaiapps, H5, RN, etc. Thus realize the ideal of writing a set of code, multi – terminal operation. (Write once, run anywhere)

Outline of the content

  1. Fast application architecture based on the Taro framework.
  2. How do I start a project?
  3. How to develop projects?
  4. How do I debug a project?
  5. How will the project be delivered?

First, fast application architecture based on the Taro framework

1. The project directory structure is basically as follows. Contents under SRC are customized according to team standards.

. ├ ─ ─ the config# taro Build the configuration file├── dist │ ├─# Compiled code├ ─ ─ scripts# Custom script command├ ─ ─ sign# Fast application project signature certificate│ ├─ ├─ ├─ SRCSource file directoryHeavy Exercises ── apis Heavy Exercises ── Heavy Exercises ── Heavy Exercises ── Heavy Exercises# Subcontract moduleHeavy Exercises ── heavy Exercises ── heavy exercisesCopy the code

2. It can be seen from the project directory structure that the development mode is subcontracting.

  • 1. All sub-business modules (subcontracting) can be developed separately
  • 2. The main project (base package) can be seen as a component library (all common modules are packaged by the main project)
  • 3. Project release: Automatic packaging operation, integration test and release through the main project

How to ensure that each sub-module can run independently, and the main project can be stable integration?

1. First of all, the project development scaffolding was unified to reduce communication problems between projects. 2. Each project can consider itself as the main project. When starting the project, other projects will be downloaded to SRC/Packages/directory in the mode of subcontracting to ensure that sub-projects can be developed independently without missing any functions. 3. The basic tool classes are output by the main project, which reduces code redundancy and ensures the pure and simple content of each sub-project, thus improving the stability of the integration project.

(Details on how to achieve the above functions will be described in the next chapter)

3. What tools are available to support the overall architecture?

  • cliTools to create and update unified scaffolding projects
  • Uniform dependency package configuration table (guaranteed for each projectTaroThe relevant NPM package environments are the same, as are some of the base toolkit environments
  • Release platform (ensure that the release platform environment is the same, and the build and release commands of different projects are the same)

Ii. How to start the project?

Three types of commands are appropriate. 1. Clean up the environment and restart services. 2

(Of course, many people would like to have more functional commands, but it is recommended to only output simple commands to developers, and those complex functional commands are automatically generated by the publishing platform based on parameters without exposure.)

yarn start:qa Delete cache, initialize subcontracting and other contents, and start fast application service

yarn dev:qa # Directly launch the Quick App service

yarn build:qa # Build fast apps
Copy the code

How to develop the project?

In the SRC/root directory app.quickapp.js, configure the page routing. The page module is written in pages/, and the components are written in components/. Of course, how to call native components in Taro, as well as the Taro syntax and a mixture of native syntax, as well as some advanced writing methods, will be explained in detail in subsequent articles.

How to debug the project?

There are three current schemes (compiled by Taro) :

1. Enter http://localhost:12306 to debug

Extremely convenient and fast, can be very efficient hot update, quickly complete UI style debugging, but also because it is web simulation, most of the native API functions can not be simulated, it is recommended to change after adjusting the UI

2. You can debug directly in the fast application IDE

It is relatively convenient and fast. Basically, all functions are the same with the real machine, but occasionally it will be stuck, or not moving, or some problems can not be tested on the simulator. It is suggested to replace it in the final acceptance stage

3. Install a debugger (fast app debugger and fast app loader) on your phone

It’s convenient? And fast? Huawei uses different technologies, so we need to install two debuggers on the mobile phone. The quick application debugger is for non-Huawei models, and the quick application loader is for Huawei models. Debugger provides two ways. The first way is to scan the code to install the corresponding fast application package. The TWO-DIMENSIONAL code can be generated on the IDE or the corresponding two-dimensional code can be found on the Chrome debugging interface. The second local installation of the corresponding fast application package, that is, to compile the generated fast application package, first uploaded to the mobile phone, and then the mobile phone from the storage to find and install. The debugger also provides online debugging function. After scanning the code to install the socket service of connecting to the computer, click the start debugging button, and the debugging panel will be automatically opened on the computer side

(Note: Scan installation or start debugging does not open automatically on the phone, probably because there is no permission to store the debugger)

5. How to deliver the project?

Before the official delivery of the project, we need to pass the test. All versions 1040-1070 of fast application debugger need compatibility test, and Huawei’s fast application loader also need to pass compatibility test.

At the same time, we adopt the subcontracting loading mode. After the successful construction, two files RPK and RPKS will be generated. The RPKS package we want to upload to the market (it will adopt the function of subcontracting loading).

The last

To sum up, the first time you contact Taro, you may feel ok, and the first time you contact Kuaifei, you may also feel ok. However, when you plan to use Taro grammar, you may find it difficult to do anything. However, instead of just teasing, we can think about why these problems have not been solved by the community, why the original author designed them this way, and whether I can help the community to make better improvements.

Finally, this chapter is the basic content, mainly for the first time to pave the way for children’s shoes, more advanced content will be launched in the next chapter.