2.5k
GitHub Stars
2
Bundled Files
2 months ago
Catalog Refreshed
3 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill openclaw/skills --skill wechat-miniprogram-dev- _meta.json297 B
- SKILL.md5.1 KB
Overview
This skill is a practical, end-to-end guide for developing and deploying WeChat Mini Program projects using cloud development. It covers recommended project structure, cloud function patterns, miniprogram-ci deployment commands, image processing extension usage, and common troubleshooting tips. The content is focused on actionable commands and code snippets to accelerate development and reduce deployment friction.
How this skill works
The guide inspects and documents a typical Mini Program repository layout, key configuration files, and cloud function best practices. It provides concrete miniprogram-ci commands for uploading, previewing, and deploying cloud functions, plus examples for initializing cloud SDK, calling other functions, and obtaining temporary file URLs. It also explains installing and invoking the cloud image-processing extension and highlights common runtime pitfalls and fixes.
When to use it
- Setting up a new WeChat Mini Program with cloud development (cloud functions and database).
- Automating deployment and preview workflows with miniprogram-ci in CI/CD pipelines.
- Developing server-side logic as cloud functions that need access to WX context and storage.
- Adding server-side image processing using the cloud image extension.
- Troubleshooting common cloud-init, upload, or preview QR code errors.
Best practices
- Organize code into miniprogram/ for front-end and cloudfunctions/ for server code to keep responsibilities clear.
- Initialize cloud SDK inside cloud functions with cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) and use cloud.getWXContext() for user info.
- Keep project.config.json up to date with appid and cloudfunctionRoot so CI tools work reliably.
- Trigger wx.requestSubscribeMessage synchronously inside a user click handler, not after async awaits or callbacks.
- Use --rnpm with miniprogram-ci uploads to let the cloud install dependencies declared in package.json.
Example use cases
- Deploying a new cloud function and updating its code via npx miniprogram-ci cloud functions upload.
- Generating a preview QR code for QA using npx miniprogram-ci preview and saving the image.
- Calling a cloud function from another cloud function to centralize shared logic.
- Retrieving temporary public URLs for files stored in cloud storage to display images in the mini program.
- Adding watermarking or other image transformations by registering and invoking the cloud image extension.
FAQ
Create the cloud function once in the WeChat DevTools before using CI to upload updates; CI updates existing functions.
Preview QR code is invalid or expired. What can I do?
Try bumping the preview version (--uv "1.0.X") and regenerate; sometimes multiple attempts are needed.
getTempFileURL returns undefined
Ensure the fileID is a cloud storage fileID. External URLs don't require conversion and will not return tempFileURL.
Where must I call wx.requestSubscribeMessage?
Call it synchronously in a user click handler (bindtap/catchtap) — do not call after awaits, setTimeout, or in asynchronous callbacks.