npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vite-plugin-mp-weixin-publish

v1.0.2

Published

打包后自动发布微信小程序的vite插件

Downloads

2

Readme

用于自动上传到微信小程序的vite插件

安装

通过npm安装

npm install vite-plugin-mp-weixin-publish -D

配置

设置options

const options = {
  appid: '', // 小程序的appid
  privateKeyPath: '', // 小程序代码上传密钥路径
  version: '', //版本号
  type: '', // 非必填,项目的类型,有效值 miniProgram/miniProgramPlugin/miniGame/miniGamePlugin
  ignores: [], // 非必填,指定需要排除的规则,默认值:['node_modules/**/*']
  desc: '', // 非必填,版本说明
  setting: {}, // 非必填,项目配置,会覆盖project.config.json中的配置,具体内容:https://developers.weixin.qq.com/miniprogram/dev/devtools/ci.html#%E7%BC%96%E8%AF%91%E8%AE%BE%E7%BD%AE
};

用法

在 vite.config.ts 中注册本插件

import { defineConfig } from 'vite'
import vitePluginMpWeixinPublish from 'vite-plugin-mp-weixin-publish'
import { Options } from "vite-plugin-mp-weixin-publish";

const options: Options = {
    appid: '<Your Appid>',
    privateKeyPath: '<Your PrivateKey Path>',
    version: '<Your Version>',
    setting: {
      minifyJS: true,
      minifyWXML: true,
      minifyWXSS: true,
      minify: true,
    },
}

export default defineConfig({
    plugins: [vitePluginMpWeixinPublish(options)]
})

最后build的时候,将自动上传代码到微信小程序

uni-app中使用方法

1,在根目录下创建文件vite.config.mp-weixin.ts,内容如下:

import { mergeConfig } from "vite";
import baseConfig from "./vite.config";
import vitePluginMpWeixinPublish from "vite-plugin-mp-weixin-publish";
import { Options } from "vite-plugin-mp-weixin-publish";

const options: Options = {
  appid: '<Your Appid>',
    privateKeyPath: '<Your PrivateKey Path>',
    version: '<Your Version>',
  desc:  '<Your Desc>',
  setting: {
    minifyJS: true,
    minifyWXML: true,
    minifyWXSS: true,
    minify: true,
  },
};

export default mergeConfig(
  {
    plugins: [vitePluginMpWeixinPublish(options)],
  },
  baseConfig
);

2,在package.json中修改命令

{
  "scripts": {
    "build:mp-weixin": "uni build -p mp-weixin --config ./vite.config.mp-weixin.ts",
  }
}

3,执行命令

npm run build:mp-weixin

注意事项

仅限于uni-app项目采用vue/cli方式创建的情况。 传送门:uni-app官方文档 如何获得上传密钥请看传送门:微信小程序官方文档