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 🙏

© 2026 – Pkg Stats / Ryan Hefner

umi-plugin-cool-docker

v1.1.0

Published

支持将项目打包为 docker。并且可以通过 umirc 配置环境变量。环境变量兼容本地开发。独立部署和 docker 部署。

Readme

umi 的插 docker 部署件

支持将项目打包为 docker。并且可以通过 umirc 配置环境变量。环境变量兼容本地开发。独立部署和 docker 部署。

支持通过 umirc 进行 nginx 配置的设置

umi 配置

  {
    docker:{
      /**是否输出调试信息。开启则会打印Dockerfile和nginx配置 */
      debug?:boolean,
      /**环境变量设置 */
      env: {
        /** 后端接口的地址。通过nginx进行代理。注意根据nginx的配置。这里的地址,最后是否有/区别很大哦*/
        apiProxy?: string,
        /**其他环境变量的设置。在umirc里的设置。在docker部署时,可以通过docker的环境变量进行覆盖 */
        [envKey: string]: string|undefined,
      },
      /**nginx配置 */
      nginx?:{
        /**默认nginx会把ajax请求转发到后端,如果设置了api的前缀,那么所以以这个前缀开头的请求都会作为api转发。例如可以设置为/api */
        /** 监听的端口号。默认是7777 */
        listen?:number,
        /**在http之下的额外配置信息 */
        inHttp?:string,
        /**在根location中的额外配置信息 */
        inLocationRoot?:string,
        /**在server之下的额外配置信息 */
        inServer?:string,
      }
      /**chart配置 */
      chart?: {
        /** values.yaml中的k8s_namespace。默认是city-brain */
        k8sNamespace?: string;
        /**values.yaml中的image.registry。默认是172.16.0.58:80 */
        imageRegistry?: string;
        /**values.yaml中的image.repository。默认是city-brain/${name}*/
        imageRepository?: string;
        /**values.yaml中的dns.domain。默认是poc.citybrain.com */
        dnsDomain?: string;
        /**values.yaml中的resources.requests.cpu。默认为100m */
        resourcesRequestsCpu?: string;
        /**values.yaml中的resources.requests.memory。默认为512Mi */
        resourcesRequestsMemory?: string;
        /**values.yaml中的resources.limits.cpu。默认为100m */
        resourcesLimitsCpu?: string;
        /**values.yaml中的resources.limits.memory。默认为512Mi */
        resourcesLimitsMemory?: string;
      }
    }
  }

base 的支持

插件支持在 umirc 中指定 base 的配置。然后会自动通过 base 设置 nginx 的配置。

并且如果在 umirc 中指定了 base,则会自动添加到环境变量。

说明

环境变量的设置,在 js 中,可以通过 window.SYS_ENV 获取。

使用示例

在 umirc 中,增加如下配置

docker:{
    env:{
      apiProxy:'http://localhost:8080/',
      umsUrl:'http://poc.citybrain/ums',
      workflow: 'https://poc.citybrain.com/workflow/flowplatform/todo',
      umsUrl: 'https://test.citybrain.com/ums',
      ssoPrefix: 'admin/api/city',
    }
    chart: {
        k8sNamespace: "city-brain";
        imageRegistry: "172.16.0.58:80";
        imageRepository: "city-brain/basic-personal-fe";
        dnsDomain: "poc.citybrain.com";
        resourcesRequestsCpu: "100m";
        resourcesRequestsMemory: "512Mi";
        resourcesLimitsCpu: "100m";
        resourcesLimitsMemory: "512Mi";
      }
},

js 代码中引用环境变量

console.log(window.SYS_ENV);
console.log(window.SYS_ENV.apiProxy, window.SYS_ENV.umsUrl);

命令

通过 docker 进行编译的命令为

umi dockerBuild
参数:
--push 通过指定push参数。会调用docker push将构建好的镜像推送到镜像库
--namespace=NAMESPACE 通过指定namespace参数,设置镜像的前缀

打包的镜像名和版本号,是从项目的 package.json 中获取的。并且每次构建之前,会通过 npm version patch 命令,将版本号升级。

umi dockerChart

该命令会在项目根目录下新建一个文件夹 chart,文件夹内容如下 chart -templates --Deployment.yaml --ingress.yaml --Service,yaml -chart.resource -Chart.yaml -resource.yaml -values.yaml -values-adapter.yaml