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

@jdthfe/chicken

v2.2.0

Published

chicken, a web framework for mjd

Downloads

5

Readme

chicken

使用说明

点这里查看 chicken 已完成功能列表

chicken 所暴露 api 与 eggjs 一致,使用可参考eggjs 文档

开发步骤

  1. npm i 安装项目依赖

  2. npm start 开启本地编译服务并监听所有源码文件变化

  3. npm run clean 清除编译文件(这些文件不应该提交到 git)

  4. npm run lint lint 检查 

  5. npm run build 编译文件,本步骤会自动运行 npm run clean

发布说明

chicken 发布在京东私有 npm 库上,chicken 的 Scope 为@jd,发布前请参考京东私有 npm 库发布说明

发布步骤

  1. 将本地 ts 文件编译成 js 文件: npm run build

  2. 修改版本号: npm version patch/minor/major,请遵循 npm 版本号规则

  3. 发布: npm publish

日记级别说明

  • app.logger 方法
logger.log() process.stdout 打印日志,namespace默认为chicken
logger.debug() process.stdout 打印日志,namespace默认为项目名
logger.error() process.stderr 打印日志,namespace默认为项目名
logger.ump() process.stdout 打印日志,并且记入ump日志,namespace默认为ump
logger.logbook() process.stdout 打印日志,并且记入logbook日志,namespace默认为logbook
  • LOG 可以自定义 debug 命名空间
logger.name('namespace').debug('这是一条日志');
// namespace 这是一条日志 +0ms

logger.name('filename').logbook(这是一条日志,这条日志会记录到文件filename.log内);
// logbook 这是一条日志,这条日志会记录到文件filename.log内 +0ms
  • chicken 默认命名空间为小写 'chicken',不同功能模块可能加以区分:'chicken:core'、'chicken:service'...

  • 如果需要输出日志,需要设置环境变量 DEBUG=命名空间

DEBUG=chicken* npm test

文件目录 (本目录未包含文件都是编译后生成的)

.
├── README.md
├── package-lock.json
├── package.json
├── src                                     ------ 【重要】项目源码目录
│   ├── index.ts                            ------ 入口js
│   ├── app
│   │   └── middleware                          ------ 默认中间件目录
│   │       ├── bodyParser.ts
│   │       ├── notfound.ts
│   │       └── siteFile.ts
│   ├── config                              ------ chicken项目默认配置
│   │   └── config.default.ts
│   └── lib                                 ------ 核心逻辑目录
│       ├── config
│       │   └── default.ts
│       └── core
│           ├── base                            ------ chicken 基类
│           │   ├── controller.ts
│           │   └── service.ts
│           ├── bootstrap                       ------ chicken 项目初始化逻辑
│           │   ├── index.ts
│           │   ├── mixin
│           │   │   ├── config.ts
│           │   │   ├── controller.ts
│           │   │   ├── middleware.ts
│           │   │   ├── router.ts
│           │   │   ├── schedule.ts
│           │   │   ├── service.ts
│           │   │   └── view.ts
│           │   └── viewStore.ts
│           ├── core.ts                         ------ chicken app 基类
│           ├── logger                          ------ chicken 日志方法,包括ump和logbook
│           │   ├── index.ts
│           │   ├── logbookProfiler.ts
│           │   └── umpProfiler.ts
│           ├── schedule                        ------ chicken 定时任务,包含timer方法,chicken项目的timer方法需严格使用schedule实例化
│           │   ├── timer.ts
│           │   └── index.ts
│           └── utils
│               ├── index.ts
│               ├── makeDirs.ts
│               ├── readFile.ts
│               └── writeStream.ts
├── test
├── tsconfig.json
├── tslint.json
└── types

v2.0.0调整了TS类型