# Creating a Plug-In Project

You can use a Mini Program's AppID to create a Mini Program plug-in project. Plug-ins are independent of Mini Programs, but the AppID is public, so do not use the original Mini Program project for plug-in development. On the Create Project page, select an empty folder as the project path. You can select the quick start template to create a Mini Program plug-in.

Description of quick start template:

  1. The miniprogram folder stores a normal Mini Program project, which is used to write the Demo of the Mini Program plug-in. This demo is uploaded together with the plug-in code, and is used as a basis for the Mini Program plug-in release review.

  2. The plugin file is the Mini Program plug-in project, to which the Mini Program plug-in code is written.

  3. Note that only when compileType == 'plug-in' in the project.config.json file, can the plug-in project be used normally. See details.

# Opening an Existing Plug-in Project

You can directly open an existing plug-in project in the project list.

To create a new project, select a non-empty directory with the project.config.json file (see details), and make sure the file contains the following fields:

{
  "miniprogramRoot": "./miniprogram",
  "pluginRoot": "./plugin",
  "compileType": "plugin"
}

You can manually modify the compileType field in the project.config.json file during project development to change the compilation type of the project.

# Uploading Plug-in

Before uploading the plug-in code, you need to specify the version number in the format of "number.number.number", and the maximum of each number is 999.

Each time a plug-in code is submitted, its version number is incremented based on the previous one. Plug-in users will use the version number, so proceed with caution.

When the plug-in code is uploaded, the content of the directory specified by miniprogramRoot in the project.config.json file is uploaded together as a plug-in Demo. The Demo must cover all application scenarios of the plug-in to facilitate its release review.

# Writing, Previewing and Uploading Plug-in Documentation

The plug-in documentation must be placed in the doc directory under the plug-in project root directory. The entry file for the plug-in documentation is doc/README.md. The images referenced in README.md must be images stored locally in the doc directory.

When editing README.md in Weixin DevTools, you can preview the plug-in documentation by clicking the Preview button at the bottom of the editor. After editing the documentation, you can upload it using the Upload entry at the bottom of the README.md edit window.

# Using Plug-ins

You can declare and use a plug-in in the plugins field in the app.json file of the Mini Program project. If the compilation type is Mini Program, you need to specify the version number of the released plug-in, based on which the Weixin DevTools can pull and compile the plug-in of the corresponding version.

Only when compileType == 'plug-in' in the project.config.json file, can the version number of the plug-in be 'dev'.