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

@pluve/taro-h5-plugin-version-output

v1.1.0

Published

The version output plugin for taro h5

Downloads

13

Readme

@pluve/taro-h5-plugin-version-output

npm (scoped)

关于

适用于 Taro H5 平台的版本构建插件,在原始构建输出目录下,增加输出以下文件:

  • index-{version}.html - 版本文件,内容同 index.html
  • version.json - 记录最新版本号
  • 对外入口文件(默认为 main.html)- 当访问入口文件时,从 version.json 获取最新版本号, 跳转到对应的版本号文件路径(即 index-{version}.html

安装

yarn add @pluve/taro-h5-plugin-version-output -D

使用

// config/prod.ts

import type { UserConfigExport } from "@tarojs/cli";

export default {
  mini: {},
  h5: {},
  plugins: [
    ...(process.env.TARO_ENV === "h5"
      ? [
          [
            "@pluve/taro-h5-plugin-version-output",
            {
              version: "date",
              mainFileName: "index.html",
              mainFilePageTitle: "哥伦布", 
              mainFileTheme: {
                colorPrimary: "#00b578", 
              },
              vconsole: false,
            },
          ],
        ]
      : []),
  ],
} satisfies UserConfigExport;

参数

export interface Options {
  /**
   * 版本号
   *  - date 取当前构建时间 YYYYMMDDHHmm
   *  - 其他输入为自定义版本号(自定义版本号必须数字或小写字母构成)
   *  - false 或 空字符串 此插件不启用
   * @default 'date'
   */
  version?: 'date' | false | string;
  /**
   * 入口文件名称
   * @default 'main.html'
   */
  mainFileName?: string;
  /**
   * 入口文件页面标题
   * @default undefined
   */
  mainFilePageTitle?: string;
  /**
   * 入口文件主题色
   * @default { colorPrimary: '#00b578' }
   */
  mainFileTheme?: Record<string, string>;
  /**
   * 模式
   * - v1.1.0 不再支持 json
   * @default 'json'
   *  - json 生成 version.json, 入口文件通过接口请求 version.json 获取版本号
   */
  mode?: 'json';
  /**
   * 是否注入 vconsole
   * @default false
   */
  vconsole?: boolean;
  /**
   * 自定义入口文件内容
   * @default undefined
   */
  customMainHtml?: (options: {
    mode?: 'json';
    title?: string; // 页面标题,即传入的 mainFilePageTitle
    theme?: Record<string, string>; // 页面主题色,即传入的 mainFileTheme
    vconsole?: boolean;
  }) => string;
}