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

mwt-package

v1.0.3

Published

mwt-package-base

Readme

概述

此工程最主要作用是用于提取前端公用的代码。包含:apis、components、utils、constants等

基本使用

发布

在package.json文件中,修改版本号

{
  "version": "0.0.2",
}

然后使用publish命令,发布到服务器

npm publish --registry=http://192.168.0.202:8081/content/groups/npm/
或者:xsh npm publish

安装:install

在项目的package.json中指定依赖

{
  "mwt-package": "0.0.2",
}

然后使用install命令

npm install --registry=http://192.168.0.202:8081/content/groups/npm/
或者xsh npm install

例子:增加一个API,然后发布并引用

[1] 增加一个API文件:mwt-package/apis/infra-isa/ManorApi.js [2] 发布mwt-package [3] 在其他vue文件中引用

引用:import ManorApi from "mwt-package/apis/infra-isa/ManorApi.js";
使用:ManorApi.page( { }, res => {
  ...
});

例子:增加一个component,然后发布并引用

[1] 增加一个vue文件:mwt-package/components/demo/ad/AdList.vue [2] 发布mwt-package [3] 在其他vue文件中引用

引用:import AdList from "mwt-package/components/demo/ad/AdList.vue";
使用:
components: {
  AdList
}
<ad-list :list="adList" :line="2"> </ad-list>

相关问题

开发步骤比较繁琐

mwt-package的每一次改动,都需要发布,每次发布都会产生新的版本号,每个引用mwt-package的项目都需要重新安装依赖,如果工程已经启动,还需要重启,才能最终生效

解决方案:

在mwt-package中执行:npm link
在其他项目中执行:npm link mwt-package

注意:要修改项目中的配置:webpack.base.conf

  resolve: {
    symlinks: false,
  }

效果是:mwt-package的每一次改动都会马上生效,不需要发布,不需要重启(非关键性文件) 注意:重新安装依赖后,需要重新link

发布的版本号问题

问题:每次发布都会产生一个新的版本号,其他工程的依赖要对应的修改。 解决:

npm包的版本号,遵循semver 2.0规范:[major].[minor].[patch] 其中major为主版本号,只有更新了不向下兼容的API时进行修改主版本号 其中minor为次版本号,当模块增加了向下兼容的功能时进行修改 其中patch为修订版本,当模块进行了向下兼容的bug修改后进行修改


npm version patch:[patch]+1 
npm version minor:[minor]+1,patch归零
npm version major:[major]+1,minor/patch归零

执行npm update时
^1.2.1 代表的更新版本范围为 >=1.2.1 && < 2.0.0
^0.2.1 代表的更新版本范围为 >=0.2.1 && < 0.3.0
^0.0.2 代表的更新版本范围为 0.0.2(相当于锁定为了0.0.2版本)

[1] 发布mwt-package:

npm version minor
npm publish

[2] 在其他工程中,更新依赖(仅更新mwt-package):

npm update mwt-package

是否要独立一个工程

mwt-package有很强的版本概念,npm的版本控制也很到位,其他工程可以根据实际情况,自由选择使用哪个版本。 所以mwt-package完全可以独立一个工程去自由迭代。

考虑目前实际情况,mwt-package的定位还不是很清晰,与mwt-fe-aio也会有一定的耦合, 建议还是放置在mwt-fe-aio工程内。平时开发、调试、发布流程都会比较紧凑流畅。

从源码方面考虑,如生产环境对应的到底是哪份源码,直接查看mwt-fe-aio的线上分支,就可以分析对应的源码 如果mwt-package与mwt-fe-aio相互独立,那生产环境对应的mwt-package源码是哪一份,就比较难确定。 实际上,生产环境使用的mwt-package的版本也不好确定,除非mwt-package也有对应的develop、release、master分支

综合考虑,建议将mwt-package放置在mwt-fe-aio工程之内。