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

zero-jslib

v0.5.1

Published

create your js lib from zero.

Downloads

8

Readme

Zero - jslib

从 0 开始创建一个 JavaScritp / TypeScript 库

0 配置 : 预置了所有配置,可以直接开始编写代码,并且立即享受以下功能:

  • 模块打包(Rullup + Webpack)
  • Babel 语法转换
  • 单元测试 (Jest)
  • 覆盖率测试 (Jest)
  • TypeScript 支持
  • 文档生成(jsdoc)

npm script

npm run build

命令|描述 ---|---- dev|开发,将开启 rullup 的 watch 模式,对源文件修改会触发 buildbuild|构建代码,源文件被构建为最终生成文件放在 dist 目录下的 build-all|相当于清空 dist 目录 + build + build-bundle build-bundle|使用 webpack 构建 bundle,bundle 用在对兼容性要求高的场合 build-and-publish|相当于 build-all + doc + publish doc|根据源码的注释(jsdoc)生成文档,并把文档和 README-HEAD.md 合并生成 README.md test|启动测试(Jest) test-coverage|启动覆盖率测试并生成报告放在 coverage 目录下

src/index.js

主入口,会生成下列文件:

  • XXXX.es.js
  • XXXX.umd.js
  • XXXX.web-bundle.js

src/index.node.js

Node.js 入口,用来与主入口区分,集成仅在 Node.js 环境才有的部分,需要手动编写。会生成下列文件:

  • XXXX.node.js
  • XXXX.node-bundle.js

src/index.typescript.ts

TypeScript 入口,主要用来生成 TypeScript 定义文件,需要手动编写。会生成下列文件:

  • types/index.typescript.d.ts

Usage

Install

npm i -S XXXX

Import

// ES6 modules
import XXXX from "XXXX"

// Node.js (CJS) modules
var XXXX =  require ("XXXX")

// 浏览器载入
<script src="XXXX.umd.js"></script>

// 捆绑了所有 node_modules 依赖
import XXXX from "XXXX/dist/XXXX.node-bundle.js"

// 捆绑了所有 node_modules 依赖,浏览器适用
import XXXX from "XXXX/dist/XXXX.web-bundle.js"

Functions

sayHi(text) ⇒ string

say hai boy

Kind: global function

| Param | Type | Description | | --- | --- | --- | | text | string | 一段文本 |

genColor(inColor, [upperCase]) ⇒ string

转换一个色彩对象为文本

Kind: global function

| Param | Type | Description | | --- | --- | --- | | inColor | Color | 色彩对象 | | [upperCase] | boolean | 是否大写 |

getNowTime() ⇒ number

获取当前 ms

Kind: global function