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

taro-custom-project-config-plugin

v1.0.0

Published

小程序的 project.config.json 文件的管理,是目前小程序开发最大的痛点,他严重限制小程序开发的想象力和生产效率。

Downloads

1

Readme

Taro 项目自定义配置文件

小程序的 project.config.json 文件的管理,是目前小程序开发最大的痛点,他严重限制小程序开发的想象力和生产效率。

该插件允许在 Taro 项目内存在多个小程序的 project.config 的定义,以实现一套源代码(同一个仓库源),输出不同的小程序。

强调:目前只对 微信(weapp)、快手(tt-抖音、今日头条)、百度(swan)、京东(jd)、QQ(qq) 这几个小程序平台。实际只测试过微信和快手,其他平台看情况再做后续的更新。

使用方法

yarn add taro-custom-project-config-plugin cross-env

在任意的 Taro 的启动指令,改为如下:

cross-env MODE=dev CUSTOM_ENV=username npm run build:weapp -- --watch

在 Taro 项目的配置文件加上插件:

module.exports = {
    plugins: [
        'taro-custom-project-config-plugin',    
    ]
}

在任意的 Taro 项目的源代码目录(如:src),添加一个 mp 的目录,完整为:src/mp ,在此目录下,创建对应小程序平台名的目录,如:weapp, tt, qq, swan 等,与 Taro 的 PlatformName 对应,如:

src/mp/weapp/    => 小程序
src/mp/tt/       => 快手

在对应的目录内添加 project.config.json 文件(百度小程序是 project.swan.json )。

配置文件是自动选择性的,根据你传入的 MODE (取值:dev|test|prod) CUSTOM_ENV(取值:任意字符串) 环境变量的值,他的优先选择顺序如下:

const files = [
    'project.config.MODE.CUSTOM_ENV.json',
    'project.config.CUSTOM_ENV.json',
    'project.config.MODE.json',
    'project.config.json',
];

补充说明

非 PROD 的话,小程序的名称字段,会强制拼接字符串 [development][test] ,主要是为了便于区分不同的环境,避免小程序上传错了。

假定你添加了微信的配置文件,但是没添加快手的配置文件,在编译快手的小程序时,他会按照 Taro 原有的业务顺序去操作,不会产生任何影响。