# Develop third-party custom components
Mini Program from the base library version 2.2.1 Start supporting the use of npm Install third-party packages and therefore also support the development and use of third-party custom component packages. about npm Details of the function can be read firstRelated Documents。
# Get ready
To develop an open source custom component package for others to use, you first need to clarify how others are going to use the package, if you just copy the Mini Program directory to use directly, you can skip this document. The rest of this document is npm Management of custom component packages is described.
Prior to development, developers are required to have a basic node.js and npm Relevant knowledge, while needing to be prepared to support npm Features of the developer tools,Click here to download。
# Download Template
In order to facilitate developers to quickly build a custom component package project that can be used for development, debugging, and testing, the official provides a[Project templates](https://github.com/WeChat mini-program /miniprogram-custom-component), download the template in three ways:
- Directly from the github On Download zip File and unzip it.
- Directly will github Warehouse on the clone Come down.
- Initialize the project using the official command-line tools provided, as described below.
The build in the project template is based on the gulp + webpack Support development, build, test and other commands, see the project template [README.md](https://github.com/WeChat mini-program /miniprogram-custom-component/blob/master/README.md) Documents.
# Command Line Tools
Officially provided.[Command Line Tools](https://github.com/WeChat mini-program /miniprogram-cli ), used to quickly initialize a project. Execute the following command to install the command-line tool:
npm install -g @ wechat-miniprogram /miniprogram-cli
Then create an empty directory as the project s root directory, and execute from this root
miniprogram init --type custom-component
Many files are generated in the root directory of the project.[Project templates](https://github.com/WeChat mini-program /miniprogram-custom-component)Build a complete project on top of which developers can then make development changes directly.
More usage of the command line tool can be viewed github On the warehouse. [README.md](https://github.com/WeChat mini-program /miniprogram-cli /blob/master/README.md) Documents.
PS: First time using
miniprogram init
The initialization project will go github Pull up the template, so it is necessary to ensure that the network is smooth.
# Test tool
Unit tests for custom components, see documentationUnit test。
# Custom Component Examples
The following are the official custom components provided, you can refer to and use:
- [weui-miniprogram ](https://github.com/WeChat mini-program /weui-miniprogram )
- [recycle-view](https://github.com/WeChat mini-program /recycle-view)
# Custom Component Extension Example
The following are official custom component extensions that can be referenced and used:
- [computed](https://github.com/WeChat mini-program /computed)