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

teth-sdk

v1.0.12

Published

1. 建议node >= 12.16

Downloads

39

Readme

环境要求

  1. 建议node >= 12.16

使用

npm install teth-sdk

add teth.config.ts

import {TethConfig} from 'teth-sdk';

module.exports = {
    // 平台申请的app的英文名称
    appName: 'test',

    // 平台的该app的密钥
    appSecret: 'xxxxxx',

    // 该服务所在实例,默认os.hostname()
    // 当处于服务发现模式时,该实例ID需要和服务发现获取的实例ID保持一致,否则会被忽略掉
    instanceId: require('os').hostname(),

    // 该服务所在实例的地区或机房,默认default
    region: 'default',

    // 外部访问实例的host:机器+端口
    // accessUrl: '127.0.0.1:' + port,

    // 指标采集时,流量指标默认有一个维度uri,其值是请求path
    // 但是有时候path的取值个数会有几百上千种,特别是无效流量path。
    // 为了避免维度爆炸或者避免无效流量采集而带来内存占用,在此对uri的取值
    uriAdjust(uriPath: string) {
        // 根据app来转换uri维度
        // /app/index : 保留原样 /app/index
        // /app/auth.tar: 变成 /all_static
        // /Application/xxxx : 变成 /other-request
        if (uriPath.startsWith('/app')) {
            // 静态资源请求
            if (uriPath.includes('.')) {
                return '/all_static';
            }
            return uriPath;
        }
        return '/all_other_request';
    },

    packageDir: __dirname,

    // logPaths: [
    //     'log/xxxxx'
    // ],
} as TethConfig;

import sdk

import teth from 'teth-sdk';

teth.start({
    // 配置文件路径
    configPath: require.resolve('./teth.config'),
});

研发

开发

# 进行watch 编译,产出到dist
npm run dev

# lint
npm run lint

开发注意

  1. 记得对example进行压测 / cpu profile分析,以确定本次升级修改前后是否有性能退化
  2. 禁止使用moment等库

测试

# npm run test

# production编译,产出到dist
npm run build

发布npm包

### 1. lint and build
git pull origin master --rebase
rm -fr dist && npm run lint && npm run build && npm run test
git commit -m "fix/feature: xxx"

### 2. 增加版本号,生成commit和tag ,示例是小版本, 请按照当时具体情况修改版本号,如果版本修改不符合预期,那就人工修改
npm version patch

### 3. 先git commit 本次提交
git add .
version=`node -e "console.log(require('./package.json').version)"`
git commit -m "release ${version}"
git tag "v${version}"

### 4. 构建产出到dist目录,并发布到npm
rm -fr dist && npm run build && npm publish

### 5. 发起CR评审
git push origin HEAD:refs/for/master

git clone

git branch -b new_feature

git commit -m "icafe ID + feature描述"

git push origin HEAD:refs/for/master